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 |
|---|---|---|---|---|---|---|---|---|
c520d717466d834f421ceae3b55faf0bbe39b58c
|
Add xmldoc to ITextureUpload interface
|
ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework
|
osu.Framework/Graphics/Textures/ITextureUpload.cs
|
osu.Framework/Graphics/Textures/ITextureUpload.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 osu.Framework.Graphics.Primitives;
using osuTK.Graphics.ES30;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Framework.Graphics.Textures
{
public interface ITextureUpload : IDisposable
{
/// <summary>
/// The raw data to be uploaded.
/// </summary>
ReadOnlySpan<Rgba32> Data { get; }
/// <summary>
/// The target mipmap level to upload into.
/// </summary>
int Level { get; }
/// <summary>
/// The target bounds for this upload. If not specified, will assume to be (0, 0, width, height).
/// </summary>
RectangleI Bounds { get; set; }
/// <summary>
/// The texture format for this upload.
/// </summary>
PixelFormat Format { get; }
}
}
|
// 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 osu.Framework.Graphics.Primitives;
using osuTK.Graphics.ES30;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Framework.Graphics.Textures
{
public interface ITextureUpload : IDisposable
{
ReadOnlySpan<Rgba32> Data { get; }
int Level { get; }
RectangleI Bounds { get; set; }
PixelFormat Format { get; }
}
}
|
mit
|
C#
|
5ed1540a12bac009c075e6cbd77744824d203acd
|
Handle unhover state change better
|
johnneijzen/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,ZLima12/osu,EVAST9919/osu,peppy/osu,johnneijzen/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,EVAST9919/osu,ppy/osu,NeoAdonis/osu,peppy/osu-new,ZLima12/osu,peppy/osu,2yangk23/osu
|
osu.Game/Graphics/Containers/OsuHoverContainer.cs
|
osu.Game/Graphics/Containers/OsuHoverContainer.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osuTK.Graphics;
using System.Collections.Generic;
namespace osu.Game.Graphics.Containers
{
public class OsuHoverContainer : OsuClickableContainer
{
protected const float FADE_DURATION = 500;
protected Color4 HoverColour;
protected Color4 IdleColour = Color4.White;
protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content };
public OsuHoverContainer()
{
Enabled.ValueChanged += e =>
{
if (!e.NewValue) unhover();
};
}
private bool isHovered;
protected override bool OnHover(HoverEvent e)
{
if (!Enabled.Value)
return false;
EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint));
isHovered = true;
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
unhover();
base.OnHoverLost(e);
}
private void unhover()
{
if (!isHovered) return;
isHovered = false;
EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint));
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (HoverColour == default)
HoverColour = colours.Yellow;
}
protected override void LoadComplete()
{
base.LoadComplete();
EffectTargets.ForEach(d => d.FadeColour(IdleColour));
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osuTK.Graphics;
using System.Collections.Generic;
namespace osu.Game.Graphics.Containers
{
public class OsuHoverContainer : OsuClickableContainer
{
protected const float FADE_DURATION = 500;
protected Color4 HoverColour;
protected Color4 IdleColour = Color4.White;
protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content };
protected override bool OnHover(HoverEvent e)
{
if (Action != null)
EffectTargets.ForEach(d => d.FadeColour(HoverColour, FADE_DURATION, Easing.OutQuint));
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint));
base.OnHoverLost(e);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (HoverColour == default)
HoverColour = colours.Yellow;
}
protected override void LoadComplete()
{
base.LoadComplete();
EffectTargets.ForEach(d => d.FadeColour(IdleColour));
}
}
}
|
mit
|
C#
|
363ef2a6a382336d23526e46b3c6d3f365f9ffd2
|
Make Networking.GetWorkgroupName() work under Windows XP
|
nwoolls/MultiMiner,nwoolls/MultiMiner,IWBWbiz/MultiMiner,IWBWbiz/MultiMiner
|
MultiMiner.Utility/Networking.cs
|
MultiMiner.Utility/Networking.cs
|
using System;
using System.Management;
namespace MultiMiner.Utility
{
public class Networking
{
public static string GetWorkGroup()
{
string result = String.Empty;
if (OSVersionPlatform.GetConcretePlatform() == PlatformID.MacOSX)
{
//OS X
string configFilePath = @"/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist";
PlistParser parser = new PlistParser(configFilePath);
result = parser["Workgroup"].ToString();
}
else if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix)
{
//Linux
string configFilePath = @"/etc/samba/smb.conf";
IniFileParser parser = new IniFileParser(configFilePath);
result = parser.GetValue("Global", "Workgroup");
}
else
{
//Windows
using (ManagementObject managementObject = new ManagementObject(String.Format("Win32_ComputerSystem.Name='{0}'", Environment.MachineName)))
{
object workgroup;
//Workgroup is NULL under XP
if (OSVersionPlatform.IsWindowsVistaOrHigher())
workgroup = managementObject["Workgroup"];
else
workgroup = managementObject["Domain"];
result = workgroup.ToString();
}
}
return result;
}
}
}
|
using System;
using System.Management;
namespace MultiMiner.Utility
{
public class Networking
{
public static string GetWorkGroup()
{
string result = String.Empty;
if (OSVersionPlatform.GetConcretePlatform() == PlatformID.MacOSX)
{
//OS X
string configFilePath = @"/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist";
PlistParser parser = new PlistParser(configFilePath);
result = parser["Workgroup"].ToString();
}
else if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix)
{
//Linux
string configFilePath = @"/etc/samba/smb.conf";
IniFileParser parser = new IniFileParser(configFilePath);
result = parser.GetValue("Global", "Workgroup");
}
else
{
//Windows
using (ManagementObject managementObject = new ManagementObject(String.Format("Win32_ComputerSystem.Name='{0}'", Environment.MachineName)))
{
result = managementObject["Workgroup"].ToString();
}
}
return result;
}
}
}
|
mit
|
C#
|
9c4eb0e02d34753ca062216427e182d6c72c455e
|
Add Equals to Capability<T>
|
kazyx/kz-remote-api
|
Project/Util/SharedStructures.cs
|
Project/Util/SharedStructures.cs
|
using System.Collections.Generic;
namespace Kazyx.RemoteApi
{
/// <summary>
/// Response of getMethodTypes API.
/// </summary>
public class MethodType
{
/// <summary>
/// Name of API
/// </summary>
public string Name { set; get; }
/// <summary>
/// Request parameter types.
/// </summary>
public List<string> ReqTypes { set; get; }
/// <summary>
/// Response parameter types.
/// </summary>
public List<string> ResTypes { set; get; }
/// <summary>
/// Version of API
/// </summary>
public string Version { set; get; }
}
/// <summary>
/// Set of current value and its candidates.
/// </summary>
/// <typeparam name="T"></typeparam>
public class Capability<T>
{
/// <summary>
/// Current value of the specified parameter.
/// </summary>
public virtual T Current { set; get; }
/// <summary>
/// Candidate values of the specified parameter.
/// </summary>
public virtual List<T> Candidates { set; get; }
public override bool Equals(object o)
{
var other = o as Capability<T>;
if (!Current.Equals(other.Current))
{
return false;
}
if (Candidates?.Count != other.Candidates?.Count)
{
return false;
}
for (int i = 0; i < Candidates.Count; i++)
{
if (!Candidates[i].Equals(other.Candidates[i]))
{
return false;
}
}
return true;
}
}
}
|
using System.Collections.Generic;
namespace Kazyx.RemoteApi
{
/// <summary>
/// Response of getMethodTypes API.
/// </summary>
public class MethodType
{
/// <summary>
/// Name of API
/// </summary>
public string Name { set; get; }
/// <summary>
/// Request parameter types.
/// </summary>
public List<string> ReqTypes { set; get; }
/// <summary>
/// Response parameter types.
/// </summary>
public List<string> ResTypes { set; get; }
/// <summary>
/// Version of API
/// </summary>
public string Version { set; get; }
}
/// <summary>
/// Set of current value and its candidates.
/// </summary>
/// <typeparam name="T"></typeparam>
public class Capability<T>
{
/// <summary>
/// Current value of the specified parameter.
/// </summary>
public virtual T Current { set; get; }
/// <summary>
/// Candidate values of the specified parameter.
/// </summary>
public virtual List<T> Candidates { set; get; }
}
}
|
mit
|
C#
|
c5b7d6546674461af411f282e21c2bc67c669fc1
|
fix null ref
|
Cologler/jasily.cologler
|
Jasily.Core/Collections/ObjectModel/ObservableCollectionGroup.cs
|
Jasily.Core/Collections/ObjectModel/ObservableCollectionGroup.cs
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace System.Collections.ObjectModel
{
public class ObservableCollectionGroup<TKey, TElement> : ObservableCollection<TElement>, IGrouping<TKey, TElement>
{
private TKey key;
public ObservableCollectionGroup(TKey key)
: base()
{
this.key = key;
}
public ObservableCollectionGroup(TKey key, IEnumerable<TElement> collection)
: base(collection)
{
this.key = key;
}
public ObservableCollectionGroup(TKey key, List<TElement> list)
: base(list)
{
this.key = key;
}
public ObservableCollectionGroup()
: base()
{
}
public ObservableCollectionGroup(IEnumerable<TElement> collection)
: base(collection)
{
}
public ObservableCollectionGroup(List<TElement> list)
: base(list)
{
}
public TKey Key
{
get { return this.key; }
set
{
if (!this.key.NormalEquals(value))
{
this.key = value;
this.OnPropertyChanged(new PropertyChangedEventArgs(nameof(this.Key)));
}
}
}
}
}
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace System.Collections.ObjectModel
{
public class ObservableCollectionGroup<TKey, TElement> : ObservableCollection<TElement>, IGrouping<TKey, TElement>
{
TKey _key;
public ObservableCollectionGroup(TKey key)
: base()
{
this._key = key;
}
public ObservableCollectionGroup(TKey key, IEnumerable<TElement> collection)
: base(collection)
{
this._key = key;
}
public ObservableCollectionGroup(TKey key, List<TElement> list)
: base(list)
{
this._key = key;
}
public ObservableCollectionGroup()
: base()
{
}
public ObservableCollectionGroup(IEnumerable<TElement> collection)
: base(collection)
{
}
public ObservableCollectionGroup(List<TElement> list)
: base(list)
{
}
public TKey Key
{
get { return this._key; }
set
{
if (!this._key.Equals(value))
{
this._key = value;
this.OnPropertyChanged(new PropertyChangedEventArgs("Key"));
}
}
}
}
}
|
mit
|
C#
|
b28e3aa7d32db4d4e3e05d1f623c1b2bf9194272
|
Add test explicitly checking recursion
|
nunit/nunit,mjedrzejek/nunit,nunit/nunit,mjedrzejek/nunit
|
src/NUnitFramework/tests/Api/NUnitIssue52.cs
|
src/NUnitFramework/tests/Api/NUnitIssue52.cs
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using NUnit.Framework.Constraints;
namespace NUnit.Framework.Api
{
[TestFixture]
public class NUnitIssue52
{
[TestCaseSource(nameof(GetTestCases))]
public void SelfContainedItemFoundInCollection<T>(T x, ICollection y)
{
var equalityComparer = new NUnitEqualityComparer();
var tolerance = Tolerance.Default;
var actualResult = equalityComparer.AreEqual(x, y, ref tolerance);
Assert.IsFalse(actualResult);
Assert.Contains(x, y);
}
[TestCaseSource(nameof(GetTestCases))]
public void SelfContainedItemDoesntRecurseForever<T>(T x, ICollection y)
{
var equalityComparer = new NUnitEqualityComparer();
var tolerance = Tolerance.Default;
equalityComparer.ExternalComparers.Add(new DetectRecursionComparer(30));
Assert.DoesNotThrow(() =>
{
var equality = equalityComparer.AreEqual(x, y, ref tolerance);
Assert.IsFalse(equality);
Assert.Contains(x, y);
});
}
public static IEnumerable<TestCaseData> GetTestCases()
{
var item = new SelfContainer();
var items = new SelfContainer[] { new SelfContainer(), item };
yield return new TestCaseData(item, items);
}
private class DetectRecursionComparer : EqualityAdapter
{
private readonly int maxRecursion;
[MethodImpl(MethodImplOptions.NoInlining)]
public DetectRecursionComparer(int maxRecursion)
{
var callerDepth = new StackTrace().FrameCount - 1;
this.maxRecursion = callerDepth + maxRecursion;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override bool CanCompare(object x, object y)
{
var currentDepth = new StackTrace().FrameCount - 1;
return currentDepth >= maxRecursion;
}
public override bool AreEqual(object x, object y)
{
throw new InvalidOperationException("Recurses");
}
}
private class SelfContainer : IEnumerable
{
public IEnumerator GetEnumerator() { yield return this; }
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework.Constraints;
namespace NUnit.Framework.Api
{
[TestFixture]
public class NUnitIssue52
{
class SelfContainer : IEnumerable
{
public IEnumerator GetEnumerator() { yield return this; }
}
[Test]
public void SelfContainedItemFoundInArray()
{
var item = new SelfContainer();
var items = new SelfContainer[] { new SelfContainer(), item };
// work around
//Assert.True(((ICollection<SelfContainer>)items).Contains(item));
// causes StackOverflowException
//Assert.Contains(item, items);
var equalityComparer = new NUnitEqualityComparer();
var tolerance = Tolerance.Default;
var equal = equalityComparer.AreEqual(item, items, ref tolerance);
Assert.IsFalse(equal);
//Console.WriteLine("test completed");
}
}
}
|
mit
|
C#
|
3e8e4e4564d2c21643b46901d1498dddb7ad27e0
|
Update the set of mappings for the PCL version.
|
zaccharles/nodatime,zaccharles/nodatime,jskeet/nodatime,nodatime/nodatime,BenJenkinson/nodatime,jskeet/nodatime,zaccharles/nodatime,zaccharles/nodatime,malcolmr/nodatime,nodatime/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,malcolmr/nodatime,zaccharles/nodatime,zaccharles/nodatime,malcolmr/nodatime
|
src/NodaTime.TzdbCompiler/Tzdb/PclSupport.cs
|
src/NodaTime.TzdbCompiler/Tzdb/PclSupport.cs
|
// Copyright 2013 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NodaTime.Utility;
using System.Collections.Generic;
namespace NodaTime.TzdbCompiler.Tzdb
{
/// <summary>
/// Extra support required for the PCL, which has a somewhat anaemic
/// version of TimeZoneInfo.
/// </summary>
internal static class PclSupport
{
/// <summary>
/// Hard-coded map from StandardName to Id, where these are known to differ.
/// The unit test for this member checks that the system we're running on doesn't
/// introduce any new or different mappings, but allows this mapping to be a superset
/// of the detected one.
/// </summary>
internal static NodaReadOnlyDictionary<string, string> StandardNameToIdMap =
new NodaReadOnlyDictionary<string, string>(new Dictionary<string, string>
{
{ "Coordinated Universal Time", "UTC" },
{ "Co-ordinated Universal Time", "UTC" },
{ "Jerusalem Standard Time", "Israel Standard Time" },
{ "Malay Peninsula Standard Time" , "Singapore Standard Time" },
{ "Russia TZ 1 Standard Time", "Kaliningrad Standard Time" },
{ "Russia TZ 2 Standard Time", "Russian Standard Time" },
{ "Russia TZ 4 Standard Time", "Ekaterinburg Standard Time" },
{ "Russia TZ 6 Standard Time", "North Asia Standard Time" },
{ "Russia TZ 7 Standard Time", "North Asia East Standard Time" },
{ "Russia TZ 8 Standard Time", "Yakutsk Standard Time" },
{ "Russia TZ 9 Standard Time", "Vladivostok Standard Time" },
{ "Cabo Verde Standard Time", "Cape Verde Standard Time" },
// The following name/ID mappings give an ID which then isn't present in CLDR
// (at least in v26 data); these zones will have to be mapped by transitions
// in the PCL.
// { "Russia TZ 3 Standard Time", "Russia Time Zone 3" },
// { "Russia TZ 5 Standard Time", "N.Central Asia Standard Time" },
// { "Russia TZ 10 Standard Time", "Russia Time Zone 10" },
// { "Russia TZ 11 Standard Time", "Russia Time Zone 11" },
});
}
}
|
// Copyright 2013 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NodaTime.Utility;
using System.Collections.Generic;
namespace NodaTime.TzdbCompiler.Tzdb
{
/// <summary>
/// Extra support required for the PCL, which has a somewhat anaemic
/// version of TimeZoneInfo.
/// </summary>
internal static class PclSupport
{
/// <summary>
/// Hard-coded map from StandardName to Id, where these are known to differ.
/// The unit test for this member checks that the system we're running on doesn't
/// introduce any new or different mappings, but allows this mapping to be a superset
/// of the detected one.
/// </summary>
internal static NodaReadOnlyDictionary<string, string> StandardNameToIdMap =
new NodaReadOnlyDictionary<string, string>(new Dictionary<string, string>
{
{ "Coordinated Universal Time", "UTC" },
{ "Co-ordinated Universal Time", "UTC" },
{ "Jerusalem Standard Time", "Israel Standard Time" },
{ "Malay Peninsula Standard Time" , "Singapore Standard Time" },
{ "Russia TZ 1 Standard Time", "Kaliningrad Standard Time" },
{ "Russia TZ 2 Standard Time", "Russian Standard Time" },
{ "Russia TZ 4 Standard Time", "Ekaterinburg Standard Time" },
{ "Russia TZ 6 Standard Time", "North Asia Standard Time" },
{ "Russia TZ 7 Standard Time", "North Asia East Standard Time" },
{ "Russia TZ 8 Standard Time", "Yakutsk Standard Time" },
{ "Russia TZ 9 Standard Time", "Vladivostok Standard Time" },
// The following name/ID mappings give an ID which then isn't present in CLDR
// (at least in v26 data); these zones will have to be mapped by transitions
// in the PCL.
// { "Russia TZ 3 Standard Time", "Russia Time Zone 3" },
// { "Russia TZ 5 Standard Time", "N.Central Asia Standard Time" },
// { "Russia TZ 10 Standard Time", "Russia Time Zone 10" },
// { "Russia TZ 11 Standard Time", "Russia Time Zone 11" },
});
}
}
|
apache-2.0
|
C#
|
eda9616117bf737d4c41745ba15329767e33b373
|
Remove some stray newlines.
|
jagrem/msg
|
Msg.Core/Transport/Connections/CloseConnectionFailedException.cs
|
Msg.Core/Transport/Connections/CloseConnectionFailedException.cs
|
using System;
using System.Runtime.Serialization;
namespace Msg.Core.Transport.Connections
{
public class CloseConnectionFailedException : ConnectionFailedException
{
public CloseConnectionFailedException ()
{
}
public CloseConnectionFailedException (string message) : base (message)
{
}
public CloseConnectionFailedException (string message, Exception innerException) : base (message, innerException)
{
}
public CloseConnectionFailedException (SerializationInfo info, StreamingContext context) : base (info, context)
{
}
}
}
|
using System;
using System.Runtime.Serialization;
namespace Msg.Core.Transport.Connections
{
public class CloseConnectionFailedException : ConnectionFailedException
{
public CloseConnectionFailedException ()
{
}
public CloseConnectionFailedException (string message) : base (message)
{
}
public CloseConnectionFailedException (string message, Exception innerException) : base (message, innerException)
{
}
public CloseConnectionFailedException (SerializationInfo info, StreamingContext context) : base (info, context)
{
}
}
}
|
apache-2.0
|
C#
|
63c36013142aba3b13e7cd38ec470eb5f87aeb8a
|
Add docs re wrapped stream ownership
|
serilog/serilog-sinks-file,serilog/serilog-sinks-file
|
src/Serilog.Sinks.File/FileLifecycleHooks.cs
|
src/Serilog.Sinks.File/FileLifecycleHooks.cs
|
namespace Serilog
{
using System.IO;
/// <summary>
/// Enables hooking into log file lifecycle events
/// </summary>
public abstract class FileLifecycleHooks
{
/// <summary>
/// Wraps <paramref name="underlyingStream"/> in another stream, such as a GZipStream, then returns the wrapped stream
/// </summary>
/// <remarks>
/// Serilog is responsible for disposing of the wrapped stream
/// </remarks>
/// <param name="underlyingStream">The underlying log file stream</param>
/// <returns>The wrapped stream</returns>
public abstract Stream Wrap(Stream underlyingStream);
}
}
|
namespace Serilog
{
using System.IO;
/// <summary>
/// Enables hooking into log file lifecycle events
/// </summary>
public abstract class FileLifecycleHooks
{
/// <summary>
/// Wraps <paramref name="sourceStream"/> in another stream, such as a GZipStream, then returns the wrapped stream
/// </summary>
/// <param name="sourceStream">The source log file stream</param>
/// <returns>The wrapped stream</returns>
public abstract Stream Wrap(Stream sourceStream);
}
}
|
apache-2.0
|
C#
|
38fecc050ac5ab9561faafdc9bae02a7ae789fff
|
Add source documentation for rating item.
|
henrikfroehling/TraktApiSharp
|
Source/Lib/TraktApiSharp/Objects/Get/Ratings/TraktRatingsItem.cs
|
Source/Lib/TraktApiSharp/Objects/Get/Ratings/TraktRatingsItem.cs
|
namespace TraktApiSharp.Objects.Get.Ratings
{
using Attributes;
using Enums;
using Movies;
using Newtonsoft.Json;
using Shows;
using Shows.Episodes;
using Shows.Seasons;
using System;
/// <summary>A Trakt rating item, containing a movie, show, season and / or episode and information about it.</summary>
public class TraktRatingsItem
{
/// <summary>Gets or sets the UTC datetime, when the movie, show, season and / or episode was rated.</summary>
[JsonProperty(PropertyName = "rated_at")]
public DateTime? RatedAt { get; set; }
/// <summary>Gets or sets the rating of the movie, show, season and / or episode.</summary>
[JsonProperty(PropertyName = "rating")]
public int? Rating { get; set; }
/// <summary>
/// Gets or sets the object type, which this rating item contains.
/// See also <seealso cref="TraktSyncRatingsItemType" />.
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "type")]
[JsonConverter(typeof(TraktEnumerationConverter<TraktSyncRatingsItemType>))]
[Nullable]
public TraktSyncRatingsItemType Type { get; set; }
/// <summary>
/// Gets or sets the movie, if <see cref="Type" /> is <see cref="TraktSyncRatingsItemType.Movie" />.
/// See also <seealso cref="TraktMovie" />.
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "movie")]
[Nullable]
public TraktMovie Movie { get; set; }
/// <summary>
/// Gets or sets the show, if <see cref="Type" /> is <see cref="TraktSyncRatingsItemType.Show" />.
/// May also be set, if <see cref="Type" /> is <see cref="TraktSyncRatingsItemType.Episode" /> or
/// <see cref="TraktSyncRatingsItemType.Season" />.
/// <para>See also <seealso cref="TraktShow" />.</para>
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "show")]
[Nullable]
public TraktShow Show { get; set; }
/// <summary>
/// Gets or sets the season, if <see cref="Type" /> is <see cref="TraktSyncRatingsItemType.Season" />.
/// See also <seealso cref="TraktSeason" />.
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "season")]
[Nullable]
public TraktSeason Season { get; set; }
/// <summary>
/// Gets or sets the episode, if <see cref="Type" /> is <see cref="TraktSyncRatingsItemType.Episode" />.
/// See also <seealso cref="TraktEpisode" />.
/// <para>Nullable</para>
/// </summary>
[JsonProperty(PropertyName = "episode")]
[Nullable]
public TraktEpisode Episode { get; set; }
}
}
|
namespace TraktApiSharp.Objects.Get.Ratings
{
using Attributes;
using Enums;
using Movies;
using Newtonsoft.Json;
using Shows;
using Shows.Episodes;
using Shows.Seasons;
using System;
public class TraktRatingsItem
{
[JsonProperty(PropertyName = "rated_at")]
public DateTime? RatedAt { get; set; }
[JsonProperty(PropertyName = "rating")]
public int? Rating { get; set; }
[JsonProperty(PropertyName = "type")]
[JsonConverter(typeof(TraktEnumerationConverter<TraktSyncRatingsItemType>))]
[Nullable]
public TraktSyncRatingsItemType Type { get; set; }
[JsonProperty(PropertyName = "movie")]
[Nullable]
public TraktMovie Movie { get; set; }
[JsonProperty(PropertyName = "show")]
[Nullable]
public TraktShow Show { get; set; }
[JsonProperty(PropertyName = "season")]
[Nullable]
public TraktSeason Season { get; set; }
[JsonProperty(PropertyName = "episode")]
[Nullable]
public TraktEpisode Episode { get; set; }
}
}
|
mit
|
C#
|
66a474619ce2f56d127d92c2c0ca2429f845ab10
|
Adjust TimingControlPoint equivalency
|
ppy/osu,peppy/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu
|
osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
|
osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Beatmaps.Timing;
namespace osu.Game.Beatmaps.ControlPoints
{
public class TimingControlPoint : ControlPoint
{
/// <summary>
/// The time signature at this control point.
/// </summary>
public readonly Bindable<TimeSignatures> TimeSignatureBindable = new Bindable<TimeSignatures>(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple };
/// <summary>
/// The time signature at this control point.
/// </summary>
public TimeSignatures TimeSignature
{
get => TimeSignatureBindable.Value;
set => TimeSignatureBindable.Value = value;
}
public const double DEFAULT_BEAT_LENGTH = 1000;
/// <summary>
/// The beat length at this control point.
/// </summary>
public readonly BindableDouble BeatLengthBindable = new BindableDouble(DEFAULT_BEAT_LENGTH)
{
Default = DEFAULT_BEAT_LENGTH,
MinValue = 6,
MaxValue = 60000
};
/// <summary>
/// The beat length at this control point.
/// </summary>
public double BeatLength
{
get => BeatLengthBindable.Value;
set => BeatLengthBindable.Value = value;
}
/// <summary>
/// The BPM at this control point.
/// </summary>
public double BPM => 60000 / BeatLength;
public override bool EquivalentTo(ControlPoint other) =>
other is TimingControlPoint otherTyped
&& Time == otherTyped.Time && TimeSignature == otherTyped.TimeSignature && BeatLength.Equals(otherTyped.BeatLength);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Beatmaps.Timing;
namespace osu.Game.Beatmaps.ControlPoints
{
public class TimingControlPoint : ControlPoint
{
/// <summary>
/// The time signature at this control point.
/// </summary>
public readonly Bindable<TimeSignatures> TimeSignatureBindable = new Bindable<TimeSignatures>(TimeSignatures.SimpleQuadruple) { Default = TimeSignatures.SimpleQuadruple };
/// <summary>
/// The time signature at this control point.
/// </summary>
public TimeSignatures TimeSignature
{
get => TimeSignatureBindable.Value;
set => TimeSignatureBindable.Value = value;
}
public const double DEFAULT_BEAT_LENGTH = 1000;
/// <summary>
/// The beat length at this control point.
/// </summary>
public readonly BindableDouble BeatLengthBindable = new BindableDouble(DEFAULT_BEAT_LENGTH)
{
Default = DEFAULT_BEAT_LENGTH,
MinValue = 6,
MaxValue = 60000
};
/// <summary>
/// The beat length at this control point.
/// </summary>
public double BeatLength
{
get => BeatLengthBindable.Value;
set => BeatLengthBindable.Value = value;
}
/// <summary>
/// The BPM at this control point.
/// </summary>
public double BPM => 60000 / BeatLength;
public override bool EquivalentTo(ControlPoint other) =>
other is TimingControlPoint otherTyped
&& TimeSignature == otherTyped.TimeSignature && BeatLength.Equals(otherTyped.BeatLength);
}
}
|
mit
|
C#
|
8f88408feeae147f271728d15af46b4a383e643d
|
fix logging in
|
Gatecoin/API_client_csharp,Gatecoin/api-gatecoin-dotnet,Gatecoin/api-gatecoin-dotnet
|
Request/Login.cs
|
Request/Login.cs
|
using System;
using System.Collections.Generic;
using System.Web;
using ServiceStack.Common;
using ServiceStack.ServiceHost;
using ServiceStack.Common.Web;
using GatecoinServiceInterface.Response;
namespace GatecoinServiceInterface.Request{
[Route("/Auth/Login", "POST", Summary = @"Trader session log in.", Notes = @"")]
public class Login : IReturn<LoginResponse>
{
[ApiMember(Name = "UserName", Description = "user name", ParameterType = "query", DataType = "string", IsRequired = true)]
public System.String UserName {get; set; }
[ApiMember(Name = "Password", Description = "password", ParameterType = "query", DataType = "string", IsRequired = true)]
public System.String Password {get; set; }
[ApiMember(Name = "ValidationCode", Description = "Validation code", ParameterType = "query", DataType = "string", IsRequired = false)]
public System.String ValidationCode {get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Web;
using ServiceStack.Common;
using ServiceStack.ServiceHost;
using ServiceStack.Common.Web;
using GatecoinServiceInterface.Response;
namespace GatecoinServiceInterface.Request{
[Route("/Login", "POST", Summary = @"Trader session log in.", Notes = @"")]
public class Login : IReturn<LoginResponse>
{
[ApiMember(Name = "UserName", Description = "user name", ParameterType = "query", DataType = "string", IsRequired = true)]
public System.String UserName {get; set; }
[ApiMember(Name = "Password", Description = "password", ParameterType = "query", DataType = "string", IsRequired = true)]
public System.String Password {get; set; }
[ApiMember(Name = "ValidationCode", Description = "Validation code", ParameterType = "query", DataType = "string", IsRequired = false)]
public System.String ValidationCode {get; set; }
}
}
|
mit
|
C#
|
f7a0b44fed58a7aae837c829ec98c251196e5458
|
Bump version to 0.30.1
|
github-for-unity/Unity,github-for-unity/Unity,github-for-unity/Unity
|
common/SolutionInfo.cs
|
common/SolutionInfo.cs
|
#pragma warning disable 436
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-2018")]
[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)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", 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.30.1";
}
}
|
#pragma warning disable 436
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-2018")]
[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)]
[assembly: InternalsVisibleTo("TaskSystemIntegrationTests", 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.30.0";
}
}
|
mit
|
C#
|
ed112ee3d1f91cc3f8a320f940bfe90cb48fadb3
|
fix to the basic interpreter
|
pieterderycke/Jace
|
Calculator/BasicInterpreter.cs
|
Calculator/BasicInterpreter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Calculator.Operations;
namespace Calculator
{
public class BasicInterpreter : IInterpreter
{
public double Execute(Operation operation)
{
return Execute(operation, new Dictionary<string, int>());
}
public double Execute(Operation operation, Dictionary<string, int> variables)
{
if (operation == null)
throw new ArgumentException("operation");
if (operation.GetType() == typeof(IntegerConstant))
{
IntegerConstant constant = (IntegerConstant)operation;
return constant.Value;
}
else if (operation.GetType() == typeof(Multiplication))
{
Multiplication multiplication = (Multiplication)operation;
return Execute(multiplication.Argument1, variables) * Execute(multiplication.Argument2, variables);
}
else if (operation.GetType() == typeof(Addition))
{
Addition addition = (Addition)operation;
return Execute(addition.Argument1, variables) + Execute(addition.Argument2, variables);
}
else if (operation.GetType() == typeof(Substraction))
{
Substraction addition = (Substraction)operation;
return Execute(addition.Argument1, variables) - Execute(addition.Argument2, variables);
}
else if (operation.GetType() == typeof(Division))
{
Division division = (Division)operation;
return Execute(division.Dividend, variables) / Execute(division.Divisor, variables);
}
else
{
throw new ArgumentException(string.Format("Unsupported operation \"{0}\".", operation.GetType().FullName), "operation");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Calculator.Operations;
namespace Calculator
{
public class BasicInterpreter : IInterpreter
{
public double Execute(Operation operation)
{
return Execute(operation, new Dictionary<string, int>());
}
public double Execute(Operation operation, Dictionary<string, int> variables)
{
if (operation == null)
throw new ArgumentException("operation");
if (operation.GetType() == typeof(Constant<int>))
{
Constant<int> constant = (Constant<int>)operation;
return constant.Value;
}
else if (operation.GetType() == typeof(Multiplication))
{
Multiplication multiplication = (Multiplication)operation;
return Execute(multiplication.Argument1, variables) * Execute(multiplication.Argument2, variables);
}
else if (operation.GetType() == typeof(Addition))
{
Addition addition = (Addition)operation;
return Execute(addition.Argument1, variables) + Execute(addition.Argument2, variables);
}
else if (operation.GetType() == typeof(Substraction))
{
Substraction addition = (Substraction)operation;
return Execute(addition.Argument1, variables) - Execute(addition.Argument2, variables);
}
else if (operation.GetType() == typeof(Division))
{
Division division = (Division)operation;
return Execute(division.Dividend, variables) / Execute(division.Divisor, variables);
}
else
{
throw new ArgumentException(string.Format("Unsupported operation \"{0}\".", operation.GetType().FullName), "operation");
}
}
}
}
|
mit
|
C#
|
72fefaa3d58ae32b9ade33b62bc39e912ee765e4
|
Update version number.
|
Damnae/storybrew
|
editor/Properties/AssemblyInfo.cs
|
editor/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.60.*")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.59.*")]
|
mit
|
C#
|
9ab6c504705aa06e9e410142b89512feb960abe0
|
Change StartContext.App from object to AppFunc.
|
abrodersen/katana,julianpaulozzi/katanaproject,evicertia/Katana,abrodersen/katana,eocampo/KatanaProject301,julianpaulozzi/katanaproject,HongJunRen/katanaproject,PxAndy/Katana,HongJunRen/katanaproject,julianpaulozzi/katanaproject,julianpaulozzi/katanaproject,eocampo/KatanaProject301,julianpaulozzi/katanaproject,tomi85/Microsoft.Owin,HongJunRen/katanaproject,tomi85/Microsoft.Owin,PxAndy/Katana,HongJunRen/katanaproject,evicertia/Katana,julianpaulozzi/katanaproject,monkeysquare/katana,abrodersen/katana,monkeysquare/katana,HongJunRen/katanaproject,abrodersen/katana,PxAndy/Katana,eocampo/KatanaProject301,evicertia/Katana,PxAndy/Katana,abrodersen/katana,tomi85/Microsoft.Owin,eocampo/KatanaProject301,monkeysquare/katana,evicertia/Katana,evicertia/Katana,eocampo/KatanaProject301,tomi85/Microsoft.Owin,abrodersen/katana,HongJunRen/katanaproject,evicertia/Katana,eocampo/KatanaProject301
|
src/Microsoft.Owin.Hosting/Engine/StartContext.cs
|
src/Microsoft.Owin.Hosting/Engine/StartContext.cs
|
// <copyright file="StartContext.cs" company="Microsoft Open Technologies, Inc.">
// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting.ServerFactory;
using Microsoft.Owin.Hosting.Settings;
using Owin;
namespace Microsoft.Owin.Hosting.Engine
{
using AppFunc = Func<IDictionary<string, object>, Task>;
public class StartContext
{
private StartContext()
{
}
public StartOptions Options { get; private set; }
public IServerFactory ServerFactory { get; set; }
public IAppBuilder Builder { get; set; }
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "By design")]
public AppFunc App { get; set; }
public Action<IAppBuilder> Startup { get; set; }
public TextWriter Output { get; set; }
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "By design")]
public IList<KeyValuePair<string, object>> EnvironmentData { get; private set; }
public static StartContext Create(StartOptions options)
{
if (options == null)
{
throw new ArgumentNullException("options");
}
if (options.Settings == null)
{
options.Settings = SettingsLoader.LoadFromConfig();
}
return new StartContext
{
Options = options,
EnvironmentData = new List<KeyValuePair<string, object>>()
};
}
}
}
|
// <copyright file="StartContext.cs" company="Microsoft Open Technologies, Inc.">
// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Microsoft.Owin.Hosting.ServerFactory;
using Microsoft.Owin.Hosting.Settings;
using Owin;
namespace Microsoft.Owin.Hosting.Engine
{
public class StartContext
{
private StartContext()
{
}
public StartOptions Options { get; private set; }
public IServerFactory ServerFactory { get; set; }
public IAppBuilder Builder { get; set; }
public object App { get; set; }
public Action<IAppBuilder> Startup { get; set; }
public TextWriter Output { get; set; }
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "By design")]
public IList<KeyValuePair<string, object>> EnvironmentData { get; private set; }
public static StartContext Create(StartOptions options)
{
if (options == null)
{
throw new ArgumentNullException("options");
}
if (options.Settings == null)
{
options.Settings = SettingsLoader.LoadFromConfig();
}
return new StartContext
{
Options = options,
EnvironmentData = new List<KeyValuePair<string, object>>()
};
}
}
}
|
apache-2.0
|
C#
|
64d99a26170678c793d6c20560fe68c827fa2ab0
|
add intructions to title attr of element
|
kreeben/resin,kreeben/resin
|
src/Sir.HttpServer/Views/Shared/SearchForm.cshtml
|
src/Sir.HttpServer/Views/Shared/SearchForm.cshtml
|
@{
var col = Context.Request.Query["collection"].ToString();
var query = Context.Request.Query["q"].ToString();
var knownFields = Context.Request.Query["field"].ToArray();
var titleSelected = knownFields.Contains("title");
var bodySelected = knownFields.Contains("body");
}
@using (Html.BeginRouteForm("default", new { controller = "Search" }, FormMethod.Get))
{
<p>
<input type="text" id="collection" name="collection" class="collection" value="@ViewBag.Collection" title="Enter the names of one or more collections here, separated by commas." />
</p>
<fieldset class="search-fields">
<legend>Search fields</legend>
<input type="checkbox" name="field" value="title" id="title" @(titleSelected ? "checked" : "") /><label for="title">title</label>
<input type="checkbox" name="field" value="body" id="body" @(bodySelected ? "checked" : "") /><label for="body">body</label>
</fieldset>
<input type="text" id="q" name="q" class="q" placeholder="Ask me anything." value="@query" />
<div class="buttons">
<button type="submit" value="OR" name="OR" id="or" title="OR">Go <sup>OR</sup></button><button type="submit" value="AND" name="AND" id="and" title="AND">Go <sup>AND</sup></button>
</div>
<div style="clear:both;"></div>
<input type="hidden" value="0" name="skip" id="skip" />
<input type="hidden" value="100" name="take" id="take" />
}
|
@{
var col = Context.Request.Query["collection"].ToString();
var query = Context.Request.Query["q"].ToString();
var knownFields = Context.Request.Query["field"].ToArray();
var titleSelected = knownFields.Contains("title");
var bodySelected = knownFields.Contains("body");
}
@using (Html.BeginRouteForm("default", new { controller = "Search" }, FormMethod.Get))
{
<p>
<input type="text" id="collection" name="collection" class="collection" value="@ViewBag.Collection" />
</p>
<fieldset class="search-fields">
<legend>Search fields</legend>
<input type="checkbox" name="field" value="title" id="title" @(titleSelected ? "checked" : "") /><label for="title">title</label>
<input type="checkbox" name="field" value="body" id="body" @(bodySelected ? "checked" : "") /><label for="body">body</label>
</fieldset>
<input type="text" id="q" name="q" class="q" placeholder="Ask me anything." value="@query" />
<div class="buttons">
<button type="submit" value="OR" name="OR" id="or" title="OR">Go <sup>OR</sup></button><button type="submit" value="AND" name="AND" id="and" title="AND">Go <sup>AND</sup></button>
</div>
<div style="clear:both;"></div>
<input type="hidden" value="0" name="skip" id="skip" />
<input type="hidden" value="100" name="take" id="take" />
}
|
mit
|
C#
|
add2198edb96e0280a62c848ea8e9936edcbb9e1
|
Fix documentation text and removed unused namespaces.
|
nohros/must,nohros/must,nohros/must
|
src/impl/cache/memorycache/MemoryCacheProvider.cs
|
src/impl/cache/memorycache/MemoryCacheProvider.cs
|
using System;
using System.Runtime.Caching;
using Nohros.Caching.Providers;
namespace Nohros.Caching
{
public class MemoryCacheProvider : ICacheProvider
{
readonly MemoryCache memory_cache_;
#region .ctor
/// <summary>
/// Initializes a new instance of the <see cref="MemoryCacheProvider"/>
/// using the specified <see cref="MemoryCache"/> object.
/// </summary>
/// <param name="memory_cache">
/// A <see cref="MemoryCache"/> that is used to cache objects.
/// </param>
public MemoryCacheProvider(MemoryCache memory_cache) {
if (memory_cache == null) {
throw new ArgumentNullException("memory_cache");
}
memory_cache_ = memory_cache;
}
#endregion
public T Get<T>(string key) {
object entry = memory_cache_.Get(key);
if (entry == null) {
return default(T);
}
return (T) entry;
}
public bool Get<T>(string key, out T item) {
object entry = memory_cache_.Get(key);
if (entry == null) {
item = default(T);
return false;
}
item = (T) entry;
return true;
}
public void Set(string key, object value) {
var policy = new CacheItemPolicy();
memory_cache_.Set(key, value, policy);
}
public void Set(string key, object value, long duration, TimeUnit unit) {
var policy = new CacheItemPolicy();
policy.AbsoluteExpiration =
DateTimeOffset.Now.AddMilliseconds(
TimeUnitHelper.ToSeconds(duration, unit));
memory_cache_.Set(key, value, policy);
}
public void Add(string key, object value) {
var policy = new CacheItemPolicy();
memory_cache_.Add(key, value, policy);
}
public void Add(string key, object value, long duration, TimeUnit unit) {
var policy = new CacheItemPolicy();
policy.AbsoluteExpiration =
DateTimeOffset.Now.AddMilliseconds(
TimeUnitHelper.ToSeconds(duration, unit));
memory_cache_.Add(key, value, policy);
}
public void Remove(string key) {
memory_cache_.Remove(key);
}
public void Clear() {
// do nothing, since memory cache does not have a Clear method.
}
}
}
|
using System;
using System.Runtime.Caching;
using Nohros.Caching.Providers;
namespace Nohros.Caching
{
public class MemoryCacheProvider : ICacheProvider
{
System.Runtime.Caching.MemoryCache memory_cache_;
#region .ctor
/// <summary>
/// Initializes a new instance of the <see cref="MemoryCacheProvider"/>
/// using the specified <see cref="MemoryCache"/> object.
/// </summary>
/// <param name="memory_cache">
/// A <see cref="MemoryCache"/> that is used to cache objects.
/// </param>
public MemoryCacheProvider(MemoryCache memory_cache) {
if (memory_cache == null) {
throw new ArgumentNullException("memory_cache");
}
memory_cache_ = memory_cache;
}
#endregion
#region ICacheProvider Members
public T Get<T>(string key) {
object entry = memory_cache_.Get(key);
if (entry == null) {
return default(T);
}
return (T) entry;
}
public bool Get<T>(string key, out T item) {
object entry = memory_cache_.Get(key);
if (entry == null) {
item = default(T);
return false;
}
item = (T) entry;
return true;
}
public void Set(string key, object value) {
CacheItemPolicy policy = new CacheItemPolicy();
memory_cache_.Set(key, value, policy);
}
public void Set(string key, object value, long duration, TimeUnit unit) {
CacheItemPolicy policy = new CacheItemPolicy();
policy.AbsoluteExpiration =
DateTimeOffset.Now.AddMilliseconds(
TimeUnitHelper.ToSeconds(duration, unit));
memory_cache_.Set(key, value, policy);
}
public void Add(string key, object value) {
CacheItemPolicy policy = new CacheItemPolicy();
memory_cache_.Add(key, value, policy);
}
public void Add(string key, object value, long duration, TimeUnit unit) {
CacheItemPolicy policy = new CacheItemPolicy();
policy.AbsoluteExpiration =
DateTimeOffset.Now.AddMilliseconds(
TimeUnitHelper.ToSeconds(duration, unit));
memory_cache_.Add(key, value, policy);
}
public void Remove(string key) {
memory_cache_.Remove(key);
}
public void Clear() {
// do nothing, since memory cache does not have a Clear method.
}
#endregion
}
}
|
mit
|
C#
|
ab66f973bf521d6f8bd310797c99454380cb342c
|
Use patterns.
|
Faithlife/Parsing
|
tests/Faithlife.Parsing.Tests/CharTests.cs
|
tests/Faithlife.Parsing.Tests/CharTests.cs
|
using Xunit;
namespace Faithlife.Parsing.Tests;
public class CharTests
{
[Fact]
public void ConstantShouldFailOnEmpty()
{
Parser.Char('a').TryParse("").ShouldFail(0);
}
[Fact]
public void ConstantShouldSucceedOnGoodChar()
{
Parser.Char('a').TryParse("a").ShouldSucceed('a', 1);
Parser.Char('a').TryParse("ab").ShouldSucceed('a', 1);
}
[Fact]
public void ConstantShouldFailOnBadChar()
{
Parser.Char('a').TryParse("b").ShouldFail(0);
}
[Fact]
public void PredicateShouldFailOnEmpty()
{
Parser.Char(ch => ch is >= 'a' and <= 'z').TryParse("").ShouldFail(0);
}
[Fact]
public void PredicateShouldSucceedOnGoodChar()
{
Parser.Char(ch => ch is >= 'a' and <= 'z').TryParse("a").ShouldSucceed('a', 1);
Parser.Char(ch => ch is >= 'a' and <= 'z').TryParse("ab").ShouldSucceed('a', 1);
Parser.Char(ch => ch is >= 'a' and <= 'z').TryParse("b").ShouldSucceed('b', 1);
}
[Fact]
public void PredicateShouldFailOnBadChar()
{
Parser.Char(ch => ch is >= 'a' and <= 'z').TryParse("1").ShouldFail(0);
}
[Fact]
public void AnyCharShouldFailOnEmpty()
{
Parser.AnyChar.TryParse("").ShouldFail(0);
}
[Fact]
public void AnyCharShouldSucceedOnAnyChar()
{
Parser.AnyChar.TryParse("a").ShouldSucceed('a', 1);
Parser.AnyChar.TryParse("1").ShouldSucceed('1', 1);
}
[Fact]
public void AnyCharExceptShouldFailOnEmpty()
{
Parser.AnyCharExcept('a').TryParse("").ShouldFail(0);
}
[Fact]
public void AnyCharExceptShouldSucceedOnGoodChar()
{
Parser.AnyCharExcept('a').TryParse("b").ShouldSucceed('b', 1);
}
[Fact]
public void AnyCharExceptShouldFailOnBadChar()
{
Parser.AnyCharExcept('a').TryParse("a").ShouldFail(0);
Parser.AnyCharExcept('a').TryParse("ab").ShouldFail(0);
}
}
|
using Xunit;
namespace Faithlife.Parsing.Tests;
public class CharTests
{
[Fact]
public void ConstantShouldFailOnEmpty()
{
Parser.Char('a').TryParse("").ShouldFail(0);
}
[Fact]
public void ConstantShouldSucceedOnGoodChar()
{
Parser.Char('a').TryParse("a").ShouldSucceed('a', 1);
Parser.Char('a').TryParse("ab").ShouldSucceed('a', 1);
}
[Fact]
public void ConstantShouldFailOnBadChar()
{
Parser.Char('a').TryParse("b").ShouldFail(0);
}
[Fact]
public void PredicateShouldFailOnEmpty()
{
Parser.Char(ch => ch >= 'a' && ch <= 'z').TryParse("").ShouldFail(0);
}
[Fact]
public void PredicateShouldSucceedOnGoodChar()
{
Parser.Char(ch => ch >= 'a' && ch <= 'z').TryParse("a").ShouldSucceed('a', 1);
Parser.Char(ch => ch >= 'a' && ch <= 'z').TryParse("ab").ShouldSucceed('a', 1);
Parser.Char(ch => ch >= 'a' && ch <= 'z').TryParse("b").ShouldSucceed('b', 1);
}
[Fact]
public void PredicateShouldFailOnBadChar()
{
Parser.Char(ch => ch >= 'a' && ch <= 'z').TryParse("1").ShouldFail(0);
}
[Fact]
public void AnyCharShouldFailOnEmpty()
{
Parser.AnyChar.TryParse("").ShouldFail(0);
}
[Fact]
public void AnyCharShouldSucceedOnAnyChar()
{
Parser.AnyChar.TryParse("a").ShouldSucceed('a', 1);
Parser.AnyChar.TryParse("1").ShouldSucceed('1', 1);
}
[Fact]
public void AnyCharExceptShouldFailOnEmpty()
{
Parser.AnyCharExcept('a').TryParse("").ShouldFail(0);
}
[Fact]
public void AnyCharExceptShouldSucceedOnGoodChar()
{
Parser.AnyCharExcept('a').TryParse("b").ShouldSucceed('b', 1);
}
[Fact]
public void AnyCharExceptShouldFailOnBadChar()
{
Parser.AnyCharExcept('a').TryParse("a").ShouldFail(0);
Parser.AnyCharExcept('a').TryParse("ab").ShouldFail(0);
}
}
|
mit
|
C#
|
32325b9b667b227f808ea34cf5fcb5de634b0368
|
Convert to ImmutableHashSet for consistency in comparison (#4090)
|
simonlaroche/akka.net,simonlaroche/akka.net
|
src/contrib/cluster/Akka.Cluster.Sharding.Tests/ConstantRateEntityRecoveryStrategySpec.cs
|
src/contrib/cluster/Akka.Cluster.Sharding.Tests/ConstantRateEntityRecoveryStrategySpec.cs
|
//-----------------------------------------------------------------------
// <copyright file="ConstantRateEntityRecoveryStrategySpec.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Akka.TestKit;
using FluentAssertions;
using Xunit;
namespace Akka.Cluster.Sharding.Tests
{
using EntityId = String;
public class ConstantRateEntityRecoveryStrategySpec : AkkaSpec
{
private readonly EntityRecoveryStrategy strategy;
public ConstantRateEntityRecoveryStrategySpec()
{
strategy = EntityRecoveryStrategy.ConstantStrategy(Sys, TimeSpan.FromSeconds(1), 2);
}
[Fact]
public void ConstantRateEntityRecoveryStrategy_must_recover_entities()
{
var entities = ImmutableHashSet.Create<EntityId>("1", "2", "3", "4", "5");
var startTime = DateTime.UtcNow;
var resultWithTimes = strategy.RecoverEntities(entities)
.Select(scheduledRecovery => scheduledRecovery.ContinueWith(t => new KeyValuePair<IImmutableSet<string>, TimeSpan>(t.Result, DateTime.UtcNow - startTime)))
.ToArray();
var result = Task.WhenAll(resultWithTimes).Result.OrderBy(pair => pair.Value).ToArray();
result.Length.Should().Be(3);
var scheduledEntities = result.Select(pair => pair.Key).ToArray();
scheduledEntities[0].Count.Should().Be(2);
scheduledEntities[1].Count.Should().Be(2);
scheduledEntities[2].Count.Should().Be(1);
scheduledEntities.SelectMany(s => s).ToImmutableHashSet().Should().Equal(entities);
var timesMillis = result.Select(pair => pair.Value.TotalMilliseconds).ToArray();
// scheduling will not happen too early
timesMillis[0].Should().BeApproximately(1400, 500);
timesMillis[1].Should().BeApproximately(2400, 500);
timesMillis[2].Should().BeApproximately(3400, 500);
}
[Fact]
public void ConstantRateEntityRecoveryStrategy_must_no_recover_when_no_entities_to_recover()
{
var result = strategy.RecoverEntities(ImmutableHashSet<EntityId>.Empty);
result.Should().BeEmpty();
}
}
}
|
//-----------------------------------------------------------------------
// <copyright file="ConstantRateEntityRecoveryStrategySpec.cs" company="Akka.NET Project">
// Copyright (C) 2009-2019 Lightbend Inc. <http://www.lightbend.com>
// Copyright (C) 2013-2019 .NET Foundation <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Akka.TestKit;
using FluentAssertions;
using Xunit;
namespace Akka.Cluster.Sharding.Tests
{
using EntityId = String;
public class ConstantRateEntityRecoveryStrategySpec : AkkaSpec
{
private readonly EntityRecoveryStrategy strategy;
public ConstantRateEntityRecoveryStrategySpec()
{
strategy = EntityRecoveryStrategy.ConstantStrategy(Sys, TimeSpan.FromSeconds(1), 2);
}
[Fact]
public void ConstantRateEntityRecoveryStrategy_must_recover_entities()
{
var entities = ImmutableHashSet.Create<EntityId>("1", "2", "3", "4", "5");
var startTime = DateTime.UtcNow;
var resultWithTimes = strategy.RecoverEntities(entities)
.Select(scheduledRecovery => scheduledRecovery.ContinueWith(t => new KeyValuePair<IImmutableSet<string>, TimeSpan>(t.Result, DateTime.UtcNow - startTime)))
.ToArray();
var result = Task.WhenAll(resultWithTimes).Result.OrderBy(pair => pair.Value).ToArray();
result.Length.Should().Be(3);
var scheduledEntities = result.Select(pair => pair.Key).ToArray();
scheduledEntities[0].Count.Should().Be(2);
scheduledEntities[1].Count.Should().Be(2);
scheduledEntities[2].Count.Should().Be(1);
scheduledEntities.SelectMany(s => s).Should().Equal(entities);
var timesMillis = result.Select(pair => pair.Value.TotalMilliseconds).ToArray();
// scheduling will not happen too early
timesMillis[0].Should().BeApproximately(1400, 500);
timesMillis[1].Should().BeApproximately(2400, 500);
timesMillis[2].Should().BeApproximately(3400, 500);
}
[Fact]
public void ConstantRateEntityRecoveryStrategy_must_no_recover_when_no_entities_to_recover()
{
var result = strategy.RecoverEntities(ImmutableHashSet<EntityId>.Empty);
result.Should().BeEmpty();
}
}
}
|
apache-2.0
|
C#
|
0cfd73dd264caad30186eb7a3e549ae266510621
|
Decrease allocations during array serialization/deserialization
|
gregsdennis/Manatee.Json,gregsdennis/Manatee.Json
|
Manatee.Json/Serialization/Internal/AutoRegistration/ArraySerializationDelegateProvider.cs
|
Manatee.Json/Serialization/Internal/AutoRegistration/ArraySerializationDelegateProvider.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
internal class ArraySerializationDelegateProvider : SerializationDelegateProviderBase
{
public override bool CanHandle(Type type)
{
return type.IsArray;
}
protected override Type[] GetTypeArguments(Type type)
{
return new[] { type.GetElementType() };
}
private static JsonValue _Encode<T>(T[] array, JsonSerializer serializer)
{
var values = new JsonValue[array.Length];
for (int ii = 0; ii < array.Length; ++ii)
{
values[ii] = serializer.Serialize(array[ii]);
}
return new JsonArray(values);
}
private static T[] _Decode<T>(JsonValue json, JsonSerializer serializer)
{
var array = json.Array;
var values = new T[array.Count];
for (int ii = 0; ii < array.Count; ++ii)
{
values[ii] = serializer.Deserialize<T>(array[ii]);
}
return values;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Manatee.Json.Serialization.Internal.AutoRegistration
{
internal class ArraySerializationDelegateProvider : SerializationDelegateProviderBase
{
public override bool CanHandle(Type type)
{
return type.IsArray;
}
protected override Type[] GetTypeArguments(Type type)
{
return new[] { type.GetElementType() };
}
private static JsonValue _Encode<T>(T[] array, JsonSerializer serializer)
{
var json = new JsonArray();
json.AddRange(array.Select(serializer.Serialize));
return json;
}
private static T[] _Decode<T>(JsonValue json, JsonSerializer serializer)
{
var list = new List<T>();
list.AddRange(json.Array.Select(serializer.Deserialize<T>));
return list.ToArray();
}
}
}
|
mit
|
C#
|
f1a8769330ced25bed4d0d9ce1d7b1e12ecceab9
|
Bump version to v0.6.1.
|
arookas/flaaffy
|
mareep/main.cs
|
mareep/main.cs
|
using System;
namespace arookas {
static partial class mareep {
static Version sVersion = new Version(0, 6, 1);
static void Main(string[] arguments) {
Console.Title = String.Format("mareep v{0} arookas", sVersion);
mareep.WriteMessage("mareep v{0} arookas\n", sVersion);
mareep.WriteSeparator('=');
if (arguments.Length == 0) {
ShowUsage();
}
bool help = false;
string name = null;
int i;
for (i = 0; (name == null && i < arguments.Length); ++i) {
switch (arguments[i]) {
case "-help": {
help = true;
break;
}
case "-errand": {
if ((i + 1) >= arguments.Length) {
ShowUsage();
}
name = arguments[++i];
break;
}
}
}
if (name == null) {
ShowUsage();
}
var errand = mareep.ReadErrand(name);
var instance = mareep.InitErrand(errand);
if (help) {
instance.ShowUsage();
} else {
string[] args = new string[arguments.Length - i];
Array.Copy(arguments, i, args, 0, args.Length);
instance.LoadParams(args);
instance.Perform();
mareep.WriteLine();
mareep.WriteSeparator('-');
if (sWarningCount > 0) {
mareep.WriteMessage("Completed with {0} warning(s).\n", sWarningCount);
} else {
mareep.WriteMessage("Completed successfully!\n");
}
}
}
static void ShowUsage() {
mareep.WriteMessage("USAGE: mareep [-help] -errand <errand> [...]\n");
mareep.WriteMessage("\n");
mareep.WriteMessage("OPTIONS:\n");
mareep.WriteMessage(" -help display help on program or errand\n");
mareep.WriteMessage("\n");
mareep.WriteMessage("ERRANDS:\n");
mareep.WriteMessage(" shock convert banks 'IBNK'\n");
mareep.WriteMessage(" whap convert wave banks 'WSYS'\n");
mareep.WriteMessage(" wave convert audio files\n");
mareep.WriteMessage(" cotton assemble sequence files\n");
mareep.WriteMessage(" jolt convert midi to assembly\n");
mareep.WriteMessage(" charge extract and import aaf\n");
mareep.Exit(0);
}
}
}
|
using System;
namespace arookas {
static partial class mareep {
static Version sVersion = new Version(0, 6, 0);
static void Main(string[] arguments) {
Console.Title = String.Format("mareep v{0} arookas", sVersion);
mareep.WriteMessage("mareep v{0} arookas\n", sVersion);
mareep.WriteSeparator('=');
if (arguments.Length == 0) {
ShowUsage();
}
bool help = false;
string name = null;
int i;
for (i = 0; (name == null && i < arguments.Length); ++i) {
switch (arguments[i]) {
case "-help": {
help = true;
break;
}
case "-errand": {
if ((i + 1) >= arguments.Length) {
ShowUsage();
}
name = arguments[++i];
break;
}
}
}
if (name == null) {
ShowUsage();
}
var errand = mareep.ReadErrand(name);
var instance = mareep.InitErrand(errand);
if (help) {
instance.ShowUsage();
} else {
string[] args = new string[arguments.Length - i];
Array.Copy(arguments, i, args, 0, args.Length);
instance.LoadParams(args);
instance.Perform();
mareep.WriteLine();
mareep.WriteSeparator('-');
if (sWarningCount > 0) {
mareep.WriteMessage("Completed with {0} warning(s).\n", sWarningCount);
} else {
mareep.WriteMessage("Completed successfully!\n");
}
}
}
static void ShowUsage() {
mareep.WriteMessage("USAGE: mareep [-help] -errand <errand> [...]\n");
mareep.WriteMessage("\n");
mareep.WriteMessage("OPTIONS:\n");
mareep.WriteMessage(" -help display help on program or errand\n");
mareep.WriteMessage("\n");
mareep.WriteMessage("ERRANDS:\n");
mareep.WriteMessage(" shock convert banks 'IBNK'\n");
mareep.WriteMessage(" whap convert wave banks 'WSYS'\n");
mareep.WriteMessage(" wave convert audio files\n");
mareep.WriteMessage(" cotton assemble sequence files\n");
mareep.WriteMessage(" jolt convert midi to assembly\n");
mareep.WriteMessage(" charge extract and import aaf\n");
mareep.Exit(0);
}
}
}
|
mit
|
C#
|
6dc2840cbf5bd9764a7090aa85c4b6bdc664fae0
|
Use simpler constructor when instantiating the Sandbox
|
jrusbatch/compilify,vendettamit/compilify,vendettamit/compilify,appharbor/ConsolR,jrusbatch/compilify,appharbor/ConsolR
|
Core/Services/CSharpExecutor.cs
|
Core/Services/CSharpExecutor.cs
|
using System;
using System.IO;
using Compilify.Models;
namespace Compilify.Services
{
public class CSharpExecutor
{
public CSharpExecutor()
: this(new CSharpCompilationProvider()) { }
public CSharpExecutor(ICSharpCompilationProvider compilationProvider)
{
compiler = compilationProvider;
}
private readonly ICSharpCompilationProvider compiler;
public object Execute(Post post)
{
var compilation = compiler.Compile(post);
byte[] compiledAssembly;
using (var stream = new MemoryStream())
{
var emitResult = compilation.Emit(stream);
if (!emitResult.Success)
{
return "[Compilation failed]";
}
compiledAssembly = stream.ToArray();
}
object result;
using (var sandbox = new Sandbox(compiledAssembly))
{
result = sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5));
}
return result;
}
}
}
|
using System;
using System.IO;
using Compilify.Models;
namespace Compilify.Services
{
public class CSharpExecutor
{
public CSharpExecutor()
: this(new CSharpCompilationProvider()) { }
public CSharpExecutor(ICSharpCompilationProvider compilationProvider)
{
compiler = compilationProvider;
}
private readonly ICSharpCompilationProvider compiler;
public object Execute(Post post)
{
var compilation = compiler.Compile(post);
byte[] compiledAssembly;
using (var stream = new MemoryStream())
{
var emitResult = compilation.Emit(stream);
if (!emitResult.Success)
{
return "[Compilation failed]";
}
compiledAssembly = stream.ToArray();
}
object result;
using (var sandbox = new Sandbox("Sandbox", compiledAssembly))
{
result = sandbox.Run("EntryPoint", "Result", TimeSpan.FromSeconds(5));
}
return result;
}
}
}
|
mit
|
C#
|
4235633e4b2142eb86f33840a3cf0925bfc6d1e4
|
write test
|
ChrisL89/SS.Integration.UnifiedDataAPIClient.DotNet,sportingsolutions/SS.Integration.UnifiedDataAPIClient.DotNet,tom-scott/Unified_Data_API_Client_DotNet,sportingsolutions/SS.Integration.UnifiedDataAPIClient.DotNet
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;;
[assembly: AssemblyProduct("Spin.TradingServices.C2E")]
[assembly: AssemblyCompany("Sporting Index Ltd.")]
[assembly: AssemblyCopyright("Copyright (c) Sporting Index Ltd. 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Spin.TradingServices.C2E")]
[assembly: AssemblyCompany("Sporting Index Ltd.")]
[assembly: AssemblyCopyright("Copyright (c) Sporting Index Ltd. 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
a4f5f93fbdfd565d0d413be9bd76b41844037d8c
|
remove default constructor from NPCFromPacketFactory
|
ethanmoffat/EndlessClient
|
EOLib/Net/Translators/NPCFromPacketFactory.cs
|
EOLib/Net/Translators/NPCFromPacketFactory.cs
|
using AutomaticTypeMapper;
using EOLib.Domain.NPC;
namespace EOLib.Net.Translators
{
[AutoMappedType]
public class NPCFromPacketFactory : INPCFromPacketFactory
{
public INPC CreateNPC(IPacket packet)
{
var index = packet.ReadChar();
var id = packet.ReadShort();
var x = packet.ReadChar();
var y = packet.ReadChar();
var direction = (EODirection)packet.ReadChar();
INPC npc = new NPC(id, index);
npc = npc.WithX(x).WithY(y).WithDirection(direction).WithFrame(NPCFrame.Standing);
return npc;
}
}
public interface INPCFromPacketFactory
{
INPC CreateNPC(IPacket packet);
}
}
|
using AutomaticTypeMapper;
using EOLib.Domain.NPC;
namespace EOLib.Net.Translators
{
[AutoMappedType]
public class NPCFromPacketFactory : INPCFromPacketFactory
{
public NPCFromPacketFactory()
{
}
public INPC CreateNPC(IPacket packet)
{
var index = packet.ReadChar();
var id = packet.ReadShort();
var x = packet.ReadChar();
var y = packet.ReadChar();
var direction = (EODirection)packet.ReadChar();
INPC npc = new NPC(id, index);
npc = npc.WithX(x).WithY(y).WithDirection(direction).WithFrame(NPCFrame.Standing);
return npc;
}
}
public interface INPCFromPacketFactory
{
INPC CreateNPC(IPacket packet);
}
}
|
mit
|
C#
|
62b4d40873086f91d556ee844d9124d8fb65769a
|
use default config for cookie sessions
|
0xFireball/KQAnalytics3,0xFireball/KQAnalytics3,0xFireball/KQAnalytics3
|
KQAnalytics3/src/KQAnalytics3/Bootstrapper.cs
|
KQAnalytics3/src/KQAnalytics3/Bootstrapper.cs
|
using KQAnalytics3.Configuration;
using Nancy;
using Nancy.Bootstrapper;
using Nancy.Conventions;
using Nancy.Session;
using Nancy.TinyIoc;
using Newtonsoft.Json;
using System.IO;
namespace KQAnalytics3
{
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("assets", "wwwroot/assets/")
);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("static", "wwwroot/static/")
);
}
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
// Read KQConfig configuration file
var configFileCont = File.ReadAllText("kqconfig.json");
KQRegistry.ServerConfiguration = JsonConvert.DeserializeObject<KQServerConfiguration>(configFileCont);
// TODO: Do any required initialization for Nancy here
CookieBasedSessions.Enable(pipelines);
// Enable CORS
pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) =>
{
foreach (var origin in KQRegistry.ServerConfiguration.CorsOptions.Origins)
{
ctx.Response.WithHeader("Access-Control-Allow-Origin", origin);
}
ctx.Response
.WithHeader("Access-Control-Allow-Methods", "POST,GET")
.WithHeader("Access-Control-Allow-Headers", "Accept, Origin, Content-type");
});
}
}
}
|
using KQAnalytics3.Configuration;
using Nancy;
using Nancy.Bootstrapper;
using Nancy.Conventions;
using Nancy.Session;
using Nancy.TinyIoc;
using Newtonsoft.Json;
using System.IO;
namespace KQAnalytics3
{
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("assets", "wwwroot/assets/")
);
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory("static", "wwwroot/static/")
);
}
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
// Read KQConfig configuration file
var configFileCont = File.ReadAllText("kqconfig.json");
KQRegistry.ServerConfiguration = JsonConvert.DeserializeObject<KQServerConfiguration>(configFileCont);
// TODO: Do any required initialization for Nancy here
CookieBasedSessions.Enable(pipelines, new CookieBasedSessionsConfiguration
{
// TODO: Configuration
});
// Enable CORS
pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) =>
{
foreach (var origin in KQRegistry.ServerConfiguration.CorsOptions.Origins)
{
ctx.Response.WithHeader("Access-Control-Allow-Origin", origin);
}
ctx.Response
.WithHeader("Access-Control-Allow-Methods", "POST,GET")
.WithHeader("Access-Control-Allow-Headers", "Accept, Origin, Content-type");
});
}
}
}
|
agpl-3.0
|
C#
|
56ac48803030bd46c55facb019665d68e5bb5643
|
Update to version 1.10.0.0
|
davispuh/gear-emu,davispuh/gear-emu,davispuh/gear-emu,davispuh/gear-emu,gatuno1/gear-emu-branch-old,gatuno1/gear-emu-branch-old,gatuno1/gear-emu-branch-old
|
Gear/Properties/AssemblyInfo.cs
|
Gear/Properties/AssemblyInfo.cs
|
/* --------------------------------------------------------------------------------
* Gear: Parallax Inc. Propeller Debugger
* Copyright 2007 - Robert Vandiver
* --------------------------------------------------------------------------------
* AssemblyInfo.cs
* Run-time settings for gear
* --------------------------------------------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* --------------------------------------------------------------------------------
*/
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("Gear")]
[assembly: AssemblyDescription(
"Developers: Robert Vandiver.\r\n" +
"\r\n" +
"Thanks to everyone on the forums for being " +
"so helpful with providing me with information\r\n" +
"\r\n" +
"As this is a pre-release, there are bound to be bugs\r\n" +
"Please do not send me reports, and I'm still in the testing " +
"phase, and most everything you will tell me I already know. " +
"The interpreted core is mostly untested. Use at your own risk.\r\n" +
"\r\n" +
"Contributed code: \r\n" +
"Windows Forms Collapsible Splitter Control for .Net\r\n" +
"(c)Copyright 2002-2003 NJF (furty74@yahoo.com). All rights reserved."
)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sublab research")]
[assembly: AssemblyProduct("Gear: Parallax Propeller Emulator")]
[assembly: AssemblyCopyright("Copyright © sublab research 2007")]
[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("59a0b77c-72ca-4835-955a-dba571ba3b42")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.10.0.0")]
[assembly: AssemblyFileVersion("1.10.0.0")]
|
/* --------------------------------------------------------------------------------
* Gear: Parallax Inc. Propeller Debugger
* Copyright 2007 - Robert Vandiver
* --------------------------------------------------------------------------------
* AssemblyInfo.cs
* Run-time settings for gear
* --------------------------------------------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* --------------------------------------------------------------------------------
*/
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("Gear")]
[assembly: AssemblyDescription(
"Developers: Robert Vandiver.\r\n" +
"\r\n" +
"Thanks to everyone on the forums for being " +
"so helpful with providing me with information\r\n" +
"\r\n" +
"As this is a pre-release, there are bound to be bugs\r\n" +
"Please do not send me reports, and I'm still in the testing " +
"phase, and most everything you will tell me I already know. " +
"The interpreted core is mostly untested. Use at your own risk.\r\n" +
"\r\n" +
"Contributed code: \r\n" +
"Windows Forms Collapsible Splitter Control for .Net\r\n" +
"(c)Copyright 2002-2003 NJF (furty74@yahoo.com). All rights reserved."
)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sublab research")]
[assembly: AssemblyProduct("Gear: Parallax Propeller Emulator")]
[assembly: AssemblyCopyright("Copyright © sublab research 2007")]
[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("59a0b77c-72ca-4835-955a-dba571ba3b42")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.9.0.0")]
|
lgpl-2.1
|
C#
|
1b03998b8675bf31ded030c635fd518afa010832
|
Improve comment of SetFrameFromTime.
|
ppy/osu,DrabWeb/osu,nyaamara/osu,ppy/osu,2yangk23/osu,peppy/osu-new,peppy/osu,Nabile-Rahmani/osu,peppy/osu,NeoAdonis/osu,DrabWeb/osu,EVAST9919/osu,RedNesto/osu,smoogipoo/osu,UselessToucan/osu,smoogipoo/osu,tacchinotacchi/osu,ZLima12/osu,naoey/osu,NeoAdonis/osu,ZLima12/osu,Damnae/osu,Frontear/osuKyzer,Drezi126/osu,peppy/osu,smoogipooo/osu,ppy/osu,EVAST9919/osu,2yangk23/osu,naoey/osu,johnneijzen/osu,UselessToucan/osu,DrabWeb/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,naoey/osu,osu-RP/osu-RP,NeoAdonis/osu
|
osu.Game/Input/Handlers/ReplayInputHandler.cs
|
osu.Game/Input/Handlers/ReplayInputHandler.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
using OpenTK;
namespace osu.Game.Input.Handlers
{
public abstract class ReplayInputHandler : InputHandler
{
/// <summary>
/// A function provided to convert replay coordinates from gamefield to screen space.
/// </summary>
public Func<Vector2, Vector2> ToScreenSpace { protected get; set; }
/// <summary>
/// Update the current frame based on an incoming time value.
/// There are cases where we return a "must-use" time value that is different from the input.
/// This is to ensure accurate playback of replay data.
/// </summary>
/// <param name="time">The time which we should use for finding the current frame.</param>
/// <returns>The usable time value. If null, we should not advance time as we do not have enough data.</returns>
public abstract double? SetFrameFromTime(double time);
public override bool Initialize(GameHost host) => true;
public override bool IsActive => true;
public override int Priority => 0;
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Input.Handlers;
using osu.Framework.MathUtils;
using osu.Framework.Platform;
using OpenTK;
using osu.Framework.Input;
using osu.Game.IO.Legacy;
using OpenTK.Input;
using KeyboardState = osu.Framework.Input.KeyboardState;
using MouseState = osu.Framework.Input.MouseState;
namespace osu.Game.Input.Handlers
{
public abstract class ReplayInputHandler : InputHandler
{
/// <summary>
/// A function provided to convert replay coordinates from gamefield to screen space.
/// </summary>
public Func<Vector2, Vector2> ToScreenSpace { protected get; set; }
/// <summary>
/// Update the current frame based on an incoming time value.
/// There are cases where we return a "must-use" time value that is different from the input.
/// This is to ensure accurate playback of replay data.
/// </summary>
/// <param name="time">The time which we should use for finding the current frame.</param>
/// <returns>The usable time value. If null, we shouldn't be running components reliant on this data.</returns>
public abstract double? SetFrameFromTime(double time);
public override bool Initialize(GameHost host) => true;
public override bool IsActive => true;
public override int Priority => 0;
}
}
|
mit
|
C#
|
c0918f1ef8be9262cd84a819933aa72e9713b50c
|
Allow changes to be triggered on Bindables externally.
|
Tom94/osu-framework,RedNesto/osu-framework,DrabWeb/osu-framework,RedNesto/osu-framework,ppy/osu-framework,naoey/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,NeoAdonis/osu-framework,naoey/osu-framework,default0/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,default0/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,paparony03/osu-framework,paparony03/osu-framework,NeoAdonis/osu-framework
|
osu.Framework/Configuration/Bindable.cs
|
osu.Framework/Configuration/Bindable.cs
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Configuration
{
public class Bindable<T> : IBindable
where T : IComparable
{
private T value;
public T Default;
public virtual bool IsDefault => Equals(value, Default);
public event EventHandler ValueChanged;
public virtual T Value
{
get { return value; }
set
{
if (this.value?.CompareTo(value) == 0) return;
this.value = value;
TriggerChange();
}
}
public Bindable(T value)
{
Value = value;
}
public static implicit operator T(Bindable<T> value)
{
return value.Value;
}
public virtual bool Parse(object s)
{
if (s is T)
Value = (T)s;
else if (typeof(T).IsEnum && s is string)
Value = (T)Enum.Parse(typeof(T), (string)s);
else
return false;
return true;
}
public void TriggerChange()
{
ValueChanged?.Invoke(this, null);
}
public void UnbindAll()
{
ValueChanged = null;
}
string description;
public string Description
{
get { return description; }
set { description = value; }
}
public override string ToString()
{
return value?.ToString() ?? string.Empty;
}
internal void Reset()
{
Value = Default;
}
}
}
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System;
namespace osu.Framework.Configuration
{
public class Bindable<T> : IBindable
where T : IComparable
{
private T value;
public T Default;
public virtual bool IsDefault => Equals(value, Default);
public event EventHandler ValueChanged;
public virtual T Value
{
get { return value; }
set
{
if (this.value?.CompareTo(value) == 0) return;
this.value = value;
TriggerChange();
}
}
public Bindable(T value)
{
Value = value;
}
public static implicit operator T(Bindable<T> value)
{
return value.Value;
}
public virtual bool Parse(object s)
{
if (s is T)
Value = (T)s;
else if (typeof(T).IsEnum && s is string)
Value = (T)Enum.Parse(typeof(T), (string)s);
else
return false;
return true;
}
internal void TriggerChange()
{
ValueChanged?.Invoke(this, null);
}
public void UnbindAll()
{
ValueChanged = null;
}
string description;
public string Description
{
get { return description; }
set { description = value; }
}
public override string ToString()
{
return value?.ToString() ?? string.Empty;
}
internal void Reset()
{
Value = Default;
}
}
}
|
mit
|
C#
|
877520670e911cb93a2ec9cc4b4cddd11a6d427c
|
Fix mispelling
|
RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast
|
RightpointLabs.Pourcast.Domain/Models/Beer.cs
|
RightpointLabs.Pourcast.Domain/Models/Beer.cs
|
namespace RightpointLabs.Pourcast.Domain.Models
{
public class Beer : Entity
{
public Beer(string id, string name)
: base(id)
{
Name = name;
}
public string Name { get; set; }
public string BreweryId { get; set; }
public double ABV { get; set; }
public int BAScore { get; set; }
public int RPScore { get; set; }
public string Style { get; set; }
public string Color { get; set; }
public string Glass { get; set; }
}
}
|
namespace RightpointLabs.Pourcast.Domain.Models
{
public class Beer : Entity
{
public Beer(string id, string name)
: base(id)
{
Name = name;
}
public string Name { get; set; }
public string BrewerId { get; set; }
public double ABV { get; set; }
public int BAScore { get; set; }
public int RPScore { get; set; }
public string Style { get; set; }
public string Color { get; set; }
public string Glass { get; set; }
}
}
|
mit
|
C#
|
9c4552c5dd0d470043fdbd1877be8f3867a2bbe5
|
remove serializable attribute
|
Amazebytes/CRDT
|
src/Crdt.Core/Counter.cs
|
src/Crdt.Core/Counter.cs
|
using System;
using System.Collections.Concurrent;
using System.Linq;
namespace Crdt.Core
{
public class Counter : ICounter
{
readonly ConcurrentBag<UInt16> _payload = new ConcurrentBag<UInt16>();
public void Increment()
{
_payload.Add(1);
}
public Int64 Value
{
get { return _payload.Sum(x => x); }
}
public ICounter Merge(ICounter counter)
{
if (counter == null)
{
throw new ArgumentNullException(nameof(counter));
}
var result = new Counter();
for (var i = 0; i < Value + counter.Value; i++)
{
result.Increment();
}
return result;
}
public Int32 CompareTo(object obj)
{
var counter = obj as ICounter;
if (counter == null)
{
throw new ArgumentNullException(nameof(obj));
}
return Value.CompareTo(counter.Value);
}
}
}
|
using System;
using System.Collections.Concurrent;
using System.Linq;
namespace Crdt.Core
{
[Serializable]
public class Counter : ICounter
{
readonly ConcurrentBag<UInt16> _payload = new ConcurrentBag<UInt16>();
public void Increment()
{
_payload.Add(1);
}
public Int64 Value
{
get { return _payload.Sum(x => x); }
}
public ICounter Merge(ICounter counter)
{
if (counter == null)
{
throw new ArgumentNullException(nameof(counter));
}
var result = new Counter();
for (var i = 0; i < Value + counter.Value; i++)
{
result.Increment();
}
return result;
}
public Int32 CompareTo(object obj)
{
var counter = obj as ICounter;
if (counter == null)
{
throw new ArgumentNullException(nameof(obj));
}
return Value.CompareTo(counter.Value);
}
}
}
|
mit
|
C#
|
6ef03ea9bc9db7735318e6642528e7ac063cb9ff
|
Change Weight to double
|
episerver/ServiceApi-Client
|
EPiServer.ServiceApi.Client/Models/Catalog/VariationProperties.cs
|
EPiServer.ServiceApi.Client/Models/Catalog/VariationProperties.cs
|
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace EPiServer.Integration.Client.Models.Catalog
{
[Serializable]
public class VariationProperties
{
public decimal MinQuantity { get; set; }
public decimal MaxQuantity { get; set; }
public double Weight { get; set; }
public String TaxCategory { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace EPiServer.Integration.Client.Models.Catalog
{
[Serializable]
public class VariationProperties
{
public decimal MinQuantity { get; set; }
public decimal MaxQuantity { get; set; }
public int Weight { get; set; }
public String TaxCategory { get; set; }
}
}
|
apache-2.0
|
C#
|
44580e2233eb0e4df40036679c7bf273d8593834
|
Update an AssmblyVersion property that I missed to 0.8.0
|
M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,ft-/arribasim-dev-tests,TomDataworks/opensim,QuillLittlefeather/opensim-1,justinccdev/opensim,RavenB/opensim,ft-/opensim-optimizations-wip-tests,justinccdev/opensim,justinccdev/opensim,RavenB/opensim,justinccdev/opensim,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,ft-/arribasim-dev-extras,BogusCurry/arribasim-dev,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-extras,Michelle-Argus/ArribasimExtract,Michelle-Argus/ArribasimExtract,QuillLittlefeather/opensim-1,TomDataworks/opensim,Michelle-Argus/ArribasimExtract,Michelle-Argus/ArribasimExtract,TomDataworks/opensim,BogusCurry/arribasim-dev,ft-/arribasim-dev-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,OpenSimian/opensimulator,RavenB/opensim,RavenB/opensim,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip,ft-/arribasim-dev-tests,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,ft-/arribasim-dev-extras,justinccdev/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,justinccdev/opensim,M-O-S-E-S/opensim,ft-/opensim-optimizations-wip-tests,QuillLittlefeather/opensim-1,QuillLittlefeather/opensim-1,RavenB/opensim,Michelle-Argus/ArribasimExtract,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-extras,TomDataworks/opensim,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip,ft-/arribasim-dev-extras,M-O-S-E-S/opensim,ft-/arribasim-dev-extras,OpenSimian/opensimulator,ft-/opensim-optimizations-wip-tests,OpenSimian/opensimulator,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,OpenSimian/opensimulator,BogusCurry/arribasim-dev,M-O-S-E-S/opensim,ft-/arribasim-dev-extras,BogusCurry/arribasim-dev,TomDataworks/opensim,TomDataworks/opensim,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip,BogusCurry/arribasim-dev,OpenSimian/opensimulator,RavenB/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim
|
OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
|
OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
|
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenSim.Addin")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenSim.Addin")]
[assembly : AssemblyCopyright("Copyright OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")]
// 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("0.7.6.*")]
[assembly : AssemblyVersion("0.8.0.*")]
|
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenSim.Addin")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenSim.Addin")]
[assembly : AssemblyCopyright("Copyright OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")]
// 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("0.7.6.*")]
[assembly : AssemblyVersion("0.7.6.*")]
|
bsd-3-clause
|
C#
|
6aa6b7cb3df50588e6943d48246a3ea209b25379
|
Simplify code with pattern matching
|
ridercz/ValidationToolkit
|
Altairis.ValidationToolkit/GreaterThanAttribute.cs
|
Altairis.ValidationToolkit/GreaterThanAttribute.cs
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Altairis.ValidationToolkit {
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class GreaterThanAttribute : ValidationAttribute {
public GreaterThanAttribute(string otherPropertyName)
: this(otherPropertyName, "{0} must be greater than {1}.") { }
public GreaterThanAttribute(string otherPropertyName, Func<string> errorMessageAccessor)
: base(errorMessageAccessor) {
this.OtherPropertyName = otherPropertyName;
}
public GreaterThanAttribute(string otherPropertyName, string errorMessage)
: base(errorMessage) {
this.OtherPropertyName = otherPropertyName;
}
public bool AllowEqual { get; set; }
public string OtherPropertyDisplayName { get; set; }
public string OtherPropertyName { get; private set; }
public override bool RequiresValidationContext => true;
public override string FormatErrorMessage(string name) => string.Format(this.ErrorMessageString, name, this.OtherPropertyDisplayName);
protected override ValidationResult IsValid(object value, ValidationContext validationContext) {
// Get values
IComparable comparableOtherValue;
try {
comparableOtherValue = validationContext.GetPropertyValue<IComparable>(this.OtherPropertyName);
} catch (ArgumentException aex) {
throw new InvalidOperationException("Other property not found", aex);
}
// Empty or noncomparable values are valid - let others validate that
if (!(value is IComparable comparableValue) || comparableOtherValue == null) return ValidationResult.Success;
var compareResult = comparableValue.CompareTo(comparableOtherValue);
if (compareResult == 1 || (this.AllowEqual && compareResult == 0)) {
// This property is greater than other property or equal when permitted
return ValidationResult.Success;
} else {
// This property is smaller or equal to the other property
if (string.IsNullOrWhiteSpace(this.OtherPropertyDisplayName)) {
this.OtherPropertyDisplayName = validationContext.GetPropertyDisplayName(this.OtherPropertyName);
}
return new ValidationResult(this.FormatErrorMessage(validationContext.DisplayName));
}
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Altairis.ValidationToolkit {
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class GreaterThanAttribute : ValidationAttribute {
public GreaterThanAttribute(string otherPropertyName)
: this(otherPropertyName, "{0} must be greater than {1}.") { }
public GreaterThanAttribute(string otherPropertyName, Func<string> errorMessageAccessor)
: base(errorMessageAccessor) {
this.OtherPropertyName = otherPropertyName;
}
public GreaterThanAttribute(string otherPropertyName, string errorMessage)
: base(errorMessage) {
this.OtherPropertyName = otherPropertyName;
}
public bool AllowEqual { get; set; }
public string OtherPropertyDisplayName { get; set; }
public string OtherPropertyName { get; private set; }
public override bool RequiresValidationContext => true;
public override string FormatErrorMessage(string name) => string.Format(this.ErrorMessageString, name, this.OtherPropertyDisplayName);
protected override ValidationResult IsValid(object value, ValidationContext validationContext) {
// Get values
var comparableValue = value as IComparable;
IComparable comparableOtherValue;
try {
comparableOtherValue = validationContext.GetPropertyValue<IComparable>(this.OtherPropertyName);
} catch (ArgumentException aex) {
throw new InvalidOperationException("Other property not found", aex);
}
// Empty or noncomparable values are valid - let others validate that
if (comparableValue == null || comparableOtherValue == null) return ValidationResult.Success;
var compareResult = comparableValue.CompareTo(comparableOtherValue);
if (compareResult == 1 || (this.AllowEqual && compareResult == 0)) {
// This property is greater than other property or equal when permitted
return ValidationResult.Success;
} else {
// This property is smaller or equal to the other property
if (string.IsNullOrWhiteSpace(this.OtherPropertyDisplayName)) {
this.OtherPropertyDisplayName = validationContext.GetPropertyDisplayName(this.OtherPropertyName);
}
return new ValidationResult(this.FormatErrorMessage(validationContext.DisplayName));
}
}
}
}
|
mit
|
C#
|
f0c6ba9263e206c54242cef5a3f69b3bc55e77eb
|
Remove debug localization field
|
plrusek/NitoriWare,uulltt/NitoriWare,Barleytree/NitoriWare,Barleytree/NitoriWare,NitorInc/NitoriWare,NitorInc/NitoriWare
|
Assets/Scripts/Localization/LocalizationManager.cs
|
Assets/Scripts/Localization/LocalizationManager.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class LocalizationManager : MonoBehaviour
{
private const string NotFoundString = "LOCALIZED TEXT NOT FOUND";
public static LocalizationManager instance;
[SerializeField]
private string forceLanguage;
private string language;
private SerializedNestedStrings localizedText;
public void Awake ()
{
if (instance != null)
{
if (instance != this)
Destroy(gameObject);
return;
}
else
instance = this;
if (transform.parent == null)
DontDestroyOnLoad(gameObject);
language = (forceLanguage == "" ? Application.systemLanguage.ToString() : forceLanguage);
loadLocalizedText("Languages/" + language + "");
}
public void loadLocalizedText(string filename)
{
string filePath = Path.Combine(Application.streamingAssetsPath, filename);
if (!File.Exists(filePath))
{
filePath = filePath.Replace(language, "English");
Debug.Log("Language " + language + " not found. Using English");
language = "English";
}
if (File.Exists(filePath))
{
System.DateTime started = System.DateTime.Now;
localizedText = SerializedNestedStrings.deserialize(File.ReadAllText(filePath));
System.TimeSpan timeElapsed = System.DateTime.Now - started;
Debug.Log("Language " + language + " loaded successfully. Deserialization time: " + timeElapsed.TotalMilliseconds + "ms");
}
else
Debug.LogError("No English json found!");
}
public string getLanguage()
{
return language;
}
public void setLanguage(string language)
{
//TODO make loading async and revisit this
}
public string getLocalizedValue(string key)
{
return (localizedText == null) ? "No language set" : getLocalizedValue(key, NotFoundString);
}
public string getLocalizedValue(string key, string defaultString)
{
if (localizedText == null)
return defaultString;
string value = (string)localizedText[key];
if (key.Split('.')[0].Equals("multiline"))
value = value.Replace("\\n", "\n");
if (string.IsNullOrEmpty(value))
{
Debug.LogWarning("Language " + getLanguage() + " does not have a value for key " + key);
return defaultString;
}
return value;
}
public string getLocalizedValueNoWarnings(string key, string defaultString)
{
if (localizedText == null)
return defaultString;
string value = (string)localizedText[key];
if (key.Split('.')[0].Equals("multiline"))
value = value.Replace("\\n", "\n");
return string.IsNullOrEmpty(value) ? defaultString : value;
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class LocalizationManager : MonoBehaviour
{
[Multiline]
public string testData;
private const string NotFoundString = "LOCALIZED TEXT NOT FOUND";
public static LocalizationManager instance;
[SerializeField]
private string forceLanguage;
private string language;
private SerializedNestedStrings localizedText;
public void Awake ()
{
if (instance != null)
{
if (instance != this)
Destroy(gameObject);
return;
}
else
instance = this;
if (transform.parent == null)
DontDestroyOnLoad(gameObject);
language = (forceLanguage == "" ? Application.systemLanguage.ToString() : forceLanguage);
loadLocalizedText("Languages/" + language + "");
}
public void loadLocalizedText(string filename)
{
string filePath = Path.Combine(Application.streamingAssetsPath, filename);
if (!File.Exists(filePath))
{
filePath = filePath.Replace(language, "English");
Debug.Log("Language " + language + " not found. Using English");
language = "English";
}
if (File.Exists(filePath))
{
System.DateTime started = System.DateTime.Now;
localizedText = SerializedNestedStrings.deserialize(File.ReadAllText(filePath));
testData = localizedText.ToString();
System.TimeSpan timeElapsed = System.DateTime.Now - started;
Debug.Log("Language " + language + " loaded successfully. Deserialization time: " + timeElapsed.TotalMilliseconds + "ms");
}
else
Debug.LogError("No English json found!");
}
public string getLanguage()
{
return language;
}
public void setLanguage(string language)
{
//TODO make loading async and revisit this
}
public string getLocalizedValue(string key)
{
return (localizedText == null) ? "No language set" : getLocalizedValue(key, NotFoundString);
}
public string getLocalizedValue(string key, string defaultString)
{
if (localizedText == null)
return defaultString;
string value = (string)localizedText[key];
if (key.Split('.')[0].Equals("multiline"))
value = value.Replace("\\n", "\n");
if (string.IsNullOrEmpty(value))
{
Debug.LogWarning("Language " + getLanguage() + " does not have a value for key " + key);
return defaultString;
}
return value;
}
public string getLocalizedValueNoWarnings(string key, string defaultString)
{
if (localizedText == null)
return defaultString;
string value = (string)localizedText[key];
if (key.Split('.')[0].Equals("multiline"))
value = value.Replace("\\n", "\n");
return string.IsNullOrEmpty(value) ? defaultString : value;
}
}
|
mit
|
C#
|
6829c2dd8a46637655dfcd86b77bd665851db61e
|
Add comment
|
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
|
QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs
|
QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{
class QueueDataGraphic
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{
class QueueDataGraphic
{
}
}
|
apache-2.0
|
C#
|
1c0c9c1b8c32b98b67c819209ac224c3fbc91829
|
Edit QueueDataGraphic.cs
|
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
|
QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs
|
QueueDataGraphic/QueueDataGraphic/CSharpFiles/QueueDataGraphic.cs
|
/********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* QueueDataGraphic.cs *
* 本檔案用於佇列資料繪圖功能 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class QueueDataGraphic // QueueDataGraphic class, QueueDataGraphic類別
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
} // namespace end, 結束命名空間
|
/********************************************************************
* Develop by Jimmy Hu *
* This program is licensed under the Apache License 2.0. *
* QueueDataGraphic.cs *
* 本檔案用於佇列資料繪圖功能 *
********************************************************************
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QueueDataGraphic.CSharpFiles
{ // namespace start, 進入命名空間
class QueueDataGraphic // QueueDataGraphic class, QueueDataGraphic類別
{ // QueueDataGraphic class start, 進入QueueDataGraphic類別
} // QueueDataGraphic class end, 結束QueueDataGraphic類別
} // namespace end, 結束命名空間
|
apache-2.0
|
C#
|
9ffa22be5bbb500ada1fe74b42c8ed89e3e26bea
|
Simplify static ctor
|
selvasingh/azure-sdk-for-java,selvasingh/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,selvasingh/azure-sdk-for-java,Azure/azure-sdk-for-java
|
net/Azure.Storage.Blobs.PerfStress/Core/ContainerTest.cs
|
net/Azure.Storage.Blobs.PerfStress/Core/ContainerTest.cs
|
using Azure.Test.PerfStress;
using System;
using System.Threading.Tasks;
namespace Azure.Storage.Blobs.PerfStress.Core
{
public abstract class ContainerTest<TOptions> : ServiceTest<TOptions> where TOptions : PerfStressOptions
{
private const string _containerPrefix = "perfstress";
protected static string ContainerName { get; } = _containerPrefix + "-" + Guid.NewGuid().ToString();
protected BlobContainerClient BlobContainerClient { get; private set; }
public ContainerTest(TOptions options) : base(options)
{
BlobContainerClient = BlobServiceClient.GetBlobContainerClient(ContainerName);
}
public override async Task GlobalSetup()
{
await base.GlobalSetup();
await BlobContainerClient.CreateAsync();
}
public override async Task GlobalCleanup()
{
await BlobContainerClient.DeleteAsync();
await base.GlobalCleanup();
}
}
}
|
using Azure.Test.PerfStress;
using System;
using System.Threading.Tasks;
namespace Azure.Storage.Blobs.PerfStress.Core
{
public abstract class ContainerTest<TOptions> : ServiceTest<TOptions> where TOptions : PerfStressOptions
{
private const string _containerPrefix = "perfstress";
protected static string ContainerName { get; private set; }
static ContainerTest()
{
ContainerName = _containerPrefix + "-" + Guid.NewGuid().ToString();
}
protected BlobContainerClient BlobContainerClient { get; private set; }
public ContainerTest(TOptions options) : base(options)
{
BlobContainerClient = BlobServiceClient.GetBlobContainerClient(ContainerName);
}
public override async Task GlobalSetup()
{
await base.GlobalSetup();
await BlobContainerClient.CreateAsync();
}
public override async Task GlobalCleanup()
{
await BlobContainerClient.DeleteAsync();
await base.GlobalCleanup();
}
}
}
|
mit
|
C#
|
ef88f21b6ca86779d42e4b78dd1326ad458fe2a7
|
remove any kind of allocations for dice coefficient algorithm
|
RPCS3/discord-bot
|
CompatBot/Utils/Extensions/DiceCoefficientOptimized.cs
|
CompatBot/Utils/Extensions/DiceCoefficientOptimized.cs
|
namespace CompatBot.Utils.Extensions
{
public static class DiceCoefficientOptimized
{
/// <summary>
/// Dice Coefficient based on bigrams. <br />
/// A good value would be 0.33 or above, a value under 0.2 is not a good match, from 0.2 to 0.33 is iffy.
/// </summary>
/// <param name="input"></param>
/// <param name="comparedTo"></param>
/// <returns></returns>
public static double DiceCoefficient(this string input, string comparedTo)
{
var bgCount1 = input.Length-1;
var bgCount2 = comparedTo.Length-1;
if (comparedTo.Length < input.Length)
{
var tmp = input;
input = comparedTo;
comparedTo = tmp;
}
var matches = 0;
for (var i = 0; i < input.Length-1; i++)
for (var j = 0; j < comparedTo.Length-1; j++)
{
if (input[i] == comparedTo[j] && input[i + 1] == comparedTo[j + 1])
{
matches++;
break;
}
}
if (matches == 0)
return 0.0d;
return 2.0 * matches / (bgCount1 + bgCount2);
}
}
}
|
using System;
using System.Linq;
namespace CompatBot.Utils.Extensions
{
public static class DiceCoefficientOptimized
{
/// <summary>
/// Dice Coefficient based on bigrams. <br />
/// A good value would be 0.33 or above, a value under 0.2 is not a good match, from 0.2 to 0.33 is iffy.
/// </summary>
/// <param name="input"></param>
/// <param name="comparedTo"></param>
/// <returns></returns>
public static double DiceCoefficient(this string input, in string comparedTo)
{
const int maxStackAllocSize = 256;
const int maxInputLengthToFit = maxStackAllocSize / 2 + 1;
Span<char> inputBiGrams = input.Length > maxStackAllocSize ? new char[2 * (input.Length - 1)] : stackalloc char[2 * (input.Length - 1)];
Span<char> compareToBiGrams = comparedTo.Length > maxStackAllocSize ? new char[2 * (comparedTo.Length - 1)] : stackalloc char[2 * (comparedTo.Length - 1)];
ToBiGrams(input, inputBiGrams);
ToBiGrams(comparedTo, compareToBiGrams);
return DiceCoefficient(inputBiGrams, compareToBiGrams);
}
/// <summary>
/// Dice Coefficient used to compare biGrams arrays produced in advance.
/// </summary>
/// <param name="biGrams"></param>
/// <param name="compareToBiGrams"></param>
/// <returns></returns>
private static double DiceCoefficient(in Span<char> biGrams, in Span<char> compareToBiGrams)
{
var bgCount1 = biGrams.Length / 2;
var bgCount2 = compareToBiGrams.Length / 2;
Span<char> smaller, larger;
if (biGrams.Length <= compareToBiGrams.Length)
{
smaller = biGrams;
larger = compareToBiGrams;
}
else
{
smaller = compareToBiGrams;
larger = biGrams;
}
var matches = 0;
for (var i = 0; i < smaller.Length; i += 2)
for (var j = 0; j < larger.Length; j +=2)
{
if (smaller[i] == larger[j] && smaller[i + 1] == larger[j + 1])
{
matches++;
break;
}
}
if (matches == 0)
return 0.0d;
return 2.0 * matches / (bgCount1 + bgCount2);
}
private static void ToBiGrams(in string input, Span<char> nGrams)
{
var str = input.AsSpan();
for (var i = 0; i < nGrams.Length; i++)
{
str.Slice(i, 2).CopyTo(nGrams);
nGrams = nGrams.Slice(2);
}
}
}
}
|
lgpl-2.1
|
C#
|
756c1089eb75dfc7ebfb44ebba3ab6d81470066e
|
Change documented source of windowsZones.xml file
|
RangeeGmbH/FreeRDP,rjcorrig/FreeRDP,rjcorrig/FreeRDP,nfedera/FreeRDP,ondrejholy/FreeRDP,ilammy/FreeRDP,yurashek/FreeRDP,nfedera/FreeRDP,ondrejholy/FreeRDP,rjcorrig/FreeRDP,chipitsine/FreeRDP,akallabeth/FreeRDP,akallabeth/FreeRDP,DavBfr/FreeRDP,cedrozor/FreeRDP,chipitsine/FreeRDP,eledoux/FreeRDP,oshogbo/FreeRDP,yurashek/FreeRDP,ilammy/FreeRDP,Devolutions/FreeRDP,mfleisz/FreeRDP,ondrejholy/FreeRDP,bjcollins/FreeRDP,bmiklautz/FreeRDP,awakecoding/FreeRDP,Devolutions/FreeRDP,awakecoding/FreeRDP,chipitsine/FreeRDP,yurashek/FreeRDP,erbth/FreeRDP,erbth/FreeRDP,oshogbo/FreeRDP,mfleisz/FreeRDP,eledoux/FreeRDP,mfleisz/FreeRDP,akallabeth/FreeRDP,RangeeGmbH/FreeRDP,mfleisz/FreeRDP,ilammy/FreeRDP,ondrejholy/FreeRDP,ivan-83/FreeRDP,akallabeth/FreeRDP,bjcollins/FreeRDP,bjcollins/FreeRDP,bmiklautz/FreeRDP,chipitsine/FreeRDP,ilammy/FreeRDP,bmiklautz/FreeRDP,FreeRDP/FreeRDP,chipitsine/FreeRDP,bjcollins/FreeRDP,erbth/FreeRDP,DavBfr/FreeRDP,cloudbase/FreeRDP-dev,yurashek/FreeRDP,ilammy/FreeRDP,chipitsine/FreeRDP,bjcollins/FreeRDP,erbth/FreeRDP,Devolutions/FreeRDP,DavBfr/FreeRDP,Devolutions/FreeRDP,RangeeGmbH/FreeRDP,cedrozor/FreeRDP,cloudbase/FreeRDP-dev,FreeRDP/FreeRDP,mfleisz/FreeRDP,ondrejholy/FreeRDP,erbth/FreeRDP,eledoux/FreeRDP,erbth/FreeRDP,ivan-83/FreeRDP,cedrozor/FreeRDP,nfedera/FreeRDP,nfedera/FreeRDP,eledoux/FreeRDP,FreeRDP/FreeRDP,FreeRDP/FreeRDP,bmiklautz/FreeRDP,eledoux/FreeRDP,ivan-83/FreeRDP,ivan-83/FreeRDP,akallabeth/FreeRDP,awakecoding/FreeRDP,DavBfr/FreeRDP,RangeeGmbH/FreeRDP,rjcorrig/FreeRDP,mfleisz/FreeRDP,ondrejholy/FreeRDP,oshogbo/FreeRDP,nfedera/FreeRDP,bmiklautz/FreeRDP,FreeRDP/FreeRDP,nfedera/FreeRDP,cloudbase/FreeRDP-dev,akallabeth/FreeRDP,yurashek/FreeRDP,ilammy/FreeRDP,oshogbo/FreeRDP,ivan-83/FreeRDP,ilammy/FreeRDP,DavBfr/FreeRDP,cloudbase/FreeRDP-dev,oshogbo/FreeRDP,cedrozor/FreeRDP,ivan-83/FreeRDP,awakecoding/FreeRDP,FreeRDP/FreeRDP,ondrejholy/FreeRDP,chipitsine/FreeRDP,rjcorrig/FreeRDP,Devolutions/FreeRDP,awakecoding/FreeRDP,bjcollins/FreeRDP,cloudbase/FreeRDP-dev,FreeRDP/FreeRDP,awakecoding/FreeRDP,mfleisz/FreeRDP,cedrozor/FreeRDP,mfleisz/FreeRDP,RangeeGmbH/FreeRDP,cedrozor/FreeRDP,yurashek/FreeRDP,oshogbo/FreeRDP,DavBfr/FreeRDP,eledoux/FreeRDP,Devolutions/FreeRDP,oshogbo/FreeRDP,bmiklautz/FreeRDP,cloudbase/FreeRDP-dev,FreeRDP/FreeRDP,awakecoding/FreeRDP,Devolutions/FreeRDP,DavBfr/FreeRDP,eledoux/FreeRDP,rjcorrig/FreeRDP,nfedera/FreeRDP,yurashek/FreeRDP,rjcorrig/FreeRDP,bjcollins/FreeRDP,akallabeth/FreeRDP,yurashek/FreeRDP,erbth/FreeRDP,bmiklautz/FreeRDP,RangeeGmbH/FreeRDP,ondrejholy/FreeRDP,Devolutions/FreeRDP,RangeeGmbH/FreeRDP,cloudbase/FreeRDP-dev,bmiklautz/FreeRDP,eledoux/FreeRDP,oshogbo/FreeRDP,akallabeth/FreeRDP,ilammy/FreeRDP,chipitsine/FreeRDP,bjcollins/FreeRDP,nfedera/FreeRDP,ivan-83/FreeRDP,DavBfr/FreeRDP,awakecoding/FreeRDP,rjcorrig/FreeRDP,erbth/FreeRDP,RangeeGmbH/FreeRDP,cedrozor/FreeRDP,cedrozor/FreeRDP,ivan-83/FreeRDP
|
scripts/WindowsZones.cs
|
scripts/WindowsZones.cs
|
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* TZID to Windows TimeZone Identifier Table Generator
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/*
* this script uses windowsZones.xml which can be obtained at:
* http://www.unicode.org/repos/cldr/tags/latest/common/supplemental/windowsZones.xml
*/
namespace WindowsZones
{
class MainClass
{
public static void Main(string[] args)
{
string tzid, windows;
const string file = @"WindowsZones.txt";
List<string> list = new List<string>();
StreamWriter stream = new StreamWriter(file, false);
XmlTextReader reader = new XmlTextReader(@"windowsZones.xml");
stream.WriteLine("struct _WINDOWS_TZID_ENTRY");
stream.WriteLine("{");
stream.WriteLine("\tconst char* windows;");
stream.WriteLine("\tconst char* tzid;");
stream.WriteLine("};");
stream.WriteLine("typedef struct _WINDOWS_TZID_ENTRY WINDOWS_TZID_ENTRY;");
stream.WriteLine();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name.Equals("mapZone"))
{
tzid = reader.GetAttribute("type");
windows = reader.GetAttribute("other");
string entry = String.Format("\"{0}\", \"{1}\"", windows, tzid);
if (!list.Contains(entry))
list.Add(entry);
}
break;
}
}
list.Sort();
stream.WriteLine("const WINDOWS_TZID_ENTRY WindowsTimeZoneIdTable[] =");
stream.WriteLine("{");
foreach (string entry in list)
{
stream.Write("\t{ ");
stream.Write(entry);
stream.WriteLine(" },");
}
stream.WriteLine("};");
stream.Close();
}
}
}
|
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* TZID to Windows TimeZone Identifier Table Generator
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/*
* this script uses windowsZones.xml which can be obtained at:
* http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
*/
namespace WindowsZones
{
class MainClass
{
public static void Main(string[] args)
{
string tzid, windows;
const string file = @"WindowsZones.txt";
List<string> list = new List<string>();
StreamWriter stream = new StreamWriter(file, false);
XmlTextReader reader = new XmlTextReader(@"windowsZones.xml");
stream.WriteLine("struct _WINDOWS_TZID_ENTRY");
stream.WriteLine("{");
stream.WriteLine("\tconst char* windows;");
stream.WriteLine("\tconst char* tzid;");
stream.WriteLine("};");
stream.WriteLine("typedef struct _WINDOWS_TZID_ENTRY WINDOWS_TZID_ENTRY;");
stream.WriteLine();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name.Equals("mapZone"))
{
tzid = reader.GetAttribute("type");
windows = reader.GetAttribute("other");
string entry = String.Format("\"{0}\", \"{1}\"", windows, tzid);
if (!list.Contains(entry))
list.Add(entry);
}
break;
}
}
list.Sort();
stream.WriteLine("const WINDOWS_TZID_ENTRY WindowsTimeZoneIdTable[] =");
stream.WriteLine("{");
foreach (string entry in list)
{
stream.Write("\t{ ");
stream.Write(entry);
stream.WriteLine(" },");
}
stream.WriteLine("};");
stream.Close();
}
}
}
|
apache-2.0
|
C#
|
a535562c5e8fd700f9515f13a44bcbad2146ac58
|
add copy dir function
|
sensoguyz-realsense-hackathon/extension-generator
|
ConsoleGenerator/Program.cs
|
ConsoleGenerator/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace ConsoleGenerator
{
class Program
{
private const string RealSenseExtensionString = "RealSense Extension";
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Give config filename");
return;
}
if (args.Length !=2)
{
Console.WriteLine("Give config filename and target path");
return;
}
if (!File.Exists(args[0]))
{
Console.WriteLine("Given file is not exist");
return;
}
if (!Directory.Exists(args[1]))
{
Console.WriteLine("Given directory is not exist");
Console.WriteLine("Do you want to create folder? Yes(y) or No(n)?");
var answer = Console.ReadLine()?.ToLower() == "y";
if (answer) Directory.CreateDirectory(args[1]);
else return;
}
var json = File.ReadAllText(args[0]);
dynamic config = JsonConvert.DeserializeObject(json);
// Console.WriteLine(config.ToString());
CopyDir(new DirectoryInfo(Environment.CurrentDirectory + "/project"),
args[1] + "/" + config.name + " " + RealSenseExtensionString);
}
static void CopyDir(DirectoryInfo dir,string destinationPath)
{
var files = dir.GetFiles();
Directory.CreateDirectory(destinationPath);
foreach (var file in files)
File.Copy(file.FullName, string.Concat(destinationPath, "/", file.Name));
var dirs = dir.GetDirectories();
if (dirs.Length == 0) return;
foreach (var directory in dirs)
CopyDir(directory, destinationPath + "/" + directory.Name);
}
void ParseLink(object json)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace ConsoleGenerator
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Give config filename");
return;
}
if (!File.Exists(args[0]))
{
Console.WriteLine("Given file is not exist");
return;
}
var json = File.ReadAllText(args[0]);
var config = JsonConvert.DeserializeObject(json);
Console.WriteLine(config.ToString());
}
}
}
|
mit
|
C#
|
13545a46870c7691308632ff615bdf78ad48b656
|
make controller rig public
|
dicko2/NUnitTfsTestCase
|
NUnitTfsTestCase/NUnitTfsTestCase/ControllerTestRig.cs
|
NUnitTfsTestCase/NUnitTfsTestCase/ControllerTestRig.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace NUnitTfsTestCase
{
public class ControllerTestRig
{
[OneTimeTearDown]
public void Stop()
{
TfsService.TestCases.FinailizeTestRun();
}
[OneTimeSetUp]
public void Init()
{
if (TfsService.RunData.TestSuiteId == 0 || TfsService.RunData.TestSuiteId == 0)
throw new Exception("Please set both values for test plan and test suite ids");
TfsService.TestCases.InitializeTestRun(TfsService.RunData.TestPlanId, this.GetType().Name);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace NUnitTfsTestCase
{
class ControllerTestRig
{
[OneTimeTearDown]
public void Stop()
{
TfsService.TestCases.FinailizeTestRun();
}
[OneTimeSetUp]
public void Init()
{
if (TfsService.RunData.TestSuiteId == 0 || TfsService.RunData.TestSuiteId == 0)
throw new Exception("Please set both values for test plan and test suite ids");
TfsService.TestCases.InitializeTestRun(TfsService.RunData.TestPlanId, this.GetType().Name);
}
}
}
|
mit
|
C#
|
e5127164265cb0f74effa96103bb051976d702a7
|
handle invalid path mappings
|
Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen,Pondidum/Dashen
|
Dashen/Endpoints/Static/StaticController.cs
|
Dashen/Endpoints/Static/StaticController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Http;
using Dashen.Infrastructure;
namespace Dashen.Endpoints.Static
{
public class StaticController : ApiController
{
private readonly List<IStaticContentProvider> _contentProviders;
private readonly Dictionary<string, string> _contentRouteMap;
public StaticController(IStaticContentProvider contentProvider)
{
_contentProviders = new[] { contentProvider }.ToList();
_contentRouteMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
_contentRouteMap["css/normalize"] = "css/normalize.css";
_contentRouteMap["css/foundation"] = "foundation.min.css";
_contentRouteMap["css/style"] = "css/style.css";
_contentRouteMap["js/jquery"] = "js/jquery-2.1.1.min.js";
_contentRouteMap["js/jquery-flot"] = "js/jquery.flot.min.js";
}
public HttpResponseMessage GetDispatch(string url = "")
{
var path = _contentRouteMap.Get(url);
if (string.IsNullOrWhiteSpace(path))
{
return new HttpResponseMessage(HttpStatusCode.NotFound);
}
var content = _contentProviders.Select(cp => cp.GetContent(path)).FirstOrDefault(c => c != null);
if (content == null)
{
return new HttpResponseMessage(HttpStatusCode.NotFound);
}
var streamContent = new StreamContent(content.Stream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue(content.MimeType);
return new HttpResponseMessage { Content = streamContent };
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.Http;
namespace Dashen.Endpoints.Static
{
public class StaticController : ApiController
{
private readonly List<IStaticContentProvider> _contentProviders;
private readonly Dictionary<string, string> _contentRouteMap;
public StaticController(IStaticContentProvider contentProvider)
{
_contentProviders = new[] {contentProvider}.ToList();
_contentRouteMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
_contentRouteMap["css/normalize"] = "css/normalize.css";
_contentRouteMap["css/foundation"] = "foundation.min.css";
_contentRouteMap["css/style"] = "css/style.css";
_contentRouteMap["js/jquery"] = "js/jquery-2.1.1.min.js";
_contentRouteMap["js/jquery-flot"] = "js/jquery.flot.min.js";
}
public HttpResponseMessage GetDispatch(string url = "")
{
var path = _contentRouteMap[url];
var content = _contentProviders.Select(cp => cp.GetContent(path)).FirstOrDefault(c => c != null);
if (content == null)
{
return new HttpResponseMessage { StatusCode = HttpStatusCode.NotFound };
}
var streamContent = new StreamContent(content.Stream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue(content.MimeType);
return new HttpResponseMessage { Content = streamContent };
}
}
}
|
lgpl-2.1
|
C#
|
b07cd2da9959f5f5f5c02a83ac5290268be069da
|
Raise authentication server prerelease version number.
|
affecto/dotnet-AuthenticationServer
|
Source/AuthenticationServer/Properties/AssemblyInfo.cs
|
Source/AuthenticationServer/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Affecto Authentication Server")]
[assembly: AssemblyProduct("Affecto Authentication Server")]
[assembly: AssemblyCompany("Affecto")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-prerelease02")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Tests")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Configuration.Tests")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Affecto Authentication Server")]
[assembly: AssemblyProduct("Affecto Authentication Server")]
[assembly: AssemblyCompany("Affecto")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-prerelease01")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Tests")]
[assembly: InternalsVisibleTo("Affecto.AuthenticationServer.Configuration.Tests")]
|
mit
|
C#
|
3d31f3f6529e094122ea983a3823e9bad000d405
|
Refactor PerformanceEventLogger.Run
|
mkropat/VSPerformanceTracker,mkropat/VSPerformanceTracker
|
VSPerformanceTracker/Logging/PerformanceEventLogger.cs
|
VSPerformanceTracker/Logging/PerformanceEventLogger.cs
|
using System;
using VSPerformanceTracker.FSInterface;
namespace VSPerformanceTracker.Logging
{
public static class PerformanceEventLogger
{
public static void Run(IObservable<PerformanceEvent> eventSource, IOpenableFile logFile)
{
eventSource.Subscribe(evt => WriteEvent(evt, logFile));
}
private static void WriteEvent(PerformanceEvent evt, IOpenableFile logFile)
{
var line = new object[]
{
evt.Subject,
evt.Branch,
evt.EventType,
evt.Start.ToLocalTime(),
evt.Duration,
};
using (var writer = logFile.OpenWriter())
writer.WriteLine(string.Join(",", line));
}
}
}
|
using System;
using VSPerformanceTracker.FSInterface;
namespace VSPerformanceTracker.Logging
{
public class PerformanceEventLogger
{
public static void Run(IObservable<PerformanceEvent> eventSource, IOpenableFile logFile)
{
var logger = new PerformanceEventLogger(logFile);
eventSource.Subscribe(logger.OnEvent);
}
private readonly IOpenableFile _logFile;
private PerformanceEventLogger(IOpenableFile logFile)
{
_logFile = logFile;
}
private void OnEvent(PerformanceEvent evt)
{
var line = new object[]
{
evt.Subject,
evt.Branch,
evt.EventType,
evt.Start.ToLocalTime(),
evt.Duration,
};
using (var writer = _logFile.OpenWriter())
writer.WriteLine(string.Join(",", line));
}
}
}
|
unlicense
|
C#
|
2a499a215a30e9757d29dbf34307090da3890535
|
use var where possible
|
NebulousConcept/b2-csharp-client
|
b2-csharp-client/B2.Client/Rest/DataSource.cs
|
b2-csharp-client/B2.Client/Rest/DataSource.cs
|
using System;
using System.IO;
using System.Text;
namespace B2.Client.Rest
{
/// <summary>
/// Represents an arbitrary data source which can be streamed or returned as a string or bytes.
/// It is assumed the underlying data source will not change during the lifetime of this object.
/// </summary>
public sealed class DataSource
{
/// <summary>
/// The named identity of the stream.
/// </summary>
public string StreamName { get; }
private readonly Func<Stream> streamSupplier;
/// <summary>
/// Create a new data source.
/// </summary>
/// <param name="streamName">The name to identify this stream of data, eg. a file name.</param>
/// <param name="streamSupplier">A supplier that returns a stream to the data.</param>
public DataSource(string streamName, Func<Stream> streamSupplier)
{
StreamName = streamName.ThrowIfNull(nameof(streamName));
this.streamSupplier = streamSupplier.ThrowIfNull(nameof(streamSupplier));
}
/// <summary>
/// Acquire the stream that represents the data. The caller should close the stream.
/// </summary>
/// <returns>The stream that represents the data.</returns>
public Stream GetStream() => streamSupplier.Invoke();
/// <summary>
/// Read the entire stream that represents the data and return it as a UTF-8 string.
/// </summary>
/// <returns>The data represented by this object.</returns>
public string GetAsString()
{
using (var s = GetStream())
using (var sr = new StreamReader(s, Encoding.UTF8)) {
return sr.ReadToEnd();
}
}
/// <summary>
/// Read the entire stream that represents the data and return it as raw bytes.
/// </summary>
/// <returns>The data represented by this object.</returns>
public byte[] GetBytes()
{
var buffer = new byte[16 * 1024];
using (var s = GetStream())
using (var ms = new MemoryStream()) {
int read;
while ((read = s.Read(buffer, 0, buffer.Length)) > 0) {
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}
}
}
|
using System;
using System.IO;
using System.Text;
namespace B2.Client.Rest
{
/// <summary>
/// Represents an arbitrary data source which can be streamed or returned as a string or bytes.
/// It is assumed the underlying data source will not change during the lifetime of this object.
/// </summary>
public sealed class DataSource
{
/// <summary>
/// The named identity of the stream.
/// </summary>
public string StreamName { get; }
private readonly Func<Stream> streamSupplier;
/// <summary>
/// Create a new data source.
/// </summary>
/// <param name="streamName">The name to identify this stream of data, eg. a file name.</param>
/// <param name="streamSupplier">A supplier that returns a stream to the data.</param>
public DataSource(string streamName, Func<Stream> streamSupplier)
{
StreamName = streamName.ThrowIfNull(nameof(streamName));
this.streamSupplier = streamSupplier.ThrowIfNull(nameof(streamSupplier));
}
/// <summary>
/// Acquire the stream that represents the data. The caller should close the stream.
/// </summary>
/// <returns>The stream that represents the data.</returns>
public Stream GetStream() => streamSupplier.Invoke();
/// <summary>
/// Read the entire stream that represents the data and return it as a UTF-8 string.
/// </summary>
/// <returns>The data represented by this object.</returns>
public string GetAsString()
{
using (Stream s = GetStream())
using (StreamReader sr = new StreamReader(s, Encoding.UTF8)) {
return sr.ReadToEnd();
}
}
/// <summary>
/// Read the entire stream that represents the data and return it as raw bytes.
/// </summary>
/// <returns>The data represented by this object.</returns>
public byte[] GetBytes()
{
byte[] buffer = new byte[16 * 1024];
using (Stream s = GetStream())
using (MemoryStream ms = new MemoryStream()) {
int read;
while ((read = s.Read(buffer, 0, buffer.Length)) > 0) {
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}
}
}
|
mit
|
C#
|
81091d6288902cf585e3039ea4a500f42bea678c
|
Fix build break in ShaderBytecode.
|
sharpdx/SharpDX,sharpdx/SharpDX,sharpdx/SharpDX
|
Source/SharpDX.Direct3D12/ShaderBytecode.cs
|
Source/SharpDX.Direct3D12/ShaderBytecode.cs
|
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace SharpDX.Direct3D12
{
public partial struct ShaderBytecode
{
private readonly byte[] managedData;
public ShaderBytecode(byte[] buffer) : this()
{
managedData = buffer;
}
public ShaderBytecode(IntPtr pointer, PointerSize size)
{
managedData = null;
Pointer = pointer;
Size = size;
}
public ShaderBytecode(DataPointer dataPointer) : this()
{
managedData = null;
Pointer = dataPointer.Pointer;
Size = dataPointer.Size;
}
public byte[] Buffer
{
get { return managedData; }
}
public DataPointer BufferPointer
{
get
{
return new DataPointer(Pointer, Size);
}
}
public static implicit operator ShaderBytecode(DataPointer data)
{
return new ShaderBytecode(data);
}
public static implicit operator ShaderBytecode(byte[] buffer)
{
return new ShaderBytecode(buffer);
}
internal void UpdateNative(ref __Native native, IntPtr pinBuffer)
{
native.Pointer = pinBuffer;
if (managedData != null)
{
native.Size = (IntPtr)managedData.Length;
}
}
}
}
|
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace SharpDX.Direct3D12
{
public partial struct ShaderBytecode
{
private readonly byte[] managedData;
public ShaderBytecode(byte[] buffer) : this()
{
managedData = buffer;
}
public ShaderBytecode(IntPtr pointer, PointerSize size)
{
managedData = null;
Pointer = pointer;
Size = size;
}
public ShaderBytecode(DataPointer dataPointer) : this()
{
managedData = null;
Pointer = dataPointer.Pointer;
Size = dataPointer.Size;
}
public byte[] Buffer
{
get { return managedData; }
}
public DataPointer BufferPointer
{
get
{
return new DataPointer(Pointer, Size);
}
}
public static implicit operator ShaderBytecode(DataPointer data)
{
return new ShaderBytecode(data);
}
public static implicit operator ShaderBytecode(byte[] buffer)
{
return new ShaderBytecode(buffer);
}
internal void UpdateNative(ref __Native native, IntPtr pinBuffer)
{
native.Pointer = pinBuffer;
if (managedData != null)
{
native.Size = managedData.Length;
}
}
}
}
|
mit
|
C#
|
6ffe11548dcb846cebca8c33661ad6563a8e0f66
|
update version number for the next release.
|
poderosaproject/poderosa,ArsenShnurkov/poderosa,ttdoda/poderosa,poderosaproject/poderosa,Chandu/poderosa,ArsenShnurkov/poderosa,ttdoda/poderosa,poderosaproject/poderosa,ArsenShnurkov/poderosa,poderosaproject/poderosa,Chandu/poderosa,poderosaproject/poderosa,Chandu/poderosa,ttdoda/poderosa,ttdoda/poderosa
|
Plugin/VersionInfo.cs
|
Plugin/VersionInfo.cs
|
/*
* Copyright 2004,2006 The Poderosa Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* $Id: VersionInfo.cs,v 1.13 2012/06/09 15:06:58 kzmi Exp $
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace Poderosa {
/// <summary>
/// <ja>
/// バージョン情報を返します。
/// </ja>
/// <en>
/// Return the version information.
/// </en>
/// </summary>
/// <exclude/>
public class VersionInfo {
/// <summary>
/// <ja>
/// バージョン番号です。
/// </ja>
/// <en>
/// Version number.
/// </en>
/// </summary>
public const string PODEROSA_VERSION = "4.3.15b";
/// <summary>
/// <ja>
/// プロジェクト名です。
/// </ja>
/// <en>
/// Project name.
/// </en>
/// </summary>
public const string PROJECT_NAME = "Poderosa Project";
}
}
|
/*
* Copyright 2004,2006 The Poderosa Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* $Id: VersionInfo.cs,v 1.13 2012/06/09 15:06:58 kzmi Exp $
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace Poderosa {
/// <summary>
/// <ja>
/// バージョン情報を返します。
/// </ja>
/// <en>
/// Return the version information.
/// </en>
/// </summary>
/// <exclude/>
public class VersionInfo {
/// <summary>
/// <ja>
/// バージョン番号です。
/// </ja>
/// <en>
/// Version number.
/// </en>
/// </summary>
public const string PODEROSA_VERSION = "4.3.14b";
/// <summary>
/// <ja>
/// プロジェクト名です。
/// </ja>
/// <en>
/// Project name.
/// </en>
/// </summary>
public const string PROJECT_NAME = "Poderosa Project";
}
}
|
apache-2.0
|
C#
|
f19a7f96ca0e4321bd75efb3e191415dd0da1590
|
update version for the next release.
|
Chandu/poderosa,ttdoda/poderosa,ArsenShnurkov/poderosa,ttdoda/poderosa,ttdoda/poderosa,poderosaproject/poderosa,poderosaproject/poderosa,poderosaproject/poderosa,ArsenShnurkov/poderosa,Chandu/poderosa,ArsenShnurkov/poderosa,poderosaproject/poderosa,ttdoda/poderosa,poderosaproject/poderosa,Chandu/poderosa
|
Plugin/VersionInfo.cs
|
Plugin/VersionInfo.cs
|
/*
* Copyright 2004,2006 The Poderosa Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* $Id: VersionInfo.cs,v 1.13 2012/06/09 15:06:58 kzmi Exp $
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace Poderosa {
/// <summary>
/// <ja>
/// o[WԂ܂B
/// </ja>
/// <en>
/// Return the version information.
/// </en>
/// </summary>
/// <exclude/>
public class VersionInfo {
/// <summary>
/// <ja>
/// o[WԍłB
/// </ja>
/// <en>
/// Version number.
/// </en>
/// </summary>
public const string PODEROSA_VERSION = "4.3.14b";
/// <summary>
/// <ja>
/// vWFNgłB
/// </ja>
/// <en>
/// Project name.
/// </en>
/// </summary>
public const string PROJECT_NAME = "Poderosa Project";
}
}
|
/*
* Copyright 2004,2006 The Poderosa Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* $Id: VersionInfo.cs,v 1.13 2012/06/09 15:06:58 kzmi Exp $
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace Poderosa {
/// <summary>
/// <ja>
/// o[WԂ܂B
/// </ja>
/// <en>
/// Return the version information.
/// </en>
/// </summary>
/// <exclude/>
public class VersionInfo {
/// <summary>
/// <ja>
/// o[WԍłB
/// </ja>
/// <en>
/// Version number.
/// </en>
/// </summary>
public const string PODEROSA_VERSION = "4.3.13b";
/// <summary>
/// <ja>
/// vWFNgłB
/// </ja>
/// <en>
/// Project name.
/// </en>
/// </summary>
public const string PROJECT_NAME = "Poderosa Project";
}
}
|
apache-2.0
|
C#
|
dffd9c73f019cfb743bcce54789e93276147addf
|
Bump version to 0.5.3
|
whampson/bft-spec,whampson/cascara
|
Src/WHampson.Bft/Properties/AssemblyInfo.cs
|
Src/WHampson.Bft/Properties/AssemblyInfo.cs
|
#region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WHampson.BFT")]
[assembly: AssemblyDescription("Binary File Template parser.")]
[assembly: AssemblyProduct("WHampson.BFT")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")]
[assembly: AssemblyFileVersion("0.5.3")]
[assembly: AssemblyVersion("0.5.3")]
[assembly: AssemblyInformationalVersion("0.5.3")]
|
#region License
/* Copyright (c) 2017 Wes Hampson
*
* 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.
*/
#endregion
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WHampson.BFT")]
[assembly: AssemblyDescription("Binary File Template parser.")]
[assembly: AssemblyProduct("WHampson.BFT")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Wes Hampson")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2cc76928-f34e-4a9b-8623-1ccc543005c0")]
[assembly: AssemblyFileVersion("0.5.2")]
[assembly: AssemblyVersion("0.5.2")]
[assembly: AssemblyInformationalVersion("0.5.2")]
|
mit
|
C#
|
55e8a7b4661677a64c013913bdc0f1aa67fbaaaa
|
Change formatting to match C# style
|
versionone/VersionOne.Integration.Bugzilla,versionone/VersionOne.Integration.Bugzilla,versionone/VersionOne.Integration.Bugzilla
|
VersionOne.ServerConnector/IQueryBuilder.cs
|
VersionOne.ServerConnector/IQueryBuilder.cs
|
using System.Collections.Generic;
using VersionOne.SDK.APIClient;
using VersionOne.ServerConnector.Entities;
using VersionOne.ServerConnector.Filters;
namespace VersionOne.ServerConnector
{
// TODO refactor APIClient types
public interface IQueryBuilder
{
IDictionary<string, PropertyValues> ListPropertyValues { get; }
IEntityFieldTypeResolver TypeResolver { get; }
IEnumerable<AttributeInfo> AttributesToQuery { get; }
void Setup(IServices services, IMetaModel metaModel, ILocalizer localizer);
void AddProperty(string attr, string prefix, bool isList);
void AddListProperty(string fieldName, string typeToken);
void AddOptionalProperty(string attr, string prefix);
IQueryBuilder SortBy(SortBy sort);
PropertyValues QueryPropertyValues(string propertyName);
AssetList Query(string typeToken, IFilterTerm filter);
AssetList Query(string typeToken, IFilter filter);
string Localize(string text);
}
}
|
using System.Collections.Generic;
using VersionOne.SDK.APIClient;
using VersionOne.ServerConnector.Entities;
using VersionOne.ServerConnector.Filters;
namespace VersionOne.ServerConnector {
// TODO refactor APIClient types
public interface IQueryBuilder {
IDictionary<string, PropertyValues> ListPropertyValues { get; }
IEntityFieldTypeResolver TypeResolver { get; }
IEnumerable<AttributeInfo> AttributesToQuery { get; }
void Setup(IServices services, IMetaModel metaModel, ILocalizer localizer);
void AddProperty(string attr, string prefix, bool isList);
void AddListProperty(string fieldName, string typeToken);
void AddOptionalProperty(string attr, string prefix);
IQueryBuilder SortBy(SortBy sort);
PropertyValues QueryPropertyValues(string propertyName);
AssetList Query(string typeToken, IFilterTerm filter);
AssetList Query(string typeToken, IFilter filter);
string Localize(string text);
}
}
|
bsd-3-clause
|
C#
|
df2af370bb5695bc480a2a8ae90d3b7a99444ab4
|
Update Main class for compatibility with Pre-Alpha 5.
|
parkitectLab/statMaster
|
Main.cs
|
Main.cs
|
using UnityEngine;
namespace StatMaster
{
public class Main : IMod
{
private GameObject _go;
public void onEnabled()
{
_go = new GameObject();
_go.AddComponent<Behaviour>();
}
public void onDisabled()
{
UnityEngine.Object.Destroy(_go);
}
public string Name
{
get { return "Stat Master"; }
}
public string Description
{
get { return "All you need to get your stats mastered!"; }
}
}
}
|
using UnityEngine;
namespace StatMaster
{
class Main : IMod
{
private GameObject _go;
public void onEnabled()
{
_go = new GameObject();
_go.AddComponent<Behaviour>();
}
public void onDisabled()
{
UnityEngine.Object.Destroy(_go);
}
public string Name
{
get { return "Stat Master"; }
}
public string Description
{
get { return "All you need to get your stats mastered!"; }
}
}
}
|
mit
|
C#
|
401919a6f423b580f163b1ff9871a58f0ba46571
|
Fix conversion of 3241
|
ermshiperete/TntMPDConverter,ermshiperete/TntMPDConverter
|
Account.cs
|
Account.cs
|
using System;
namespace TntMPDConverter
{
public class Account : State
{
private int m_AccountNo;
public Account(Scanner reader) : base(reader)
{
IsValid = true;
}
public static bool IsAccount(string line)
{
string[] textArray1 = line.Split(new[] { '\t' });
if (textArray1.Length != 4)
{
return false;
}
try
{
Convert.ToInt32(textArray1[1]);
}
catch (FormatException)
{
return false;
}
return true;
}
public override State NextState()
{
ProcessAccountNo();
if (m_AccountNo == 7100 || m_AccountNo == 7800 ||
// new account numbers starting 1/2011
m_AccountNo == 1191 || m_AccountNo == 1197 || m_AccountNo == 1185 ||
// new account numbers starting 12/2011
m_AccountNo == 3220 || m_AccountNo == 3231 || m_AccountNo == 3239 ||
// 3241 - Transfers from other organizations
m_AccountNo == 3241)
{
return new ProcessingDonations(Reader);
}
if (m_AccountNo == 8900 ||
// new account numbers starting 1/2011
m_AccountNo == 3215)
{
return new ProcessingOtherProceeds(Reader);
}
// Member transfer
if (m_AccountNo == 715)
{
return new ProcessingMemberTransfers(m_AccountNo, Reader);
}
// 3224 - Transfers from other WOs
if (m_AccountNo == 3224)
{
return new ProcessingOtherTransfers(Reader);
}
return new IgnoreAccount(Reader);
}
protected void ProcessAccountNo()
{
string text1 = Reader.ReadLine();
string[] textArray1 = text1.Split(new[] { '\t' });
if (textArray1.Length != 4)
{
throw new ApplicationException();
}
text1 = Reader.ReadLine();
Reader.UnreadLine(text1);
IsValid = IsAccount(text1);
m_AccountNo = Convert.ToInt32(textArray1[1]);
}
}
}
|
using System;
namespace TntMPDConverter
{
public class Account : State
{
private int m_AccountNo;
public Account(Scanner reader) : base(reader)
{
IsValid = true;
}
public static bool IsAccount(string line)
{
string[] textArray1 = line.Split(new[] { '\t' });
if (textArray1.Length != 4)
{
return false;
}
try
{
Convert.ToInt32(textArray1[1]);
}
catch (FormatException)
{
return false;
}
return true;
}
public override State NextState()
{
ProcessAccountNo();
if (m_AccountNo == 7100 || m_AccountNo == 7800 ||
// new account numbers starting 1/2011
m_AccountNo == 1191 || m_AccountNo == 1197 || m_AccountNo == 1185 ||
// new account numbers starting 12/2011
m_AccountNo == 3220 || m_AccountNo == 3231 || m_AccountNo == 3239)
{
return new ProcessingDonations(Reader);
}
if (m_AccountNo == 8900 ||
// new account numbers starting 1/2011
m_AccountNo == 3215)
{
return new ProcessingOtherProceeds(Reader);
}
// Member transfer
if (m_AccountNo == 715)
{
return new ProcessingMemberTransfers(m_AccountNo, Reader);
}
// 3224 - Transfers from other WOs
// 3241 - Transfers from other organizations
if (m_AccountNo == 3224 || m_AccountNo == 3241)
{
return new ProcessingOtherTransfers(Reader);
}
return new IgnoreAccount(Reader);
}
protected void ProcessAccountNo()
{
string text1 = Reader.ReadLine();
string[] textArray1 = text1.Split(new[] { '\t' });
if (textArray1.Length != 4)
{
throw new ApplicationException();
}
text1 = Reader.ReadLine();
Reader.UnreadLine(text1);
IsValid = IsAccount(text1);
m_AccountNo = Convert.ToInt32(textArray1[1]);
}
}
}
|
mit
|
C#
|
b50fe7ec50d0399ca4a7490eacc2a14c861aee13
|
change artifacts dir
|
chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,MienDev/IdentityServer4,chrisowhite/IdentityServer4,jbijlsma/IdentityServer4,jbijlsma/IdentityServer4,siyo-wang/IdentityServer4,MienDev/IdentityServer4,IdentityServer/IdentityServer4,siyo-wang/IdentityServer4,IdentityServer/IdentityServer4,jbijlsma/IdentityServer4,MienDev/IdentityServer4,siyo-wang/IdentityServer4,IdentityServer/IdentityServer4,jbijlsma/IdentityServer4,MienDev/IdentityServer4
|
build.cake
|
build.cake
|
var target = Argument("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor;
var solutionPath = Directory("./src/IdentityServer4");
var sourcePath = Directory("./src");
var testsPath = Directory("test");
var buildArtifacts = Directory("./artifacts/packages");
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
var projects = GetFiles("./**/project.json");
foreach(var project in projects)
{
DotNetCoreBuild(project.GetDirectory().FullPath, new DotNetCoreBuildSettings {
Configuration = configuration
// Runtime = IsRunningOnWindows() ? null : "unix-x64"
});
}
});
Task("RunTests")
.IsDependentOn("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
var projects = GetFiles("./test/**/project.json");
foreach(var project in projects)
{
DotNetCoreTest(project.GetDirectory().FullPath, new DotNetCoreTestSettings {
Configuration = configuration
});
}
});
Task("Pack")
.IsDependentOn("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = buildArtifacts,
};
if(!isLocalBuild)
{
settings.VersionSuffix = AppVeyor.Environment.Build.Number.ToString().PadLeft(5,'0');
}
DotNetCorePack(solutionPath, settings);
});
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] { buildArtifacts });
});
Task("Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
Sources = new [] {
"https://api.nuget.org/v3/index.json",
},
};
//Restore at root until preview1-002702 bug fixed
DotNetCoreRestore(sourcePath, settings);
DotNetCoreRestore(testsPath, settings);
});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("RunTests")
.IsDependentOn("Pack");
RunTarget(target);
|
var target = Argument("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor;
var solutionPath = Directory("./src/IdentityServer4");
var sourcePath = Directory("./src");
var testsPath = Directory("test");
var buildArtifacts = Directory("./cakeartifacts/packages");
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
var projects = GetFiles("./**/project.json");
foreach(var project in projects)
{
DotNetCoreBuild(project.GetDirectory().FullPath, new DotNetCoreBuildSettings {
Configuration = configuration
// Runtime = IsRunningOnWindows() ? null : "unix-x64"
});
}
});
Task("RunTests")
.IsDependentOn("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
var projects = GetFiles("./test/**/project.json");
foreach(var project in projects)
{
DotNetCoreTest(project.GetDirectory().FullPath, new DotNetCoreTestSettings {
Configuration = configuration
});
}
});
Task("Pack")
.IsDependentOn("Restore")
.IsDependentOn("Clean")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = buildArtifacts,
};
if(!isLocalBuild)
{
settings.VersionSuffix = AppVeyor.Environment.Build.Number.ToString().PadLeft(5,'0');
}
DotNetCorePack(solutionPath, settings);
});
Task("Clean")
.Does(() =>
{
CleanDirectories(new DirectoryPath[] { buildArtifacts });
});
Task("Restore")
.Does(() =>
{
var settings = new DotNetCoreRestoreSettings
{
Sources = new [] {
"https://api.nuget.org/v3/index.json",
},
};
//Restore at root until preview1-002702 bug fixed
DotNetCoreRestore(sourcePath, settings);
DotNetCoreRestore(testsPath, settings);
});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("RunTests")
.IsDependentOn("Pack");
RunTarget(target);
|
apache-2.0
|
C#
|
6f4341f56451f08bfc1fc680ecdcc6dc2a60ea95
|
Set build configuration for XBuild use.
|
cake-build/example,cake-build/example
|
build.cake
|
build.cake
|
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./src/Example/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./src/Example.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild("./src/Example.sln", settings =>
settings.SetConfiguration(configuration));
}
else
{
// Use XBuild
XBuild("./src/Example.sln", settings =>
settings.SetConfiguration(configuration));
}
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./src/Example/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./src/Example.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild("./src/Example.sln", settings =>
settings.SetConfiguration(configuration));
}
else
{
// Use XBuild
XBuild("./src/Example.sln");
}
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
mit
|
C#
|
a612cd4e37a0546746b28382f34036ba7279b1cc
|
Fix RichTextExtension that color doesn't work.
|
LuviKunG/LuviTools,LuviKunG/LuviTools
|
Extension/RichTextExtension.cs
|
Extension/RichTextExtension.cs
|
using UnityEngine;
using StringBuilder = System.Text.StringBuilder;
namespace LuviKunG.RichText
{
public static class RichTextExtension
{
public static string Color(this string s, string hexString)
{
Color color;
if (ColorUtility.TryParseHtmlString(hexString, out color))
return Color(s, color);
else
return s;
}
public static string Color(this string s, Color color)
{
StringBuilder str = new StringBuilder();
str.Append("<color=#");
str.Append(ColorUtility.ToHtmlStringRGB(color));
str.Append(">");
str.Append(s);
str.Append("</color>");
return str.ToString();
}
public static string Bold(this string s)
{
StringBuilder str = new StringBuilder();
str.Append("<b>");
str.Append(s);
str.Append("</b>");
return str.ToString();
}
public static string Italic(this string s)
{
StringBuilder str = new StringBuilder();
str.Append("<i>");
str.Append(s);
str.Append("</i>");
return str.ToString();
}
public static string Size(this string s, int size)
{
StringBuilder str = new StringBuilder();
str.Append("<size=");
str.Append(size);
str.Append(">");
str.Append(s);
str.Append("</size>");
return str.ToString();
}
}
}
|
using UnityEngine;
using StringBuilder = System.Text.StringBuilder;
namespace LuviKunG.RichText
{
public static class RichTextExtension
{
public static string Color(this string s, string hexString)
{
Color color;
if (ColorUtility.TryParseHtmlString(hexString, out color))
return Color(s, color);
else
return s;
}
public static string Color(this string s, Color color)
{
StringBuilder str = new StringBuilder();
str.Append("<color=");
str.Append(ColorUtility.ToHtmlStringRGB(color));
str.Append(">");
str.Append(s);
str.Append("</color>");
return str.ToString();
}
public static string Bold(this string s)
{
StringBuilder str = new StringBuilder();
str.Append("<b>");
str.Append(s);
str.Append("</b>");
return str.ToString();
}
public static string Italic(this string s)
{
StringBuilder str = new StringBuilder();
str.Append("<i>");
str.Append(s);
str.Append("</i>");
return str.ToString();
}
public static string Size(this string s, int size)
{
StringBuilder str = new StringBuilder();
str.Append("<size=");
str.Append(size);
str.Append(">");
str.Append(s);
str.Append("</size>");
return str.ToString();
}
}
}
|
mit
|
C#
|
c6bf856c7b619d10f6c21a19b3a07181def531a9
|
Add two popular namespaces to the default templates #8
|
jbe2277/dotnetpad
|
src/DotNetPad/DotNetPad.Applications/CodeAnalysis/TemplateCode.cs
|
src/DotNetPad/DotNetPad.Applications/CodeAnalysis/TemplateCode.cs
|
namespace Waf.DotNetPad.Applications.CodeAnalysis
{
internal static class TemplateCode
{
public static string InitialCSharpCode
{
get
{
return
@"using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Sample
{
internal static class Program
{
internal static void Main()
{
}
}
}";
}
}
public static int StartCaretPositionCSharp { get { return 226; } }
public static string InitialVisualBasicCode
{
get
{
return
@"Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Namespace Sample
Module Program
Sub Main()
End Sub
End Module
End Namespace";
}
}
public static int StartCaretPositionVisualBasic { get { return 177; } }
}
}
|
namespace Waf.DotNetPad.Applications.CodeAnalysis
{
internal static class TemplateCode
{
public static string InitialCSharpCode
{
get
{
return
@"using System;
using System.Linq;
namespace Sample
{
internal static class Program
{
internal static void Main()
{
}
}
}";
}
}
public static int StartCaretPositionCSharp { get { return 160; } }
public static string InitialVisualBasicCode
{
get
{
return
@"Imports System
Imports System.Linq
Namespace Sample
Module Program
Sub Main()
End Sub
End Module
End Namespace";
}
}
public static int StartCaretPositionVisualBasic { get { return 110; } }
}
}
|
mit
|
C#
|
354e7aa1528ed7bb141200becc1362c8d2049567
|
Make sure that duration is rounded on the end request duration
|
zanetdev/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype
|
src/Glimpse.Agent.Web/Providers/AspNet/AspNetTelemetryListener.cs
|
src/Glimpse.Agent.Web/Providers/AspNet/AspNetTelemetryListener.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Glimpse.Agent.Web.Messages;
using Microsoft.AspNet.Http;
using Microsoft.Framework.TelemetryAdapter;
namespace Glimpse.Agent.Web
{
public partial class WebTelemetryListener
{
[TelemetryName("Microsoft.AspNet.Hosting.BeginRequest")]
public void OnBeginRequest(HttpContext httpContext)
{
// TODO: Not sure if this is where this should live but it's the earlist hook point we have
_contextData.Value = new MessageContext { Id = Guid.NewGuid(), Type = "Request" };
var request = httpContext.Request;
var beginMessage = new BeginRequestMessage
{
// TODO: check if there is a better way of doing this
// TODO: should there be a StartTime property here?
Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}",
Method = request.Method,
};
_broker.BeginLogicalOperation(beginMessage);
}
[TelemetryName("Microsoft.AspNet.Hosting.EndRequest")]
public void OnEndRequest(HttpContext httpContext)
{
var timing = _broker.EndLogicalOperation<BeginRequestMessage>().Timing;
var request = httpContext.Request;
var response = httpContext.Response;
var endMessage = new EndRequestMessage
{
// TODO: check if there is a better way of doing this
Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}",
Duration = Math.Round(timing.Elapsed.TotalMilliseconds, 2),
ContentType = response.ContentType,
StatusCode = response.StatusCode,
StartTime = timing.Start.ToUniversalTime(),
EndTime = timing.End.ToUniversalTime()
};
_broker.SendMessage(endMessage);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Glimpse.Agent.Web.Messages;
using Microsoft.AspNet.Http;
using Microsoft.Framework.TelemetryAdapter;
namespace Glimpse.Agent.Web
{
public partial class WebTelemetryListener
{
[TelemetryName("Microsoft.AspNet.Hosting.BeginRequest")]
public void OnBeginRequest(HttpContext httpContext)
{
// TODO: Not sure if this is where this should live but it's the earlist hook point we have
_contextData.Value = new MessageContext { Id = Guid.NewGuid(), Type = "Request" };
var request = httpContext.Request;
var beginMessage = new BeginRequestMessage
{
// TODO: check if there is a better way of doing this
// TODO: should there be a StartTime property here?
Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}",
Method = request.Method,
};
_broker.BeginLogicalOperation(beginMessage);
}
[TelemetryName("Microsoft.AspNet.Hosting.EndRequest")]
public void OnEndRequest(HttpContext httpContext)
{
var timing = _broker.EndLogicalOperation<BeginRequestMessage>().Timing;
var request = httpContext.Request;
var response = httpContext.Response;
var endMessage = new EndRequestMessage
{
// TODO: check if there is a better way of doing this
Url = $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}",
Duration = timing.Elapsed.TotalMilliseconds,
ContentType = response.ContentType,
StatusCode = response.StatusCode,
StartTime = timing.Start.ToUniversalTime(),
EndTime = timing.End.ToUniversalTime()
};
_broker.SendMessage(endMessage);
}
}
}
|
mit
|
C#
|
eedf15a621e0898e19ca4931532c891acae0c7ed
|
Move settings menu to the "Edit" category
|
PhannGor/unity3d-rainbow-folders
|
Assets/RainbowFolders/Editor/RainbowFoldersMenu.cs
|
Assets/RainbowFolders/Editor/RainbowFoldersMenu.cs
|
/*
* 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 Borodar.RainbowFolders.Editor.Settings;
using UnityEditor;
namespace Borodar.RainbowFolders.Editor
{
public static class RainbowFoldersMenu
{
[MenuItem("Edit/Rainbow Folders Settings", false, 500)]
public static void OpenSettings()
{
var settings = RainbowFoldersSettings.Load();
Selection.activeObject = settings;
}
}
}
|
/*
* 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 Borodar.RainbowFolders.Editor.Settings;
using UnityEditor;
namespace Borodar.RainbowFolders.Editor
{
public static class RainbowFoldersMenu
{
[MenuItem("Rainbow Folders/Show Settings")]
public static void OpenSettings()
{
var settings = RainbowFoldersSettings.Load();
Selection.activeObject = settings;
}
}
}
|
apache-2.0
|
C#
|
eec3c27ad0797d21b28a16c83bf908191fa3dde0
|
Rename CalcLength to GetLength
|
ektrah/nsec
|
src/Cryptography/Oid.cs
|
src/Cryptography/Oid.cs
|
using System;
using System.Diagnostics;
namespace NSec.Cryptography
{
internal struct Oid
{
private readonly byte[] _bytes;
public Oid(
uint first,
uint second,
params uint[] rest)
{
int length = GetLength(first * 40 + second);
for (int i = 0; i < rest.Length; i++)
length += GetLength(rest[i]);
byte[] bytes = new byte[length];
int pos = Encode(first * 40 + second, bytes, 0);
for (int i = 0; i < rest.Length; i++)
pos += Encode(rest[i], bytes, pos);
_bytes = bytes;
}
public ReadOnlySpan<byte> Bytes => _bytes ?? default(ReadOnlySpan<byte>);
private static int Encode(
uint value,
byte[] buffer,
int pos)
{
int start = pos;
Debug.Assert((value & 0xF0000000) == 0);
if ((value & 0xFFE00000) != 0)
buffer[pos++] = (byte)((value >> 21) & 0x7F | 0x80);
if ((value & 0xFFFFC000) != 0)
buffer[pos++] = (byte)((value >> 14) & 0x7F | 0x80);
if ((value & 0xFFFFFF80) != 0)
buffer[pos++] = (byte)((value >> 7) & 0x7F | 0x80);
buffer[pos++] = (byte)(value & 0x7F);
return pos - start;
}
private static int GetLength(
uint value)
{
int length = 0;
Debug.Assert((value & 0xF0000000) == 0);
if ((value & 0xFFE00000) != 0)
length++;
if ((value & 0xFFFFC000) != 0)
length++;
if ((value & 0xFFFFFF80) != 0)
length++;
length++;
return length;
}
}
}
|
using System;
using System.Diagnostics;
namespace NSec.Cryptography
{
internal struct Oid
{
private readonly byte[] _bytes;
public Oid(
uint first,
uint second,
params uint[] rest)
{
int length = CalcLength(first * 40 + second);
for (int i = 0; i < rest.Length; i++)
length += CalcLength(rest[i]);
byte[] bytes = new byte[length];
int pos = Encode(first * 40 + second, bytes, 0);
for (int i = 0; i < rest.Length; i++)
pos += Encode(rest[i], bytes, pos);
_bytes = bytes;
}
public ReadOnlySpan<byte> Bytes => _bytes ?? default(ReadOnlySpan<byte>);
private static int CalcLength(
uint value)
{
int length = 0;
Debug.Assert((value & 0xF0000000) == 0);
if ((value & 0xFFE00000) != 0)
length++;
if ((value & 0xFFFFC000) != 0)
length++;
if ((value & 0xFFFFFF80) != 0)
length++;
length++;
return length;
}
private static int Encode(
uint value,
byte[] buffer,
int pos)
{
int start = pos;
Debug.Assert((value & 0xF0000000) == 0);
if ((value & 0xFFE00000) != 0)
buffer[pos++] = (byte)((value >> 21) & 0x7F | 0x80);
if ((value & 0xFFFFC000) != 0)
buffer[pos++] = (byte)((value >> 14) & 0x7F | 0x80);
if ((value & 0xFFFFFF80) != 0)
buffer[pos++] = (byte)((value >> 7) & 0x7F | 0x80);
buffer[pos++] = (byte)(value & 0x7F);
return pos - start;
}
}
}
|
mit
|
C#
|
ada525b6af76df7ee1e2e6d2311fafa48955a790
|
Fix comment
|
k-t/SharpHaven
|
MonoHaven.Client/MainScreen.cs
|
MonoHaven.Client/MainScreen.cs
|
using System;
using MonoHaven.Game;
using MonoHaven.Graphics;
using MonoHaven.Login;
using MonoHaven.UI;
using OpenTK.Input;
namespace MonoHaven
{
public class MainScreen : IScreen
{
private readonly LoginScreen loginScreen;
private GameScreen gameScreen;
private IScreen current;
public MainScreen()
{
loginScreen = new LoginScreen();
loginScreen.LoginCompleted += OnLoginCompleted;
current = loginScreen;
}
private void ChangeScreen(IScreen screen)
{
if (screen == null)
throw new ArgumentNullException("screen");
current.Close();
current = screen;
current.Resize(App.Instance.Window.Size);
current.Show();
}
private void OnLoginCompleted(GameSession session)
{
gameScreen = session.Screen;
gameScreen.Exited += OnGameExited;
ChangeScreen(gameScreen);
}
private void OnGameExited()
{
gameScreen.Exited -= OnGameExited;
ChangeScreen(loginScreen);
gameScreen.Dispose();
// ensure that the instance is not lingering
gameScreen = null;
}
#region IScreen Implementation
void IScreen.Show()
{
current.Show();
}
void IScreen.Close()
{
current.Close();
}
void IScreen.Resize(int newWidth, int newHeight)
{
current.Resize(newWidth, newHeight);
}
void IScreen.Draw(DrawingContext dc)
{
current.Draw(dc);
}
void IScreen.MouseButtonDown(MouseButtonEventArgs e)
{
current.MouseButtonDown(e);
}
void IScreen.MouseButtonUp(MouseButtonEventArgs e)
{
current.MouseButtonUp(e);
}
void IScreen.MouseMove(MouseMoveEventArgs e)
{
current.MouseMove(e);
}
void IScreen.MouseWheel(MouseWheelEventArgs e)
{
current.MouseWheel(e);
}
void IScreen.KeyDown(KeyEventArgs e)
{
current.KeyDown(e);
}
void IScreen.KeyUp(KeyEventArgs e)
{
current.KeyUp(e);
}
void IScreen.KeyPress(KeyPressEventArgs e)
{
current.KeyPress(e);
}
#endregion
}
}
|
using System;
using MonoHaven.Game;
using MonoHaven.Graphics;
using MonoHaven.Login;
using MonoHaven.UI;
using OpenTK.Input;
namespace MonoHaven
{
public class MainScreen : IScreen
{
private readonly LoginScreen loginScreen;
private GameScreen gameScreen;
private IScreen current;
public MainScreen()
{
loginScreen = new LoginScreen();
loginScreen.LoginCompleted += OnLoginCompleted;
current = loginScreen;
}
private void ChangeScreen(IScreen screen)
{
if (screen == null)
throw new ArgumentNullException("screen");
current.Close();
current = screen;
current.Resize(App.Instance.Window.Size);
current.Show();
}
private void OnLoginCompleted(GameSession session)
{
gameScreen = session.Screen;
gameScreen.Exited += OnGameExited;
ChangeScreen(gameScreen);
}
private void OnGameExited()
{
gameScreen.Exited -= OnGameExited;
ChangeScreen(loginScreen);
gameScreen.Dispose();
// ensure that the instance is not lingering between switches
gameScreen = null;
}
#region IScreen Implementation
void IScreen.Show()
{
current.Show();
}
void IScreen.Close()
{
current.Close();
}
void IScreen.Resize(int newWidth, int newHeight)
{
current.Resize(newWidth, newHeight);
}
void IScreen.Draw(DrawingContext dc)
{
current.Draw(dc);
}
void IScreen.MouseButtonDown(MouseButtonEventArgs e)
{
current.MouseButtonDown(e);
}
void IScreen.MouseButtonUp(MouseButtonEventArgs e)
{
current.MouseButtonUp(e);
}
void IScreen.MouseMove(MouseMoveEventArgs e)
{
current.MouseMove(e);
}
void IScreen.MouseWheel(MouseWheelEventArgs e)
{
current.MouseWheel(e);
}
void IScreen.KeyDown(KeyEventArgs e)
{
current.KeyDown(e);
}
void IScreen.KeyUp(KeyEventArgs e)
{
current.KeyUp(e);
}
void IScreen.KeyPress(KeyPressEventArgs e)
{
current.KeyPress(e);
}
#endregion
}
}
|
mit
|
C#
|
8642bff54c96a61a618119ee6145419013209212
|
remove useless invocation for VarString
|
MetacoSA/NBitcoin,MetacoSA/NBitcoin,NicolasDorier/NBitcoin
|
NBitcoin/Protocol/VarString.cs
|
NBitcoin/Protocol/VarString.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBitcoin.Protocol
{
public class VarString : IBitcoinSerializable
{
public VarString()
{
_Bytes = new byte[0];
}
byte[] _Bytes;
public int Length
{
get
{
return _Bytes.Length;
}
}
public VarString(byte[] bytes)
{
if(bytes == null)
throw new ArgumentNullException(nameof(bytes));
_Bytes = bytes;
}
public byte[] GetString()
{
return GetString(false);
}
public byte[] GetString(bool @unsafe)
{
if(@unsafe)
return _Bytes;
return _Bytes.ToArray();
}
#region IBitcoinSerializable Members
public void ReadWrite(BitcoinStream stream)
{
var len = new VarInt((ulong)_Bytes.Length);
stream.ReadWrite(ref len);
if(!stream.Serializing)
{
if(len.ToLong() > (uint)stream.MaxArraySize)
throw new ArgumentOutOfRangeException("Array size not big");
_Bytes = new byte[len.ToLong()];
}
stream.ReadWrite(ref _Bytes);
}
internal static void StaticWrite(BitcoinStream bs, byte[] bytes)
{
VarInt.StaticWrite(bs, (ulong)bytes.Length);
bs.ReadWrite(ref bytes);
}
internal static void StaticRead(BitcoinStream bs, ref byte[] bytes)
{
var len = VarInt.StaticRead(bs);
bytes = new byte[len];
bs.ReadWrite(ref bytes);
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBitcoin.Protocol
{
public class VarString : IBitcoinSerializable
{
public VarString()
{
}
byte[] _Bytes = new byte[0];
public int Length
{
get
{
return _Bytes.Length;
}
}
public VarString(byte[] bytes)
{
if(bytes == null)
throw new ArgumentNullException(nameof(bytes));
_Bytes = bytes;
}
public byte[] GetString()
{
return GetString(false);
}
public byte[] GetString(bool @unsafe)
{
if(@unsafe)
return _Bytes;
return _Bytes.ToArray();
}
#region IBitcoinSerializable Members
public void ReadWrite(BitcoinStream stream)
{
var len = new VarInt((ulong)_Bytes.Length);
stream.ReadWrite(ref len);
if(!stream.Serializing)
{
if(len.ToLong() > (uint)stream.MaxArraySize)
throw new ArgumentOutOfRangeException("Array size not big");
_Bytes = new byte[len.ToLong()];
}
stream.ReadWrite(ref _Bytes);
}
internal static void StaticWrite(BitcoinStream bs, byte[] bytes)
{
VarInt.StaticWrite(bs, (ulong)bytes.Length);
bs.ReadWrite(ref bytes);
}
internal static void StaticRead(BitcoinStream bs, ref byte[] bytes)
{
var len = VarInt.StaticRead(bs);
bytes = new byte[len];
bs.ReadWrite(ref bytes);
}
#endregion
}
}
|
mit
|
C#
|
c18bc1a7ae167010b73ff711bc5012c3e96a4bb2
|
Fix bug with missing unmute timers.
|
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
|
MitternachtWeb/Areas/Guild/Controllers/MutesController.cs
|
MitternachtWeb/Areas/Guild/Controllers/MutesController.cs
|
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Mitternacht.Modules.Administration.Services;
using Mitternacht.Services;
using MitternachtWeb.Areas.Guild.Models;
using MitternachtWeb.Exceptions;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MitternachtWeb.Areas.Guild.Controllers {
[Authorize]
[Area("Guild")]
public class MutesController : GuildBaseController {
private readonly DbService _db;
private readonly MuteService _muteService;
public MutesController(DbService db, MuteService ms) {
_db = db;
_muteService = ms;
}
public IActionResult Index() {
using var uow = _db.UnitOfWork;
var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers));
var mutedUsers = gc.MutedUsers;
var unmuteTimers = gc.UnmuteTimers;
var mutes = mutedUsers.Select(mu => mu.UserId).Concat(unmuteTimers.Select(ut => ut.UserId)).Select(userId => {
var user = Guild.GetUser(userId);
var userUnmuteTimers = unmuteTimers.Where(ut => ut.UserId == userId).Select(ut => ut.UnmuteAt).OrderBy(d => d).ToArray();
return new Mute {
UserId = userId,
Muted = mutedUsers.Any(mu => mu.UserId == userId),
UnmuteAt = userUnmuteTimers.Any() ? (DateTime?)userUnmuteTimers.First() : null,
Username = user?.ToString() ?? uow.UsernameHistory.GetUsernamesDescending(userId).FirstOrDefault()?.ToString() ?? "-",
AvatarUrl = user?.GetAvatarUrl(),
};
}).ToList();
return View(mutes);
}
public async Task<IActionResult> Delete(ulong id) {
if(!PermissionWriteMutes)
throw new NoPermissionsException();
var user = Guild.GetUser(id);
if(user != null) {
await _muteService.UnmuteUser(user);
} else {
using var uow = _db.UnitOfWork;
var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers));
gc.MutedUsers.RemoveWhere(mu => mu.UserId == id);
gc.UnmuteTimers.RemoveWhere(ut => ut.UserId == id);
await uow.CompleteAsync();
_muteService.StopUnmuteTimer(GuildId, id);
}
return RedirectToAction("Index");
}
}
}
|
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Mitternacht.Modules.Administration.Services;
using Mitternacht.Services;
using MitternachtWeb.Areas.Guild.Models;
using MitternachtWeb.Exceptions;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MitternachtWeb.Areas.Guild.Controllers {
[Authorize]
[Area("Guild")]
public class MutesController : GuildBaseController {
private readonly DbService _db;
private readonly MuteService _muteService;
public MutesController(DbService db, MuteService ms) {
_db = db;
_muteService = ms;
}
public IActionResult Index() {
using var uow = _db.UnitOfWork;
var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers));
var mutedUsers = gc.MutedUsers;
var unmuteTimers = gc.UnmuteTimers;
var mutes = mutedUsers.Select(mu => mu.UserId).Concat(unmuteTimers.Select(ut => ut.UserId)).Select(userId => new Mute{
UserId = userId,
Muted = mutedUsers.Any(mu => mu.UserId == userId),
UnmuteAt = unmuteTimers.Any() ? (DateTime?)unmuteTimers.Where(ut => ut.UserId == userId).Min(ut => ut.UnmuteAt) : null,
Username = Guild.GetUser(userId)?.ToString() ?? uow.UsernameHistory.GetUsernamesDescending(userId).FirstOrDefault()?.ToString() ?? "-",
AvatarUrl = Guild.GetUser(userId)?.GetAvatarUrl(),
}).ToList();
return View(mutes);
}
public async Task<IActionResult> Delete(ulong id) {
if(!PermissionWriteMutes)
throw new NoPermissionsException();
var user = Guild.GetUser(id);
if(user != null) {
await _muteService.UnmuteUser(user);
} else {
using var uow = _db.UnitOfWork;
var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers));
gc.MutedUsers.RemoveWhere(mu => mu.UserId == id);
gc.UnmuteTimers.RemoveWhere(ut => ut.UserId == id);
await uow.CompleteAsync();
_muteService.StopUnmuteTimer(GuildId, id);
}
return RedirectToAction("Index");
}
}
}
|
mit
|
C#
|
f8e2931e60f885f618cd3a679cc51174c83d9948
|
Refactor notification object and add methods for static property changed event
|
emoacht/SnowyImageCopy
|
Source/SnowyImageCopy/Common/NotificationObject.cs
|
Source/SnowyImageCopy/Common/NotificationObject.cs
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace SnowyImageCopy.Common
{
public abstract class NotificationObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetPropertyValue<T>(ref T storage, in T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(storage, value))
return false;
storage = value;
RaisePropertyChanged(propertyName);
return true;
}
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
protected static bool SetPropertyValue<T>(ref T storage, in T value, EventHandler<PropertyChangedEventArgs> handler, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(storage, value))
return false;
storage = value;
RaisePropertyChanged(handler, propertyName);
return true;
}
protected static void RaisePropertyChanged(EventHandler<PropertyChangedEventArgs> handler, [CallerMemberName] string propertyName = null) =>
handler?.Invoke(null, new PropertyChangedEventArgs(propertyName));
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace SnowyImageCopy.Common
{
public abstract class NotificationObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void SetPropertyValue<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(storage, value))
return;
storage = value;
RaisePropertyChanged(propertyName);
}
protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
{
if (propertyExpression is null)
throw new ArgumentNullException(nameof(propertyExpression));
if (!(propertyExpression.Body is MemberExpression memberExpression))
throw new ArgumentException("The expression is not a member access expression.", nameof(propertyExpression));
RaisePropertyChanged(memberExpression.Member.Name);
}
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
|
mit
|
C#
|
9c4c947b55de5a1f3491f6b5610e2e3d89987c18
|
Test the hub
|
Community-Manager/NCS-Server,Community-Manager/NCS-Server
|
Source/Server/NeighboursCommunitySystem.API/Hubs/StickyNotesHub.cs
|
Source/Server/NeighboursCommunitySystem.API/Hubs/StickyNotesHub.cs
|
namespace NeighboursCommunitySystem.API.Hubs
{
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
[HubName("stickyNotesHub")]
public class StickyNotesHub : Hub
{
public void VoteProposal()
{
//var context = GlobalHost.ConnectionManager.GetHubContext<StickyNotesHub>();
this.Clients.Others.refresh();
}
public void AddProposal()
{
//var context = GlobalHost.ConnectionManager.GetHubContext<StickyNotesHub>();
this.Clients.Others.refreshAndRedirect();
}
public override Task OnConnected()
{
return (base.OnConnected());
}
}
}
|
namespace NeighboursCommunitySystem.API.Hubs
{
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
[HubName("stickyNotesHub")]
public class StickyNotesHub : Hub
{
public void VoteProposal()
{
var context = GlobalHost.ConnectionManager.GetHubContext<StickyNotesHub>();
context.Clients.All.refresh();
}
public void AddProposal()
{
var context = GlobalHost.ConnectionManager.GetHubContext<StickyNotesHub>();
context.Clients.All.refreshAndRedirect();
}
public override Task OnConnected()
{
return (base.OnConnected());
}
}
}
|
mit
|
C#
|
747fa3689557faefb15c184bc362d3d16f8bdaa2
|
Define 'System.Char'
|
jonathanvdc/flame-llvm,jonathanvdc/flame-llvm,jonathanvdc/flame-llvm
|
stdlib/corlib/Integers.cs
|
stdlib/corlib/Integers.cs
|
// This file makes use of the LeMP 'unroll' macro to avoid copy-pasting code.
// See http://ecsharp.net/lemp/avoid-tedium-with-LeMP.html for an explanation.
#importMacros(LeMP);
namespace System
{
unroll ((TYPE, NAME, DESCRIPTION) in (
(sbyte, SByte, "a signed 8-bit integer"),
(byte, Byte, "an unsigned 8-bit integer"),
(short, Int16, "a signed 16-bit integer"),
(ushort, UInt16, "an unsigned 16-bit integer"),
(int, Int32, "a signed 32-bit integer"),
(uint, UInt32, "an unsigned 32-bit integer"),
(long, Int64, "a signed 64-bit integer"),
(ulong, UInt64, "an unsigned 64-bit integer"),
(char, Char, "a UTF-16 character")))
{
[#trivia_doc_comment("<summary>\nRepresents " + DESCRIPTION + ".\n</summary>")]
public struct NAME : Object, IEquatable<NAME>
{
// Note: integers are equivalent to instances of this data structure because
// flame-llvm stores the contents of single-field structs as a value of their
// field, rather than as an LLVM struct. So a SIZE-bit integer becomes an iSIZE
// and so does a `System.NAME`. But don't add, remove, or edit the fields in this
// struct.
private TYPE value;
/// <summary>
/// Converts this integer to a string representation.
/// </summary>
/// <returns>The string representation for the integer.</returns>
public sealed override string ToString()
{
return Convert.ToString(value);
}
/// <inheritdoc/>
public bool Equals(NAME other)
{
return value == other.value;
}
/// <inheritdoc/>
public sealed override bool Equals(Object other)
{
return other is NAME && Equals((NAME)other);
}
/// <inheritdoc/>
public sealed override int GetHashCode()
{
return (int)value;
}
}
}
}
|
// This file makes use of the LeMP 'unroll' macro to avoid copy-pasting code.
// See http://ecsharp.net/lemp/avoid-tedium-with-LeMP.html for an explanation.
#importMacros(LeMP);
namespace System
{
unroll ((TYPE, NAME, DESCRIPTION) in (
(sbyte, SByte, "a signed 8-bit"),
(byte, Byte, "an unsigned 8-bit"),
(short, Int16, "a signed 16-bit"),
(ushort, UInt16, "an unsigned 16-bit"),
(int, Int32, "a signed 32-bit"),
(uint, UInt32, "an unsigned 32-bit"),
(long, Int64, "a signed 64-bit"),
(ulong, UInt64, "an unsigned 64-bit")))
{
[#trivia_doc_comment("<summary>\nRepresents " + DESCRIPTION + " integer.\n</summary>")]
public struct NAME : Object, IEquatable<NAME>
{
// Note: integers are equivalent to instances of this data structure because
// flame-llvm stores the contents of single-field structs as a value of their
// field, rather than as an LLVM struct. So a SIZE-bit integer becomes an iSIZE
// and so does a `System.NAME`. But don't add, remove, or edit the fields in this
// struct.
private TYPE value;
/// <summary>
/// Converts this integer to a string representation.
/// </summary>
/// <returns>The string representation for the integer.</returns>
public sealed override string ToString()
{
return Convert.ToString(value);
}
/// <inheritdoc/>
public bool Equals(NAME other)
{
return value == other.value;
}
/// <inheritdoc/>
public sealed override bool Equals(Object other)
{
return other is NAME && Equals((NAME)other);
}
/// <inheritdoc/>
public sealed override int GetHashCode()
{
return (int)value;
}
}
}
}
|
mit
|
C#
|
6a85f5ca8bf2a9506ed55d9a60f870b820326e2b
|
Add null checks to prevent nullrefexception in automated test
|
smoogipoo/osu,peppy/osu-new,smoogipooo/osu,ppy/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu
|
osu.Game.Tournament/Components/TournamentModDisplay.cs
|
osu.Game.Tournament/Components/TournamentModDisplay.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Components
{
public class TournamentModDisplay : CompositeDrawable
{
public string ModAcronym;
[Resolved]
private LadderInfo ladderInfo { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
var texture = textures.Get($"mods/{ModAcronym}");
if (texture != null)
{
AddInternal(new Sprite
{
FillMode = FillMode.Fit,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Texture = texture
});
}
else
{
var ruleset = rulesets.AvailableRulesets.FirstOrDefault(r => r == ladderInfo.Ruleset.Value);
if (ruleset == null)
return;
var modIcon = ruleset.CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
if (modIcon == null)
return;
AddInternal(new ModIcon(modIcon)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.5f)
});
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets;
using osu.Game.Rulesets.UI;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Components
{
public class TournamentModDisplay : CompositeDrawable
{
public string ModAcronym;
[Resolved]
private LadderInfo ladderInfo { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
var texture = textures.Get($"mods/{ModAcronym}");
if (texture != null)
{
AddInternal(new Sprite
{
FillMode = FillMode.Fit,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Texture = texture
});
}
else
{
var modIcon = rulesets.GetRuleset(ladderInfo.Ruleset.Value.ID ?? 0).CreateInstance().GetAllMods().FirstOrDefault(mod => mod.Acronym == ModAcronym);
AddInternal(new ModIcon(modIcon)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.5f)
});
}
}
}
}
|
mit
|
C#
|
f388e118e7ff8be4f8b70e4ae52c5d1f6726ffe6
|
update version
|
curit/ExocortexDSP
|
src/AssemblyInfo.cs
|
src/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
//
// 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("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
//
// 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("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
|
bsd-3-clause
|
C#
|
6a2f5e0c3c980a176e36257b0b197f4a04896b0b
|
Add the ability to move objects relative to the camera
|
PearMed/Pear-Interaction-Engine
|
Scripts/EventListeners/Move.cs
|
Scripts/EventListeners/Move.cs
|
using Pear.InteractionEngine.Utils;
using UnityEngine;
using Pear.InteractionEngine.Events;
using Pear.InteractionEngine.Interactions;
namespace Pear.InteractionEngine.EventListeners
{
/// <summary>
/// Move based on the change in event
/// </summary>
public class Move : MonoBehaviour, IEventListener<Vector3>
{
[Tooltip("Move speed")]
public float MoveSpeed = 1f;
[Tooltip("Only move in a single direction based on the maximum direciton of the move vector")]
public bool SingleDirection = false;
[Tooltip("True if the direction is relative to the source. World axis used otherwise.")]
public bool RelativeToSource = true;
[Tooltip("Relative to camera")]
public bool RelativeToCamera = true;
// Movement velocity
private Vector3 _velocity = Vector3.zero;
// Anchor to move
private Anchor _anchor;
private void Start()
{
_anchor = transform.GetOrAddComponent<ObjectWithAnchor>().AnchorElement;
}
/// <summary>
/// Move this object based on the velocity
/// </summary>
private void Update()
{
Vector3 velocity = RelativeToCamera ? Camera.main.transform.TransformDirection(_velocity) : _velocity;
_anchor.transform.Translate(velocity * MoveSpeed * Time.deltaTime);
}
/// <summary>
/// Move the object based on the supplied vector
/// </summary>
/// <param name="args">Event args</param>
public void ValueChanged(EventArgs<Vector3> args)
{
_velocity = SingleDirection ? GetMaximumDirection(args.NewValue) : args.NewValue;
_velocity = RelativeToSource ? args.Source.transform.TransformVector(_velocity) : _velocity;
}
/// <summary>
/// Gets a vector with the maximum dimension non-zero and all other dimensions set to 0
/// </summary>
/// <param name="moveVector">Vector to update</param>
/// <returns>a vector with the maximum dimension non-zero and all other dimensions set to 0</returns>
private Vector3 GetMaximumDirection(Vector3 moveVector)
{
Vector3 moveValue = moveVector;
float absX = Mathf.Abs(moveValue.x);
float absY = Mathf.Abs(moveValue.y);
if (absX >= moveValue.y && absX >= moveValue.z)
moveValue.y = moveValue.z = 0;
else if (absY >= moveValue.x && absY >= moveValue.z)
moveValue.x = moveValue.z = 0;
else
moveValue.x = moveValue.y = 0;
return moveValue;
}
}
}
|
using Pear.InteractionEngine.Utils;
using UnityEngine;
using Pear.InteractionEngine.Events;
using Pear.InteractionEngine.Interactions;
namespace Pear.InteractionEngine.EventListeners
{
/// <summary>
/// Move based on the change in event
/// </summary>
public class Move : MonoBehaviour, IEventListener<Vector3>
{
[Tooltip("Move speed")]
public float MoveSpeed = 1f;
[Tooltip("Only move in a single direction based on the meximum direciton of the move vector")]
public bool SingleDirection = false;
[Tooltip("True if the direction is relative to the source. World axis used otherwise.")]
public bool RelativeToSource = true;
// Movement velocity
private Vector3 _velocity = Vector3.zero;
// Anchor to move
private Anchor _anchor;
private void Start()
{
_anchor = transform.GetOrAddComponent<ObjectWithAnchor>().AnchorElement;
}
/// <summary>
/// Move this object based on the velocity
/// </summary>
private void Update()
{
_anchor.transform.position += _velocity * MoveSpeed * Time.deltaTime;
}
/// <summary>
/// Move the object based on the supplied vector
/// </summary>
/// <param name="args">Event args</param>
public void ValueChanged(EventArgs<Vector3> args)
{
_velocity = SingleDirection ? GetMaximumDirection(args.NewValue) : args.NewValue;
_velocity = RelativeToSource ? args.Source.transform.TransformVector(_velocity) : _velocity;
}
/// <summary>
/// Gets a vector with the maximum dimension non-zero and all other dimensions set to 0
/// </summary>
/// <param name="moveVector">Vector to update</param>
/// <returns>a vector with the maximum dimension non-zero and all other dimensions set to 0</returns>
private Vector3 GetMaximumDirection(Vector3 moveVector)
{
Vector3 moveValue = moveVector;
float absX = Mathf.Abs(moveValue.x);
float absY = Mathf.Abs(moveValue.y);
if (absX >= moveValue.y && absX >= moveValue.z)
moveValue.y = moveValue.z = 0;
else if (absY >= moveValue.x && absY >= moveValue.z)
moveValue.x = moveValue.z = 0;
else
moveValue.x = moveValue.y = 0;
return moveValue;
}
}
}
|
mit
|
C#
|
a00bf4c13494f2223b60fd0600823cb7e8e97424
|
Update TODO
|
OrleansContrib/Orleankka,ElanHasson/Orleankka,OrleansContrib/Orleankka,llytvynenko/Orleankka,mhertis/Orleankka,mhertis/Orleankka,pkese/Orleankka,yevhen/Orleankka,ElanHasson/Orleankka,yevhen/Orleankka,llytvynenko/Orleankka,AntyaDev/Orleankka,pkese/Orleankka,AntyaDev/Orleankka
|
Source/Orleankka.Tests/TODO.cs
|
Source/Orleankka.Tests/TODO.cs
|
using System;
using System.Linq;
using NUnit.Framework;
namespace Orleankka
{
[TestFixture]
public class TodoFixture
{
[Test, Ignore]
public void TypeCode()
{
// - Make sure Orleans' TypeCodeOverride is utilized.
}
[Test, Ignore]
public void Flavors()
{
// - Introduce flavors: permutations of all possible host configurations. Check it by creating actors with various flavors.
// You can dynamically generate assembly with all possible permutations and then register it. And then simply check the type of the host returned.
// - There is a single attribute that cannot be placed on class: UnorderedAttribute. Make your own, such as DelieveryOrderAgnostic
// Contribute to Orleans by making it placeable on a class, if that will be ok for the owners.
}
}
}
|
using System;
using System.Linq;
using NUnit.Framework;
namespace Orleankka
{
[TestFixture]
public class TodoFixture
{
[Test, Ignore]
public void Reminders()
{
// + Check Reminders. Introduce explicit assembly registration. Enumerate types and use type name as typecode.
// - Make sure Orleans' TypeCodeOverride is utilized.
}
[Test, Ignore]
public void Flavors()
{
// - Introduce flavors: permutations of all possible host configurations. Check it by creating actors with various flavors.
// You can dynamically generate assembly with all possible permutations and then register it. And then simply check the type of the host returned.
// - There is a single attribute that cannot be placed on class: UnorderedAttribute. Make your own, such as DelieveryOrderAgnostic
// Contribute to Orleans by making it placeable on a class, if that will be ok for the owners.
}
}
}
|
apache-2.0
|
C#
|
bc6a01983bb1171023fb9e69c6b2c89757e96863
|
fix nav by role
|
mjmilan/crisischeckin,HTBox/crisischeckin,brunck/crisischeckin,brunck/crisischeckin,andrewhart098/crisischeckin,HTBox/crisischeckin,mjmilan/crisischeckin,andrewhart098/crisischeckin,andrewhart098/crisischeckin,HTBox/crisischeckin,mjmilan/crisischeckin,brunck/crisischeckin
|
crisischeckin/crisicheckinweb/Views/Shared/_VolunteerLayout.cshtml
|
crisischeckin/crisicheckinweb/Views/Shared/_VolunteerLayout.cshtml
|
@using System.Web.Optimization
@{
Layout = "/Views/Shared/_Layout.cshtml";
}
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Crisis Check-In</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
@Html.MenuItem("View Volunteers", "ListbyDisaster", "Volunteer")
</ul>
@Html.Partial("_LoginStatus")
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
@RenderBody()
</div>
@section scripts {
@RenderSection("scripts", required: false)
}
@section styles {
@RenderSection("styles", required: false)
}
|
@using System.Web.Optimization
@{
Layout = "/Views/Shared/_Layout.cshtml";
}
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Crisis Check-In</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
@Html.MenuItem("Home (Disaster List)", "List", "Disaster")
</ul>
@Html.Partial("_LoginStatus")
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container">
@RenderBody()
</div>
@section scripts {
@RenderSection("scripts", required: false)
}
@section styles {
@RenderSection("styles", required: false)
}
|
apache-2.0
|
C#
|
4ec9494966cc91b7d9043783260229c59ab10d96
|
Bump version to 0.9.0
|
ar3cka/Journalist
|
src/SolutionInfo.cs
|
src/SolutionInfo.cs
|
// <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.9.0")]
[assembly: AssemblyInformationalVersionAttribute("0.9.0")]
[assembly: AssemblyFileVersionAttribute("0.9.0")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.9.0";
}
}
|
// <auto-generated/>
using System.Reflection;
[assembly: AssemblyProductAttribute("Journalist")]
[assembly: AssemblyVersionAttribute("0.8.5")]
[assembly: AssemblyInformationalVersionAttribute("0.8.5")]
[assembly: AssemblyFileVersionAttribute("0.8.5")]
[assembly: AssemblyCompanyAttribute("Anton Mednonogov")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.8.5";
}
}
|
apache-2.0
|
C#
|
23aaef081b104eb8965e2a55673258a929a5b497
|
Fix (code) typo and avoid infinite recursion on SupportsVideo[Max|Min]FrameDuration properties
|
mono/maccore,cwensley/maccore,jorik041/maccore
|
src/AVFoundation/AVCaptureConnection.cs
|
src/AVFoundation/AVCaptureConnection.cs
|
//
// AVCaptureConnection: Extensions to the class
//
// Authors:
// Miguel de Icaza
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011-2012, 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 MonoMac.ObjCRuntime;
namespace MonoMac.AVFoundation {
public partial class AVCaptureConnection {
public bool SupportsVideoMinFrameDuration {
get {
if (RespondsToSelector (new Selector ("isVideoMinFrameDurationSupported")))
return _SupportsVideoMinFrameDuration;
return false;
}
}
public bool SupportsVideoMaxFrameDuration {
get {
if (RespondsToSelector (new Selector ("isVideoMaxFrameDurationSupported")))
return _SupportsVideoMaxFrameDuration;
return false;
}
}
[Obsolete ("Use InputPorts")]
public AVCaptureInputPort [] inputPorts {
get { return InputPorts; }
}
}
}
|
//
// AVCaptureConnection: Extensions to the class
//
// Authors:
// Miguel de Icaza
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2011-2012, 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 MonoMac.ObjCRuntime;
namespace MonoMac.AVFoundation {
public partial class AVCaptureConnection {
public bool SupportsVideoMinFrameDuration {
get {
if (RespondsToSelector (new Selector ("isVideoMinFrameDurationSupported")))
return SupportsVideoMinFrameDuration;
return false;
}
}
public bool SupportsVideoMaxFrameDuration {
get {
if (RespondsToSelector (new Selector ("isVideoMaxFrameDurationSupported")))
return SupportsVideoMinFrameDuration;
return false;
}
}
[Obsolete ("Use InputPorts")]
public AVCaptureInputPort [] inputPorts {
get { return InputPorts; }
}
}
}
|
apache-2.0
|
C#
|
72bf6fc6ea3b29666825477b1cf5af3b3f555870
|
Add namespace
|
insthync/LiteNetLibManager,insthync/LiteNetLibManager
|
Scripts/LiteNetLibServer.cs
|
Scripts/LiteNetLibServer.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LiteNetLib;
using LiteNetLib.Utils;
using LiteNetLibHighLevel.Utils;
namespace LiteNetLibHighLevel
{
public class LiteNetLibServer : INetEventListener
{
public LiteNetLibManager Manager { get; protected set; }
public NetManager NetManager { get; protected set; }
public LiteNetLibServer(LiteNetLibManager manager, int maxConnections, string connectKey)
{
this.Manager = manager;
NetManager = new NetManager(this, maxConnections, connectKey);
}
public void OnNetworkError(NetEndPoint endPoint, int socketErrorCode)
{
if (Manager.LogError) Debug.LogError("[" + Manager.name + "] LiteNetLibServer::OnNetworkError endPoint: " + endPoint + " socketErrorCode " + socketErrorCode);
Manager.OnServerNetworkError(endPoint, socketErrorCode);
}
public void OnNetworkLatencyUpdate(NetPeer peer, int latency)
{
}
public void OnNetworkReceive(NetPeer peer, NetDataReader reader)
{
Manager.ServerReadPacket(peer, reader);
}
public void OnNetworkReceiveUnconnected(NetEndPoint remoteEndPoint, NetDataReader reader, UnconnectedMessageType messageType)
{
if (messageType == UnconnectedMessageType.DiscoveryRequest)
Manager.OnServerReceivedDiscoveryRequest(remoteEndPoint, StringBytesConverter.ConvertToString(reader.Data));
}
public void OnPeerConnected(NetPeer peer)
{
if (Manager.LogInfo) Debug.Log("[" + Manager.name + "] LiteNetLibServer::OnPeerConnected peer.ConnectId: " + peer.ConnectId);
Manager.AddPeer(peer);
Manager.OnServerConnected(peer);
}
public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
{
if (Manager.LogInfo) Debug.Log("[" + Manager.name + "] LiteNetLibServer::OnPeerDisconnected peer.ConnectId: " + peer.ConnectId + " disconnectInfo.Reason: " + disconnectInfo.Reason);
Manager.RemovePeer(peer);
Manager.OnServerDisconnected(peer, disconnectInfo);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LiteNetLib;
using LiteNetLib.Utils;
namespace LiteNetLibHighLevel
{
public class LiteNetLibServer : INetEventListener
{
public LiteNetLibManager Manager { get; protected set; }
public NetManager NetManager { get; protected set; }
public LiteNetLibServer(LiteNetLibManager manager, int maxConnections, string connectKey)
{
this.Manager = manager;
NetManager = new NetManager(this, maxConnections, connectKey);
}
public void OnNetworkError(NetEndPoint endPoint, int socketErrorCode)
{
if (Manager.LogError) Debug.LogError("[" + Manager.name + "] LiteNetLibServer::OnNetworkError endPoint: " + endPoint + " socketErrorCode " + socketErrorCode);
Manager.OnServerNetworkError(endPoint, socketErrorCode);
}
public void OnNetworkLatencyUpdate(NetPeer peer, int latency)
{
}
public void OnNetworkReceive(NetPeer peer, NetDataReader reader)
{
Manager.ServerReadPacket(peer, reader);
}
public void OnNetworkReceiveUnconnected(NetEndPoint remoteEndPoint, NetDataReader reader, UnconnectedMessageType messageType)
{
if (messageType == UnconnectedMessageType.DiscoveryRequest)
Manager.OnServerReceivedDiscoveryRequest(remoteEndPoint, StringBytesConverter.ConvertToString(reader.Data));
}
public void OnPeerConnected(NetPeer peer)
{
if (Manager.LogInfo) Debug.Log("[" + Manager.name + "] LiteNetLibServer::OnPeerConnected peer.ConnectId: " + peer.ConnectId);
Manager.AddPeer(peer);
Manager.OnServerConnected(peer);
}
public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
{
if (Manager.LogInfo) Debug.Log("[" + Manager.name + "] LiteNetLibServer::OnPeerDisconnected peer.ConnectId: " + peer.ConnectId + " disconnectInfo.Reason: " + disconnectInfo.Reason);
Manager.RemovePeer(peer);
Manager.OnServerDisconnected(peer, disconnectInfo);
}
}
}
|
mit
|
C#
|
654ec80cb9ad1dde844a5b39a11c121def68be80
|
implement DebugIDTag writing
|
Alexx999/SwfSharp
|
SwfSharp/Tags/DebugIDTag.cs
|
SwfSharp/Tags/DebugIDTag.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SwfSharp.Utils;
namespace SwfSharp.Tags
{
public class DebugIDTag : SwfTag
{
public byte[] Uuid { get; set; }
public DebugIDTag(int size)
: base(TagType.DebugID, size)
{
}
internal override void FromStream(BitReader reader, byte swfVersion)
{
Uuid = reader.ReadBytes(16);
}
internal override void ToStream(BitWriter writer, byte swfVersion)
{
writer.WriteBytes(Uuid);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SwfSharp.Utils;
namespace SwfSharp.Tags
{
public class DebugIDTag : SwfTag
{
public byte[] Uuid { get; set; }
public DebugIDTag(int size)
: base(TagType.DebugID, size)
{
}
internal override void FromStream(BitReader reader, byte swfVersion)
{
Uuid = reader.ReadBytes(16);
}
internal override void ToStream(BitWriter writer, byte swfVersion)
{
throw new NotImplementedException();
}
}
}
|
mit
|
C#
|
121ea935ed127a0377f65b49c45906d18b2fc66e
|
Make LogEnrollment virtual
|
metageek-llc/Magpie,ashokgelal/Magpie
|
src/Magpie/Magpie/Services/AnalyticsLogger.cs
|
src/Magpie/Magpie/Services/AnalyticsLogger.cs
|
using MagpieUpdater.Interfaces;
using MagpieUpdater.Models;
namespace MagpieUpdater.Services
{
public class AnalyticsLogger : IAnalyticsLogger
{
public virtual void LogDownloadNow()
{
}
public virtual void LogUserSkipsUpdate(Channel channel)
{
}
public virtual void LogRemindMeLater()
{
}
public virtual void LogContinueWithInstallation()
{
}
public virtual void LogOldVersion(string oldVersion)
{
}
public virtual void LogNewVersion(string s)
{
}
public virtual void LogAppTitle(string mySuperAwesomeApp)
{
}
public virtual void LogUpdateCancelled()
{
}
public virtual void LogUpdateAvailable(Channel channel)
{
}
public virtual void LogEnrollment(Enrollment enrollment)
{
}
}
}
|
using MagpieUpdater.Interfaces;
using MagpieUpdater.Models;
namespace MagpieUpdater.Services
{
public class AnalyticsLogger : IAnalyticsLogger
{
public virtual void LogDownloadNow()
{
}
public virtual void LogUserSkipsUpdate(Channel channel)
{
}
public virtual void LogRemindMeLater()
{
}
public virtual void LogContinueWithInstallation()
{
}
public virtual void LogOldVersion(string oldVersion)
{
}
public virtual void LogNewVersion(string s)
{
}
public virtual void LogAppTitle(string mySuperAwesomeApp)
{
}
public virtual void LogUpdateCancelled()
{
}
public virtual void LogUpdateAvailable(Channel channel)
{
}
public void LogEnrollment(Enrollment enrollment)
{
}
}
}
|
mit
|
C#
|
ebd9ab3625d9940ce5189fbfc9795132d2f81656
|
Fix tutorial compile error
|
l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,l8s/Eto,bbqchickenrobot/Eto-1,PowerOfCode/Eto,bbqchickenrobot/Eto-1
|
Tutorials/Tutorial2/Main.cs
|
Tutorials/Tutorial2/Main.cs
|
using System;
using Eto.Forms;
using Eto.Drawing;
using Eto;
namespace Tutorial2
{
public class MyCommand : Command
{
public MyCommand()
{
MenuText = "C&lick Me";
ToolBarText = "Click Me";
ToolTip = "This shows a dialog for no reason";
//Icon = Icon.FromResource ("MyResourceName.ico");
Shortcut = Application.Instance.CommonModifier | Keys.M; // control+M or cmd+M
}
protected override void OnExecuted(EventArgs e)
{
base.OnExecuted(e);
MessageBox.Show(Application.Instance.MainForm, "You clicked me!", "Tutorial 2", MessageBoxButtons.OK);
}
}
public class MyForm : Form
{
public MyForm()
{
ClientSize = new Size(600, 400);
Title = "Menus and Toolbars";
Menu = CreateMenu();
ToolBar = CreateToolBar();
}
MenuBar CreateMenu()
{
var menu = MenuBar.CreateStandardMenu();
// add command to file sub-menu
var file = menu.Items.GetSubmenu("&File");
file.Items.Add(new MyCommand());
return menu;
}
ToolBar CreateToolBar()
{
var toolbar = new ToolBar();
toolbar.Items.Add(new MyCommand());
return toolbar;
}
}
class MainClass
{
[STAThread]
public static void Main(string[] args)
{
var app = new Application();
app.Initialized += delegate
{
app.MainForm = new MyForm();
app.MainForm.Show();
};
app.Run(args);
}
}
}
|
using System;
using Eto.Forms;
using Eto.Drawing;
using Eto;
namespace Tutorial2
{
public class MyCommand : Command
{
public MyCommand()
{
MenuText = "C&lick Me";
ToolBarText = "Click Me";
ToolTip = "This shows a dialog for no reason";
//Icon = Icon.FromResource ("MyResourceName.ico");
Shortcut = Application.Instance.CommonModifier | Keys.M; // control+M or cmd+M
}
public override void OnExecuted(EventArgs e)
{
base.OnExecuted(e);
MessageBox.Show(Application.Instance.MainForm, "You clicked me!", "Tutorial 2", MessageBoxButtons.OK);
}
}
public class MyForm : Form
{
public MyForm()
{
ClientSize = new Size(600, 400);
Title = "Menus and Toolbars";
Menu = CreateMenu();
ToolBar = CreateToolBar();
}
MenuBar CreateMenu()
{
var menu = MenuBar.CreateStandardMenu();
// add command to file sub-menu
var file = menu.Items.GetSubmenu("&File");
file.Items.Add(new MyCommand());
return menu;
}
ToolBar CreateToolBar()
{
var toolbar = new ToolBar();
toolbar.Items.Add(new MyCommand());
return toolbar;
}
}
class MainClass
{
[STAThread]
public static void Main(string[] args)
{
var app = new Application();
app.Initialized += delegate
{
app.MainForm = new MyForm();
app.MainForm.Show();
};
app.Run(args);
}
}
}
|
bsd-3-clause
|
C#
|
7f80d4990a885c066be7967472f71bbb6f540fd4
|
Fix getState
|
octoblu/meshblu-connector-skype,octoblu/meshblu-connector-skype
|
src/csharp/get-state.cs
|
src/csharp/get-state.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Lync.Model;
using Microsoft.Lync.Model.Conversation;
using Microsoft.Lync.Model.Conversation.AudioVideo;
using Microsoft.Lync.Model.Extensibility;
public class Startup
{
public async Task<object> Invoke()
{
var Client = LyncClient.GetClient();
Thread.Sleep(3000);
Conversation conversation = Client.ConversationManager.Conversations.FirstOrDefault();
var participant = conversation.Participants.Where(p => p.IsSelf).FirstOrDefault();
var videoChannel = ((AVModality)conversation.Modalities[ModalityTypes.AudioVideo]).VideoChannel;
return new {
conversationId = conversation.Properties[ConversationProperty.Id].ToString(),
meetingUrl = conversation.Properties[ConversationProperty.ConferencingUri].ToString(),
audioEnabled = participant.IsMuted,
videoEnabled = videoChannel.IsContributing,
};
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Lync.Model;
using Microsoft.Lync.Model.Conversation;
using Microsoft.Lync.Model.Conversation.AudioVideo;
using Microsoft.Lync.Model.Extensibility;
public class Startup
{
public async Task<object> Invoke(string conversationId)
{
var Client = LyncClient.GetClient();
Thread.Sleep(3000);
Conversation conversation = Client.ConversationManager.Conversations.FirstOrDefault();
var participant = conversation.Participants.Where(p => p.IsSelf).FirstOrDefault();
var videoChannel = ((AVModality)conversation.Modalities[ModalityTypes.AudioVideo]).VideoChannel;
return new {
conversationId = conversation.Properties[ConversationProperty.Id].ToString(),
meetingUrl = conversation.Properties[ConversationProperty.ConferencingUri].ToString(),
audioEnabled = participant.IsMuted,
videoEnabled = videoChannel.IsContributing,
};
}
}
|
mit
|
C#
|
f268a3d8dc7c10348a30b73b46cfafd5843d9c9b
|
Reformat IBuckets
|
coryrwest/B2.NET
|
src/IBuckets.cs
|
src/IBuckets.cs
|
using B2Net.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace B2Net {
public interface IBuckets {
Task<B2Bucket> Create(string bucketName, B2BucketOptions options, CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Create(string bucketName, BucketTypes bucketType, CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Delete(string bucketId = "", CancellationToken cancelToken = default(CancellationToken));
Task<List<B2Bucket>> GetList(CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Update(B2BucketOptions options, string bucketId = "", CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Update(BucketTypes bucketType, string bucketId = "", CancellationToken cancelToken = default(CancellationToken));
}
}
|
using B2Net.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace B2Net
{
public interface IBuckets
{
Task<B2Bucket> Create(string bucketName, B2BucketOptions options, CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Create(string bucketName, BucketTypes bucketType, CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Delete(string bucketId = "", CancellationToken cancelToken = default(CancellationToken));
Task<List<B2Bucket>> GetList(CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Update(B2BucketOptions options, string bucketId = "", CancellationToken cancelToken = default(CancellationToken));
Task<B2Bucket> Update(BucketTypes bucketType, string bucketId = "", CancellationToken cancelToken = default(CancellationToken));
}
}
|
mit
|
C#
|
4cf40af36b2a6bc8eb1bacd833afab06ae42fa40
|
Improve TracRevisionLog textual !ChangeLog format (1/3): Refactoring log_changelog.cs to use the ClearSilver ''with'' command.
|
dafrito/trac-mirror,exocad/exotrac,moreati/trac-gitsvn,exocad/exotrac,dafrito/trac-mirror,exocad/exotrac,moreati/trac-gitsvn,dokipen/trac,dokipen/trac,dokipen/trac,dafrito/trac-mirror,moreati/trac-gitsvn,moreati/trac-gitsvn,exocad/exotrac,dafrito/trac-mirror
|
templates/log_changelog.cs
|
templates/log_changelog.cs
|
#
# ChangeLog for <?cs var:log.path ?>
#
# Generated by Trac <?cs var:trac.version ?>
# <?cs var:trac.time ?>
#
<?cs each:item = $log.items ?>
<?cs with:changeset = log.changes[item.rev] ?>
<?cs var:changeset.date ?> <?cs
var:changeset.author ?> [<?cs var:item.rev ?>]
<?cs each:file = $changeset.files ?>
* <?cs var:file ?>:<?cs
/each ?>
<?cs var:changeset.message ?>
<?cs /with ?>
<?cs /each ?>
|
#
# ChangeLog for <?cs var:log.path ?>
#
# Generated by Trac <?cs var:trac.version ?>
# <?cs var:trac.time ?>
#
<?cs each:item = $log.items ?>
<?cs var:log.changes[item.rev].date ?> <?cs
var:log.changes[item.rev].author ?> [<?cs var:item.rev ?>]
<?cs each:file = $log.changes[item.rev].files ?>
* <?cs var:file ?>:<?cs
/each ?>
<?cs var:log.changes[item.rev].message ?>
<?cs /each ?>
|
bsd-3-clause
|
C#
|
13cb7a0348579cd1f41a133d1b5ab7829b744e37
|
Update assembly info
|
deadsurgeon42/SummonLimit
|
Properties/AssemblyInfo.cs
|
Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SummonLimit")]
[assembly: AssemblyDescription("Prevents summon hacking.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SummonLimit")]
[assembly: AssemblyCopyright("Copyright © Newy 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0edb49ef-4289-41f2-bb14-a8e9fd3a52ac")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.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("SummonLimit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SummonLimit")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0edb49ef-4289-41f2-bb14-a8e9fd3a52ac")]
// 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#
|
c97ea6bb36427903479d0f601b760ca49a6df709
|
Add kernel load
|
Branimir123/ZobShop,Branimir123/ZobShop,Branimir123/ZobShop
|
src/ZobShop.Web/App_Start/NinjectWebCommon.cs
|
src/ZobShop.Web/App_Start/NinjectWebCommon.cs
|
using WebFormsMvp.Binder;
using ZobShop.Web.App_Start.NinjectModules;
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(ZobShop.Web.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(ZobShop.Web.App_Start.NinjectWebCommon), "Stop")]
namespace ZobShop.Web.App_Start
{
using System;
using System.Web;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
using Ninject;
using Ninject.Web.Common;
public static class NinjectWebCommon
{
private static readonly Bootstrapper bootstrapper = new Bootstrapper();
/// <summary>
/// Starts the application
/// </summary>
public static void Start()
{
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
bootstrapper.Initialize(CreateKernel);
}
/// <summary>
/// Stops the application.
/// </summary>
public static void Stop()
{
bootstrapper.ShutDown();
}
/// <summary>
/// Creates the kernel that will manage your application.
/// </summary>
/// <returns>The created kernel.</returns>
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
try
{
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
RegisterServices(kernel);
return kernel;
}
catch
{
kernel.Dispose();
throw;
}
}
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Load(new MvpNinjectModule());
kernel.Load(new DataNinjectModule());
PresenterBinder.Factory = kernel.Get<IPresenterFactory>();
}
}
}
|
using WebFormsMvp.Binder;
using ZobShop.Web.App_Start.NinjectModules;
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(ZobShop.Web.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(ZobShop.Web.App_Start.NinjectWebCommon), "Stop")]
namespace ZobShop.Web.App_Start
{
using System;
using System.Web;
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
using Ninject;
using Ninject.Web.Common;
public static class NinjectWebCommon
{
private static readonly Bootstrapper bootstrapper = new Bootstrapper();
/// <summary>
/// Starts the application
/// </summary>
public static void Start()
{
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
bootstrapper.Initialize(CreateKernel);
}
/// <summary>
/// Stops the application.
/// </summary>
public static void Stop()
{
bootstrapper.ShutDown();
}
/// <summary>
/// Creates the kernel that will manage your application.
/// </summary>
/// <returns>The created kernel.</returns>
private static IKernel CreateKernel()
{
var kernel = new StandardKernel();
try
{
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
RegisterServices(kernel);
return kernel;
}
catch
{
kernel.Dispose();
throw;
}
}
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Load(new MvpNinjectModule());
PresenterBinder.Factory = kernel.Get<IPresenterFactory>();
}
}
}
|
mit
|
C#
|
98813222afbeadbf823af00724fa23a4a9a55bbd
|
Adjust comment
|
peppy/osu,ZLima12/osu,peppy/osu,smoogipoo/osu,peppy/osu,NeoAdonis/osu,smoogipooo/osu,2yangk23/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu-new,UselessToucan/osu,smoogipoo/osu,EVAST9919/osu,2yangk23/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,EVAST9919/osu,johnneijzen/osu,UselessToucan/osu,ppy/osu,ZLima12/osu
|
osu.Game/Skinning/SkinReloadableDrawable.cs
|
osu.Game/Skinning/SkinReloadableDrawable.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 osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Skinning
{
/// <summary>
/// A drawable which has a callback when the skin changes.
/// </summary>
public abstract class SkinReloadableDrawable : CompositeDrawable
{
private readonly Func<ISkinSource, bool> allowFallback;
private ISkinSource skin;
/// <summary>
/// Whether fallback to default skin should be allowed if the custom skin is missing this resource.
/// </summary>
private bool allowDefaultFallback => allowFallback == null || allowFallback.Invoke(skin);
/// <summary>
/// Create a new <see cref="SkinReloadableDrawable"/>
/// </summary>
/// <param name="allowFallback">A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present.</param>
protected SkinReloadableDrawable(Func<ISkinSource, bool> allowFallback = null)
{
this.allowFallback = allowFallback;
}
[BackgroundDependencyLoader]
private void load(ISkinSource source)
{
skin = source;
skin.SourceChanged += onChange;
}
private void onChange() =>
// schedule required to avoid calls after disposed.
// note that this has the side-effect of components only performing a skin change when they are alive.
Scheduler.AddOnce(() => SkinChanged(skin, allowDefaultFallback));
protected override void LoadAsyncComplete()
{
base.LoadAsyncComplete();
SkinChanged(skin, allowDefaultFallback);
}
/// <summary>
/// Called when a change is made to the skin.
/// </summary>
/// <param name="skin">The new skin.</param>
/// <param name="allowFallback">Whether fallback to default skin should be allowed if the custom skin is missing this resource.</param>
protected virtual void SkinChanged(ISkinSource skin, bool allowFallback)
{
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (skin != null)
skin.SourceChanged -= onChange;
}
}
}
|
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Skinning
{
/// <summary>
/// A drawable which has a callback when the skin changes.
/// </summary>
public abstract class SkinReloadableDrawable : CompositeDrawable
{
private readonly Func<ISkinSource, bool> allowFallback;
private ISkinSource skin;
/// <summary>
/// Whether fallback to default skin should be allowed if the custom skin is missing this resource.
/// </summary>
private bool allowDefaultFallback => allowFallback == null || allowFallback.Invoke(skin);
/// <summary>
/// Create a new <see cref="SkinReloadableDrawable"/>
/// </summary>
/// <param name="allowFallback">A conditional to decide whether to allow fallback to the default implementation if a skinned element is not present.</param>
protected SkinReloadableDrawable(Func<ISkinSource, bool> allowFallback = null)
{
this.allowFallback = allowFallback;
}
[BackgroundDependencyLoader]
private void load(ISkinSource source)
{
skin = source;
skin.SourceChanged += onChange;
}
private void onChange() =>
// schedule required to avoid calls after disposed.
// note that this has the side-effect of components only performance a skin change when they are alive.
Scheduler.AddOnce(() => SkinChanged(skin, allowDefaultFallback));
protected override void LoadAsyncComplete()
{
base.LoadAsyncComplete();
SkinChanged(skin, allowDefaultFallback);
}
/// <summary>
/// Called when a change is made to the skin.
/// </summary>
/// <param name="skin">The new skin.</param>
/// <param name="allowFallback">Whether fallback to default skin should be allowed if the custom skin is missing this resource.</param>
protected virtual void SkinChanged(ISkinSource skin, bool allowFallback)
{
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (skin != null)
skin.SourceChanged -= onChange;
}
}
}
|
mit
|
C#
|
e3e381a7e7e1ab58798d266bd344ac59dcfed09b
|
Remove extra casts
|
dipeshc/BTDeploy
|
src/MonoTorrent.Dht/MonoTorrent.Dht/Tasks/AnnounceTask.cs
|
src/MonoTorrent.Dht/MonoTorrent.Dht/Tasks/AnnounceTask.cs
|
using MonoTorrent.Dht.Messages;
using System.Collections.Generic;
using MonoTorrent.BEncoding;
namespace MonoTorrent.Dht
{
internal class AnnounceTask : Task
{
NodeId infoHash;
DhtEngine engine;
public AnnounceTask(DhtEngine engine, byte[] infohash)
: this(engine, new NodeId(infohash))
{
}
public AnnounceTask(DhtEngine engine, NodeId infohash)
{
this.engine = engine;
this.infoHash = infohash;
}
public override void Execute()
{
engine.PeersFound += PeerFound;
IList<Node> nodes = engine.RoutingTable.GetClosest(infoHash);
foreach(Node n in nodes)
{
GetPeers m = new GetPeers(engine.RoutingTable.LocalNode.Id, infoHash);
engine.MessageLoop.EnqueueSend(m, n);
}
}
public void PeerFound(object sender, PeersFoundEventArgs e)
{
Node node = (Node)sender;
AnnouncePeer apmsg = new AnnouncePeer(engine.RoutingTable.LocalNode.Id, infoHash, engine.Port, node.Token);
engine.MessageLoop.EnqueueSend(apmsg, node);
RaiseComplete(new TaskCompleteEventArgs(this));
}
public void NodeFound(object sender, NodeFoundEventArgs e)
{
GetPeers gpmsg = new GetPeers(engine.RoutingTable.LocalNode.Id, infoHash);
engine.MessageLoop.EnqueueSend(gpmsg, e.Node);
}
protected override void RaiseComplete(TaskCompleteEventArgs e)
{
engine.PeersFound -= PeerFound;
base.RaiseComplete(e);
}
}
}
|
using MonoTorrent.Dht.Messages;
using System.Collections.Generic;
using MonoTorrent.BEncoding;
namespace MonoTorrent.Dht
{
internal class AnnounceTask : Task
{
NodeId infoHash;
DhtEngine engine;
public AnnounceTask(DhtEngine engine, byte[] infohash)
: this(engine, new NodeId(infohash))
{
}
public AnnounceTask(DhtEngine engine, NodeId infohash)
{
this.engine = engine;
this.infoHash = infohash;
}
public override void Execute()
{
engine.PeersFound += PeerFound;
IList<Node> nodes = engine.RoutingTable.GetClosest(infoHash);
foreach(Node n in nodes)
{
GetPeers m = new GetPeers(engine.RoutingTable.LocalNode.Id, infoHash);
engine.MessageLoop.EnqueueSend(m, n);
}
}
public void PeerFound(object sender, PeersFoundEventArgs e)
{
AnnouncePeer apmsg = new AnnouncePeer(engine.RoutingTable.LocalNode.Id, infoHash, engine.Port, ((Node)sender).Token);
engine.MessageLoop.EnqueueSend(apmsg, (Node)sender);
RaiseComplete(new TaskCompleteEventArgs(this));
}
public void NodeFound(object sender, NodeFoundEventArgs e)
{
GetPeers gpmsg = new GetPeers(engine.RoutingTable.LocalNode.Id, infoHash);
engine.MessageLoop.EnqueueSend(gpmsg, e.Node);
}
protected override void RaiseComplete(TaskCompleteEventArgs e)
{
engine.PeersFound -= PeerFound;
base.RaiseComplete(e);
}
}
}
|
mit
|
C#
|
3b56a8463522de3daf7aa9e0595a3f8c2ded2e6e
|
add AccountLegalEntityPublicHashedId to domain apprenticeship
|
SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments,SkillsFundingAgency/das-commitments
|
src/SFA.DAS.Commitments.Domain/Entities/Apprenticeship.cs
|
src/SFA.DAS.Commitments.Domain/Entities/Apprenticeship.cs
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace SFA.DAS.Commitments.Domain.Entities
{
public class Apprenticeship
{
public Apprenticeship()
{
PriceHistory = new List<PriceHistory>();
}
public long Id { get; set; }
public long CommitmentId { get; set; }
public long EmployerAccountId { get; set; }
public long ProviderId { get; set; }
public long? TransferSenderId { get; set; }
public string Reference { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? DateOfBirth { get; set; }
public string NINumber { get; set; }
public string ULN { get; set; }
public TrainingType TrainingType { get; set; }
public string TrainingCode { get; set; }
public string TrainingName { get; set; }
public decimal? Cost { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime? PauseDate { get; set; }
public DateTime? StopDate { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public AgreementStatus AgreementStatus { get; set; }
public string EmployerRef { get; set; }
public string ProviderRef { get; set; }
public bool EmployerCanApproveApprenticeship { get; set; }
public bool ProviderCanApproveApprenticeship { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime? AgreedOn { get; set; }
public int PaymentOrder { get; set; }
public Originator? UpdateOriginator { get; set; }
public string ProviderName { get; set; }
public string LegalEntityId { get; set; }
public string LegalEntityName { get; set; }
public string AccountLegalEntityPublicHashedId { get; set; }
public bool DataLockPrice { get; set; }
public bool DataLockPriceTriaged { get; set; }
public bool DataLockCourse { get; set; }
public bool DataLockCourseTriaged { get; set; }
public bool DataLockCourseChangeTriaged { get; set; }
public List<PriceHistory> PriceHistory { get; set; }
public bool HasHadDataLockSuccess { get; set; }
public string EndpointAssessorName { get; set; }
public Apprenticeship Clone()
{
var json = JsonConvert.SerializeObject(this);
return JsonConvert.DeserializeObject<Apprenticeship>(json);
}
}
}
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace SFA.DAS.Commitments.Domain.Entities
{
public class Apprenticeship
{
public Apprenticeship()
{
PriceHistory = new List<PriceHistory>();
}
public long Id { get; set; }
public long CommitmentId { get; set; }
public long EmployerAccountId { get; set; }
public long ProviderId { get; set; }
public long? TransferSenderId { get; set; }
public string Reference { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? DateOfBirth { get; set; }
public string NINumber { get; set; }
public string ULN { get; set; }
public TrainingType TrainingType { get; set; }
public string TrainingCode { get; set; }
public string TrainingName { get; set; }
public decimal? Cost { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public DateTime? PauseDate { get; set; }
public DateTime? StopDate { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public AgreementStatus AgreementStatus { get; set; }
public string EmployerRef { get; set; }
public string ProviderRef { get; set; }
public bool EmployerCanApproveApprenticeship { get; set; }
public bool ProviderCanApproveApprenticeship { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime? AgreedOn { get; set; }
public int PaymentOrder { get; set; }
public Originator? UpdateOriginator { get; set; }
public string ProviderName { get; set; }
public string LegalEntityId { get; set; }
public string LegalEntityName { get; set; }
public bool DataLockPrice { get; set; }
public bool DataLockPriceTriaged { get; set; }
public bool DataLockCourse { get; set; }
public bool DataLockCourseTriaged { get; set; }
public bool DataLockCourseChangeTriaged { get; set; }
public List<PriceHistory> PriceHistory { get; set; }
public bool HasHadDataLockSuccess { get; set; }
public string EndpointAssessorName { get; set; }
public Apprenticeship Clone()
{
var json = JsonConvert.SerializeObject(this);
return JsonConvert.DeserializeObject<Apprenticeship>(json);
}
}
}
|
mit
|
C#
|
a9bff4e6a1ad903c6ba4a3b7995481d49ae72191
|
Fix for the DefaultViewAttribute throws bug.
|
ZocDoc/ServiceStack,ZocDoc/ServiceStack,NServiceKit/NServiceKit,nataren/NServiceKit,timba/NServiceKit,timba/NServiceKit,timba/NServiceKit,MindTouch/NServiceKit,nataren/NServiceKit,nataren/NServiceKit,MindTouch/NServiceKit,NServiceKit/NServiceKit,nataren/NServiceKit,MindTouch/NServiceKit,timba/NServiceKit,MindTouch/NServiceKit,NServiceKit/NServiceKit,ZocDoc/ServiceStack,NServiceKit/NServiceKit,ZocDoc/ServiceStack
|
src/ServiceStack.ServiceInterface/DefaultViewAttribute.cs
|
src/ServiceStack.ServiceInterface/DefaultViewAttribute.cs
|
using System;
using ServiceStack.ServiceHost;
namespace ServiceStack.ServiceInterface
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class DefaultViewAttribute : RequestFilterAttribute
{
public string View { get; set; }
public string Template { get; set; }
public DefaultViewAttribute() { }
public DefaultViewAttribute(string view) : this(view, null) { }
public DefaultViewAttribute(string view, string template)
{
View = view;
Template = template;
}
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto)
{
if (!string.IsNullOrEmpty(View))
{
object currentView;
if (!req.Items.TryGetValue("View", out currentView) || string.IsNullOrEmpty(currentView as string))
req.Items["View"] = View;
}
if (!string.IsNullOrEmpty(Template))
{
object currentTemplate;
if (!req.Items.TryGetValue("Template", out currentTemplate) || string.IsNullOrEmpty(currentTemplate as string))
req.Items["Template"] = Template;
}
}
}
}
|
using System;
using ServiceStack.ServiceHost;
namespace ServiceStack.ServiceInterface
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public class DefaultViewAttribute : RequestFilterAttribute
{
public string View { get; set; }
public string Template { get; set; }
public DefaultViewAttribute() { }
public DefaultViewAttribute(string view) : this(view, null) { }
public DefaultViewAttribute(string view, string template)
{
View = view;
Template = template;
}
public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto)
{
if (!string.IsNullOrEmpty(View) && string.IsNullOrEmpty(req.Items["View"] as string))
req.Items["View"] = View;
if (!string.IsNullOrEmpty(Template) && string.IsNullOrEmpty(req.Items["Template"] as string))
req.Items["Template"] = Template;
}
}
}
|
bsd-3-clause
|
C#
|
d01bdd80570940dc02a807fc760d0204f7f49a3b
|
Add useful doc comment about NameInModule.
|
marekr/atpgm.avrxml
|
RegisterGroup.cs
|
RegisterGroup.cs
|
#region License Information (MIT)
/*
The MIT License (MIT)
Copyright (c) 2014 Marek Roszko
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.
*/
#endregion License Information (MIT)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Globalization;
namespace atpgm.avrxml
{
[Serializable()]
public class RegisterGroup
{
[XmlAttribute("name")]
public string Name = "";
/// <summary>
/// Name of the matching module
/// in the "modules" section of the device file
/// </summary>
[XmlAttribute("name-in-module")]
public string NameInModule = "";
[XmlAttribute("address-space")]
public string AddressSpace = "";
[XmlIgnore]
public UInt32 Offset = 0;
[XmlAttribute("offset")]
public string OffsetAsString
{
get
{
return "0x" + Offset.ToString("X");
}
set
{
Offset = UInt32.Parse(value.Replace("0x", ""), NumberStyles.HexNumber);
}
}
[XmlElement("register")]
public List<Register> Registers { get; set; }
}
}
|
#region License Information (MIT)
/*
The MIT License (MIT)
Copyright (c) 2014 Marek Roszko
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.
*/
#endregion License Information (MIT)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Globalization;
namespace atpgm.avrxml
{
[Serializable()]
public class RegisterGroup
{
[XmlAttribute("name")]
public string Name = "";
[XmlAttribute("name-in-module")]
public string NameInModule = "";
[XmlAttribute("address-space")]
public string AddressSpace = "";
[XmlIgnore]
public UInt32 Offset = 0;
[XmlAttribute("offset")]
public string OffsetAsString
{
get
{
return "0x" + Offset.ToString("X");
}
set
{
Offset = UInt32.Parse(value.Replace("0x", ""), NumberStyles.HexNumber);
}
}
[XmlElement("register")]
public List<Register> Registers { get; set; }
}
}
|
mit
|
C#
|
6e1ced534a10ce3ca96109cb701e7371b2da0613
|
Delete commented out doc code
|
LBreedlove/Toml.net
|
Toml/Document.cs
|
Toml/Document.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toml
{
/// <summary>
/// The root group for a Toml document.
/// </summary>
public class Document : Group
{
public static Document Create()
{
return new Document(string.Empty);
}
private Document(string name)
: base(name)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toml
{
/*
public class Document : Group
{
#region Private Members
/// <summary>
/// The Groups contained in this document.
/// </summary>
private Dictionary<string, Group> _groups;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the Toml Document class.
/// </summary>
/// <param name="key">The key that uniquely identifies the document.</param>
internal Document(string name)
{
this.Name = name;
_groups = new Dictionary<string, Group>();
}
#endregion
#region Properties
/// <summary>
/// Gets the KeyValuePairs that define the groups.
/// </summary>
public IEnumerable<KeyValuePair<string, Group>> Groups
{
get
{
return _groups.Select
(
(g) =>
{
return new KeyValuePair<string, Group>(g.Key, g.Value);
}
);
}
}
#endregion
#region Public Methods
/// <summary>
/// Attempts to add the specified group to the Document.
/// </summary>
/// <param name="group">The Group to add to the Document.</param>
public Group CreateGroup(string key)
{
IEnumerable<string> keyParts = key.Split(Group.Separators, StringSplitOptions.RemoveEmptyEntries);
Group rootGroup = _groups[keyParts.First()];
if (rootGroup == null)
{
rootGroup = new Group(keyParts.First());
_groups.Add(keyParts.First(), rootGroup);
return rootGroup.CreateGroup(keyParts.Skip(1));
}
return rootGroup.CreateGroup(keyParts.Skip(1));
}
/// <summary>
/// Attempts to retrieve the group with the specified key.
/// </summary>
/// <param name="key">The key of the group to retrieve.</param>
/// <param name="result">Contains the located Group on output.</param>
/// <returns>true if the Group is found, otherwise false.</returns>
public bool TryGetGroup(string key, out Group result)
{
result = null;
IEnumerable<string> keyParts = key.Split(Group.Separators, StringSplitOptions.RemoveEmptyEntries);
Group rootGroup = _groups[keyParts.First()];
if (rootGroup == null)
{
return false;
}
return rootGroup.TryGetGroup(keyParts.Skip(1), out result);
}
/// <summary>
/// Indicates whether or not the specified group exists in the Document.
/// </summary>
/// <param name="groupKey">The key of the Group to search for.</param>
/// <returns>true if a Group with the specified key is found, otherwise false.</returns>
public bool Exists(string key)
{
IEnumerable<string> keyParts = key.Split(Group.Separators, StringSplitOptions.RemoveEmptyEntries);
Group rootGroup = _groups[keyParts.First()];
if (rootGroup == null)
{
return false;
}
return rootGroup.GroupExists(keyParts.Skip(1));
}
#endregion
}
*/
public class Document : Group
{
public static Document Create()
{
return new Document(string.Empty);
}
private Document(string name)
: base(name)
{
}
}
}
|
mit
|
C#
|
746058ff6da172951d7b346085f7f44b023ff679
|
Allow multiple files on the command line.
|
otac0n/Weave
|
Weave/Program.cs
|
Weave/Program.cs
|
// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
// Copyright © 2013 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Weave
{
using System.IO;
using Weave.Compiler;
using Weave.Parser;
internal class Program
{
private static void Main(string[] args)
{
foreach (var arg in args)
{
var input = File.ReadAllText(arg);
var parser = new WeaveParser();
var parsed = parser.Parse(input, arg);
var output = WeaveCompiler.Compile(parsed);
File.WriteAllText(arg + ".cs", output.Code);
}
}
}
}
|
// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
// Copyright © 2013 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Weave
{
using System.IO;
using Weave.Compiler;
using Weave.Parser;
internal class Program
{
private static void Main(string[] args)
{
var input = File.ReadAllText(args[0]);
var parser = new WeaveParser();
var parsed = parser.Parse(input);
var output = WeaveCompiler.Compile(parsed);
File.WriteAllText(args[0] + ".cs", output.Code);
}
}
}
|
mit
|
C#
|
cb19d3dd0df79b3155c6d518b654a23fb3f31c45
|
resolve name #51
|
richardschneider/net-ipfs-core
|
src/CoreApi/IGenericApi.cs
|
src/CoreApi/IGenericApi.cs
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Ipfs.CoreApi
{
/// <summary>
/// Some miscellaneous methods.
/// </summary>
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md">Generic API spec</seealso>
public interface IGenericApi
{
/// <summary>
/// Information about an IPFS peer.
/// </summary>
/// <param name="peer">
/// The id of the IPFS peer. If not specified (e.g. null), then the local
/// peer is used.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the <see cref="Peer"/> information.
/// </returns>
Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken));
/// <summary>
/// Get the version information.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// a <see cref="Dictionary{TKey, TValue}"/> of values.
/// </returns>
Task<Dictionary<string, string>> VersionAsync(CancellationToken cancel = default(CancellationToken));
/// <summary>
/// Stop the IPFS peer.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task ShutdownAsync();
/// <summary>
/// Resolve a name.
/// </summary>
/// <param name="name">
/// The name to resolve.
/// </param>
/// <param name="recursive">
/// Resolve until the result is an IPFS name. Defaults to <b>false</b>.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the resolved path as a <see cref="string"/>.
/// </returns>
/// <remarks>
/// The <paramref name="name"/> can be <see cref="Cid"/> + [path], "/ipfs/..." or
/// "/ipns/...".
/// </remarks>
Task<string> ResolveAsync(
string name,
bool recursive = false,
CancellationToken cancel = default(CancellationToken)
);
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Ipfs.CoreApi
{
/// <summary>
/// Some miscellaneous methods.
/// </summary>
/// <seealso href="https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md">Generic API spec</seealso>
public interface IGenericApi
{
/// <summary>
/// Information about an IPFS peer.
/// </summary>
/// <param name="peer">
/// The id of the IPFS peer. If not specified (e.g. null), then the local
/// peer is used.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// the <see cref="Peer"/> information.
/// </returns>
Task<Peer> IdAsync(MultiHash peer = null, CancellationToken cancel = default(CancellationToken));
/// <summary>
/// Get the version information.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation. The task's value is
/// a <see cref="Dictionary{TKey, TValue}"/> of values.
/// </returns>
Task<Dictionary<string, string>> VersionAsync(CancellationToken cancel = default(CancellationToken));
/// <summary>
/// Stop the IPFS peer.
/// </summary>
/// <returns>
/// A task that represents the asynchronous operation.
/// </returns>
Task ShutdownAsync();
}
}
|
mit
|
C#
|
004f851325a3148cf0ab84ac84d7eb0824afa592
|
Fix item not removed bug #629
|
Caliburn-Micro/Caliburn.Micro,serenabenny/Caliburn.Micro
|
src/Caliburn.Micro.Core/ConductorBaseWithActiveItem.cs
|
src/Caliburn.Micro.Core/ConductorBaseWithActiveItem.cs
|
using System.Threading;
using System.Threading.Tasks;
namespace Caliburn.Micro
{
/// <summary>
/// A base class for various implementations of <see cref="IConductor"/> that maintain an active item.
/// </summary>
/// <typeparam name="T">The type that is being conducted.</typeparam>
public abstract class ConductorBaseWithActiveItem<T> : ConductorBase<T>, IConductActiveItem where T : class
{
private T _activeItem;
/// <summary>
/// The currently active item.
/// </summary>
public T ActiveItem
{
get => _activeItem;
set => ActivateItemAsync(value, CancellationToken.None);
}
/// <summary>
/// The currently active item.
/// </summary>
/// <value></value>
object IHaveActiveItem.ActiveItem
{
get => ActiveItem;
set => ActiveItem = (T)value;
}
/// <summary>
/// Changes the active item.
/// </summary>
/// <param name="newItem">The new item to activate.</param>
/// <param name="closePrevious">Indicates whether or not to close the previous active item.</param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
protected virtual async Task ChangeActiveItemAsync(T newItem, bool closePrevious, CancellationToken cancellationToken)
{
await ScreenExtensions.TryDeactivateAsync(_activeItem, closePrevious, cancellationToken);
var oldItem = _activeItem;
newItem = EnsureItem(newItem);
_activeItem = newItem;
NotifyOfPropertyChange(nameof(ActiveItem));
if (IsActive)
await ScreenExtensions.TryActivateAsync(newItem, cancellationToken);
await DeactivateItemAsync(oldItem, closePrevious, cancellationToken);
OnActivationProcessed(_activeItem, true);
}
/// <summary>
/// Changes the active item.
/// </summary>
/// <param name="newItem">The new item to activate.</param>
/// <param name="closePrevious">Indicates whether or not to close the previous active item.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
protected Task ChangeActiveItemAsync(T newItem, bool closePrevious) => ChangeActiveItemAsync(newItem, closePrevious, default);
}
}
|
using System.Threading;
using System.Threading.Tasks;
namespace Caliburn.Micro
{
/// <summary>
/// A base class for various implementations of <see cref="IConductor"/> that maintain an active item.
/// </summary>
/// <typeparam name="T">The type that is being conducted.</typeparam>
public abstract class ConductorBaseWithActiveItem<T> : ConductorBase<T>, IConductActiveItem where T : class
{
private T _activeItem;
/// <summary>
/// The currently active item.
/// </summary>
public T ActiveItem
{
get => _activeItem;
set => ActivateItemAsync(value, CancellationToken.None);
}
/// <summary>
/// The currently active item.
/// </summary>
/// <value></value>
object IHaveActiveItem.ActiveItem
{
get => ActiveItem;
set => ActiveItem = (T)value;
}
/// <summary>
/// Changes the active item.
/// </summary>
/// <param name="newItem">The new item to activate.</param>
/// <param name="closePrevious">Indicates whether or not to close the previous active item.</param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
protected virtual async Task ChangeActiveItemAsync(T newItem, bool closePrevious, CancellationToken cancellationToken)
{
await ScreenExtensions.TryDeactivateAsync(_activeItem, closePrevious, cancellationToken);
newItem = EnsureItem(newItem);
_activeItem = newItem;
NotifyOfPropertyChange(nameof(ActiveItem));
if (IsActive)
await ScreenExtensions.TryActivateAsync(newItem, cancellationToken);
OnActivationProcessed(_activeItem, true);
}
/// <summary>
/// Changes the active item.
/// </summary>
/// <param name="newItem">The new item to activate.</param>
/// <param name="closePrevious">Indicates whether or not to close the previous active item.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
protected Task ChangeActiveItemAsync(T newItem, bool closePrevious) => ChangeActiveItemAsync(newItem, closePrevious, default);
}
}
|
mit
|
C#
|
ace88367cf26b2ac86393187f20a15eab59de990
|
add initial model to MasterSubscribe
|
leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net
|
src/JoinRpg.Portal/Views/GameSubscribe/ByMaster.cshtml
|
src/JoinRpg.Portal/Views/GameSubscribe/ByMaster.cshtml
|
@model JoinRpg.Web.Models.Subscribe.SubscribeByMasterPageViewModel
@{
ViewBag.Title = "Настройки подписок";
}
<h2>@ViewBag.Title</h2>
@Html.DisplayFor(model => model.UserDetails)
<h3>Подписки</h3>
<component type="typeof(JoinRpg.Web.GameSubscribe.MasterSubscribeList)"
render-mode="WebAssemblyPrerendered"
param-ProjectId="@Model.SubscribeList.ProjectId"
param-MasterId="@Model.SubscribeList.MasterId"
param-InitialModel="@Model.SubscribeList "
/>
@section Scripts {
<script src="/_framework/blazor.webassembly.js"></script>
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
<script src="/Scripts/blazor-interop.js"></script>
}
|
@model JoinRpg.Web.Models.Subscribe.SubscribeByMasterPageViewModel
@{
ViewBag.Title = "Настройки подписок";
}
<h2>@ViewBag.Title</h2>
@Html.DisplayFor(model => model.UserDetails)
<h3>Подписки</h3>
<component type="typeof(JoinRpg.Web.GameSubscribe.MasterSubscribeList)"
render-mode="WebAssemblyPrerendered"
param-ProjectId="@Model.SubscribeList.ProjectId"
param-MasterId="@Model.SubscribeList.MasterId" />
@section Scripts {
<script src="/_framework/blazor.webassembly.js"></script>
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
<script src="/Scripts/blazor-interop.js"></script>
}
|
mit
|
C#
|
d528b98c64111639546197caa07ad4b438ed5ec8
|
Use SwaggerRootBuilder
|
catcherwong/Nancy.Swagger,pinnstrat/snap-nancy-swagger,yahehe/Nancy.Swagger,khellang/Nancy.Swagger
|
src/Nancy.Swagger/Services/SwaggerMetadataConverter.cs
|
src/Nancy.Swagger/Services/SwaggerMetadataConverter.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Swagger.ObjectModel;
using Swagger.ObjectModel.Builders;
namespace Nancy.Swagger.Services
{
[SwaggerApi]
public abstract class SwaggerMetadataConverter : ISwaggerMetadataConverter
{
public SwaggerRoot GetSwaggerJson()
{
var builder = new SwaggerRootBuilder();
foreach (var kvp in RetrieveSwaggerRouteData())
{
builder.Path(kvp.Key, kvp.Value);
}
builder.Info(new Info()
{
Title = "No title set",
Version = "0.1"
});
return builder.Build();
}
protected abstract IDictionary<string, PathItem> RetrieveSwaggerRouteData();
private static Type GetType(Type type)
{
if (type.IsContainer())
{
return type.GetElementType() ?? type.GetGenericArguments().First();
}
return type;
}
private SwaggerModelData EnsureModelData(Type type, IList<SwaggerModelData> modelData)
{
return modelData.FirstOrDefault(x => x.ModelType == type) ?? new SwaggerModelData(type);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Swagger.ObjectModel;
namespace Nancy.Swagger.Services
{
[SwaggerApi]
public abstract class SwaggerMetadataConverter : ISwaggerMetadataConverter
{
public SwaggerRoot GetSwaggerJson()
{
return new SwaggerRoot
{
Paths = RetrieveSwaggerRouteData(),
Info = new Info()
{
Title = "No title set",
Version = "0.1"
}
};
}
protected abstract IDictionary<string, PathItem> RetrieveSwaggerRouteData();
private static Type GetType(Type type)
{
if (type.IsContainer())
{
return type.GetElementType() ?? type.GetGenericArguments().First();
}
return type;
}
private SwaggerModelData EnsureModelData(Type type, IList<SwaggerModelData> modelData)
{
return modelData.FirstOrDefault(x => x.ModelType == type) ?? new SwaggerModelData(type);
}
}
}
|
mit
|
C#
|
3b536e24f2c59fffa27dff259ed38fa71bc2b1fa
|
Make Translate method receive any object.
|
Secullum/secullum-i18n,Secullum/secullum-i18n
|
dotnet/Secullum.Internationalization/Translator.cs
|
dotnet/Secullum.Internationalization/Translator.cs
|
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Secullum.Internationalization
{
public class Translator
{
private static Dictionary<string, Dictionary<string, string>> expressionsByLanguage = new Dictionary<string, Dictionary<string, string>>();
private static Dictionary<string, string> dateFormatsByLanguage = new Dictionary<string, string>();
private static Regex regexPlaceholder = new Regex(@"\{(\d)\}", RegexOptions.Compiled);
public static void AddResource(string language, string resourceName)
{
using (var resourceStream = Assembly.GetEntryAssembly().GetManifestResourceStream(resourceName))
using (var streamReader = new StreamReader(resourceStream, Encoding.UTF8))
{
var resourceContent = JsonConvert.DeserializeObject<JObject>(streamReader.ReadToEnd());
dateFormatsByLanguage[language] = resourceContent.Value<string>("dateFormat");
expressionsByLanguage[language] = new Dictionary<string, string>();
foreach (JProperty expression in resourceContent["expressions"])
{
expressionsByLanguage[language].Add(expression.Name, expression.Value.ToString());
}
}
}
public static string Translate(string expression, params object[] args)
{
var translatedExpresssion = expression;
if (expressionsByLanguage[GetCurrentLanguageKey()].ContainsKey(expression))
{
translatedExpresssion = expressionsByLanguage[GetCurrentLanguageKey()][expression];
}
return regexPlaceholder.Replace(translatedExpresssion, match => {
var argIndex = int.Parse(match.Groups[1].Value);
return args[argIndex].ToString();
});
}
public static string GetDateFormat()
{
return dateFormatsByLanguage[GetCurrentLanguageKey()];
}
private static string GetCurrentLanguageKey()
{
return CultureInfo.CurrentCulture.Name.Substring(0, 2).ToLower();
}
}
}
|
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Secullum.Internationalization
{
public class Translator
{
private static Dictionary<string, Dictionary<string, string>> expressionsByLanguage = new Dictionary<string, Dictionary<string, string>>();
private static Dictionary<string, string> dateFormatsByLanguage = new Dictionary<string, string>();
private static Regex regexPlaceholder = new Regex(@"\{(\d)\}", RegexOptions.Compiled);
public static void AddResource(string language, string resourceName)
{
using (var resourceStream = Assembly.GetEntryAssembly().GetManifestResourceStream(resourceName))
using (var streamReader = new StreamReader(resourceStream, Encoding.UTF8))
{
var resourceContent = JsonConvert.DeserializeObject<JObject>(streamReader.ReadToEnd());
dateFormatsByLanguage[language] = resourceContent.Value<string>("dateFormat");
expressionsByLanguage[language] = new Dictionary<string, string>();
foreach (JProperty expression in resourceContent["expressions"])
{
expressionsByLanguage[language].Add(expression.Name, expression.Value.ToString());
}
}
}
public static string Translate(string expression, params string[] args)
{
var translatedExpresssion = expression;
if (expressionsByLanguage[GetCurrentLanguageKey()].ContainsKey(expression))
{
translatedExpresssion = expressionsByLanguage[GetCurrentLanguageKey()][expression];
}
return regexPlaceholder.Replace(translatedExpresssion, match => {
var argIndex = int.Parse(match.Groups[1].Value);
return args[argIndex];
});
}
public static string GetDateFormat()
{
return dateFormatsByLanguage[GetCurrentLanguageKey()];
}
private static string GetCurrentLanguageKey()
{
return CultureInfo.CurrentCulture.Name.Substring(0, 2).ToLower();
}
}
}
|
mit
|
C#
|
5d3861126461611cddfea0f9b4fd6ba3adeb16b2
|
Fix line endings.
|
digibaraka/BotBuilder,jockorob/BotBuilder,mmatkow/BotBuilder,Clairety/ConnectMe,Clairety/ConnectMe,dr-em/BotBuilder,digibaraka/BotBuilder,stevengum97/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,navaei/BotBuilder,Clairety/ConnectMe,yakumo/BotBuilder,msft-shahins/BotBuilder,dr-em/BotBuilder,jockorob/BotBuilder,stevengum97/BotBuilder,yakumo/BotBuilder,digibaraka/BotBuilder,Clairety/ConnectMe,navaei/BotBuilder,stevengum97/BotBuilder,xiangyan99/BotBuilder,navaei/BotBuilder,digibaraka/BotBuilder,xiangyan99/BotBuilder,navaei/BotBuilder,mmatkow/BotBuilder,mmatkow/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,xiangyan99/BotBuilder,yakumo/BotBuilder,jockorob/BotBuilder,dr-em/BotBuilder,msft-shahins/BotBuilder,stevengum97/BotBuilder,jockorob/BotBuilder,mmatkow/BotBuilder,xiangyan99/BotBuilder
|
CSharp/Documentation/Overview.cs
|
CSharp/Documentation/Overview.cs
|
namespace Microsoft.Bot.Builder.Dialogs
{
///
/// \mainpage Getting Started
///
/// <ul style="list-style-type: none;">
/// <li>\ref overview </li>
/// <li>\ref install </li>
/// <li>\ref dialogs </li>
/// <li>\ref forms </li>
/// <li><a href="namespaces.html"><b>Namespaces</b></a></li>
/// <li><a href="annotated.html"><b>Classes</b></a></li>
/// <li><a href="files.html"><b>Source Files</b></a></li>
/// </ul>
///
/// \section overview Overview
///
/// %Microsoft %Bot %Builder is a powerful framework for constructing bots that can handle
/// both freeform interactions and more guided ones where the possibilities are explicitly
/// shown to the user. It is easy to use and leverages C# to provide a natural way to
/// write Bots.
///
/// High Level Features:
/// * Powerful dialog system with dialogs that are isolated and composable.
/// * Built-in dialogs for simple things like Yes/No, strings, numbers, enumerations.
/// * Built-in dialogs that utilize powerful AI frameworks like <a href="http://luis.ai">LUIS</a>.
/// * Bots are stateless which helps them scale.
/// * Form Flow for automatically generating a Bot from a C# class for filling in the class and that supports help, navigation, clarification and confirmation.
/// * Open source found on http://github.com/Microsoft/botbuilder.
///
/// \section install Install
///
/// In order to use the Microsoft Bot Builder you should first follow the install steps in the
/// <a href="http://aka.ms/bf-getting-started-in-c">Getting Started with Bot Connector</a> page to setup your bot.
/// In order to use the framework you need to:
/// 1. Right-click on your project and select "Manage NuGet Packages".
/// 2. In the "Browse" tab, type "Microsoft.Bot.Builder".
/// 3. Click the "Install" button and accept the changes.
///
/// At this point your project has the builder installed and is ready to use it. If you want to understand how
/// to create and use dialogs, see \ref dialogs or if you would like to have a dialog automatically constructed see \ref forms.
///
/// \section troubleshooting_q_and_a Troubleshooting Q & A
///
/// If your question isn't answered here visit our [support page](/support/).
///
/// -----------------
/// \b Question: I have a problem with the builder who should I contact?
///
/// \b Answer: contact fuse labs
///
/// \tableofcontents
///
///
}
|
namespace Microsoft.Bot.Builder.Dialogs
{
///
/// \mainpage Getting Started
///
/// <ul style="list-style-type: none;">
/// <li>\ref overview </li>
/// <li>\ref install </li>
/// <li>\ref dialogs </li>
/// <li>\ref forms </li>
/// <li><a href="namespaces.html"><b>Namespaces</b></a></li>
/// <li><a href="annotated.html"><b>Classes</b></a></li>
/// <li><a href="files.html"><b>Source Files</b></a></li>
/// </ul>
///
/// \section overview Overview
///
/// %Microsoft %Bot %Builder is a powerful framework for constructing bots that can handle
/// both freeform interactions and more guided ones where the possibilities are explicitly
/// shown to the user. It is easy to use and leverages C# to provide a natural way to
/// write Bots.
///
/// High Level Features:
/// * Powerful dialog system with dialogs that are isolated and composable.
/// * Built-in dialogs for simple things like Yes/No, strings, numbers, enumerations.
/// * Built-in dialogs that utilize powerful AI frameworks like <a href="http://luis.ai">LUIS</a>.
/// * Bots are stateless which helps them scale.
/// * Form Flow for automatically generating a Bot from a C# class for filling in the class and that supports help, navigation, clarification and confirmation.
/// * Open source found on http://github.com/Microsoft/botbuilder.
///
/// \section install Install
///
/// In order to use the Microsoft Bot Builder you should first follow the install steps in the
/// <a href="http://aka.ms/bf-getting-started-in-c">Getting Started with Bot Connector</a> page to setup your bot.
/// In order to use the framework you need to:
/// 1. Right-click on your project and select "Manage NuGet Packages".
/// 2. In the "Browse" tab, type "Microsoft.Bot.Builder".
/// 3. Click the "Install" button and accept the changes.
///
/// At this point your project has the builder installed and is ready to use it. If you want to understand how
/// to create and use dialogs, see \ref dialogs or if you would like to have a dialog automatically constructed see \ref forms.
///
/// \section troubleshooting_q_and_a Troubleshooting Q & A
///
/// If your question isn't answered here visit our [support page](/support/).
///
/// -----------------
/// \b Question: I have a problem with the builder who should I contact?
///
/// \b Answer: contact fuse labs
///
/// \tableofcontents
///
///
}
|
mit
|
C#
|
567b3872f7fb9b7f4769ce4086ccb35c06447528
|
Remove unnecessary statuscode assignment
|
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
|
SupportManager.Web/Infrastructure/AdminAreaAccessFilter.cs
|
SupportManager.Web/Infrastructure/AdminAreaAccessFilter.cs
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace SupportManager.Web.Infrastructure;
internal class AdminAreaAccessFilter : IPageFilter
{
public void OnPageHandlerSelected(PageHandlerSelectedContext context)
{
}
public void OnPageHandlerExecuting(PageHandlerExecutingContext context)
{
if (context.ActionDescriptor.AreaName != "Admin") return;
if (context.HttpContext.User.HasClaim(SupportManagerClaimTypes.SuperUser, true.ToString())) return;
context.Result = new ForbidResult();
}
public void OnPageHandlerExecuted(PageHandlerExecutedContext context)
{
}
}
|
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace SupportManager.Web.Infrastructure;
internal class AdminAreaAccessFilter : IPageFilter
{
public void OnPageHandlerSelected(PageHandlerSelectedContext context)
{
}
public void OnPageHandlerExecuting(PageHandlerExecutingContext context)
{
if (context.ActionDescriptor.AreaName != "Admin") return;
if (context.HttpContext.User.HasClaim(SupportManagerClaimTypes.SuperUser, true.ToString())) return;
context.HttpContext.Response.StatusCode = (int) HttpStatusCode.Forbidden;
context.Result = new ForbidResult();
}
public void OnPageHandlerExecuted(PageHandlerExecutedContext context)
{
}
}
|
mit
|
C#
|
83a81cf26a6b3617a9ce65862c07ba8936bb9886
|
Update to new Marshal() API
|
mono/dbus-sharp-glib,mono/dbus-sharp-glib
|
glib/TestExport.cs
|
glib/TestExport.cs
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using GLib;
using Gtk;
using NDesk.DBus;
using org.freedesktop.DBus;
public class TestGLib
{
public static void OnClick (object o, EventArgs args)
{
demo.Say ("Button clicked");
}
static Bus bus;
static DemoObject demo;
public static void Main ()
{
DApplication.Init ();
Application.Init ();
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("DBus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
bus = DApplication.Connection.GetObject<Bus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.Error.WriteLine ("NameAcquired: " + acquired_name);
};
string myName = bus.Hello ();
Console.Error.WriteLine ("myName: " + myName);
ObjectPath myOpath = new ObjectPath ("/org/ndesk/test");
string myNameReq = "org.ndesk.gtest";
if (bus.NameHasOwner (myNameReq)) {
demo = DApplication.Connection.GetObject<DemoObject> (myNameReq, opath);
} else {
NameReply nameReply = bus.RequestName (myNameReq, NameFlag.None);
Console.WriteLine ("nameReply: " + nameReply);
demo = new DemoObject ();
DApplication.Connection.Marshal (demo, myNameReq, opath);
}
Application.Run ();
}
}
[Interface ("org.ndesk.gtest")]
public class DemoObject : MarshalByRefObject
{
public void Say (string text)
{
Console.WriteLine (text);
}
}
|
// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using GLib;
using Gtk;
using NDesk.DBus;
using org.freedesktop.DBus;
public class TestGLib
{
public static void OnClick (object o, EventArgs args)
{
demo.Say ("Button clicked");
}
static Bus bus;
static DemoObject demo;
public static void Main ()
{
DApplication.Init ();
Application.Init ();
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
VBox vb = new VBox (false, 2);
vb.PackStart (btn, false, true, 0);
Window win = new Window ("DBus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
string name = "org.freedesktop.DBus";
bus = DApplication.Connection.GetObject<Bus> (name, opath);
bus.NameAcquired += delegate (string acquired_name) {
Console.Error.WriteLine ("NameAcquired: " + acquired_name);
};
string myName = bus.Hello ();
Console.Error.WriteLine ("myName: " + myName);
string myNameReq = "org.ndesk.gtest";
if (bus.NameHasOwner (myNameReq)) {
demo = DApplication.Connection.GetObject<DemoObject> (myNameReq, opath);
} else {
NameReply nameReply = bus.RequestName (myNameReq, NameFlag.None);
Console.WriteLine ("nameReply: " + nameReply);
demo = new DemoObject ();
DApplication.Connection.Marshal (demo, "org.ndesk.gtest");
}
Application.Run ();
}
}
[Interface ("org.ndesk.gtest")]
public class DemoObject : MarshalByRefObject
{
public void Say (string text)
{
Console.WriteLine (text);
}
}
|
mit
|
C#
|
364747de485f93b2470610ec096f08a62d429484
|
Make the header not suck
|
RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast,RightpointLabs/Pourcast
|
RightpointLabs.Pourcast.Web/Areas/Admin/Views/Shared/_Layout.cshtml
|
RightpointLabs.Pourcast.Web/Areas/Admin/Views/Shared/_Layout.cshtml
|
@using RightpointLabs.Pourcast.Web.Properties
@using System.Web.Optimization
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - @Resources.Application</title>
@Styles.Render("~/Content/css/bootstrap")
@Styles.Render("~/Content/css/bootstrap-theme")
@Scripts.Render("~/bundles/modernizer")
</head>
<body>
<div class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink(Resources.Application, "Index", "Home", null, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Manage Taps", "Index", "Tap")</li>
<li>@Html.ActionLink("Manage Kegs", "Index", "Keg")</li>
<li>@Html.ActionLink("Manage Breweries", "Index", "Brewery")</li>
<li>@Html.ActionLink("Manage Beers", "Index", "Beer")</li>
<li>@Html.ActionLink("Manage Styles", "Index", "Style")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - @Resources.Company | @Resources.Made</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryUI")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
@using RightpointLabs.Pourcast.Web.Properties
@using System.Web.Optimization
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - @Resources.Application</title>
@Styles.Render("~/Content/css/bootstrap")
@Styles.Render("~/Content/css/bootstrap-theme")
@Scripts.Render("~/bundles/modernizer")
</head>
<body>
<div class="navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink(Resources.Application, "Index", "Home", null, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Manage Taps", "Index", "Tap", null, new { @class = "navbar-btn" })</li>
<li>@Html.ActionLink("Manage Kegs", "Index", "Keg", null, new { @class = "navbar-btn" })</li>
<li>@Html.ActionLink("Manage Breweries", "Index", "Brewery", null, new { @class = "navbar-btn" })</li>
<li>@Html.ActionLink("Manage Beers", "Index", "Beer", null, new { @class = "navbar-btn" })</li>
<li>@Html.ActionLink("Manage Styles", "Index", "Style", null, new { @class = "navbar-btn" })</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - @Resources.Company | @Resources.Made</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryUI")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>
|
mit
|
C#
|
6ba82ececf2a2543cfcc9c970e0e2ddb4a8ce78f
|
Make var name more descriptive
|
Konash/arabic-support-unity
|
Assets/ArabicSupport/Scripts/Samples/FixArabic3DText.cs
|
Assets/ArabicSupport/Scripts/Samples/FixArabic3DText.cs
|
using UnityEngine;
using System.Collections;
using ArabicSupport;
public class FixArabic3DText : MonoBehaviour {
public bool showTashkeel = true;
public bool useHinduNumbers = true;
// Use this for initialization
void Start () {
TextMesh textMesh = gameObject.GetComponent<TextMesh>();
string fixedText = ArabicFixer.Fix(textMesh.text, showTashkeel, useHinduNumbers);
gameObject.GetComponent<TextMesh>().text = fixedText;
Debug.Log(fixedFixed);
}
}
|
using UnityEngine;
using System.Collections;
using ArabicSupport;
public class FixArabic3DText : MonoBehaviour {
public bool showTashkeel = true;
public bool useHinduNumbers = true;
// Use this for initialization
void Start () {
TextMesh textMesh = gameObject.GetComponent<TextMesh>();
string fixedFixed = ArabicFixer.Fix(textMesh.text, showTashkeel, useHinduNumbers);
gameObject.GetComponent<TextMesh>().text = fixedFixed;
Debug.Log(fixedFixed);
}
}
|
mit
|
C#
|
7b1d0c3b2d98f92e5df8714519b62b0fe263cd4f
|
Rename file to .css for new stream
|
pvcbuild/pvc-less
|
src/PvcLess.cs
|
src/PvcLess.cs
|
using PvcCore;
using System.Collections.Generic;
using System.IO;
namespace PvcPlugins
{
public class PvcLess : PvcPlugin
{
public override string[] SupportedTags
{
get
{
return new string[] { ".less" };
}
}
public override IEnumerable<PvcStream> Execute(IEnumerable<PvcStream> inputStreams)
{
var lessEngine = new dotless.Core.LessEngine();
var resultStreams = new List<PvcStream>();
foreach (var inputStream in inputStreams)
{
var lessContent = inputStream.ToString();
var cssContent = lessEngine.TransformToCss(lessContent, "");
var newStreamName = Path.Combine(Path.GetDirectoryName(inputStream.StreamName), Path.GetFileNameWithoutExtension(inputStream.StreamName) + ".css");
var resultStream = PvcUtil.StringToStream(cssContent, newStreamName);
resultStreams.Add(resultStream);
}
return resultStreams;
}
}
}
|
using PvcCore;
using System.Collections.Generic;
using System.IO;
namespace PvcPlugins
{
public class PvcLess : PvcPlugin
{
public override string[] SupportedTags
{
get
{
return new string[] { ".less" };
}
}
public override IEnumerable<PvcStream> Execute(IEnumerable<PvcStream> inputStreams)
{
var lessEngine = new dotless.Core.LessEngine();
var resultStreams = new List<PvcStream>();
foreach (var inputStream in inputStreams)
{
var lessContent = inputStream.ToString();
var cssContent = lessEngine.TransformToCss(lessContent, "");
var resultStream = PvcUtil.StringToStream(cssContent, inputStream.StreamName);
resultStreams.Add(resultStream);
}
return resultStreams;
}
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.