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 |
|---|---|---|---|---|---|---|---|---|
b032d70f0b13dc3e69212668c0bb48087d4ee47d | Update AssemblyInfo.cs | DoubleLinePartners/ObjectFiller.NET,blmeyers/ObjectFiller.NET,Tynamix/ObjectFiller.NET,HerrLoesch/ObjectFiller.NET | ObjectFiller/Properties/AssemblyInfo.cs | ObjectFiller/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("ObjectFiller.NET")]
[assembly: AssemblyDescription("Fills your objects with random data and uses a fluent API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tynamix")]
[assembly: AssemblyProduct("ObjectFiller.NET")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("61fcdbaa-891a-459d-baf0-9e4f1ddfdd43")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("ObjectFiller.NET")]
[assembly: AssemblyDescription("Fills your objects with random data and uses a fluent API")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tynamix")]
[assembly: AssemblyProduct("ObjectFiller.NET")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("61fcdbaa-891a-459d-baf0-9e4f1ddfdd43")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| mit | C# |
6d2e0b4cd3700a50508bd416290b6866f3ca0314 | add remote class to sandbox | tarik-s/Meticulous,tarik-s/Basis | SandBoxes/Meticulous.SandBox/Program.cs | SandBoxes/Meticulous.SandBox/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Meticulous.Threading;
namespace Meticulous.SandBox
{
public sealed class Remote<T>
{
private T _value;
public Remote(T value)
{
_value = value;
}
public static implicit operator Remote<T>(T value)
{
return new Remote<T>(value);
}
public static implicit operator T(Remote<T> value)
{
if (value == null)
return default(T);
return value.Value;
}
public event EventHandler<EventArgs> Changed;
public T Value
{
get { return _value; }
}
}
public class RemoteFieldAttribute : Attribute
{
public RemoteFieldAttribute(string name)
{
}
}
class Program
{
[RemoteField("ServerVersion")]
private static readonly Remote<string> _serverVersion = default(string);
static void Main(string[] args)
{
_serverVersion.Changed += delegate(object sender, EventArgs eventArgs)
{
};
using (var q = ExecutionQueue.Create())
{
q.Post(() =>
{
q.Stop();
});
q.Wait();
}
Console.WriteLine("Press any key...");
Console.ReadKey();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Meticulous.Threading;
namespace Meticulous.SandBox
{
class Program
{
static void Main(string[] args)
{
using (var q = ExecutionQueue.Create())
{
q.Post(() =>
{
q.Stop();
});
q.Wait();
}
Console.WriteLine("Press any key...");
Console.ReadKey();
}
}
}
| mit | C# |
57fdc0dcb6a1cc85205304e7c4242e074feb6e81 | switch connection | jefking/King.Azure | King.Azure.Integration.Test/FileShareTests.cs | King.Azure.Integration.Test/FileShareTests.cs | namespace King.Azure.Integration.Test.Data
{
using System;
using System.Threading.Tasks;
using King.Azure.Data;
using NUnit.Framework;
[TestFixture]
public class FileShareTests
{
private const string ConnectionString = "DefaultEndpointsProtocol=https;AccountName=kingdottest;AccountKey=DESdtrm9Rj+pOzS1XGIvnmuzMJN+mvOAlwy75CWJxWKPYmVNQyuSwhUG/UcAzb3/Q1c+pHdMxddvXBzDuwevxQ==;FileEndpoint=https://kingdottest.file.core.windows.net/";
[Test]
public async Task CreateIfNotExists()
{
var random = new Random();
var storage = new FileShare(string.Format("a{0}b", random.Next()), ConnectionString);
var created = await storage.CreateIfNotExists();
Assert.IsTrue(created);
}
}
} | namespace King.Azure.Integration.Test.Data
{
using System;
using System.Threading.Tasks;
using King.Azure.Data;
using NUnit.Framework;
[TestFixture]
public class FileShareTests
{
private const string ConnectionString = "DefaultEndpointsProtocol=https;AccountName=kingdottest;AccountKey=raLQzql5BzvYrHGPxZKJIFHDe/B0+kTpJwGokbQHX5p6EVbx8xOt6XbPKJsUWdyOMTYYEKAvZ7ImqFIfpLGOJQ==;FileEndpoint=https://kingdottest.file.core.windows.net/";
[Test]
public async Task CreateIfNotExists()
{
var random = new Random();
var storage = new FileShare(string.Format("a{0}b", random.Next()), ConnectionString);
var created = await storage.CreateIfNotExists();
Assert.IsTrue(created);
}
}
} | apache-2.0 | C# |
844583240119bece45ae2d4be58b00677a354d80 | Disable multithreading | mstevenson/SeudoBuild | SeudoBuild.Agent/Builder.cs | SeudoBuild.Agent/Builder.cs | using SeudoBuild.Pipeline;
using System.Threading.Tasks;
namespace SeudoBuild.Agent
{
/// <summary>
/// Executes a build pipeline for a given project and target.
/// </summary>
public class Builder : IBuilder
{
/// <summary>
/// Indicates whether a build is current in-progress.
/// </summary>
public bool IsRunning { get; private set; }
IModuleLoader moduleLoader;
ILogger logger;
public Builder(IModuleLoader moduleLoader, ILogger logger)
{
this.moduleLoader = moduleLoader;
this.logger = logger;
}
/// <summary>
/// Execute a build for the given project and target.
/// </summary>
public bool Build(ProjectConfig projectConfig, string target, string outputDirectory)
{
if (projectConfig == null)
{
throw new System.ArgumentException("Could not execute build, projectConfig is null");
}
// Find a valid target
if (string.IsNullOrEmpty(target))
{
try
{
target = projectConfig.BuildTargets[0].TargetName;
}
catch (System.IndexOutOfRangeException)
{
throw new InvalidProjectConfigException("ProjectConfig does not contain a build target.");
}
}
// Execute build
//Task.Factory.StartNew(() =>
//{
IsRunning = true;
PipelineRunner pipeline = new PipelineRunner(new PipelineConfig { OutputDirectory = outputDirectory }, logger);
pipeline.ExecutePipeline(projectConfig, target, moduleLoader);
IsRunning = false;
//});
IsRunning = false;
return true;
}
}
}
| using SeudoBuild.Pipeline;
using System.Threading.Tasks;
namespace SeudoBuild.Agent
{
/// <summary>
/// Executes a build pipeline for a given project and target.
/// </summary>
public class Builder : IBuilder
{
/// <summary>
/// Indicates whether a build is current in-progress.
/// </summary>
public bool IsRunning { get; private set; }
IModuleLoader moduleLoader;
ILogger logger;
public Builder(IModuleLoader moduleLoader, ILogger logger)
{
this.moduleLoader = moduleLoader;
this.logger = logger;
}
/// <summary>
/// Execute a build for the given project and target.
/// </summary>
public bool Build(ProjectConfig projectConfig, string target, string outputDirectory)
{
if (projectConfig == null)
{
throw new System.ArgumentException("Could not execute build, projectConfig is null");
}
// Find a valid target
if (string.IsNullOrEmpty(target))
{
try
{
target = projectConfig.BuildTargets[0].TargetName;
}
catch (System.IndexOutOfRangeException)
{
throw new InvalidProjectConfigException("ProjectConfig does not contain a build target.");
}
}
// Execute build
Task.Factory.StartNew(() =>
{
IsRunning = true;
PipelineRunner pipeline = new PipelineRunner(new PipelineConfig { OutputDirectory = outputDirectory }, logger);
pipeline.ExecutePipeline(projectConfig, target, moduleLoader);
IsRunning = false;
});
IsRunning = false;
return true;
}
}
}
| mit | C# |
a8342548c0c57de925001a67dc0ee9982f07d1b9 | increment cache version | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/CacheVersion.cs | resharper/resharper-unity/src/CacheVersion.cs | using JetBrains.Annotations;
using JetBrains.Application.PersistentMap;
using JetBrains.Serialization;
namespace JetBrains.ReSharper.Plugins.Unity
{
// Cache version
[PolymorphicMarshaller(18)]
public class CacheVersion
{
[UsedImplicitly] public static UnsafeReader.ReadDelegate<object> ReadDelegate = r => new CacheVersion();
[UsedImplicitly] public static UnsafeWriter.WriteDelegate<object> WriteDelegate = (w, o) => { };
}
} | using JetBrains.Annotations;
using JetBrains.Application.PersistentMap;
using JetBrains.Serialization;
namespace JetBrains.ReSharper.Plugins.Unity
{
// Cache version
[PolymorphicMarshaller(17)]
public class CacheVersion
{
[UsedImplicitly] public static UnsafeReader.ReadDelegate<object> ReadDelegate = r => new CacheVersion();
[UsedImplicitly] public static UnsafeWriter.WriteDelegate<object> WriteDelegate = (w, o) => { };
}
} | apache-2.0 | C# |
e93d28957c8c217e0b4956eb9767452234f23a93 | Add convenience ctors to Div | praeclarum/Ooui,praeclarum/Ooui,praeclarum/Ooui | Ooui/Div.cs | Ooui/Div.cs | using System;
using System.Collections.Generic;
namespace Ooui
{
public class Div : Element
{
public Div ()
: base ("div")
{
}
public Div (params Element[] children)
: this ()
{
foreach (var c in children) {
AppendChild (c);
}
}
public Div (IEnumerable<Element> children)
: this ()
{
foreach (var c in children) {
AppendChild (c);
}
}
}
}
| using System;
namespace Ooui
{
public class Div : Element
{
public Div ()
: base ("div")
{
}
}
}
| mit | C# |
5514f3b6f9afac7de7e3053382ab7249e9624714 | Update BuyerOrderReferencedDocument.cs | stephanstapel/ZUGFeRD-csharp,stephanstapel/ZUGFeRD-csharp | ZUGFeRD/BuyerOrderReferencedDocument.cs | ZUGFeRD/BuyerOrderReferencedDocument.cs | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace s2industries.ZUGFeRD
{
public class BuyerOrderReferencedDocument : BaseReferencedDocument
{
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace s2industries.ZUGFeRD
{
public class BuyerOrderReferencedDocument : BaseReferencedDocument
{
}
}
| apache-2.0 | C# |
3ae1a708a7d752fc17d4384ca2a1d122f21806e1 | Add example links to the design-time datacontext | indigotock/AboutDialog.WPF | AboutDialog.WPF/DesignVersionable.cs | AboutDialog.WPF/DesignVersionable.cs | using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
using KyleHughes.AboutDialog.WPF.Properties;
namespace KyleHughes.AboutDialog.WPF
{
/// <summary>
/// A class for extracting data from an Assembly.
/// </summary>
internal sealed class DesignVersionable : IVersionable
{
public BitmapImage Image { get; set; } = null;
public string Product { get; set; } = "A product";
public string Title { get; set; } = "An Assembly";
public string Version { get; set; } = "1.0.3";
public string Description { get; set; } = "A product to do that thing which this product doees";
public string Author { get; set; } = "John Doe";
public string Owner { get; set; } = "A Company, Inc.";
public string License
{
get { return string.Format(Resources.MIT, Environment.NewLine, Copyright); }
set { }
}
public string Copyright
{
get { return $"Copyright \u00a9 {Author} {string.Join(", ", Years)}"; }
set { }
}
public int[] Years { get; set; } = { 2013, 2014, 2015 };
public bool ShowYearsAsRange { get; set; } = true;
public IList<Tuple<string, Uri>> Links
{
get { return new List<Tuple<string, Uri>>
{
new Tuple<string, Uri>("Link 1", new Uri("http://example.com/")),
new Tuple<string, Uri>("Link 2", new Uri("http://example.com/"))
}; }
set { }
}
}
} | using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
using KyleHughes.AboutDialog.WPF.Properties;
namespace KyleHughes.AboutDialog.WPF
{
/// <summary>
/// A class for extracting data from an Assembly.
/// </summary>
internal sealed class DesignVersionable : IVersionable
{
public BitmapImage Image { get; set; } = null;
public string Product { get; set; } = "A product";
public string Title { get; set; } = "An Assembly";
public string Version { get; set; } = "1.0.3";
public string Description { get; set; } = "A product to do that thing which this product doees";
public string Author { get; set; } = "John Doe";
public string Owner { get; set; } = "A Company, Inc.";
public string License
{
get { return string.Format(Resources.MIT, Environment.NewLine, Copyright); }
set { }
}
public string Copyright
{
get { return $"Copyright \u00a9 {Author} {string.Join(", ", Years)}"; }
set { }
}
public int[] Years { get; set; } = {2013, 2014, 2015};
public bool ShowYearsAsRange { get; set; } = true;
public IList<Tuple<string, Uri>> Links { get; set; }
}
} | mit | C# |
b228e5fd437208a341a2e1469c6846cde503386d | Prepare release 1.1.0.11 | physion/BarcodePrinter | BarcodePrinter/Properties/AssemblyInfo.cs | BarcodePrinter/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Physion.BarcodePrinter")]
[assembly: AssemblyDescription("Barcode printer for Zebra thermal printers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Physion LLC")]
[assembly: AssemblyProduct("BarcodePrinter")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.11")]
[assembly: AssemblyFileVersion("1.1.0.11")]
| using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Physion.BarcodePrinter")]
[assembly: AssemblyDescription("Barcode printer for Zebra thermal printers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Physion LLC")]
[assembly: AssemblyProduct("BarcodePrinter")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.10")]
[assembly: AssemblyFileVersion("1.1.0.10")]
| apache-2.0 | C# |
480244b4b4d50abb6632ec13abee15a48ca3d95c | Fix bug: properly create time span from seconds (not mod 60) | erooijak/MeditationTimer | src/Data/Settings.cs | src/Data/Settings.cs | using System;
using Rooijakkers.MeditationTimer.Data.Contracts;
namespace Rooijakkers.MeditationTimer.Data
{
/// <summary>
/// Stores settings data in local settings storage
/// </summary>
public class Settings : ISettings
{
private const string TIME_TO_GET_READY_IN_SECONDS_STORAGE = "TimeToGetReadyStorage";
public TimeSpan TimeToGetReady
{
get
{
int? secondsToGetReady =
Windows.Storage.ApplicationData.Current.LocalSettings.Values[TIME_TO_GET_READY_IN_SECONDS_STORAGE] as int?;
// If settings were not yet stored set to default value.
if (secondsToGetReady == null)
{
secondsToGetReady = Constants.DEFAULT_TIME_TO_GET_READY_IN_SECONDS;
SetTimeToGetReady(secondsToGetReady.Value);
}
// Return stored time in seconds as a TimeSpan.
return TimeSpan.FromSeconds(secondsToGetReady.Value);
}
set
{
// Store time in seconds obtained from TimeSpan.
SetTimeToGetReady(value.Seconds);
}
}
private void SetTimeToGetReady(int value)
{
Windows.Storage.ApplicationData.Current.LocalSettings.Values[TIME_TO_GET_READY_IN_SECONDS_STORAGE] = value;
}
}
}
| using System;
using Rooijakkers.MeditationTimer.Data.Contracts;
namespace Rooijakkers.MeditationTimer.Data
{
/// <summary>
/// Stores settings data in local settings storage
/// </summary>
public class Settings : ISettings
{
private const string TIME_TO_GET_READY_IN_SECONDS_STORAGE = "TimeToGetReadyStorage";
public TimeSpan TimeToGetReady
{
get
{
int? secondsToGetReady =
Windows.Storage.ApplicationData.Current.LocalSettings.Values[TIME_TO_GET_READY_IN_SECONDS_STORAGE] as int?;
// If settings were not yet stored set to default value.
if (secondsToGetReady == null)
{
secondsToGetReady = Constants.DEFAULT_TIME_TO_GET_READY_IN_SECONDS;
SetTimeToGetReady(secondsToGetReady.Value);
}
// Return stored time in seconds as a TimeSpan.
return new TimeSpan(0, 0, secondsToGetReady.Value);
}
set
{
// Store time in seconds obtained from TimeSpan.
SetTimeToGetReady(value.Seconds);
}
}
private void SetTimeToGetReady(int value)
{
Windows.Storage.ApplicationData.Current.LocalSettings.Values[TIME_TO_GET_READY_IN_SECONDS_STORAGE] = value;
}
}
}
| mit | C# |
ca0f0e56a42816a37abd1cbff7c762a7e8a0fba8 | update version | slagou/HTML-Renderer,verdesgrobert/HTML-Renderer,drickert5/HTML-Renderer,windygu/HTML-Renderer,Perspex/HTML-Renderer,slagou/HTML-Renderer,ArthurHub/HTML-Renderer,todor-dk/HTML-Renderer,Perspex/HTML-Renderer,evitself/HTML-Renderer,tinygg/graphic-HTML-Renderer,todor-dk/HTML-Renderer,tinygg/graphic-HTML-Renderer,evitself/HTML-Renderer,drickert5/HTML-Renderer,windygu/HTML-Renderer,todor-dk/HTML-Renderer,tinygg/graphic-HTML-Renderer,ArthurHub/HTML-Renderer,verdesgrobert/HTML-Renderer | Source/HtmlRenderer/Properties/AssemblyInfo.cs | Source/HtmlRenderer/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("HTML Renderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Open source hosted on CodePlex")]
[assembly: AssemblyProduct("HTML Renderer")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[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("ec8a9e7e-9a9d-43c3-aa97-f6f505b1d3ed")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.5.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("HTML Renderer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Open source hosted on CodePlex")]
[assembly: AssemblyProduct("HTML Renderer")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[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("ec8a9e7e-9a9d-43c3-aa97-f6f505b1d3ed")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.4.8.1")] | bsd-3-clause | C# |
cfa0ef6fd9c410cf0f2d7c32c9613daf5c179e62 | convert field to a local variable | 2yangk23/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,ZLima12/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,johnneijzen/osu,johnneijzen/osu,smoogipooo/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,ZLima12/osu,ppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu | osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Overlays.Profile.Sections;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneShowMoreButton : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ShowMoreButton),
};
public TestSceneShowMoreButton()
{
ShowMoreButton button;
Add(button = new ShowMoreButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
AddStep("switch loading state", () => button.IsLoading = !button.IsLoading);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Overlays.Profile.Sections;
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneShowMoreButton : OsuTestScene
{
private readonly ShowMoreButton button;
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ShowMoreButton),
};
public TestSceneShowMoreButton()
{
Add(button = new ShowMoreButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
AddStep("switch loading state", () => button.IsLoading = !button.IsLoading);
}
}
}
| mit | C# |
ce5f474398aa02efaaffc2cfb9de37c47a28885a | Update summary. | PenguinF/sandra-three | Eutherion/Shared/Text/Json/IJsonSymbol.cs | Eutherion/Shared/Text/Json/IJsonSymbol.cs | #region License
/*********************************************************************************
* IJsonSymbol.cs
*
* Copyright (c) 2004-2020 Henk Nicolai
*
* 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.
*
**********************************************************************************/
#endregion
using System.Collections.Generic;
namespace Eutherion.Text.Json
{
public abstract class JsonSymbol : ISpan
{
public virtual bool IsBackground => false;
public virtual bool IsValueStartSymbol => false;
/// <summary>
/// Gets if there are any errors associated with this symbol.
/// </summary>
public virtual bool HasErrors => false;
/// <summary>
/// Generates a sequence of errors associated with this symbol at a given start position.
/// </summary>
/// <param name="startPosition">
/// The start position for which to generate the errors.
/// </param>
/// <returns>
/// A sequence of errors associated with this symbol.
/// </returns>
public virtual IEnumerable<JsonErrorInfo> GetErrors(int startPosition) => EmptyEnumerable<JsonErrorInfo>.Instance;
public abstract int Length { get; }
public abstract void Accept(JsonSymbolVisitor visitor);
public abstract TResult Accept<TResult>(JsonSymbolVisitor<TResult> visitor);
public abstract TResult Accept<T, TResult>(JsonSymbolVisitor<T, TResult> visitor, T arg);
}
}
| #region License
/*********************************************************************************
* IJsonSymbol.cs
*
* Copyright (c) 2004-2020 Henk Nicolai
*
* 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.
*
**********************************************************************************/
#endregion
using System.Collections.Generic;
namespace Eutherion.Text.Json
{
public abstract class JsonSymbol : ISpan
{
public virtual bool IsBackground => false;
public virtual bool IsValueStartSymbol => false;
/// <summary>
/// Gets if there are any errors associated with this symbol.
/// </summary>
public virtual bool HasErrors => false;
/// <summary>
/// If <see cref="HasErrors"/> is true, generates a non-empty sequence of errors associated
/// with this symbol at a given start position.
/// </summary>
/// <param name="startPosition">
/// The start position for which to generate the errors.
/// </param>
/// <returns>
/// A sequence of errors associated with this symbol.
/// </returns>
public virtual IEnumerable<JsonErrorInfo> GetErrors(int startPosition) => EmptyEnumerable<JsonErrorInfo>.Instance;
public abstract int Length { get; }
public abstract void Accept(JsonSymbolVisitor visitor);
public abstract TResult Accept<TResult>(JsonSymbolVisitor<TResult> visitor);
public abstract TResult Accept<T, TResult>(JsonSymbolVisitor<T, TResult> visitor, T arg);
}
}
| apache-2.0 | C# |
b08f870ad787dc3e00b21244a783fe5bf717d5de | Fix variable names in ListSerialization.cs | AndrewBaker/magecrawl,jeongroseok/magecrawl | Trunk/GameEngine/SaveLoad/ListSerialization.cs | Trunk/GameEngine/SaveLoad/ListSerialization.cs | using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using Magecrawl.Utilities;
namespace Magecrawl.GameEngine.SaveLoad
{
public delegate void ReadListFromXMLCore(XmlReader reader);
internal static class ListSerialization
{
public static void WriteListToXML<T>(XmlWriter writer, List<T> list, string listName) where T : IXmlSerializable
{
writer.WriteStartElement(listName + "List");
writer.WriteElementString("Count", list.Count.ToString());
for (int i = 0; i < list.Count; ++i)
{
IXmlSerializable current = list[i];
writer.WriteStartElement(string.Format(listName + "{0}", i));
current.WriteXml(writer);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
public static void WriteListToXML<T>(XmlWriter writer, List<Pair<T, Point>> list, string listName) where T : IXmlSerializable
{
writer.WriteStartElement(listName + "List");
writer.WriteElementString("Count", list.Count.ToString());
for (int i = 0; i < list.Count; ++i)
{
IXmlSerializable current = list[i].First;
writer.WriteStartElement(string.Format(listName + "{0}", i));
current.WriteXml(writer);
list[i].Second.WriteToXml(writer, "Position");
writer.WriteEndElement();
}
writer.WriteEndElement();
}
public static void ReadListFromXML(XmlReader reader, ReadListFromXMLCore readDelegate)
{
reader.ReadStartElement();
int listLength = reader.ReadElementContentAsInt();
for (int i = 0; i < listLength; ++i)
{
reader.ReadStartElement();
readDelegate(reader);
reader.ReadEndElement();
}
reader.ReadEndElement();
}
}
}
| using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using Magecrawl.Utilities;
namespace Magecrawl.GameEngine.SaveLoad
{
public delegate void ReadListFromXMLCore(XmlReader reader);
internal static class ListSerialization
{
public static void WriteListToXML<T>(XmlWriter writer, List<T> list, string listName) where T : IXmlSerializable
{
writer.WriteStartElement(listName + "List");
writer.WriteElementString("Count", list.Count.ToString());
for (int i = 0; i < list.Count; ++i)
{
IXmlSerializable current = list[i];
writer.WriteStartElement(string.Format(listName + "{0}", i));
current.WriteXml(writer);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
public static void WriteListToXML<T>(XmlWriter writer, List<Pair<T, Point>> list, string listName) where T : IXmlSerializable
{
writer.WriteStartElement(listName + "List");
writer.WriteElementString("Count", list.Count.ToString());
for (int i = 0; i < list.Count; ++i)
{
IXmlSerializable current = list[i].First;
writer.WriteStartElement(string.Format(listName + "{0}", i));
current.WriteXml(writer);
list[i].Second.WriteToXml(writer, "Position");
writer.WriteEndElement();
}
writer.WriteEndElement();
}
public static void ReadListFromXML(XmlReader reader, ReadListFromXMLCore readDelegate)
{
reader.ReadStartElement();
int mapFeatureListLength = reader.ReadElementContentAsInt();
for (int i = 0; i < mapFeatureListLength; ++i)
{
reader.ReadStartElement();
readDelegate(reader);
reader.ReadEndElement();
}
reader.ReadEndElement();
}
}
}
| bsd-2-clause | C# |
1dea8a9af6c05e9da9a6c9df1941742f1bfca5a0 | Add IfAllValidThenValid extension method | ahanusa/facile.net,peasy/Samples,peasy/Samples,peasy/Peasy.NET,ahanusa/Peasy.NET,peasy/Samples | Facile.Core/Extensions/IRuleExtensions.cs | Facile.Core/Extensions/IRuleExtensions.cs | using Facile.Core.Extensions;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace Facile.Core
{
public static class IRuleExtensions
{
public static IEnumerable<ValidationResult> GetBusinessRulesResults(this IEnumerable<IRule> businessRules, string entityName)
{
var invalidRules = businessRules.ToArray()
.ForEach(rule => rule.Validate())
.Where(rule => !rule.IsValid);
foreach (var rule in invalidRules)
{
yield return new ValidationResult(rule.ErrorMessage, new string[] { entityName });
}
}
public static IRule IfAllValidThenValidate(this IEnumerable<IRule> r, params IRule[] rules)
{
return new ValidRuleContainer().IfValidThenValidate(r.ToArray()).IfValidThenValidate(rules);
}
}
internal class ValidRuleContainer : RuleBase
{
protected override void OnValidate()
{
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Facile.Core.Extensions
{
public static class IRuleExtensions
{
public static IEnumerable<ValidationResult> GetBusinessRulesResults(this IEnumerable<IRule> businessRules, string entityName)
{
var invalidRules = businessRules.ToArray()
.ForEach(rule => rule.Validate())
.Where(rule => !rule.IsValid);
foreach (var rule in invalidRules)
{
yield return new ValidationResult(rule.ErrorMessage, new string[] { entityName });
}
}
}
}
| mit | C# |
5d4fb1845db3bc203472c56656974dd80f41778d | Change indicator | ucdavis/CRP,ucdavis/CRP,ucdavis/CRP | CRP.Mvc/Views/Home/AdminHome.cshtml | CRP.Mvc/Views/Home/AdminHome.cshtml | @{
ViewBag.Title = "AdminHome";
}
@section NavButtons
{
<div class="pull-right">
@Html.Partial("_LogonPartial")
</div>
}
<div class="boundary">
<h2>Administration Tools</h2>
<p>
@Html.ActionLink("Items", "List", "ItemManagement", null, new { @class = "btn" })
</p>
<p>
@Html.ActionLink("Question Sets", "List", "QuestionSet", null, new { @class = "btn" })
</p>
<p>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Administrative Screens <span class="caret"></span></button>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Transaction Lookup", "AdminLookup", "Transaction")</li>
<li class="divider"></li>
<li>@Html.ActionLink("Application Management", "Index", "ApplicationManagement")</li>
<li>@Html.ActionLink("System Reports", "ViewSystemReport", "Report")</li>
<li>@Html.ActionLink("Manage Users", "ManageUsers", "Account")</li>
</ul>
</div>
</p>
<hr/>
<p>
<a class="btn btn-green" href="https://computing.caes.ucdavis.edu/documentation/registration/registration-change-log" target="_blank">What's New (April 26, 2021)</a>
</p>
<p>
<a class="btn btn-green" href="https://computing.caes.ucdavis.edu/documentation/registration" target="_blank">FAQ</a>
</p>
<p>
<a class="btn btn-red" href="https://caeshelp.ucdavis.edu/?appname=Registration" target="_blank">Admin Help Ticket</a>
</p>
</div>
| @{
ViewBag.Title = "AdminHome";
}
@section NavButtons
{
<div class="pull-right">
@Html.Partial("_LogonPartial")
</div>
}
<div class="boundary">
<h2>Administration Tools</h2>
<p>
@Html.ActionLink("Items", "List", "ItemManagement", null, new { @class = "btn" })
</p>
<p>
@Html.ActionLink("Question Sets", "List", "QuestionSet", null, new { @class = "btn" })
</p>
<p>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Administrative Screens <span class="caret"></span></button>
<ul class="dropdown-menu">
<li>@Html.ActionLink("Transaction Lookup", "AdminLookup", "Transaction")</li>
<li class="divider"></li>
<li>@Html.ActionLink("Application Management", "Index", "ApplicationManagement")</li>
<li>@Html.ActionLink("System Reports", "ViewSystemReport", "Report")</li>
<li>@Html.ActionLink("Manage Users", "ManageUsers", "Account")</li>
</ul>
</div>
</p>
<hr/>
<p>
<a class="btn btn-green" href="https://computing.caes.ucdavis.edu/documentation/registration/registration-change-log" target="_blank">What's New (March 19, 2021)</a>
</p>
<p>
<a class="btn btn-green" href="https://computing.caes.ucdavis.edu/documentation/registration" target="_blank">FAQ</a>
</p>
<p>
<a class="btn btn-red" href="https://caeshelp.ucdavis.edu/?appname=Registration" target="_blank">Admin Help Ticket</a>
</p>
</div>
| mit | C# |
c42e9e46ea5ec4d706748bec89776951df5292d7 | Update AssemblyLoadContext ref assembly | shimingsg/corefx,shimingsg/corefx,wtgodbe/corefx,ericstj/corefx,wtgodbe/corefx,shimingsg/corefx,wtgodbe/corefx,ViktorHofer/corefx,ericstj/corefx,ericstj/corefx,ViktorHofer/corefx,ericstj/corefx,wtgodbe/corefx,ViktorHofer/corefx,ericstj/corefx,ericstj/corefx,BrennanConroy/corefx,wtgodbe/corefx,wtgodbe/corefx,BrennanConroy/corefx,ViktorHofer/corefx,shimingsg/corefx,wtgodbe/corefx,shimingsg/corefx,shimingsg/corefx,ViktorHofer/corefx,ericstj/corefx,ViktorHofer/corefx,BrennanConroy/corefx,ViktorHofer/corefx,shimingsg/corefx | src/System.Runtime.Loader/ref/System.Runtime.Loader.cs | src/System.Runtime.Loader/ref/System.Runtime.Loader.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Reflection.Metadata
{
public static partial class AssemblyExtensions
{
[System.CLSCompliantAttribute(false)]
public unsafe static bool TryGetRawMetadata(this System.Reflection.Assembly assembly, out byte* blob, out int length) { throw null; }
}
}
namespace System.Runtime.Loader
{
public sealed partial class AssemblyDependencyResolver
{
public AssemblyDependencyResolver(string componentAssemblyPath) { }
public string ResolveAssemblyToPath(System.Reflection.AssemblyName assemblyName) { throw null; }
public string ResolveUnmanagedDllToPath(string unmanagedDllName) { throw null; }
}
public partial class AssemblyLoadContext
{
protected AssemblyLoadContext() { }
protected AssemblyLoadContext(bool isCollectible) { }
public AssemblyLoadContext(string name, bool isCollectible = false) { }
public static System.Collections.Generic.IEnumerable<AssemblyLoadContext> All { get { throw null; } }
public System.Collections.Generic.IEnumerable<System.Reflection.Assembly> Assemblies { get { throw null; } }
public static System.Runtime.Loader.AssemblyLoadContext Default { get { throw null; } }
public bool IsCollectible { get { throw null; } }
public string Name { get { throw null; } }
public event System.Func<System.Runtime.Loader.AssemblyLoadContext, System.Reflection.AssemblyName, System.Reflection.Assembly> Resolving { add { } remove { } }
public event System.Func<System.Reflection.Assembly, string, System.IntPtr> ResolvingUnmanagedDll { add { } remove { } }
public event System.Action<System.Runtime.Loader.AssemblyLoadContext> Unloading { add { } remove { } }
public static System.Reflection.AssemblyName GetAssemblyName(string assemblyPath) { throw null; }
public static System.Runtime.Loader.AssemblyLoadContext GetLoadContext(System.Reflection.Assembly assembly) { throw null; }
protected virtual System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyName) { throw null; }
public System.Reflection.Assembly LoadFromAssemblyName(System.Reflection.AssemblyName assemblyName) { throw null; }
public System.Reflection.Assembly LoadFromAssemblyPath(string assemblyPath) { throw null; }
public System.Reflection.Assembly LoadFromNativeImagePath(string nativeImagePath, string assemblyPath) { throw null; }
public System.Reflection.Assembly LoadFromStream(System.IO.Stream assembly) { throw null; }
public System.Reflection.Assembly LoadFromStream(System.IO.Stream assembly, System.IO.Stream assemblySymbols) { throw null; }
protected virtual System.IntPtr LoadUnmanagedDll(string unmanagedDllName) { throw null; }
protected System.IntPtr LoadUnmanagedDllFromPath(string unmanagedDllPath) { throw null; }
public void SetProfileOptimizationRoot(string directoryPath) { }
public void StartProfileOptimization(string profile) { }
public void Unload() { }
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Reflection.Metadata
{
public static partial class AssemblyExtensions
{
[System.CLSCompliantAttribute(false)]
public unsafe static bool TryGetRawMetadata(this System.Reflection.Assembly assembly, out byte* blob, out int length) { throw null; }
}
}
namespace System.Runtime.Loader
{
public sealed partial class AssemblyDependencyResolver
{
public AssemblyDependencyResolver(string componentAssemblyPath) { }
public string ResolveAssemblyToPath(System.Reflection.AssemblyName assemblyName) { throw null; }
public string ResolveUnmanagedDllToPath(string unmanagedDllName) { throw null; }
}
public abstract partial class AssemblyLoadContext
{
protected AssemblyLoadContext() { }
protected AssemblyLoadContext(bool isCollectible) { }
public static System.Runtime.Loader.AssemblyLoadContext Default { get { throw null; } }
public bool IsCollectible { get { throw null; } }
public event System.Func<System.Runtime.Loader.AssemblyLoadContext, System.Reflection.AssemblyName, System.Reflection.Assembly> Resolving { add { } remove { } }
public event System.Func<System.Reflection.Assembly, string, System.IntPtr> ResolvingUnmanagedDll { add { } remove { } }
public event System.Action<System.Runtime.Loader.AssemblyLoadContext> Unloading { add { } remove { } }
public static System.Reflection.AssemblyName GetAssemblyName(string assemblyPath) { throw null; }
public static System.Runtime.Loader.AssemblyLoadContext GetLoadContext(System.Reflection.Assembly assembly) { throw null; }
protected abstract System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyName);
public System.Reflection.Assembly LoadFromAssemblyName(System.Reflection.AssemblyName assemblyName) { throw null; }
public System.Reflection.Assembly LoadFromAssemblyPath(string assemblyPath) { throw null; }
public System.Reflection.Assembly LoadFromNativeImagePath(string nativeImagePath, string assemblyPath) { throw null; }
public System.Reflection.Assembly LoadFromStream(System.IO.Stream assembly) { throw null; }
public System.Reflection.Assembly LoadFromStream(System.IO.Stream assembly, System.IO.Stream assemblySymbols) { throw null; }
protected virtual System.IntPtr LoadUnmanagedDll(string unmanagedDllName) { throw null; }
protected System.IntPtr LoadUnmanagedDllFromPath(string unmanagedDllPath) { throw null; }
public void SetProfileOptimizationRoot(string directoryPath) { }
public void StartProfileOptimization(string profile) { }
public void Unload() { }
}
}
| mit | C# |
b5c6d9905661303e20083a805be64b996e404a1c | Fix build warning | spritely/Configuration.Json | Configuration.Json.Test/JsonTest.cs | Configuration.Json.Test/JsonTest.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="JsonTest.cs">
// Copyright (c) 2015. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Spritely.Configuration.Json.Test
{
using System;
using System.Security;
using Newtonsoft.Json;
using NUnit.Framework;
[TestFixture]
public class JsonTest
{
private enum TestEnum
{
FirstType
}
[Test]
public void Serializer_writes_camel_cased_properties()
{
var result = JsonConvert.SerializeObject(new CamelCasedPropertyTest(), Json.SerializerSettings);
Assert.That(
result,
Is.EqualTo(
"{" + Environment.NewLine +
" \"testName\": \"Hello\"" + Environment.NewLine +
"}"));
}
[Test]
public void Serializer_writes_camel_cased_enumerations()
{
var result = JsonConvert.SerializeObject(new CamelCasedEnumTest(), Json.SerializerSettings);
Assert.That(
result,
Is.EqualTo(
"{" + Environment.NewLine +
" \"first\": \"firstType\"" + Environment.NewLine +
"}"));
}
[Test]
public void Serializer_reads_and_writes_SecureString_types()
{
var serializedValue = "{" + Environment.NewLine +
" \"secure\": \"Password\"" + Environment.NewLine +
"}";
var deserialized = JsonConvert.DeserializeObject<SecureStringTest>(serializedValue, Json.SerializerSettings);
var result = JsonConvert.SerializeObject(deserialized, Json.SerializerSettings);
Assert.That(result, Is.EqualTo(serializedValue));
}
private class CamelCasedPropertyTest
{
public string TestName = "Hello";
}
private class CamelCasedEnumTest
{
public TestEnum First = TestEnum.FirstType;
}
private class SecureStringTest
{
#pragma warning disable 649
public SecureString Secure;
#pragma warning restore
}
}
}
| // --------------------------------------------------------------------------------------------------------------------
// <copyright file="JsonTest.cs">
// Copyright (c) 2015. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Spritely.Configuration.Json.Test
{
using Newtonsoft.Json;
using NUnit.Framework;
using System;
using System.Security;
[TestFixture]
public class JsonTest
{
private enum TestEnum
{
FirstType
}
[Test]
public void Serializer_writes_camel_cased_properties()
{
var result = JsonConvert.SerializeObject(new CamelCasedPropertyTest(), Json.SerializerSettings);
Assert.That(result, Is.EqualTo("{" + Environment.NewLine +
" \"testName\": \"Hello\"" + Environment.NewLine +
"}"));
}
[Test]
public void Serializer_writes_camel_cased_enumerations()
{
var result = JsonConvert.SerializeObject(new CamelCasedEnumTest(), Json.SerializerSettings);
Assert.That(result, Is.EqualTo("{" + Environment.NewLine +
" \"first\": \"firstType\"" + Environment.NewLine +
"}"));
}
private class CamelCasedPropertyTest
{
public string TestName = "Hello";
}
private class CamelCasedEnumTest
{
public TestEnum First = TestEnum.FirstType;
}
[Test]
public void Serializer_reads_and_writes_SecureString_types()
{
var serializedValue = "{" + Environment.NewLine +
" \"secure\": \"Password\"" + Environment.NewLine +
"}";
var deserialized = JsonConvert.DeserializeObject<SecureStringTest>(serializedValue, Json.SerializerSettings);
var result = JsonConvert.SerializeObject(deserialized, Json.SerializerSettings);
Assert.That(result, Is.EqualTo(serializedValue));
}
private class SecureStringTest
{
public SecureString Secure;
}
}
}
| mit | C# |
e1225e0dabdfc836b1b80a221fd6654c6bc60d5d | Add test | sakapon/Samples-2016,sakapon/Samples-2016 | MathSample/PropositionsConsole/Program.cs | MathSample/PropositionsConsole/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using Blaze.Propositions;
using static Blaze.Propositions.Formula;
namespace PropositionsConsole
{
class Program
{
static void Main(string[] args)
{
var p = Variable("P");
var q = Variable("Q");
var r = Variable("R");
TestContradiction(p & !p);
TestTautology(p | !p);
TestTautology(Imply(p, !p));
TestContradiction(Imply(p, !p));
TestContradiction(Equivalent(p, !p));
}
static void TestTautology(Formula f)
{
Console.WriteLine($"{f} is{(f.IsTautology() ? "" : " not")} a tautology.");
}
static void TestContradiction(Formula f)
{
Console.WriteLine($"{f} is{(f.IsContradiction() ? "" : " not")} a contradiction.");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PropositionsConsole
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
9baf42fcedc5acdad767dba1296475ba242d4925 | Address feedback. | kant2002/nodejstools,munyirik/nodejstools,mjbvz/nodejstools,AustinHull/nodejstools,Microsoft/nodejstools,paladique/nodejstools,lukedgr/nodejstools,paulvanbrenk/nodejstools,lukedgr/nodejstools,AustinHull/nodejstools,mousetraps/nodejstools,paladique/nodejstools,avitalb/nodejstools,AustinHull/nodejstools,paladique/nodejstools,mjbvz/nodejstools,paulvanbrenk/nodejstools,avitalb/nodejstools,paulvanbrenk/nodejstools,AustinHull/nodejstools,Microsoft/nodejstools,lukedgr/nodejstools,avitalb/nodejstools,Microsoft/nodejstools,mjbvz/nodejstools,paladique/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,paulvanbrenk/nodejstools,munyirik/nodejstools,kant2002/nodejstools,Microsoft/nodejstools,AustinHull/nodejstools,munyirik/nodejstools,paulvanbrenk/nodejstools,Microsoft/nodejstools,paladique/nodejstools,kant2002/nodejstools,munyirik/nodejstools,mousetraps/nodejstools,avitalb/nodejstools,mousetraps/nodejstools,mousetraps/nodejstools,kant2002/nodejstools,avitalb/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,mousetraps/nodejstools,munyirik/nodejstools,kant2002/nodejstools | Nodejs/Tests/Core/Mocks/MockTextBuffer.cs | Nodejs/Tests/Core/Mocks/MockTextBuffer.cs | using System.IO;
using Microsoft.NodejsTools;
namespace NodejsTests.Mocks {
class MockTextBuffer : TestUtilities.Mocks.MockTextBuffer {
public MockTextBuffer(string content) : base(content: content, contentType: NodejsConstants.Nodejs) {
}
private static string GetRandomFileNameIfNull(string filename) {
if (filename == null) {
filename = Path.Combine(TestUtilities.TestData.GetTempPath(), Path.GetRandomFileName(), "file.js");
}
return filename;
}
public MockTextBuffer(string content, string contentType, string filename = null) : base(content: content,
contentType: contentType, filename: MockTextBuffer.GetRandomFileNameIfNull(filename)) {
}
}
}
| using Microsoft.NodejsTools;
namespace NodejsTests.Mocks {
class MockTextBuffer : TestUtilities.Mocks.MockTextBuffer {
public MockTextBuffer(string content) : base(content: content, contentType: NodejsConstants.Nodejs, filename: "file.js") {
}
}
}
| apache-2.0 | C# |
6d282e725f7f06207e29b19dc10513bdd12e581b | Update TestMongoEntity.cs | tiksn/TIKSN-Framework | TIKSN.Framework.IntegrationTests/Data/Mongo/TestMongoEntity.cs | TIKSN.Framework.IntegrationTests/Data/Mongo/TestMongoEntity.cs | using System;
using MongoDB.Bson.Serialization.Attributes;
using TIKSN.Data;
namespace TIKSN.Framework.IntegrationTests.Data.Mongo
{
public class TestMongoEntity : IEntity<Guid>
{
public Guid Value { get; set; }
public int Version { get; set; }
[BsonId] public Guid ID { get; set; }
}
}
| using System;
using MongoDB.Bson.Serialization.Attributes;
using TIKSN.Data;
namespace TIKSN.Framework.IntegrationTests.Data.Mongo
{
public class TestMongoEntity : IEntity<Guid>
{
public Guid Value { get; set; }
public int Version { get; set; }
[BsonId]
public Guid ID { get; set; }
}
} | mit | C# |
80979133363e43453a67dce0ffd1e116c960be61 | bump version | raml-org/raml-dotnet-parser,raml-org/raml-dotnet-parser | source/RAML.Parser/Properties/AssemblyInfo.cs | source/RAML.Parser/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RAML.Parser")]
[assembly: AssemblyDescription("RAML and OAS (swagger/OpenAPI) parser for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MuleSoft")]
[assembly: AssemblyProduct("RAML.Parser")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("af24976e-d021-4aa5-b7d7-1de6574cd6f6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3")]
[assembly: AssemblyFileVersion("2.0.3")]
| 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("RAML.Parser")]
[assembly: AssemblyDescription("RAML and OAS (swagger/OpenAPI) parser for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MuleSoft")]
[assembly: AssemblyProduct("RAML.Parser")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("af24976e-d021-4aa5-b7d7-1de6574cd6f6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2")]
[assembly: AssemblyFileVersion("2.0.2")]
| apache-2.0 | C# |
1d12581e06889b0bdff0b63de4f36a41185002d4 | Format RestoreObjectRequest | carbon/Amazon | src/Amazon.S3/Actions/RestoreObjectRequest.cs | src/Amazon.S3/Actions/RestoreObjectRequest.cs | using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
namespace Amazon.S3
{
public sealed class RestoreObjectRequest : S3Request
{
public RestoreObjectRequest(string host, string bucketName, string key)
: base(HttpMethod.Post, host, bucketName, key + "?restore")
{
if (key is null) throw new ArgumentNullException(nameof(key));
string xmlText = GetXmlString();
Content = new StringContent(xmlText, Encoding.UTF8, "text/xml");
using MD5 md5 = MD5.Create();
Content.Headers.ContentMD5 = md5.ComputeHash(Encoding.UTF8.GetBytes(xmlText));
CompletionOption = HttpCompletionOption.ResponseContentRead;
}
public GlacierJobTier Tier { get; set; } = GlacierJobTier.Standard;
public int Days { get; set; } = 7; // Default to 7
public string GetXmlString() =>
$@"<RestoreRequest>
<Days>{Days}</Days>
<GlacierJobParameters>
<Tier>{Tier}</Tier>
</GlacierJobParameters>
</RestoreRequest>";
}
}
/*
POST /ObjectName?restore&versionId=VersionID HTTP/1.1
Host: BucketName.s3.amazonaws.com
<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-3-01">
<Days>NumberOfDays</Days>
</RestoreRequest>
*/
| using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
namespace Amazon.S3
{
public sealed class RestoreObjectRequest : S3Request
{
public RestoreObjectRequest(string host, string bucketName, string key)
: base(HttpMethod.Post, host, bucketName, key + "?restore")
{
if (key is null) throw new ArgumentNullException(nameof(key));
var xmlText = GetXmlString();
Content = new StringContent(xmlText, Encoding.UTF8, "text/xml");
Content.Headers.ContentMD5 = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(xmlText));
CompletionOption = HttpCompletionOption.ResponseContentRead;
}
public GlacierJobTier Tier { get; set; } = GlacierJobTier.Standard;
public int Days { get; set; } = 7; // Default to 7
public string GetXmlString() =>
$@"<RestoreRequest>
<Days>{Days}</Days>
<GlacierJobParameters>
<Tier>{Tier}</Tier>
</GlacierJobParameters>
</RestoreRequest>";
}
}
/*
POST /ObjectName?restore&versionId=VersionID HTTP/1.1
Host: BucketName.s3.amazonaws.com
<RestoreRequest xmlns="http://s3.amazonaws.com/doc/2006-3-01">
<Days>NumberOfDays</Days>
</RestoreRequest>
*/
| mit | C# |
0ec7c11a90f6ec343752ea786a5adf4078c06f7c | implement CatchModRelax | NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,EVAST9919/osu,peppy/osu,ppy/osu,2yangk23/osu,UselessToucan/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,peppy/osu,peppy/osu-new,johnneijzen/osu,smoogipooo/osu,EVAST9919/osu,peppy/osu | osu.Game.Rulesets.Catch/Mods/CatchModRelax.cs | osu.Game.Rulesets.Catch/Mods/CatchModRelax.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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osuTK;
using System;
namespace osu.Game.Rulesets.Catch.Mods {
public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject> {
public override string Description => @"Use the mouse to control the catcher.";
public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset) =>
(drawableRuleset.Playfield.Parent as Container).Add(new CatchModRelaxHelper(drawableRuleset.Playfield as CatchPlayfield));
private class CatchModRelaxHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition {
private CatcherArea.Catcher catcher;
public CatchModRelaxHelper(CatchPlayfield catchPlayfield) {
catcher = catchPlayfield.CatcherArea.MovableCatcher;
RelativeSizeAxes = Axes.Both;
}
//disable keyboard controls
public bool OnPressed(CatchAction action) => true;
public bool OnReleased(CatchAction action) => true;
protected override bool OnMouseMove(MouseMoveEvent e) {
//lock catcher to mouse position horizontally
catcher.X = e.MousePosition.X / DrawSize.X;
//make Yuzu face the direction he's moving
var direction = Math.Sign(e.Delta.X);
if (direction != 0)
catcher.Scale = new Vector2(Math.Abs(catcher.Scale.X) * direction, catcher.Scale.Y);
return base.OnMouseMove(e);
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Catch.Mods
{
public class CatchModRelax : ModRelax
{
public override string Description => @"Use the mouse to control the catcher.";
}
}
| mit | C# |
8538ba1837e020809741261ae1f506f5e9883938 | Bump version to 13.0.0.27845 | HearthSim/HearthDb | HearthDb/Properties/AssemblyInfo.cs | HearthDb/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("13.0.0.27845")]
[assembly: AssemblyFileVersion("13.0.0.27845")]
| 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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("12.4.0.27405")]
[assembly: AssemblyFileVersion("12.4.0.27405")]
| mit | C# |
22cfc334d7d5669705f5c9310bd981e83870208a | Bump version to 15.4.0.34670 | HearthSim/HearthDb | HearthDb/Properties/AssemblyInfo.cs | HearthDb/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[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("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("15.4.0.34670")]
[assembly: AssemblyFileVersion("15.4.0.34670")]
| 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("HearthDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HearthSim")]
[assembly: AssemblyProduct("HearthDb")]
[assembly: AssemblyCopyright("Copyright © HearthSim 2019")]
[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("7ed14243-e02b-4b94-af00-a67a62c282f0")]
// 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("15.2.2.34104")]
[assembly: AssemblyFileVersion("15.2.2.34104")]
| mit | C# |
c8f571bb66880273cc9380bc8caec1ceb2077b1a | Update version to v0.2.0 | dsarfati/OrleansTestKit | src/OrleansTestKit/Properties/AssemblyInfo.cs | src/OrleansTestKit/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("OrleansTestKit")]
[assembly: AssemblyDescription("An testing framework for Microsoft Orleans that does not use a real silo")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("OrleansContrib")]
[assembly: AssemblyProduct("OrleansTestKit")]
[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("0e2cb8b5-1cbc-4786-9c95-b75317e3c311")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.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("OrleansTestKit")]
[assembly: AssemblyDescription("An testing framework for Microsoft Orleans that does not use a real silo")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("OrleansContrib")]
[assembly: AssemblyProduct("OrleansTestKit")]
[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("0e2cb8b5-1cbc-4786-9c95-b75317e3c311")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
| mit | C# |
879bd263a182335e1ef57ed6b09983c08173d3f8 | Remove unnecessary 'using' | rongriffin/MassTransit.Host.RabbitMQ | MassTransit.Host.RabbitMQ/Program.cs | MassTransit.Host.RabbitMQ/Program.cs | // Copyright 2014 Ron Griffin, ...
//
// 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 Topshelf;
namespace MassTransit.Host.RabbitMQ
{
/// <summary>
/// Entry point of the host process used to construct the Topshelf service.
/// </summary>
class Program
{
static void Main(string[] args)
{
var exitCode = HostFactory.Run(x =>
{
x.Service<ServiceHost>(s =>
{
s.ConstructUsing(name => new ServiceHost());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription("MassTransit RabbitMQ Service Bus Host");
x.SetDisplayName("MassTransitServiceBusHost");
x.SetServiceName("MassTransitServiceBusHost");
});
//TODO: extra parameter stuff
Environment.Exit((int)exitCode);
}
}
}
| // Copyright 2014 Ron Griffin, ...
//
// 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 Magnum.Extensions;
using Topshelf;
namespace MassTransit.Host.RabbitMQ
{
/// <summary>
/// Entry point of the host process used to construct the Topshelf service.
/// </summary>
class Program
{
static void Main(string[] args)
{
var exitCode = HostFactory.Run(x =>
{
x.Service<ServiceHost>(s =>
{
s.ConstructUsing(name => new ServiceHost());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription("MassTransit RabbitMQ Service Bus Host");
x.SetDisplayName("MassTransitServiceBusHost");
x.SetServiceName("MassTransitServiceBusHost");
});
//TODO: extra parameter stuff
Environment.Exit((int)exitCode);
}
}
}
| apache-2.0 | C# |
db7a490d2ffda9c615c6312c232c7a22e0197142 | Update project properties | jaquadro/LilyPath | LilyPath/Properties/AssemblyInfo.cs | LilyPath/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System;
// 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("LilyPath")]
[assembly: AssemblyDescription("A shape and path drawing library for MonoGame and XNA.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LilyPath")]
[assembly: AssemblyCopyright("Copyright © Justin Aquadro 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("17443c6a-c7fa-4886-b84f-1b188c3606b5")]
// 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")]
[assembly: CLSCompliant(false)]
| 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("LilyPath2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("LilyPath2")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("17443c6a-c7fa-4886-b84f-1b188c3606b5")]
// 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# |
0d76a8d4a887377a1d991ef01323e7846c05333c | Add a region tag for UploadImage(). | GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet,GoogleCloudPlatform/getting-started-dotnet | aspnet/3-binary-data/Services/ImageUploader.cs | aspnet/3-binary-data/Services/ImageUploader.cs | // Copyright 2015 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Google.Apis.Storage.v1;
using Google.Apis.Storage.v1.ClientWrapper;
using System.Web;
namespace GoogleCloudSamples.Services
{
public class ImageUploader
{
private string _bucketName;
private string _applicationName;
public ImageUploader(string bucketName, string applicationName)
{
_bucketName = bucketName;
_applicationName = applicationName;
}
// [START uploadimage]
public async Task<String> UploadImage(HttpPostedFileBase image, long id)
{
// Create client and use it to upload object to Cloud Storage
var client = await StorageClient
.FromApplicationCredentials(_applicationName);
var imageAcl = ObjectsResource
.InsertMediaUpload.PredefinedAclEnum.PublicRead;
var imageObject = await client.UploadObjectAsync(
bucket: _bucketName,
objectName: id.ToString(),
contentType: image.ContentType,
source: image.InputStream,
options: new UploadObjectOptions { PredefinedAcl = imageAcl }
);
return imageObject.MediaLink;
}
// [END uploadimage]
public async Task DeleteUploadedImage(long id)
{
var client = await StorageClient
.FromApplicationCredentials(_applicationName);
client.DeleteObject(_bucketName, id.ToString());
}
}
}
| // Copyright 2015 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Google.Apis.Storage.v1;
using Google.Apis.Storage.v1.ClientWrapper;
using System.Web;
namespace GoogleCloudSamples.Services
{
public class ImageUploader
{
private string _bucketName;
private string _applicationName;
public ImageUploader(string bucketName, string applicationName)
{
_bucketName = bucketName;
_applicationName = applicationName;
}
public async Task<String> UploadImage(HttpPostedFileBase image, long id)
{
// Create client and use it to upload object to Cloud Storage
var client = await StorageClient
.FromApplicationCredentials(_applicationName);
var imageAcl = ObjectsResource
.InsertMediaUpload.PredefinedAclEnum.PublicRead;
var imageObject = await client.UploadObjectAsync(
bucket: _bucketName,
objectName: id.ToString(),
contentType: image.ContentType,
source: image.InputStream,
options: new UploadObjectOptions { PredefinedAcl = imageAcl }
);
return imageObject.MediaLink;
}
public async Task DeleteUploadedImage(long id)
{
var client = await StorageClient
.FromApplicationCredentials(_applicationName);
client.DeleteObject(_bucketName, id.ToString());
}
}
}
| apache-2.0 | C# |
1e0029db1e20cb1e72a5bc31bceb7c4471c59e10 | Test fixing | ghusse/MagicExpression | MagicExpression.Test/LiteralTest.cs | MagicExpression.Test/LiteralTest.cs | namespace MagicExpression.Test
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class LiteralTest : MagicTest
{
[TestInitialize]
public override void Setup()
{
base.Setup();
}
[TestMethod]
public void Literal()
{
this.Magic.Literal(@"[A-Z][a-z]*[\s][a-z]*\.");
this.AssertIsMatching("Hello world.");
this.AssertIsNotMatching("hello world.");
}
}
}
| namespace MagicExpression.Test
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class LiteralTest : MagicTest
{
[TestInitialize]
public override void Setup()
{
base.Setup();
}
[TestMethod]
public void Literal()
{
this.Magic.Literal(@"[A-Z][a-z]*[\w][a-z]*\.");
this.AssertIsMatching("Hello world.");
this.AssertIsNotMatching("hello world.");
}
}
}
| mit | C# |
c13fe7f662a66767591a6a2f2d3adea1414fe9b4 | Prepare for next development iteration | richardlawley/NModbus4,NModbus/NModbus | NModbus4/Properties/AssemblyInfo.cs | NModbus4/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("NModbus4")]
[assembly: AssemblyProduct("NModbus4")]
[assembly: AssemblyCompany("Maxwe11")]
[assembly: AssemblyCopyright("Licensed under MIT License.")]
[assembly: AssemblyDescription("NModbus is a C# implementation of the Modbus protocol. " +
"Provides connectivity to Modbus slave compatible devices and applications. " +
"Supports serial ASCII, serial RTU, TCP, and UDP protocols. "+
"NModbus4 it's a fork of NModbus(https://code.google.com/p/nmodbus)")]
[assembly: CLSCompliant(false)]
[assembly: Guid("95B2AE1E-E0DC-4306-8431-D81ED10A2D5D")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0-dev")]
#if !SIGNED
[assembly: InternalsVisibleTo(@"Modbus.UnitTests")]
[assembly: InternalsVisibleTo(@"DynamicProxyGenAssembly2")]
#endif | using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("NModbus4")]
[assembly: AssemblyProduct("NModbus4")]
[assembly: AssemblyCompany("Maxwe11")]
[assembly: AssemblyCopyright("Licensed under MIT License.")]
[assembly: AssemblyDescription("NModbus is a C# implementation of the Modbus protocol. " +
"Provides connectivity to Modbus slave compatible devices and applications. " +
"Supports serial ASCII, serial RTU, TCP, and UDP protocols. "+
"NModbus4 it's a fork of NModbus(https://code.google.com/p/nmodbus)")]
[assembly: CLSCompliant(false)]
[assembly: Guid("95B2AE1E-E0DC-4306-8431-D81ED10A2D5D")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0")]
#if !SIGNED
[assembly: InternalsVisibleTo(@"Modbus.UnitTests")]
[assembly: InternalsVisibleTo(@"DynamicProxyGenAssembly2")]
#endif | mit | C# |
081ba3eb88a6285192db71691f58d8d18380220e | Fix a typo | DotNetToscana/TranslatorService | Samples/NetCoreConsoleApp/Program.cs | Samples/NetCoreConsoleApp/Program.cs | using NetCoreConsoleApp;
using System;
using System.IO;
using TranslatorService;
using TranslatorService.Models.Speech;
// Initializes the speech client.
using var speechClient = new SpeechClient(ServiceKeys.SpeechSubscriptionKey, ServiceKeys.SpeechRegion);
try
{
Console.WriteLine("Calling Speech Service for speech-to-text (using a sample file \"What's the weather like?\")...\n");
using var fileStream = File.OpenRead(@"SpeechSample.wav");
var recognitionResponse = await speechClient.RecognizeAsync(fileStream, "en-US", RecognitionResultFormat.Detailed);
Console.WriteLine($"Recognition Result: {recognitionResponse.RecognitionStatus}");
Console.WriteLine(recognitionResponse.DisplayText);
var speakResponse = await speechClient.SpeakAsync(new TextToSpeechParameters
{
Language = "en-US",
VoiceType = Gender.Female,
VoiceName = "en-US-AriaNeural",
Text = "Hello everyone! Today is really a nice day."
});
// speakResponse contains the stream of the audio.
}
catch (TranslatorServiceException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
// Initializes the translator client.
using var translatorClient = new TranslatorClient(ServiceKeys.TranslatorSubscriptionKey, ServiceKeys.TranslatorRegion);
do
{
try
{
Console.Write("\nWrite the sentence you want to translate: ");
var sentence = Console.ReadLine();
if (string.IsNullOrWhiteSpace(sentence))
{
break;
}
Console.Write("Specify the target language: ");
var language = Console.ReadLine();
if (string.IsNullOrWhiteSpace(language))
{
break;
}
Console.WriteLine("Translating...\n");
var response = await translatorClient.TranslateAsync(sentence, to: language);
Console.WriteLine($"Detected source language: {response.DetectedLanguage.Language} ({response.DetectedLanguage.Score:P2})");
Console.WriteLine(response.Translation.Text);
}
catch (TranslatorServiceException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
} while (true);
| using NetCoreConsoleApp;
using System;
using System.IO;
using TranslatorService;
using TranslatorService.Models.Speech;
// Initializes the speech client.
using var speechClient = new SpeechClient(ServiceKeys.SpeechSubscriptionKey, ServiceKeys.SpeechRegion);
try
{
Console.WriteLine("Calling Speech Service for speech-to-text (using a sample file \"What's the weather like?\")...\n");
using var fileStream = File.OpenRead(@"SpeechSample.wav");
var recognitionResponse = await speechClient.RecognizeAsync(fileStream, "en-US", RecognitionResultFormat.Detailed);
Console.WriteLine($"Recognition Result: {recognitionResponse.RecognitionStatus}");
Console.WriteLine(recognitionResponse.DisplayText);
var speakResponse = await speechClient.SpeakAsync(new TextToSpeechParameters
{
Language = "en-US",
VoiceType = Gender.Female,
VoiceName = "en-US-AriaNeural",
Text = "Hello everyone! Today is really a beautiful day."
});
// speakResponse contains the stream of the audio.
}
catch (TranslatorServiceException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
// Initializes the translator client.
using var translatorClient = new TranslatorClient(ServiceKeys.TranslatorSubscriptionKey, ServiceKeys.TranslatorRegion);
do
{
try
{
Console.Write("\nWrite the sentence you want to translate: ");
var sentence = Console.ReadLine();
if (string.IsNullOrWhiteSpace(sentence))
{
break;
}
Console.Write("Specify the target language: ");
var language = Console.ReadLine();
if (string.IsNullOrWhiteSpace(language))
{
break;
}
Console.WriteLine("Translating...\n");
var response = await translatorClient.TranslateAsync(sentence, to: language);
Console.WriteLine($"Detected source language: {response.DetectedLanguage.Language} ({response.DetectedLanguage.Score:P2})");
Console.WriteLine(response.Translation.Text);
}
catch (TranslatorServiceException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
} while (true);
| mit | C# |
547d0bbde0dd92de5c32ce721a0634ee392228d8 | Delete some of index | SpilledMilkCOM/ParkerSmart,SpilledMilkCOM/ParkerSmart,SpilledMilkCOM/ParkerSmart | ParkerSmart/Views/Home/Index.cshtml | ParkerSmart/Views/Home/Index.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
</div> | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
</div> | mit | C# |
f218547c68c70fc710cb5cf96f7493852a2db563 | Update PBU-Main-Future.cs | win120a/ACClassRoomUtil,win120a/ACClassRoomUtil | ProcessBlockUtil/PBU-Main-Future.cs | ProcessBlockUtil/PBU-Main-Future.cs | /*
THIS IS ONLY TO EASY CHANGE, NOT THE PROJECT CODE AT NOW. (I will use in the future.)
Copyright (C) 2011-2014 AC Inc. (Andy Cheung)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.IO;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading;
using System.Collections;
namespace ACProcessBlockUtil
{
class Run:ServiceBase
{
SteamReader sr;
ArrayList<String> al;
String[] list;
public static void kill()
{
while (true)
{
Process[] ieProcArray = Process.GetProcessesByName("iexplore");
//Console.WriteLine(ieProcArray.Length);
if (ieProcArray.Length == 0)
{
continue;
}
foreach(Process p in ieProcArray){
p.Kill();
}
Thread.Sleep(2000);
}
}
public static void Main(String[] a)
{
String userProfile = Environment.GetEnvironmentVariable("UserProfile");
String systemRoot = Environment.GetEnvironmentVariable("SystemRoot");
if(File.Exists(userProfile + "\\ACRules.txt")){
ar = new ArrayList<String>();
sr = new SteamReader(userProfile + "\\ACRules.txt");
while(true){
String tempLine = sr.ReadLine();
if(tempLine == null){
break;
}
else{
ar.Add(tempLine);
}
}
list = ar.ToArray();
}
else{
list = {"iexplore", "360se", "chrome", "firefox", "safari"}
}
ServiceBase.Run(new Run());
}
protected override void OnStart(String[] a){
Thread t = new Thread(new ThreadStart(kill));
t.IsBackground = true;
t.Start();
}
}
}
| /*
THIS IS ONLY TO EASY CHANGE, NOT THE PROJECT CODE AT NOW. (I will use in the future.)
Copyright (C) 2011-2014 AC Inc. (Andy Cheung)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.IO;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading;
using System.Collections;
namespace ACProcessBlockUtil
{
class Run:ServiceBase
{
SteamReader sr;
ArrayList<String> al;
String[] list;
public static void kill()
{
while (true)
{
Process[] ieProcArray = Process.GetProcessesByName("iexplore");
//Console.WriteLine(ieProcArray.Length);
if (ieProcArray.Length == 0)
{
continue;
}
foreach(Process p in ieProcArray){
p.Kill();
}
Thread.Sleep(2000);
}
}
public static void Main(String[] a)
{
String userProfile = Environment.GetEnvironmentVariable("UserProfile");
String systemRoot = Environment.GetEnvironmentVariable("SystemRoot");
if(File.Exists(userProfile + "\\ACRules.txt")){
ar = new ArrayList<String>();
sr = new SteamReader(userProfile + "\\ACRules.txt");
while(true){
String tempLine = sr.ReadLine();
if(tempLine == null){
break;
}
else{
ar.Add(tempLine);
}
}
list = ar.ToArray();
}
else{
list = {"iexplore", "360se", "qqbrowser"}
}
ServiceBase.Run(new Run());
}
protected override void OnStart(String[] a){
Thread t = new Thread(new ThreadStart(kill));
t.IsBackground = true;
t.Start();
}
}
}
| apache-2.0 | C# |
a23a15afb2e9c636dc240685c0c40128b8c85c3a | add cpu count to environment data | cvent/Metrics.NET,mnadel/Metrics.NET,MetaG8/Metrics.NET,DeonHeyns/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET,Recognos/Metrics.NET,Recognos/Metrics.NET,DeonHeyns/Metrics.NET,Liwoj/Metrics.NET,Liwoj/Metrics.NET,mnadel/Metrics.NET,alhardy/Metrics.NET,huoxudong125/Metrics.NET,MetaG8/Metrics.NET,huoxudong125/Metrics.NET,ntent-ad/Metrics.NET,alhardy/Metrics.NET,etishor/Metrics.NET,cvent/Metrics.NET,ntent-ad/Metrics.NET | Src/Metrics/Utils/AppEnvironment.cs | Src/Metrics/Utils/AppEnvironment.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using Metrics.MetricData;
namespace Metrics.Utils
{
public class AppEnvironment
{
public static IEnumerable<EnvironmentEntry> Current
{
get
{
yield return new EnvironmentEntry("MachineName", Environment.MachineName);
yield return new EnvironmentEntry("DomainName", Environment.UserDomainName);
yield return new EnvironmentEntry("UserName", Environment.UserName);
yield return new EnvironmentEntry("ProcessName", SafeGetString(() => Process.GetCurrentProcess().ProcessName));
yield return new EnvironmentEntry("OSVersion", Environment.OSVersion.ToString());
yield return new EnvironmentEntry("CPUCount", Environment.ProcessorCount.ToString());
yield return new EnvironmentEntry("CommandLine", Environment.CommandLine);
yield return new EnvironmentEntry("HostName", SafeGetString(() => Dns.GetHostName()));
yield return new EnvironmentEntry("IPAddress", SafeGetString(() => GetIpAddress()));
yield return new EnvironmentEntry("LocalTime", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.ffffK", CultureInfo.InvariantCulture));
}
}
private static string GetIpAddress()
{
var ipAddress = Dns.GetHostEntry(Dns.GetHostName())
.AddressList
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);
if (ipAddress != null)
{
return ipAddress.ToString();
}
return string.Empty;
}
private static string SafeGetString(Func<string> action)
{
try
{
return action();
}
catch (Exception x)
{
MetricsErrorHandler.Handle(x, "Error retrieving environment value");
return string.Empty;
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using Metrics.MetricData;
namespace Metrics.Utils
{
public class AppEnvironment
{
public static IEnumerable<EnvironmentEntry> Current
{
get
{
yield return new EnvironmentEntry("MachineName", Environment.MachineName);
yield return new EnvironmentEntry("DomainName", Environment.UserDomainName);
yield return new EnvironmentEntry("UserName", Environment.UserName);
yield return new EnvironmentEntry("ProcessName", SafeGetString(() => Process.GetCurrentProcess().ProcessName));
yield return new EnvironmentEntry("OSVersion", Environment.OSVersion.ToString());
yield return new EnvironmentEntry("CommandLine", Environment.CommandLine);
yield return new EnvironmentEntry("HostName", SafeGetString(() => Dns.GetHostName()));
yield return new EnvironmentEntry("IPAddress", SafeGetString(() => GetIpAddress()));
yield return new EnvironmentEntry("LocalTime", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.ffffK", CultureInfo.InvariantCulture));
}
}
private static string GetIpAddress()
{
var ipAddress = Dns.GetHostEntry(Dns.GetHostName())
.AddressList
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);
if (ipAddress != null)
{
return ipAddress.ToString();
}
return string.Empty;
}
private static string SafeGetString(Func<string> action)
{
try
{
return action();
}
catch (Exception x)
{
MetricsErrorHandler.Handle(x, "Error retrieving environment value");
return string.Empty;
}
}
}
}
| apache-2.0 | C# |
128f017af5b16fb819b42e18601efc813fc51b43 | Bump v1.0.11 | karronoli/tiny-sato | TinySato/Properties/AssemblyInfo.cs | TinySato/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.11.*")]
[assembly: AssemblyFileVersion("1.0.11")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.10.*")]
[assembly: AssemblyFileVersion("1.0.10")]
| apache-2.0 | C# |
bfb0ac25f424c453d06dcea2298081cf807babc5 | Bump version number. | travismartinjones/Dauber.Azure | Dauber.Cqrs.Azure.ServiceBus/Properties/AssemblyInfo.cs | Dauber.Cqrs.Azure.ServiceBus/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dauber.Cqrs.Azure.ServiceBus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dauber Applications, LLC")]
[assembly: AssemblyProduct("Dauber.Cqrs.Azure.ServiceBus")]
[assembly: AssemblyCopyright("Copyright © 2016 Dauber Applications, LLC")]
[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("715d0bda-3fe2-49cf-a69e-90fb93e7e679")]
// 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.7.0")]
[assembly: AssemblyFileVersion("1.0.6.1")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dauber.Cqrs.Azure.ServiceBus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dauber Applications, LLC")]
[assembly: AssemblyProduct("Dauber.Cqrs.Azure.ServiceBus")]
[assembly: AssemblyCopyright("Copyright © 2016 Dauber Applications, LLC")]
[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("715d0bda-3fe2-49cf-a69e-90fb93e7e679")]
// 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.6.1")]
[assembly: AssemblyFileVersion("1.0.6.1")]
| mit | C# |
544587a924f09ce1af46260c0c4772f95315fa17 | Mark Image as Obsolete in Track DTO | gregsochanik/SevenDigital.Api.Schema,7digital/SevenDigital.Api.Schema,scooper91/SevenDigital.Api.Schema | src/Schema/Tracks/Track.cs | src/Schema/Tracks/Track.cs | using System;
using System.Xml.Serialization;
using SevenDigital.Api.Schema.Artists;
using SevenDigital.Api.Schema.Attributes;
using SevenDigital.Api.Schema.Legacy;
using SevenDigital.Api.Schema.Media;
using SevenDigital.Api.Schema.Packages;
using SevenDigital.Api.Schema.ParameterDefinitions.Get;
using SevenDigital.Api.Schema.Pricing;
using SevenDigital.Api.Schema.Releases;
namespace SevenDigital.Api.Schema.Tracks
{
[Serializable]
[XmlRoot("track")]
[ApiEndpoint("track/details")]
public class Track : HasTrackIdParameter
{
[XmlAttribute("id")]
public int Id { get; set; }
[XmlElement("title")]
public string Title { get; set; }
[XmlElement("version")]
public string Version { get; set; }
[XmlElement("artist")]
public Artist Artist { get; set; }
/// <summary>
/// Track number or in cases where disc number is greater than 1, it is the discNumber + trackNumber (ie 203)
/// </summary>
/// <remarks>Will soon de decommisioned</remarks>
[XmlElement("trackNumber")]
public int TrackNumber { get; set; }
[XmlElement("duration")]
public int Duration { get; set; }
[XmlElement("explicitContent")]
public bool ExplicitContent { get; set; }
[XmlElement("isrc")]
public string Isrc { get; set; }
[XmlElement("type")]
public TrackType Type { get; set; }
[XmlElement("release")]
public Release Release { get; set; }
[XmlElement("url")]
public string Url { get; set; }
[Obsolete("This is not on the track response")]
[XmlElement("image")]
public string Image { get; set; }
[Obsolete]
public Price Price { get { return PriceLegacyMapper.PrimaryPackagePrice(Download); } }
[XmlElement(ElementName = "streamingReleaseDate", IsNullable = true)]
public DateTime? StreamingReleaseDate { get; set; }
[XmlElement("discNumber")]
public int DiscNumber { get; set; }
[Obsolete]
public FormatList Formats { get { return FormatLegacyMapper.PrimaryPackageFormats(Download); } }
/// <summary>
/// Track Number. Should be used instead of "TrackNumber"
/// </summary>
[XmlElement("number")]
public int Number { get; set; }
[XmlElement("download")]
public Download Download { get; set; }
public override string ToString()
{
return string.Format("{0}: {1} {2} {3}, ISRC: {4}", Id, Title, Version, Type, Isrc);
}
}
} | using System;
using System.Xml.Serialization;
using SevenDigital.Api.Schema.Artists;
using SevenDigital.Api.Schema.Attributes;
using SevenDigital.Api.Schema.Legacy;
using SevenDigital.Api.Schema.Media;
using SevenDigital.Api.Schema.Packages;
using SevenDigital.Api.Schema.ParameterDefinitions.Get;
using SevenDigital.Api.Schema.Pricing;
using SevenDigital.Api.Schema.Releases;
namespace SevenDigital.Api.Schema.Tracks
{
[Serializable]
[XmlRoot("track")]
[ApiEndpoint("track/details")]
public class Track : HasTrackIdParameter
{
[XmlAttribute("id")]
public int Id { get; set; }
[XmlElement("title")]
public string Title { get; set; }
[XmlElement("version")]
public string Version { get; set; }
[XmlElement("artist")]
public Artist Artist { get; set; }
/// <summary>
/// Track number or in cases where disc number is greater than 1, it is the discNumber + trackNumber (ie 203)
/// </summary>
/// <remarks>Will soon de decommisioned</remarks>
[XmlElement("trackNumber")]
public int TrackNumber { get; set; }
[XmlElement("duration")]
public int Duration { get; set; }
[XmlElement("explicitContent")]
public bool ExplicitContent { get; set; }
[XmlElement("isrc")]
public string Isrc { get; set; }
[XmlElement("type")]
public TrackType Type { get; set; }
[XmlElement("release")]
public Release Release { get; set; }
[XmlElement("url")]
public string Url { get; set; }
[XmlElement("image")]
public string Image { get; set; }
[Obsolete]
public Price Price { get { return PriceLegacyMapper.PrimaryPackagePrice(Download); } }
[XmlElement(ElementName = "streamingReleaseDate", IsNullable = true)]
public DateTime? StreamingReleaseDate { get; set; }
[XmlElement("discNumber")]
public int DiscNumber { get; set; }
[Obsolete]
public FormatList Formats { get { return FormatLegacyMapper.PrimaryPackageFormats(Download); } }
/// <summary>
/// Track Number. Should be used instead of "TrackNumber"
/// </summary>
[XmlElement("number")]
public int Number { get; set; }
[XmlElement("download")]
public Download Download { get; set; }
public override string ToString()
{
return string.Format("{0}: {1} {2} {3}, ISRC: {4}", Id, Title, Version, Type, Isrc);
}
}
} | mit | C# |
6386783f090d6bd5099b1cdec1a6a6b104b5f218 | Comment RPGVital | jkpenner/RPGSystemTutorial | Assets/Scripts/RPGSystems/StatTypes/RPGVital.cs | Assets/Scripts/RPGSystems/StatTypes/RPGVital.cs | using UnityEngine;
using System;
using System.Collections;
/// <summary>
/// RPGStat that inherits from RPGAttribute and implement IStatCurrentValueChange
/// </summary>
public class RPGVital : RPGAttribute, IStatCurrentValueChange {
/// <summary>
/// Used by the StatCurrentValue Property
/// </summary>
private int _statCurrentValue;
/// <summary>
/// Event called when the StatCurrentValue changes
/// </summary>
public event EventHandler OnCurrentValueChange;
/// <summary>
/// The current value of the stat. Restricted between the values 0
/// and StatValue. When set will trigger the OnCurrentValueChange event.
/// </summary>
public int StatCurrentValue {
get {
if (_statCurrentValue > StatValue) {
_statCurrentValue = StatValue;
} else if (_statCurrentValue < 0) {
_statCurrentValue = 0;
}
return _statCurrentValue;
}
set {
if (_statCurrentValue != value) {
_statCurrentValue = value;
TriggerCurrentValueChange();
}
}
}
/// <summary>
/// Basic Constructor
/// </summary>
public RPGVital() {
_statCurrentValue = 0;
}
/// <summary>
/// Sets the StatCurrentValue to StatValue
/// </summary>
public void SetCurrentValueToMax() {
StatCurrentValue = StatValue;
}
/// <summary>
/// Triggers the OnCurrentValueChange Event
/// </summary>
private void TriggerCurrentValueChange() {
if (OnCurrentValueChange != null) {
OnCurrentValueChange(this, null);
}
}
}
| using UnityEngine;
using System;
using System.Collections;
public class RPGVital : RPGAttribute, IStatCurrentValueChange {
private int _statCurrentValue;
public event EventHandler OnCurrentValueChange;
public int StatCurrentValue {
get {
if (_statCurrentValue > StatValue) {
_statCurrentValue = StatValue;
} else if (_statCurrentValue < 0) {
_statCurrentValue = 0;
}
return _statCurrentValue;
}
set {
if (_statCurrentValue != value) {
_statCurrentValue = value;
TriggerCurrentValueChange();
}
}
}
public RPGVital() {
_statCurrentValue = 0;
}
public void SetCurrentValueToMax() {
StatCurrentValue = StatValue;
}
private void TriggerCurrentValueChange() {
if (OnCurrentValueChange != null) {
OnCurrentValueChange(this, null);
}
}
}
| mit | C# |
04d43913ffb4854609da3cfc6a8b444f3e2a5a70 | Remove some warnings. | Noxalus/Xmas-Hell | Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/BossFactory.cs | Xmas-Hell/Xmas-Hell-Core/Entities/Bosses/BossFactory.cs | using System;
using BulletML;
using XmasHell.Entities.Bosses.XmasBall;
namespace XmasHell.Entities.Bosses
{
public static class BossFactory
{
public static Boss CreateBoss(BossType type, XmasHell game, PositionDelegate playerPositionDelegate)
{
switch (type)
{
case BossType.XmasBall:
return new XmasBall.XmasBall(game, playerPositionDelegate);
case BossType.XmasBell:
return new XmasBell.XmasBell(game, playerPositionDelegate);
case BossType.XmasCandy:
break;
case BossType.XmasSnowflake:
return new XmasSnowflake.XmasSnowflake(game, playerPositionDelegate);
case BossType.XmasLog:
return new XmasLog.XmasLog(game, playerPositionDelegate);
case BossType.XmasTree:
break;
case BossType.XmasGift:
return new XmasGift.XmasGift(game, playerPositionDelegate);
case BossType.XmasReinder:
break;
case BossType.XmasSnowman:
break;
case BossType.XmasSanta:
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
return new XmasBall.XmasBall(game, playerPositionDelegate);
}
}
} | using System;
using BulletML;
using XmasHell.Entities.Bosses.XmasBall;
namespace XmasHell.Entities.Bosses
{
public static class BossFactory
{
public static Boss CreateBoss(BossType type, XmasHell game, PositionDelegate playerPositionDelegate)
{
switch (type)
{
case BossType.XmasBall:
return new XmasBall.XmasBall(game, playerPositionDelegate);
case BossType.XmasBell:
return new XmasBell.XmasBell(game, playerPositionDelegate);
case BossType.XmasCandy:
break;
case BossType.XmasSnowflake:
return new XmasSnowflake.XmasSnowflake(game, playerPositionDelegate);
break;
case BossType.XmasLog:
return new XmasLog.XmasLog(game, playerPositionDelegate);
case BossType.XmasTree:
break;
case BossType.XmasGift:
return new XmasGift.XmasGift(game, playerPositionDelegate);
break;
case BossType.XmasReinder:
break;
case BossType.XmasSnowman:
break;
case BossType.XmasSanta:
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
return new XmasBall.XmasBall(game, playerPositionDelegate);
}
}
} | mit | C# |
914c0cf260e90e181e688c66eb583eb84e1f421f | Add DrawArea rectangle to IHaveChatBubble | ethanmoffat/EndlessClient | EndlessClient/Rendering/Chat/IHaveChatBubble.cs | EndlessClient/Rendering/Chat/IHaveChatBubble.cs | // Original Work Copyright (c) Ethan Moffat 2014-2017
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using Microsoft.Xna.Framework;
namespace EndlessClient.Rendering.Chat
{
public interface IHaveChatBubble
{
Rectangle DrawArea { get; }
}
}
| // Original Work Copyright (c) Ethan Moffat 2014-2017
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
namespace EndlessClient.Rendering.Chat
{
public interface IHaveChatBubble
{
}
}
| mit | C# |
9f802c50c78829a3b63752c59ea8bdc9e4627e90 | Fix concurrency issue in DelayAction (#1870) | ACEmulator/ACE,ACEmulator/ACE,LtRipley36706/ACE,ACEmulator/ACE,LtRipley36706/ACE,LtRipley36706/ACE | Source/ACE.Server/Entity/Actions/DelayAction.cs | Source/ACE.Server/Entity/Actions/DelayAction.cs | using System;
using System.Threading;
namespace ACE.Server.Entity.Actions
{
/// <summary>
/// Action that will not return until Timer.PortalYearTicks >= EndTime
/// must only be inserted into DelayManager actor
/// </summary>
public class DelayAction : ActionEventBase, IComparable<DelayAction>
{
public double WaitTime { get; }
public double EndTime { get; private set; }
// For breaking ties on compareto, two actions cannot be equal
private readonly long sequence;
private static long glblSequence;
public DelayAction(double waitTimePortalYearTicks)
{
WaitTime = waitTimePortalYearTicks;
sequence = Interlocked.Increment(ref glblSequence);
}
public void Start()
{
EndTime = Timers.PortalYearTicks + WaitTime;
}
public int CompareTo(DelayAction rhs)
{
int ret = EndTime.CompareTo(rhs.EndTime);
if (ret == 0)
return sequence.CompareTo(rhs.sequence);
return ret;
}
}
}
| using System;
namespace ACE.Server.Entity.Actions
{
/// <summary>
/// Action that will not return until Timer.PortalYearTicks >= EndTime
/// must only be inserted into DelayManager actor
/// </summary>
public class DelayAction : ActionEventBase, IComparable<DelayAction>
{
public double WaitTime { get; }
public double EndTime { get; private set; }
// For breaking ties on compareto, two actions cannot be equal
private readonly long sequence;
private static volatile uint glblSequence;
public DelayAction(double waitTimePortalYearTicks)
{
WaitTime = waitTimePortalYearTicks;
sequence = glblSequence++;
}
public void Start()
{
EndTime = Timers.PortalYearTicks + WaitTime;
}
public int CompareTo(DelayAction rhs)
{
int ret = EndTime.CompareTo(rhs.EndTime);
if (ret == 0)
return sequence.CompareTo(rhs.sequence);
return ret;
}
}
}
| agpl-3.0 | C# |
cd176e466bf3d9fd4192aca8d1dfa7ef3f511739 | Update MicrosoftAdUnitBundle.cs | tiksn/TIKSN-Framework | TIKSN.Core/Advertising/MicrosoftAdUnitBundle.cs | TIKSN.Core/Advertising/MicrosoftAdUnitBundle.cs | namespace TIKSN.Advertising
{
public abstract class MicrosoftAdUnitBundle : AdUnitBundle
{
protected MicrosoftAdUnitBundle(AdUnit designTime, string applicationId, string adUnitId)
: base(designTime, new AdUnit(AdProviders.Microsoft, applicationId, adUnitId))
{
}
}
} | namespace TIKSN.Advertising
{
public abstract class MicrosoftAdUnitBundle : AdUnitBundle
{
protected MicrosoftAdUnitBundle(AdUnit designTime, string tabletApplicationId, string tabletAdUnitId, string mobileApplicationId, string mobileAdUnitId)
: base(designTime, new AdUnit(AdProviders.Microsoft, tabletApplicationId, tabletAdUnitId), new AdUnit(AdProviders.Microsoft, mobileApplicationId, mobileAdUnitId))
{
}
protected MicrosoftAdUnitBundle(AdUnit designTime, string applicationId, string adUnitId)
: base(designTime, new AdUnit(AdProviders.Microsoft, applicationId, adUnitId))
{
}
}
} | mit | C# |
e26f3073abddd5b46884ebc1dd2883f4fa8898d7 | Fix for outcomes defect | andyfmiller/LtiLibrary | src/LtiLibrary.AspNetCore/Common/AddBodyHashHeaderAttribute.cs | src/LtiLibrary.AspNetCore/Common/AddBodyHashHeaderAttribute.cs | using System;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Http.Internal;
namespace LtiLibrary.AspNetCore.Common
{
/// <summary>
/// Calculate the incomming body hash and store it as a header in the request.
/// </summary>
/// <remarks>
/// The Request.Body stream is disposed during ModelBinding, making it impossible
/// to calculate the incomming body hash inside the Action. This ResourceFilter
/// is executed just before ModelBinding and the hash is stored in a header that
/// the Action can access.
/// </remarks>
internal class AddBodyHashHeaderAttribute : Attribute, IAsyncResourceFilter
{
public async Task OnResourceExecutionAsync(ResourceExecutingContext context, ResourceExecutionDelegate next)
{
var httpContext = context.HttpContext;
var request = httpContext.Request;
request.EnableRewind();
if (request.Body.CanRead)
{
// Calculate the body hash
try
{
using (var sha1 = SHA1.Create())
{
var hash = sha1.ComputeHash(request.Body);
var hash64 = Convert.ToBase64String(hash);
request.Headers.Add("BodyHash", hash64);
}
}
finally
{
if (request.Body.CanSeek)
{
request.Body.Position = 0;
}
}
}
await next();
}
}
}
| using System;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;
namespace LtiLibrary.AspNetCore.Common
{
/// <summary>
/// Calculate the incomming body hash and store it as a header in the request.
/// </summary>
/// <remarks>
/// The Request.Body stream is disposed during ModelBinding, making it impossible
/// to calculate the incomming body hash inside the Action. This ResourceFilter
/// is executed just before ModelBinding and the hash is stored in a header that
/// the Action can access.
/// </remarks>
internal class AddBodyHashHeaderAttribute : Attribute, IAsyncResourceFilter
{
public async Task OnResourceExecutionAsync(ResourceExecutingContext context, ResourceExecutionDelegate next)
{
var httpContext = context.HttpContext;
var request = httpContext.Request;
if (request.Body.CanRead)
{
// Calculate the body hash
try
{
using (var sha1 = SHA1.Create())
{
var hash = sha1.ComputeHash(request.Body);
var hash64 = Convert.ToBase64String(hash);
request.Headers.Add("BodyHash", hash64);
}
}
finally
{
if (request.Body.CanSeek)
{
request.Body.Position = 0;
}
}
}
await next();
}
}
}
| apache-2.0 | C# |
237ada9ee1758e1b29cf7cd4980f17ac2e76deda | Change Namespace | muhammedikinci/FuzzyCore | FuzzyCore/ConcreteCommands/ProgramOpen_Command.cs | FuzzyCore/ConcreteCommands/ProgramOpen_Command.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FuzzyCore.Server.Data;
namespace FuzzyCore.Server
{
public class ProgramOpen_Command : Command
{
public ProgramOpen_Command(JsonCommand Comm) : base(Comm)
{
}
public override void Execute()
{
Console.WriteLine(Comm.CommandType);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using fuzzyControl.Server.Data;
namespace fuzzyControl.Server
{
public class ProgramOpen_Command : Command
{
public ProgramOpen_Command(JsonCommand Comm) : base(Comm)
{
}
public override void Execute()
{
Console.WriteLine(Comm.CommandType);
}
}
}
| mit | C# |
47d9f1138be58cf4ce34f9ec72c687936e4afd79 | fix redirect action | SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery | AstroPhotoGallery/AstroPhotoGallery/Views/Picture/Delete.cshtml | AstroPhotoGallery/AstroPhotoGallery/Views/Picture/Delete.cshtml | @model AstroPhotoGallery.Models.Picture
@{
ViewBag.Title = "Delete";
}
<div class="container">
<div class="well">
<h2>Delete Picture</h2>
@using (Html.BeginForm("Delete", "Picture", FormMethod.Post, new { @class = "form-horizontal" }))
{
@Html.AntiForgeryToken()
<div class="gallery">
<img src="@Url.Content(Model.ImagePath)" alt="Astro" width="300" height="200">
</div>
<div class="form-group">
@Html.LabelFor(m => m.PicTitle, new { @class = "control-label col-sm-4" })
<div class="col-sm-4">
@Html.TextBoxFor(m => m.PicTitle, new { @class = "form-control", @readonly = "readonly" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.PicDescription, new { @class = "control-label col-sm-4" })
<div class="col-sm-4">
@Html.TextAreaFor(m => m.PicDescription, new { @class = "form-control", @readonly = "readonly", @rows = "7" })
</div>
</div>
//ObjectDisposedException:
@*<div class="form-group">
@Html.LabelFor(m => m.CategoryId, new { @class = "control-label col-sm-4" })
<div class="dropdown col-sm-4">
@Html.TextAreaFor(m => m.Category.Name)
</div>
</div>*@
<div class="form-group">
<div class="col-sm-4 col-sm-offset-4">
@Html.ActionLink("Cancel", "List", "Picture", null, new { @class = "btn btn-default" })
<input type="submit" value="Delete" class="btn btn-danger" />
</div>
</div>
}
</div>
</div>
| @model AstroPhotoGallery.Models.Picture
@{
ViewBag.Title = "Delete";
}
<div class="container">
<div class="well">
<h2>Delete Picture</h2>
@using (Html.BeginForm("Delete", "Picture", FormMethod.Post, new { @class = "form-horizontal" }))
{
@Html.AntiForgeryToken()
<div class="gallery">
<img src="@Url.Content(Model.ImagePath)" alt="Astro" width="300" height="200">
</div>
<div class="form-group">
@Html.LabelFor(m => m.PicTitle, new { @class = "control-label col-sm-4" })
<div class="col-sm-4">
@Html.TextBoxFor(m => m.PicTitle, new { @class = "form-control", @readonly = "readonly" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.PicDescription, new { @class = "control-label col-sm-4" })
<div class="col-sm-4">
@Html.TextAreaFor(m => m.PicDescription, new { @class = "form-control", @readonly = "readonly", @rows = "7" })
</div>
</div>
//ObjectDisposedException:
@*<div class="form-group">
@Html.LabelFor(m => m.CategoryId, new { @class = "control-label col-sm-4" })
<div class="dropdown col-sm-4">
@Html.TextAreaFor(m => m.Category.Name)
</div>
</div>*@
<div class="form-group">
<div class="col-sm-4 col-sm-offset-4">
@Html.ActionLink("Cancel", "Index", "Article", null, new { @class = "btn btn-default" })
<input type="submit" value="Delete" class="btn btn-danger" />
</div>
</div>
}
</div>
</div>
| mit | C# |
6b809efb7b34cf725b4de26893bcb95cb15f4197 | rework GetEventLogs() to use linq query | StilgarISCA/EventLogManager | Source/EventLogManager/EventLogConnection/EventLogConnection.cs | Source/EventLogManager/EventLogConnection/EventLogConnection.cs | using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using Microsoft.Win32;
namespace EventLogManager.Connection
{
/// <summary>
/// Encapsulate logic for managing Windows Event Logs
/// </summary>
public class EventLogConnection : IEventLogConnection
{
/// <summary>
/// Look at the event log and retrieve all the event log names
/// </summary>
/// <returns>Collection of event log names</returns>
public Collection<string> GetEventLogs()
{
// TODO: Handle SystemException which can be thrown by EventLog.GetEventLogs()
// http://msdn.microsoft.com/en-us/library/74e2ybbs(v=vs.110).aspx
var eventLogNames = new List<string>();
eventLogNames.AddRange( from EventLog eventLog in EventLog.GetEventLogs()
select eventLog.Log );
return new Collection<string>( eventLogNames );
}
/// <summary>
/// Looks in the registry to retrieve a collection of all event sources
/// for a given event log
/// </summary>
/// <param name="eventLogName">event log to list sources of</param>
/// <returns>Collection of event source names</returns>
public Collection<string> GetEventLogSources( string eventLogName )
{
// TODO: Handle exceptions thrown by OpenSubKey
// http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.getsubkeynames(v=vs.110).aspx
var eventSourceNames = new List<string>();
string registryLocation = string.Format( CultureInfo.InvariantCulture, @"SYSTEM\CurrentControlSet\Services\Eventlog\{0}", eventLogName );
using( RegistryKey registryKey = Registry.LocalMachine.OpenSubKey( registryLocation ) )
{
if( registryKey == null )
{
return new Collection<string>( eventSourceNames );
}
eventSourceNames.AddRange( registryKey.GetSubKeyNames() );
}
return new Collection<string>( eventSourceNames );
}
}
}
| using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using Microsoft.Win32;
namespace EventLogManager.Connection
{
/// <summary>
/// Encapsulate logic for managing Windows Event Logs
/// </summary>
public class EventLogConnection : IEventLogConnection
{
/// <summary>
/// Look at the event log and retrieve all the event log names
/// </summary>
/// <returns>Collection of event log names</returns>
public Collection<string> GetEventLogs()
{
// TODO: Handle SystemException which can be thrown by EventLog.GetEventLogs()
// http://msdn.microsoft.com/en-us/library/74e2ybbs(v=vs.110).aspx
var eventLogNames = new Collection<string>();
EventLog[] eventLogs = EventLog.GetEventLogs();
foreach( EventLog eventLog in eventLogs )
{
eventLogNames.Add( eventLog.Log );
}
return eventLogNames;
}
/// <summary>
/// Looks in the registry to retrieve a collection of all event sources
/// for a given event log
/// </summary>
/// <param name="eventLogName">event log to list sources of</param>
/// <returns>Collection of event source names</returns>
public Collection<string> GetEventLogSources( string eventLogName )
{
// TODO: Handle exceptions thrown by OpenSubKey
// http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.getsubkeynames(v=vs.110).aspx
var eventSourceNames = new List<string>();
string registryLocation = string.Format( CultureInfo.InvariantCulture, @"SYSTEM\CurrentControlSet\Services\Eventlog\{0}", eventLogName );
using( RegistryKey registryKey = Registry.LocalMachine.OpenSubKey( registryLocation ) )
{
if( registryKey == null )
{
return new Collection<string>( eventSourceNames );
}
eventSourceNames.AddRange( registryKey.GetSubKeyNames() );
}
return new Collection<string>( eventSourceNames );
}
}
}
| mit | C# |
6438ed7f79a9a1fd6f89b19ed0d2eb71623ec847 | Remove incomplete test | pardahlman/akeneo-csharp | Akeneo.IntegrationTests/AttributeTests.cs | Akeneo.IntegrationTests/AttributeTests.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Akeneo.Common;
using Akeneo.Consts;
using Akeneo.Model;
using Akeneo.Model.Attributes;
using Akeneo.Serialization;
using Newtonsoft.Json;
using Xunit;
namespace Akeneo.IntegrationTests
{
public class AttributeTests : IntegrationTestBase
{
[Fact]
public async Task Get_Many_Async()
{
var pagination = await Client.GetManyAsync<AttributeBase>();
Assert.NotNull(pagination);
Assert.Equal(pagination.CurrentPage, 1);
}
[Fact]
public async Task Create_Many_Async()
{
var result = await Client.CreateOrUpdateAsync(new List<NumberAttribute>
{
new NumberAttribute
{
AvailableLocales = new List<string> {Locales.EnglishUs, Locales.SwedenSwedish},
Code = "test_6",
Group = AkeneoDefaults.AttributeGroup,
NegativeAllowed = true
},
new NumberAttribute
{
AvailableLocales = new List<string> {Locales.EnglishUs, Locales.SwedenSwedish},
Code = "test_7",
Group = AkeneoDefaults.AttributeGroup,
NegativeAllowed = true
}
});
Assert.NotNull(result);
Assert.Equal(result.Count, 2);
}
[Fact]
public async Task Create_Update_Delete_Number_Atttribute()
{
/* Create */
var number = new NumberAttribute
{
AvailableLocales = new List<string> { Locales.EnglishUs, Locales.SwedenSwedish },
Code = "test_2",
Group = AkeneoDefaults.AttributeGroup,
NegativeAllowed = true
};
var createResponse = await Client.CreateAsync(number);
Assert.Equal(createResponse.Code, HttpStatusCode.Created);
/* Update */
number.NegativeAllowed = false;
var updateResponse = await Client.UpdateAsync(number);
Assert.Equal(updateResponse.Code, HttpStatusCode.NoContent);
/* Delete */
var deleteResponse = await Client.DeleteAsync<NumberAttribute>(number.Code);
Assert.True(deleteResponse.Code == HttpStatusCode.MethodNotAllowed, "API does not support removal of attributes");
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Akeneo.Common;
using Akeneo.Consts;
using Akeneo.Model;
using Akeneo.Model.Attributes;
using Akeneo.Serialization;
using Newtonsoft.Json;
using Xunit;
namespace Akeneo.IntegrationTests
{
public class AttributeTests : IntegrationTestBase
{
[Fact]
public async Task Get_Many_Async()
{
var pagination = await Client.GetManyAsync<AttributeBase>();
Assert.NotNull(pagination);
Assert.Equal(pagination.CurrentPage, 1);
}
[Fact]
public async Task Create_Many_Async()
{
var result = await Client.CreateOrUpdateAsync(new List<NumberAttribute>
{
new NumberAttribute
{
AvailableLocales = new List<string> {Locales.EnglishUs, Locales.SwedenSwedish},
Code = "test_6",
Group = AkeneoDefaults.AttributeGroup,
NegativeAllowed = true
},
new NumberAttribute
{
AvailableLocales = new List<string> {Locales.EnglishUs, Locales.SwedenSwedish},
Code = "test_7",
Group = AkeneoDefaults.AttributeGroup,
NegativeAllowed = true
}
});
Assert.NotNull(result);
Assert.Equal(result.Count, 2);
}
[Fact]
public async Task Create_Update_Delete_Number_Atttribute()
{
/* Create */
var number = new NumberAttribute
{
AvailableLocales = new List<string> { Locales.EnglishUs, Locales.SwedenSwedish },
Code = "test_2",
Group = AkeneoDefaults.AttributeGroup,
NegativeAllowed = true
};
var createResponse = await Client.CreateAsync(number);
Assert.Equal(createResponse.Code, HttpStatusCode.Created);
/* Update */
number.NegativeAllowed = false;
var updateResponse = await Client.UpdateAsync(number);
Assert.Equal(updateResponse.Code, HttpStatusCode.NoContent);
/* Delete */
var deleteResponse = await Client.DeleteAsync<NumberAttribute>(number.Code);
Assert.True(deleteResponse.Code == HttpStatusCode.MethodNotAllowed, "API does not support removal of attributes");
}
[Fact]
public async Task Create_Image_Attribute()
{
var media = new MediaUpload
{
Product =
{
Identifier = "tyfon-bb-1000-1000-3m-3m",
Attribute = "Product_Image_Medium"
},
FilePath = "C:\\tmp\\banhof.png",
FileName = "banhof3.png"
};
var download = await Client.DownloadAsync("d/c/b/6/dcb68b9fd1dc17bc711d7041c4c817e290596b30_boxer2.png");
}
}
}
| mit | C# |
a5ec4057e75959ab9b7ac0f29a5f0f68e4f47a30 | Bump version to 0.12.2 | quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot | CactbotOverlay/Properties/AssemblyInfo.cs | CactbotOverlay/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.12.2.0")]
[assembly: AssemblyFileVersion("0.12.2.0")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("CactbotOverlay")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CactbotOverlay")]
[assembly: AssemblyCopyright("Copyright 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")]
// Version:
// - Major Version
// - Minor Version
// - Build Number
// - Revision
// GitHub has only 3 version components, so Revision should always be 0.
[assembly: AssemblyVersion("0.12.1.0")]
[assembly: AssemblyFileVersion("0.12.1.0")] | apache-2.0 | C# |
7176e743325cfa30119c86175ab582ff62c114c9 | Change margin | bartlomiejwolk/AnimationPathAnimator | Editor/PropertyDrawers/NodeEventDrawer.cs | Editor/PropertyDrawers/NodeEventDrawer.cs | using UnityEngine;
using System.Collections;
using UnityEditor;
namespace ATP.SimplePathAnimator {
[CustomPropertyDrawer(typeof(NodeEvent))]
public class NodeEventDrawer : PropertyDrawer {
/// How many rows (properties) will be displayed.
const int _rows = 2;
/// Hight of a single property.
const int propHeight = 16;
/// Margin between properties.
const int propMargin = 4;
const int RowsSpace = 8;
/// Overall hight of the serialized property.
public override float GetPropertyHeight(
SerializedProperty property,
GUIContent label) {
return base.GetPropertyHeight(property, label)
* _rows // Each row is 16 px high.
+ (_rows - 1) * RowsSpace; // Add 4 px for each spece between rows.
}
public override void OnGUI(
Rect pos,
SerializedProperty prop,
GUIContent label) {
SerializedProperty methodName =
prop.FindPropertyRelative("methodName");
SerializedProperty methodArg =
prop.FindPropertyRelative("methodArg");
EditorGUIUtility.labelWidth = 70;
EditorGUI.PropertyField(
new Rect(pos.x, pos.y, pos.width, propHeight),
methodName,
new GUIContent("Method", ""));
EditorGUI.PropertyField(
new Rect(
pos.x,
pos.y + 1 * (propHeight + propMargin),
pos.width,
propHeight),
methodArg,
new GUIContent("Argument", ""));
}
}
}
| using UnityEngine;
using System.Collections;
using UnityEditor;
namespace ATP.SimplePathAnimator {
[CustomPropertyDrawer(typeof(NodeEvent))]
public class NodeEventDrawer : PropertyDrawer {
/// How many rows (properties) will be displayed.
const int _rows = 2;
/// Hight of a single property.
const int propHeight = 16;
/// Margin between properties.
const int propMargin = 4;
/// Overall hight of the serialized property.
public override float GetPropertyHeight(
SerializedProperty property,
GUIContent label) {
return base.GetPropertyHeight(property, label)
* _rows // Each row is 16 px high.
+ (_rows - 1) * 4; // Add 4 px for each spece between rows.
}
public override void OnGUI(
Rect pos,
SerializedProperty prop,
GUIContent label) {
SerializedProperty methodName =
prop.FindPropertyRelative("methodName");
SerializedProperty methodArg =
prop.FindPropertyRelative("methodArg");
EditorGUIUtility.labelWidth = 70;
EditorGUI.PropertyField(
new Rect(pos.x, pos.y, pos.width, propHeight),
methodName,
new GUIContent("Method", ""));
EditorGUI.PropertyField(
new Rect(
pos.x,
pos.y + 1 * (propHeight + propMargin),
pos.width,
propHeight),
methodArg,
new GUIContent("Argument", ""));
}
}
}
| mit | C# |
88efa3d83ef3bc6dd5d3bd99f6130339fe13b2a2 | Use dotnet core run task | jeyjeyemem/Xer.Cqrs | setup.cake | setup.cake | #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./",
title: "Xer.Cqrs",
repositoryOwner: "XerProjects",
repositoryName: "Xer.Cqrs",
appVeyorAccountName: "mvput",
shouldRunDupFinder: false,
shouldRunDotNetCorePack: true);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore(); | #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./",
title: "Xer.Cqrs",
repositoryOwner: "XerProjects",
repositoryName: "Xer.Cqrs",
appVeyorAccountName: "mvput",
shouldRunDupFinder: false,
shouldRunDotNetCorePack: true);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.Run(); | mit | C# |
a30a9d32a41efdd06a042eccfc5d62fb226a998d | Add License | chraft/c-raft | Chraft/World/NBT/TagNodeType.cs | Chraft/World/NBT/TagNodeType.cs | /* Minecraft NBT reader
*
* Copyright 2010-2011 Michael Ong, all rights reserved.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
namespace Chraft.World.NBT
{
/// <summary>
/// Provides the basic TAG_TYPE for a node.
/// </summary>
public enum TagNodeType : int
{
/// <summary>
/// Empty tag
/// </summary>
TAG_END,
/// <summary>
/// Byte tag
/// </summary>
TAG_BYTE,
/// <summary>
/// Short integer tag
/// </summary>
TAG_SHORT,
/// <summary>
/// Normal integer tag
/// </summary>
TAG_INT,
/// <summary>
/// Large integer tag
/// </summary>
TAG_LONG,
/// <summary>
/// Single precision floating-point tag
/// </summary>
TAG_SINGLE,
/// <summary>
/// Double precision floating-point tag
/// </summary>
TAG_DOUBLE,
/// <summary>
/// Byte array tag
/// </summary>
TAG_BYTEA,
/// <summary>
/// String tag
/// </summary>
TAG_STRING,
/// <summary>
/// Unnamed, custom type array tag
/// </summary>
TAG_LIST,
/// <summary>
/// Named, custom type array tag
/// </summary>
TAG_COMPOUND,
}
}
| using System;
namespace Chraft.World.NBT
{
/// <summary>
/// Provides the basic TAG_TYPE for a node.
/// </summary>
public enum TagNodeType : int
{
/// <summary>
/// Empty tag
/// </summary>
TAG_END,
/// <summary>
/// Byte tag
/// </summary>
TAG_BYTE,
/// <summary>
/// Short integer tag
/// </summary>
TAG_SHORT,
/// <summary>
/// Normal integer tag
/// </summary>
TAG_INT,
/// <summary>
/// Large integer tag
/// </summary>
TAG_LONG,
/// <summary>
/// Single precision floating-point tag
/// </summary>
TAG_SINGLE,
/// <summary>
/// Double precision floating-point tag
/// </summary>
TAG_DOUBLE,
/// <summary>
/// Byte array tag
/// </summary>
TAG_BYTEA,
/// <summary>
/// String tag
/// </summary>
TAG_STRING,
/// <summary>
/// Unnamed, custom type array tag
/// </summary>
TAG_LIST,
/// <summary>
/// Named, custom type array tag
/// </summary>
TAG_COMPOUND,
}
}
| agpl-3.0 | C# |
1340332891c03236f4bcefe739b96fa9854d7755 | Update FerCorrales.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/FerCorrales.cs | src/Firehose.Web/Authors/FerCorrales.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class FerCorrales : IAmACommunityMember
{
public string FirstName => "Fer";
public string LastName => "Corrales";
public string ShortBioOrTagLine => "Passionate about PowerShell and automation. Virtualization / Cloud Engineer";
public string StateOrRegion => "Costa Rica";
public string EmailAddress => "string.Empty";
public string TwitterHandle => "FerCorrales_";
public string GravatarHash => "f4b846ac7c5798b6700b2e9265a7acd0";
public string GitHubHandle => "F3rC";
public GeoPosition Position => new GeoPosition(9.864687, -83.920451);
public Uri WebSite => new Uri("https://fercorrales.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://fercorrales.com/category/powershell/feed/"); } }
public string FeedLanguageCode => "en";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class FerCorrales : IAmACommunityMember
{
public string FirstName => "Fer";
public string LastName => "Corrales";
public string ShortBioOrTagLine => "Passionate about PSand automation. Virtualization / Cloud Engineer";
public string StateOrRegion => "Costa Rica";
public string EmailAddress => "string.Empty";
public string TwitterHandle => "FerCorrales_";
public string GravatarHash => "f4b846ac7c5798b6700b2e9265a7acd0";
public string GitHubHandle => "F3rC";
public GeoPosition Position => new GeoPosition(9.864687, -83.920451);
public Uri WebSite => new Uri("https://fercorrales.com/");
public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://fercorrales.com/category/powershell/feed/"); } }
public string FeedLanguageCode => "en";
}
}
| mit | C# |
8a1e79e27cb5e6f29fdabbaed3b784a922e05398 | Revert "Minor version bump" | rough007/PythLR | CyLR/Properties/AssemblyInfo.cs | CyLR/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CyLR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CyLR")]
[assembly: AssemblyCopyright("Copyright © 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("87ad38a9-7d56-45e5-b131-64534fae0435")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| using System.Reflection;
using System.Runtime.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("CyLR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CyLR")]
[assembly: AssemblyCopyright("Copyright © 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("87ad38a9-7d56-45e5-b131-64534fae0435")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.1")]
[assembly: AssemblyFileVersion("1.2.0.1")]
| apache-2.0 | C# |
a04bf23a349ac777dc5a527be7dde38aa2b41cc9 | Fix '"_csharpnull": true' showing up in Mongo | ermshiperete/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge,ermshiperete/LfMerge,sillsdev/LfMerge | src/LfMerge/LanguageForge/Model/LfLexEntry.cs | src/LfMerge/LanguageForge/Model/LfLexEntry.cs | // Copyright (c) 2015 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace LfMerge.LanguageForge.Model
{
public class LfLexEntry : LfFieldBase
{
// Metadata properties
public ObjectId Id { get; set; }
public string LiftId { get; set; } // TODO Investigate why this seems to not be modeled in LF PHP code... should it be?
[BsonRepresentation(BsonType.String)]
public Guid Guid { get; set; }
public bool IsDeleted { get; set; }
public string MercurialSha { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateModified { get; set; }
// Data properties
public LfMultiText Lexeme { get; set; }
public List<LfSense> Senses { get; set; }
public LfAuthorInfo AuthorInfo { get; set; }
public LfMultiText CitationForm { get; set; }
public BsonDocument CustomFields { get; set; }
public BsonDocument CustomFieldGuids { get; set; }
public LfMultiText CvPattern { get; set; }
public LfMultiText EntryBibliography { get; set; }
public LfMultiText EntryRestrictions { get; set; }
public LfStringArrayField Environments { get; set; }
public LfMultiText Etymology { get; set; }
public LfMultiText EtymologyGloss { get; set; }
public LfMultiText EtymologyComment { get; set; }
public LfMultiText EtymologySource { get; set; }
public LfMultiText LiteralMeaning { get; set; }
public LfStringField Location { get; set; }
public string MorphologyType { get; set; }
public LfMultiText Note { get; set; }
public LfMultiText Pronunciation { get; set; }
[BsonRepresentation(BsonType.String)]
public Guid PronunciationGuid { get; set; }
public LfMultiText SummaryDefinition { get; set; }
public LfMultiText Tone { get; set; }
public LfLexEntry()
{
Senses = new List<LfSense>();
}
}
}
| // Copyright (c) 2015 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace LfMerge.LanguageForge.Model
{
public class LfLexEntry : LfFieldBase
{
// Metadata properties
public ObjectId Id { get; set; }
public string LiftId { get; set; } // TODO Investigate why this seems to not be modeled in LF PHP code... should it be?
[BsonRepresentation(BsonType.String)]
public Guid Guid { get; set; }
public bool IsDeleted { get; set; }
public string MercurialSha { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateModified { get; set; }
// Data properties
public LfMultiText Lexeme { get; set; }
public List<LfSense> Senses { get; set; }
public LfAuthorInfo AuthorInfo { get; set; }
public LfMultiText CitationForm { get; set; }
public BsonDocument CustomFields { get; set; }
public BsonDocument CustomFieldGuids { get; set; }
public LfMultiText CvPattern { get; set; }
public LfMultiText EntryBibliography { get; set; }
public LfMultiText EntryRestrictions { get; set; }
public BsonDocument Environments { get; set; }
public LfMultiText Etymology { get; set; }
public LfMultiText EtymologyGloss { get; set; }
public LfMultiText EtymologyComment { get; set; }
public LfMultiText EtymologySource { get; set; }
public LfMultiText LiteralMeaning { get; set; }
public LfStringField Location { get; set; }
public string MorphologyType { get; set; }
public LfMultiText Note { get; set; }
public LfMultiText Pronunciation { get; set; }
[BsonRepresentation(BsonType.String)]
public Guid PronunciationGuid { get; set; }
public LfMultiText SummaryDefinition { get; set; }
public LfMultiText Tone { get; set; }
public LfLexEntry()
{
Senses = new List<LfSense>();
}
}
}
| mit | C# |
33a14b0126b1ac0dc938710848028b128c416e10 | Fix to properly shutdown managed TimerWatcher | jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,jmptrader/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,jacksonh/manos,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jmptrader/manos,mdavid/manos-spdy,jmptrader/manos,jacksonh/manos,mdavid/manos-spdy,mdavid/manos-spdy,jacksonh/manos | src/Manos.IO/Manos.IO.Managed/TimerWatcher.cs | src/Manos.IO/Manos.IO.Managed/TimerWatcher.cs | using System;
using System.Threading;
namespace Manos.IO.Managed
{
class TimerWatcher : Watcher, ITimerWatcher
{
private Action cb;
private Timer timer;
private TimeSpan after;
private int invocationConcurrency;
public TimerWatcher (Context context, Action callback, TimeSpan after, TimeSpan repeat)
: base (context)
{
if (callback == null)
throw new ArgumentNullException ("callback");
this.cb = callback;
this.timer = new Timer (Invoke);
this.after = after;
this.Repeat = repeat;
}
void Invoke (object state)
{
try {
if (Interlocked.Increment (ref invocationConcurrency) == 1) {
if (IsRunning) {
Context.Enqueue (cb);
after = TimeSpan.Zero;
}
}
} finally {
Interlocked.Decrement (ref invocationConcurrency);
}
}
public override void Start ()
{
base.Start ();
timer.Change ((int) after.TotalMilliseconds,
Repeat == TimeSpan.Zero ? Timeout.Infinite : (int) Repeat.TotalMilliseconds);
}
public override void Stop ()
{
timer.Change (Timeout.Infinite, Timeout.Infinite);
base.Stop ();
}
protected override void Dispose (bool disposing)
{
if (timer != null)
{
timer.Change(Timeout.Infinite, Timeout.Infinite);
timer.Dispose();
timer = null;
}
Context.Remove (this);
}
public void Again ()
{
after = TimeSpan.Zero;
Start ();
}
public TimeSpan Repeat {
get;
set;
}
}
}
| using System;
using System.Threading;
namespace Manos.IO.Managed
{
class TimerWatcher : Watcher, ITimerWatcher
{
private Action cb;
private Timer timer;
private TimeSpan after;
private int invocationConcurrency;
public TimerWatcher (Context context, Action callback, TimeSpan after, TimeSpan repeat)
: base (context)
{
if (callback == null)
throw new ArgumentNullException ("callback");
this.cb = callback;
this.timer = new Timer (Invoke);
this.after = after;
this.Repeat = repeat;
}
void Invoke (object state)
{
try {
if (Interlocked.Increment (ref invocationConcurrency) == 1) {
if (IsRunning) {
Context.Enqueue (cb);
after = TimeSpan.Zero;
}
}
} finally {
Interlocked.Decrement (ref invocationConcurrency);
}
}
public override void Start ()
{
base.Start ();
timer.Change ((int) after.TotalMilliseconds,
Repeat == TimeSpan.Zero ? Timeout.Infinite : (int) Repeat.TotalMilliseconds);
}
public override void Stop ()
{
timer.Change (Timeout.Infinite, Timeout.Infinite);
base.Stop ();
}
protected override void Dispose (bool disposing)
{
Context.Remove (this);
}
public void Again ()
{
after = TimeSpan.Zero;
Start ();
}
public TimeSpan Repeat {
get;
set;
}
}
}
| mit | C# |
d9612fdc722e234cbd3523787ad4a6b7a41e4136 | Fix the build | charlenni/Mapsui,charlenni/Mapsui | Samples/Mapsui.Samples.Common/Maps/Data/MbTilesSample.cs | Samples/Mapsui.Samples.Common/Maps/Data/MbTilesSample.cs | using System.IO;
using System.Threading.Tasks;
using BruTile.MbTiles;
using Mapsui.Tiling.Layers;
using Mapsui.UI;
using SQLite;
namespace Mapsui.Samples.Common.Maps
{
public class MbTilesSample : ISample
{
// This is a hack used for iOS/Android deployment
public static string MbTilesLocation { get; set; } = @"." + Path.DirectorySeparatorChar + "MbTiles";
public string Name => "1 MbTiles";
public string Category => "Data";
public static Map CreateMap()
{
var map = new Map();
map.Layers.Add(CreateMbTilesLayer(Path.GetFullPath(Path.Combine(MbTilesLocation, "world.mbtiles")), "regular"));
return map;
}
public Task<Map> CreateMapAsync()
{
return Task.FromResult(CreateMap());
}
public static TileLayer CreateMbTilesLayer(string path, string name)
{
var mbTilesTileSource = new MbTilesTileSource(new SQLiteConnectionString(path, true));
var mbTilesLayer = new TileLayer(mbTilesTileSource) { Name = name };
return mbTilesLayer;
}
}
} | using System.IO;
using System.Threading.Tasks;
using BruTile.MbTiles;
using Mapsui.Tiling.Layers;
using Mapsui.UI;
using SQLite;
namespace Mapsui.Samples.Common.Maps
{
public class MbTilesSample : ISample
{
// This is a hack used for iOS/Android deployment
public static string MbTilesLocation { get; set; } = @"." + Path.DirectorySeparatorChar + "MbTiles";
public string Name => "1 MbTiles";
public string Category => "Data";
public Task<Map> CreateMapAsync()
{
var map = new Map();
map.Layers.Add(CreateMbTilesLayer(Path.GetFullPath(Path.Combine(MbTilesLocation, "world.mbtiles")), "regular"));
return Task.FromResult(map);
}
public static TileLayer CreateMbTilesLayer(string path, string name)
{
var mbTilesTileSource = new MbTilesTileSource(new SQLiteConnectionString(path, true));
var mbTilesLayer = new TileLayer(mbTilesTileSource) { Name = name };
return mbTilesLayer;
}
}
} | mit | C# |
6dda76d4ba450d6b2926603e354295232ec8c9f3 | 把bundleconfig.cs過濾掉在測試涵蓋率裡面 | alantsai-samples/devops-psake,alantsai-samples/devops-psake,alantsai-samples/devops-psake | src/WebApplication1/App_Start/BundleConfig.cs | src/WebApplication1/App_Start/BundleConfig.cs | using System.Diagnostics.CodeAnalysis;
using System.Web;
using System.Web.Optimization;
namespace WebApplication1
{
[ExcludeFromCodeCoverage]
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| using System.Web;
using System.Web.Optimization;
namespace WebApplication1
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| mit | C# |
a01b6db094ed80ca2bd90016c657d65ded1c165a | Remove unused code from GameActionPacket (#1947) | ACEmulator/ACE,LtRipley36706/ACE,LtRipley36706/ACE,LtRipley36706/ACE,ACEmulator/ACE,ACEmulator/ACE | Source/ACE.Server/Network/GameAction/GameActionPacket.cs | Source/ACE.Server/Network/GameAction/GameActionPacket.cs | using ACE.Server.Network.Enum;
using ACE.Server.Network.GameMessages;
using ACE.Server.Network.Managers;
namespace ACE.Server.Network.GameAction
{
public static class GameActionPacket
{
[GameMessage(GameMessageOpcode.GameAction, SessionState.WorldConnected)]
public static void HandleGameAction(ClientMessage message, Session session)
{
// TODO: verify sequence
uint sequence = message.Payload.ReadUInt32();
uint opcode = message.Payload.ReadUInt32();
InboundMessageManager.HandleGameAction((GameActionType)opcode, message, session);
}
}
}
| using ACE.Server.Network.Enum;
using ACE.Server.Network.GameMessages;
using ACE.Server.Network.Managers;
namespace ACE.Server.Network.GameAction
{
public abstract class GameActionPacket
{
protected Session Session { get; private set; }
protected ClientPacketFragment Fragment { get; private set; }
protected GameActionPacket(Session session, ClientPacketFragment fragment)
{
Session = session;
Fragment = fragment;
}
// not all action packets have a body
public virtual void Read() { }
public abstract void Handle();
[GameMessage(GameMessageOpcode.GameAction, SessionState.WorldConnected)]
public static void HandleGameAction(ClientMessage message, Session session)
{
// TODO: verify sequence
uint sequence = message.Payload.ReadUInt32();
uint opcode = message.Payload.ReadUInt32();
InboundMessageManager.HandleGameAction((GameActionType)opcode, message, session);
}
}
}
| agpl-3.0 | C# |
21c5d7deceb2fca56bd5343c15e50684ab3cc442 | Add an IRandom.GetDigit() extension method, which returns a string between '0' and '9'. | brendanjbaker/Bakery | src/Bakery/Security/RandomExtensions.cs | src/Bakery/Security/RandomExtensions.cs | namespace Bakery.Security
{
using System;
public static class RandomExtensions
{
public static Byte[] GetBytes(this IRandom random, Int32 count)
{
if (count <= 0)
throw new ArgumentOutOfRangeException(nameof(count));
var buffer = new Byte[count];
for (var i = 0; i < count; i++)
buffer[i] = random.GetByte();
return buffer;
}
public static String GetDigit(this IRandom random)
{
return (random.GetUInt64() % 10).ToString();
}
public static Int64 GetInt64(this IRandom random)
{
return BitConverter.ToInt64(random.GetBytes(8), 0);
}
public static UInt64 GetUInt64(this IRandom random)
{
return BitConverter.ToUInt64(random.GetBytes(8), 0);
}
}
}
| namespace Bakery.Security
{
using System;
public static class RandomExtensions
{
public static Byte[] GetBytes(this IRandom random, Int32 count)
{
if (count <= 0)
throw new ArgumentOutOfRangeException(nameof(count));
var buffer = new Byte[count];
for (var i = 0; i < count; i++)
buffer[i] = random.GetByte();
return buffer;
}
public static Int64 GetInt64(this IRandom random)
{
return BitConverter.ToInt64(random.GetBytes(8), 0);
}
public static UInt64 GetUInt64(this IRandom random)
{
return BitConverter.ToUInt64(random.GetBytes(8), 0);
}
}
}
| mit | C# |
14f2a639083039339fe40bc593d84f1adcbe142c | Enable testing of internal functionality, to allow tests of AsyncBarrier | nlkl/Channels | src/Channels/Properties/AssemblyInfo.cs | src/Channels/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Channels")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Channels")]
[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("e3f88afb-274b-43cb-8dd9-98de51e8838e")]
// 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")]
// Allow test project access to internal functionality
[assembly: InternalsVisibleTo("Channels.Tests")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Channels")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Channels")]
[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("e3f88afb-274b-43cb-8dd9-98de51e8838e")]
// 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# |
84ff82ee515a8fd233a99dc9a142d18be3dbcb26 | fix #13 | nerai/CMenu | src/ConsoleMenu/DefaultItems/MI_Help.cs | src/ConsoleMenu/DefaultItems/MI_Help.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleMenu.DefaultItems
{
public class MI_Help : CMenuItem
{
private readonly CMenu _Menu;
public MI_Help (CMenu menu)
: base ("help")
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
_Menu = menu;
HelpText = ""
+ "help [command]\n"
+ "Displays a help text for the specified command, or\n"
+ "Displays a list of all available commands.";
}
public override MenuResult Execute (string arg)
{
DisplayHelp (arg, _Menu, false);
return MenuResult.Normal;
}
private static void DisplayHelp (string arg, CMenuItem context, bool isInner)
{
if (arg == null) {
throw new ArgumentNullException ("arg");
}
if (context == null) {
throw new ArgumentNullException ("context");
}
if (string.IsNullOrEmpty (arg)) {
if (!DisplayItemHelp (context, !context.Any ())) {
DisplayAvailableCommands (context, isInner);
}
return;
}
var cmd = arg;
var inner = context.GetMenuItem (ref cmd, out arg, false, false);
if (inner != null) {
DisplayHelp (arg, inner, true);
return;
}
Console.WriteLine ("Could not find inner command \"" + cmd + "\".");
if (context.Selector != null) {
Console.WriteLine ("Help for " + context.Selector + ":");
}
DisplayItemHelp (context, true);
}
private static bool DisplayItemHelp (CMenuItem item, bool force)
{
if (item == null) {
throw new ArgumentNullException ("item");
}
if (item.HelpText == null) {
if (force) {
Console.WriteLine ("No help available for " + item.Selector);
}
return false;
}
else {
Console.WriteLine (item.HelpText);
return true;
}
}
private static void DisplayAvailableCommands (CMenuItem menu, bool inner)
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
if (!inner) {
Console.WriteLine ("Available commands:");
}
var abbreviations = menu.CommandAbbreviations ().OrderBy (it => it.Key);
foreach (var ab in abbreviations) {
if (ab.Value == null) {
Console.Write (" ");
}
else {
Console.Write (ab.Value.PadRight (3) + " | ");
}
Console.WriteLine (ab.Key);
}
if (!inner) {
Console.WriteLine ("Type \"help <command>\" for individual command help.");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleMenu.DefaultItems
{
public class MI_Help : CMenuItem
{
private readonly CMenu _Menu;
public MI_Help (CMenu menu)
: base ("help")
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
_Menu = menu;
HelpText = ""
+ "help [command]\n"
+ "Displays a help text for the specified command, or\n"
+ "Displays a list of all available commands.";
}
public override MenuResult Execute (string arg)
{
DisplayHelp (arg, _Menu, false);
return MenuResult.Normal;
}
private static void DisplayHelp (string arg, CMenuItem context, bool isInner)
{
if (arg == null) {
throw new ArgumentNullException ("arg");
}
if (context == null) {
throw new ArgumentNullException ("context");
}
if (string.IsNullOrEmpty (arg)) {
if (!DisplayItemHelp (context, !context.Any ())) {
DisplayAvailableCommands (context, isInner);
}
return;
}
var cmd = arg;
var inner = context.GetMenuItem (ref cmd, out arg, false, false);
if (inner != null) {
DisplayHelp (arg, inner, true);
return;
}
DisplayItemHelp (context, true);
if (!string.IsNullOrEmpty (arg)) {
Console.WriteLine ("Inner command \"" + arg + "\" not found.");
}
}
private static bool DisplayItemHelp (CMenuItem item, bool force)
{
if (item == null) {
throw new ArgumentNullException ("item");
}
if (item.HelpText == null) {
if (force) {
Console.WriteLine ("No help available for " + item.Selector);
}
return false;
}
else {
Console.WriteLine (item.HelpText);
return true;
}
}
private static void DisplayAvailableCommands (CMenuItem menu, bool inner)
{
if (menu == null) {
throw new ArgumentNullException ("menu");
}
if (!inner) {
Console.WriteLine ("Available commands:");
}
var abbreviations = menu.CommandAbbreviations ().OrderBy (it => it.Key);
foreach (var ab in abbreviations) {
if (ab.Value == null) {
Console.Write (" ");
}
else {
Console.Write (ab.Value.PadRight (3) + " | ");
}
Console.WriteLine (ab.Key);
}
if (!inner) {
Console.WriteLine ("Type \"help <command>\" for individual command help.");
}
}
}
}
| mit | C# |
45dd5d171c2ffe446a7c30d4d7b849db3c297bbe | Fix build failure on benchmark server V2 (#1920) | grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet,grpc/grpc-dotnet | src/Grpc.Core.Api/IAsyncStreamWriter.cs | src/Grpc.Core.Api/IAsyncStreamWriter.cs | #region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Grpc.Core;
/// <summary>
/// A writable stream of messages.
/// </summary>
/// <typeparam name="T">The message type.</typeparam>
public interface IAsyncStreamWriter<in T>
{
/// <summary>
/// Writes a message asynchronously. Only one write can be pending at a time.
/// </summary>
/// <param name="message">The message to be written. Cannot be null.</param>
Task WriteAsync(T message);
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
/// <summary>
/// Writes a message asynchronously. Only one write can be pending at a time.
/// </summary>
/// <param name="message">The message to be written. Cannot be null.</param>
/// <param name="cancellationToken">Cancellation token that can be used to cancel the operation.</param>
Task WriteAsync(T message, CancellationToken cancellationToken)
{
if (cancellationToken.CanBeCanceled)
{
// Note to implementors:
// Add a netstandard2.1 or greater target to your library and override
// WriteAsync(T, CancellationToken) on stream writer to use the cancellation token.
throw new NotSupportedException("Cancellation of stream writes is not supported by this gRPC implementation.");
}
return WriteAsync(message);
}
#endif
/// <summary>
/// Write options that will be used for the next write.
/// If null, default options will be used.
/// Once set, this property maintains its value across subsequent
/// writes.
/// </summary>
WriteOptions? WriteOptions { get; set; }
}
| #region Copyright notice and license
// Copyright 2015 gRPC authors.
//
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Grpc.Core;
/// <summary>
/// A writable stream of messages.
/// </summary>
/// <typeparam name="T">The message type.</typeparam>
public interface IAsyncStreamWriter<in T>
{
/// <summary>
/// Writes a message asynchronously. Only one write can be pending at a time.
/// </summary>
/// <param name="message">The message to be written. Cannot be null.</param>
Task WriteAsync(T message);
#if NETSTANDARD2_1_OR_GREATER
/// <summary>
/// Writes a message asynchronously. Only one write can be pending at a time.
/// </summary>
/// <param name="message">The message to be written. Cannot be null.</param>
/// <param name="cancellationToken">Cancellation token that can be used to cancel the operation.</param>
Task WriteAsync(T message, CancellationToken cancellationToken)
{
if (cancellationToken.CanBeCanceled)
{
// Note to implementors:
// Add a netstandard2.1 or greater target to your library and override
// WriteAsync(T, CancellationToken) on stream writer to use the cancellation token.
throw new NotSupportedException("Cancellation of stream writes is not supported by this gRPC implementation.");
}
return WriteAsync(message);
}
#endif
/// <summary>
/// Write options that will be used for the next write.
/// If null, default options will be used.
/// Once set, this property maintains its value across subsequent
/// writes.
/// </summary>
WriteOptions? WriteOptions { get; set; }
}
| apache-2.0 | C# |
a1065b6be05dac4ccc114fc0482e29d725337a79 | fix DateTime formatting | apemost/Newq,apemost/Newq | src/Newq/Extensions/ObjectExtensions.cs | src/Newq/Extensions/ObjectExtensions.cs | /* Copyright 2015-2016 Andrew Lyu and Uriel Van
*
* 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.
*/
namespace Newq.Extensions
{
using System;
/// <summary>
///
/// </summary>
public static class ObjectExtensions
{
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ToSqlValue(this object obj)
{
var value = string.Empty;
if (obj is string)
{
value = string.Format("'{0}'", obj.ToString().Replace("'", "''"));
}
else if (obj is DateTime)
{
var time = (DateTime)obj;
value = time.Year < 1753 ? "'1753-01-01 00:00:00.000'"
: string.Format("'{0}'", time.ToString("yyyy-MM-dd HH:mm:ss.fff"));
}
else if (obj == null)
{
value = "''";
}
else
{
value = obj.ToString();
}
return value;
}
}
}
| /* Copyright 2015-2016 Andrew Lyu and Uriel Van
*
* 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.
*/
namespace Newq.Extensions
{
using System;
/// <summary>
///
/// </summary>
public static class ObjectExtensions
{
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ToSqlValue(this object obj)
{
var value = string.Empty;
if (obj is string)
{
value = string.Format("'{0}'", obj.ToString().Replace("'", "''"));
}
else if (obj is DateTime)
{
var time = (DateTime)obj;
value = time.Year < 1753 ? "'1753-01-01 00:00:00.000'"
: string.Format("'{0}'", time.ToString("yyyy-MM-dd hh:mm:ss.fff"));
}
else if (obj == null)
{
value = "''";
}
else
{
value = obj.ToString();
}
return value;
}
}
}
| mit | C# |
4953a1ec2dcf3d18e62f3df68bad92da3524dc47 | add result validations for StackOverflowTest and adjust counts | acple/ParsecSharp | UnitTest.ParsecSharp/StackOverflowTest.cs | UnitTest.ParsecSharp/StackOverflowTest.cs | #if !DEBUG
using System;
using System.Linq;
using ChainingAssertion;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static ParsecSharp.Parser;
using static ParsecSharp.Text;
namespace UnitTest.ParsecSharp
{
[TestClass]
[TestCategory("SkipWhenLiveUnitTesting")]
public class StackOverflowTest
{
[TestMethod]
public void SimpleRecursionStackOverflowTest()
{
// 単純な再帰ループ
const int count = 1_000_000;
var parser = SkipMany(Any<int>());
var source = new int[count];
parser.Parse(source);
}
[TestMethod]
public void ValueTypesStackOverflowTest()
{
// トークンが値型の場合
const int count = 100_000;
var parser = Many(Any<(int, int, int)>());
var source = Enumerable.Range(0, count).Select(x => (x, x, x));
parser.Parse(source).CaseOf(
fail => Assert.Fail(fail.ToString()),
success => success.Value.Count().Is(count));
}
[TestMethod]
public void ReferenceTypesStackOverflowTest()
{
// トークンが参照型の場合
const int count = 100_000;
var parser = Many(Any<Tuple<int, int, int>>());
var source = Enumerable.Range(0, count).Select(x => Tuple.Create(x, x, x));
parser.Parse(source).CaseOf(
fail => Assert.Fail(fail.ToString()),
success => success.Value.Count().Is(count));
}
[TestMethod]
public void RecursiveDataStructuresStackOverflowTest()
{
// 極端に深い構造を辿る場合
const int depth = 10_000;
var source = Enumerable.Repeat('[', depth).Concat(Enumerable.Repeat(']', depth)).ToArray();
var parser = Fix<char, int>(self => self.Or(Pure(1234)).Between(Char('['), Char(']'))).End();
parser.Parse(source).CaseOf(
fail => Assert.Fail(fail.ToString()),
success => success.Value.Is(1234));
}
}
}
#endif
| #if !DEBUG
using System;
using System.Linq;
using ChainingAssertion;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static ParsecSharp.Parser;
using static ParsecSharp.Text;
namespace UnitTest.ParsecSharp
{
[TestClass]
[TestCategory("SkipWhenLiveUnitTesting")]
public class StackOverflowTest
{
[TestMethod]
public void SimpleRecursionStackOverflowTest()
{
// 単純な再帰ループ
var parser = SkipMany(Any<int>());
var source = new int[1000000];
parser.Parse(source);
}
[TestMethod]
public void ValueTypesStackOverflowTest()
{
// トークンが値型の場合
var parser = Many(Any<(int, int, int)>());
var source = Enumerable.Range(0, 1000000).Select(x => (x, x, x));
parser.Parse(source);
}
[TestMethod]
public void ReferenceTypesStackOverflowTest()
{
// トークンが参照型の場合
var parser = Many(Any<Tuple<int, int, int>>());
var source = Enumerable.Range(0, 1000000).Select(x => Tuple.Create(x, x, x));
parser.Parse(source);
}
[TestMethod]
public void RecursiveDataStructuresStackOverflowTest()
{
// 極端に深い構造を辿る場合
const int depth = 10000;
var source = Enumerable.Repeat('[', depth).Concat(Enumerable.Repeat(']', depth)).ToArray();
var parser = Fix<char, int>(self => self.Or(Pure(1234)).Between(Char('['), Char(']'))).End();
parser.Parse(source).CaseOf(
fail => Assert.Fail(fail.ToString()),
success => success.Value.Is(1234));
}
}
}
#endif
| mit | C# |
e260727db6db3a291aa520774a451c625daabc2b | Create a way for users to specify the initial uris to scan. | AlexGhiondea/SmugMug.NET | src/SmugMugMetadataRetriever/Program.cs | src/SmugMugMetadataRetriever/Program.cs | // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using SmugMug.Shared.Descriptors;
using SmugMug.v2.Authentication;
using SmugMugShared;
using System.Collections.Generic;
using System.Diagnostics;
namespace SmugMugMetadataRetriever
{
class Program
{
static OAuthToken s_oauthToken;
static void Main(string[] args)
{
s_oauthToken = SmugMug.Shared.SecretsAccess.GetSmugMugSecrets();
Debug.Assert(!s_oauthToken.Equals(OAuthToken.Invalid));
ApiAnalyzer buf = new ApiAnalyzer(s_oauthToken);
var list = new Dictionary<string, string>();
list = buf.GetBaseUris(Constants.Addresses.SmugMug, "/api/v2");
for (int i = 0; i < args.Length; i++)
{
list.Add("arg" + i, args[i]);
}
Dictionary<string, string> uris = new Dictionary<string, string>();
foreach (var item in list)
{
uris.Add(item.Key, Constants.Addresses.SmugMug + item.Value + Constants.RequestModifiers);
}
var types = buf.AnalyzeAPIs(uris, Constants.Addresses.SmugMugApi);
}
}
}
| // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using SmugMug.Shared.Descriptors;
using SmugMug.v2.Authentication;
using SmugMugShared;
using System.Collections.Generic;
using System.Diagnostics;
namespace SmugMugMetadataRetriever
{
class Program
{
static OAuthToken s_oauthToken;
static void Main(string[] args)
{
s_oauthToken = SmugMug.Shared.SecretsAccess.GetSmugMugSecrets();
Debug.Assert(!s_oauthToken.Equals(OAuthToken.Invalid));
ApiAnalyzer buf = new ApiAnalyzer(s_oauthToken);
var list = new Dictionary<string, string>();
list = buf.GetBaseUris(Constants.Addresses.SmugMug, "/api/v2");
Dictionary<string, string> uris = new Dictionary<string, string>() {
};
foreach (var item in list)
{
uris.Add(item.Key, Constants.Addresses.SmugMug + item.Value + Constants.RequestModifiers);
}
var types = buf.AnalyzeAPIs(uris, Constants.Addresses.SmugMugApi);
}
}
}
| mit | C# |
b60ea0fc784d7b4297248fb825b0fc8b0e683178 | remove unused usings | Code-Inside/Sloader | src/Sloader.Bootstrapper/Program.cs | src/Sloader.Bootstrapper/Program.cs | using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Newtonsoft.Json;
using Sloader.Crawler;
using Sloader.Types;
using Constants = Sloader.Crawler.Constants;
namespace Sloader.Bootstrapper
{
public class Program
{
public static void Main()
{
Trace.TraceInformation("Crawler Console App started.");
var crawlerResult = InvokeCrawler().Result;
Trace.TraceInformation("Crawler succeeded - now convert and write to BlobStorage!");
var json = JsonConvert.SerializeObject(crawlerResult, Constants.CrawlerJsonSerializerSettings);
var host = new JobHost();
host.Call(typeof(Program).GetMethod("SaveToAzure"), new { json });
}
[NoAutomaticTrigger]
public static void SaveToAzure([Blob("sloader/data.json")]TextWriter writer, string json)
{
writer.Write(json);
Trace.TraceInformation("And... done.");
}
public static async Task<CrawlerRun> InvokeCrawler()
{
var client = new HttpClient();
#if DEBUG
var configString = await client.GetStringAsync("https://raw.githubusercontent.com/Code-Inside/Hub/master/CrawlerConfig.json");
#else
var configString = await client.GetStringAsync(ConfigurationManager.AppSettings[ConfigKeys.MasterCrawlerConfigPath]);
#endif
var config = JsonConvert.DeserializeObject<MasterCrawlerConfig>(configString);
var secrets = new MasterCrawlerSecrets();
secrets.TwitterConsumerKey = ConfigurationManager.AppSettings[ConfigKeys.SecretTwitterConsumerKey];
secrets.TwitterConsumerSecret = ConfigurationManager.AppSettings[ConfigKeys.SecretTwitterConsumerSecret];
var crawler = new MasterCrawler(config, secrets);
return await crawler.RunAllCrawlers();
}
}
}
| using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
using Newtonsoft.Json;
using Sloader.Crawler;
using Sloader.Types;
using Constants = Sloader.Crawler.Constants;
namespace Sloader.Bootstrapper
{
public class Program
{
public static void Main()
{
Trace.TraceInformation("Crawler Console App started.");
var crawlerResult = InvokeCrawler().Result;
Trace.TraceInformation("Crawler succeeded - now convert and write to BlobStorage!");
var json = JsonConvert.SerializeObject(crawlerResult, Constants.CrawlerJsonSerializerSettings);
var host = new JobHost();
host.Call(typeof(Program).GetMethod("SaveToAzure"), new { json });
}
[NoAutomaticTrigger]
public static void SaveToAzure([Blob("sloader/data.json")]TextWriter writer, string json)
{
writer.Write(json);
Trace.TraceInformation("And... done.");
}
public static async Task<CrawlerRun> InvokeCrawler()
{
var client = new HttpClient();
#if DEBUG
var configString = await client.GetStringAsync("https://raw.githubusercontent.com/Code-Inside/Hub/master/CrawlerConfig.json");
#else
var configString = await client.GetStringAsync(ConfigurationManager.AppSettings[ConfigKeys.MasterCrawlerConfigPath]);
#endif
var config = JsonConvert.DeserializeObject<MasterCrawlerConfig>(configString);
var secrets = new MasterCrawlerSecrets();
secrets.TwitterConsumerKey = ConfigurationManager.AppSettings[ConfigKeys.SecretTwitterConsumerKey];
secrets.TwitterConsumerSecret = ConfigurationManager.AppSettings[ConfigKeys.SecretTwitterConsumerSecret];
var crawler = new MasterCrawler(config, secrets);
return await crawler.RunAllCrawlers();
}
}
}
| mit | C# |
51bcf60663541f23f5015a5b0cc6df76c62adace | Update assembly information. | codito/supa | src/Supa/Properties/AssemblyInfo.cs | src/Supa/Properties/AssemblyInfo.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs">
// Copyright (c) Supa Contributors. All rights reserved.
// See license.md for license details.
// </copyright>
// <summary>
// AssemblyInfo.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
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("supa")]
[assembly: AssemblyDescription("A friendly support assistant!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("supa")]
[assembly: AssemblyCopyright("Copyright (c) 2015-Present, Supa Contributors.")]
[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("df09a882-6dd6-4340-8a70-4fd5da7c4405")]
// 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")] | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs">
// Copyright (c) Supa Contributors. All rights reserved.
// See license.md for license details.
// </copyright>
// <summary>
// AssemblyInfo.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
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.
using CommandLine;
[assembly: AssemblyTitle("supa")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("supa")]
[assembly: AssemblyCopyright("Copyright (c) 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("df09a882-6dd6-4340-8a70-4fd5da7c4405")]
// 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")]
// CommandLine help text
//[assembly: AssemblyLicense(
// "This is free software. You may redistribute copies of it under the terms of",
// "the MIT License <http://www.opensource.org/licenses/mit-license.php>.")]
//[assembly: AssemblyUsage(
// "Usage: supa -rMyData.in -wMyData.out --calculate",
// " supa -rMyData.in -i -j9.7 file0.def file1.def",
// @" supa source -name Exchange -Username fareast\myuser -Password mypassword -Folder issuesfolder",
// " Adds an exchange source to supa to collect issues from mail folder.",
// " TODO")] | mit | C# |
4876748a6ac4a7cbd481cb560a014d335c2b7b5b | Use out var in jumbo command | mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX | Modix/Modules/FunModule.cs | Modix/Modules/FunModule.cs | using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Serilog;
namespace Modix.Modules
{
[Name("Fun"), Summary("A bunch of miscellaneous, fun commands")]
public class FunModule : ModuleBase
{
[Command("jumbo"), Summary("Jumbofy an emoji")]
public async Task Jumbo(string emoji)
{
string emojiUrl = null;
if (Emote.TryParse(emoji, out var found))
{
emojiUrl = found.Url;
}
else
{
int codepoint = Char.ConvertToUtf32(emoji, 0);
string codepointHex = codepoint.ToString("X").ToLower();
emojiUrl = $"https://raw.githubusercontent.com/twitter/twemoji/gh-pages/2/72x72/{codepointHex}.png";
}
try
{
HttpClient client = new HttpClient();
var req = await client.GetStreamAsync(emojiUrl);
await Context.Channel.SendFileAsync(req, Path.GetFileName(emojiUrl), Context.User.Mention);
try
{
await Context.Message.DeleteAsync();
}
catch (HttpRequestException)
{
Log.Information("Couldn't delete message after jumbofying.");
}
}
catch (HttpRequestException)
{
await ReplyAsync($"Sorry {Context.User.Mention}, I don't recognize that emoji.");
}
}
}
}
| using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Serilog;
namespace Modix.Modules
{
[Name("Fun"), Summary("A bunch of miscellaneous, fun commands")]
public class FunModule : ModuleBase
{
[Command("jumbo"), Summary("Jumbofy an emoji")]
public async Task Jumbo(string emoji)
{
string emojiUrl = null;
if (Emote.TryParse(emoji, out Emote found))
{
emojiUrl = found.Url;
}
else
{
int codepoint = Char.ConvertToUtf32(emoji, 0);
string codepointHex = codepoint.ToString("X").ToLower();
emojiUrl = $"https://raw.githubusercontent.com/twitter/twemoji/gh-pages/2/72x72/{codepointHex}.png";
}
try
{
HttpClient client = new HttpClient();
var req = await client.GetStreamAsync(emojiUrl);
await Context.Channel.SendFileAsync(req, Path.GetFileName(emojiUrl), Context.User.Mention);
try
{
await Context.Message.DeleteAsync();
}
catch (HttpRequestException)
{
Log.Information("Couldn't delete message after jumbofying.");
}
}
catch (HttpRequestException)
{
await ReplyAsync($"Sorry {Context.User.Mention}, I don't recognize that emoji.");
}
}
}
}
| mit | C# |
383a18f5711572f17e7bcae3dd2658cd2ccd7c39 | Revert to older version of GitVersion | dnnsoftware/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform,bdukes/Dnn.Platform,nvisionative/Dnn.Platform,nvisionative/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,bdukes/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform | Build/Program.cs | Build/Program.cs | using System;
using System.Collections.Generic;
using System.IO;
using Cake.Core;
using Cake.Core.Configuration;
using Cake.Frosting;
using Cake.NuGet;
public class Program : IFrostingStartup
{
public static int Main(string[] args)
{
// Create the host.
var host = new CakeHostBuilder()
.WithArguments(args)
.UseStartup<Program>()
.Build();
// Run the host.
return host.Run();
}
public void Configure(ICakeServices services)
{
services.UseContext<Context>();
services.UseLifetime<Lifetime>();
services.UseWorkingDirectory("..");
// from https://github.com/cake-build/cake/discussions/2931
var module = new NuGetModule(new CakeConfiguration(new Dictionary<string, string>()));
module.Register(services);
services.UseTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.0.1"));
services.UseTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0"));
services.UseTool(new Uri("nuget:?package=NUnitTestAdapter&version=2.3.0"));
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using Cake.Core;
using Cake.Core.Configuration;
using Cake.Frosting;
using Cake.NuGet;
public class Program : IFrostingStartup
{
public static int Main(string[] args)
{
// Create the host.
var host = new CakeHostBuilder()
.WithArguments(args)
.UseStartup<Program>()
.Build();
// Run the host.
return host.Run();
}
public void Configure(ICakeServices services)
{
services.UseContext<Context>();
services.UseLifetime<Lifetime>();
services.UseWorkingDirectory("..");
// from https://github.com/cake-build/cake/discussions/2931
var module = new NuGetModule(new CakeConfiguration(new Dictionary<string, string>()));
module.Register(services);
services.UseTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.5.1"));
services.UseTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0"));
services.UseTool(new Uri("nuget:?package=NUnitTestAdapter&version=2.3.0"));
}
}
| mit | C# |
f66b0d773e24d7496f71ee36b564c6352d3fcf76 | Add AtomicChessGame constructors | ProgramFOX/Chess.NET | ChessDotNet.Variants/Atomic/AtomicChessGame.cs | ChessDotNet.Variants/Atomic/AtomicChessGame.cs | using System.Collections.Generic;
using ChessDotNet.Pieces;
namespace ChessDotNet.Variants.Atomic
{
public class AtomicChessGame : ChessGame
{
public AtomicChessGame() : base() { }
public AtomicChessGame(Piece[][] board, Player whoseTurn) : base(board, whoseTurn) { }
public AtomicChessGame(IEnumerable<Move> moves, bool movesAreValidated) : base(moves, movesAreValidated) { }
public override MoveType ApplyMove(Move move, bool alreadyValidated)
{
MoveType type = base.ApplyMove(move, alreadyValidated);
if (!type.HasFlag(MoveType.Capture))
return type;
int[][] surroundingSquares = new int[][] { new int[] { 1, 0 }, new int[] { 1, 1 }, new int[] { 0, 1 }, new int[] { -1, -1 },
new int[] { -1, 0 }, new int[] { 0, -1 }, new int[] { -1, 1 }, new int[] { 1, -1 } };
SetPieceAt(move.NewPosition.File, move.NewPosition.Rank, null);
foreach (int[] surroundingSquaresDistance in surroundingSquares)
{
File f = move.NewPosition.File + surroundingSquaresDistance[0];
Rank r = move.NewPosition.Rank + surroundingSquaresDistance[1];
if (!(GetPieceAt(f, r) is Pawn))
{
SetPieceAt(f, r, null);
}
}
return type;
}
}
}
| namespace ChessDotNet.Variants.Atomic
{
using Pieces;
public class AtomicChessGame : ChessGame
{
public override MoveType ApplyMove(Move move, bool alreadyValidated)
{
MoveType type = base.ApplyMove(move, alreadyValidated);
if (!type.HasFlag(MoveType.Capture))
return type;
int[][] surroundingSquares = new int[][] { new int[] { 1, 0 }, new int[] { 1, 1 }, new int[] { 0, 1 }, new int[] { -1, -1 },
new int[] { -1, 0 }, new int[] { 0, -1 }, new int[] { -1, 1 }, new int[] { 1, -1 } };
SetPieceAt(move.NewPosition.File, move.NewPosition.Rank, null);
foreach (int[] surroundingSquaresDistance in surroundingSquares)
{
File f = move.NewPosition.File + surroundingSquaresDistance[0];
Rank r = move.NewPosition.Rank + surroundingSquaresDistance[1];
if (!(GetPieceAt(f, r) is Pawn))
{
SetPieceAt(f, r, null);
}
}
return type;
}
}
}
| mit | C# |
50c850ac32e10f136f5a057a511f846427f068b0 | add AsEnumerable | shockzinfinity/sapHowmuch.Base | sapHowmuch.Base/Extensions/SboUIExtensions.cs | sapHowmuch.Base/Extensions/SboUIExtensions.cs | using System.Collections.Generic;
namespace sapHowmuch.Base.Extensions
{
public static class SboUIExtensions
{
/// <summary>
/// Return IEnumerable for LINQ support
/// </summary>
/// <param name="dbDatasources"></param>
/// <returns></returns>
public static IEnumerable<SAPbouiCOM.DBDataSource> AsEnumerable(this SAPbouiCOM.DBDataSources dbDatasources)
{
foreach (SAPbouiCOM.DBDataSource item in dbDatasources)
{
yield return item;
}
}
/// <summary>
/// Return IEnumerable for LINQ support
/// </summary>
/// <param name="userDatasources"></param>
/// <returns></returns>
public static IEnumerable<SAPbouiCOM.UserDataSource> AsEnumerable(this SAPbouiCOM.UserDataSources userDatasources)
{
foreach (SAPbouiCOM.UserDataSource item in userDatasources)
{
yield return item;
}
}
/// <summary>
/// Return IEnumerable for LINQ support
/// </summary>
/// <param name="dataTables"></param>
/// <returns></returns>
public static IEnumerable<SAPbouiCOM.DataTable> AsEnumerable(this SAPbouiCOM.DataTables dataTables)
{
foreach (SAPbouiCOM.DataTable item in dataTables)
{
yield return item;
}
}
/// <summary>
/// Return IEnumerable for LINQ support
/// </summary>
/// <param name="menus"></param>
/// <returns></returns>
public static IEnumerable<SAPbouiCOM.MenuItem> AsEnumerable(this SAPbouiCOM.Menus menus)
{
foreach (SAPbouiCOM.MenuItem item in menus)
{
yield return item;
}
}
}
} | using System.Collections.Generic;
namespace sapHowmuch.Base.Extensions
{
public static class SboUIExtensions
{
//public static SAPbouiCOM.DataTable GetDataTable(this SAPbouiCOM.Form form)
//{
// form.DataSources.DataTables.GetEnumerator
//}
public static IEnumerable<SAPbouiCOM.MenuItem> AsEnumerable(this SAPbouiCOM.Menus menus)
{
foreach (SAPbouiCOM.MenuItem item in menus)
{
yield return item;
}
}
}
} | mit | C# |
b5aeb9b4c7d55019231c7027603043ee38cc4665 | Add comments | farity/farity | Farity/Always.cs | Farity/Always.cs | namespace Farity
{
public static partial class F
{
/// <summary>
/// Returns a function that takes any arguments but always returns the specified value.
/// </summary>
/// <typeparam name="T">The type of value to always return.</typeparam>
/// <param name="value">The value that is to be always returned.</param>
/// <returns>A function that takes any arguments but always return the specified value.</returns>
/// <remarks>Category: Function</remarks>
public static FuncAny<T> Always<T>(T value) => args => value;
}
} | namespace Farity
{
public static partial class F
{
public static FuncAny<T> Always<T>(T value) => args => value;
}
} | mit | C# |
6d39eea4a1612888cd92a4bbedb21a4a4604074d | bump version to 1.0 | thirkcircus/EmptyStringGuard | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyTitle("EmptyStringGuard")]
[assembly: AssemblyProduct("EmptyStringGuard")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")] | using System.Reflection;
[assembly: AssemblyTitle("EmptyStringGuard")]
[assembly: AssemblyProduct("EmptyStringGuard")]
[assembly: AssemblyVersion("0.1.0")]
[assembly: AssemblyFileVersion("0.1.0")] | mit | C# |
17796dc1e2a0fd1582531dac2f07d3c6d589a60a | Add more IHandleContext extension methods | volak/Aggregates.NET,volak/Aggregates.NET | src/Aggregates.NET/Extensions/BusExtensions.cs | src/Aggregates.NET/Extensions/BusExtensions.cs | using Aggregates.Internal;
using NServiceBus;
using NServiceBus.Unicast;
using NServiceBus.Unicast.Messages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aggregates.Extensions
{
public static class BusExtensions
{
public static void ReplyAsync(this IHandleContext context, object message)
{
var incoming = context.Context.PhysicalMessage;
context.Bus.Send(incoming.ReplyToAddress, String.IsNullOrEmpty( incoming.CorrelationId ) ? incoming.Id : incoming.CorrelationId, message);
}
public static void ReplyAsync<T>(this IHandleContext context, Action<T> message)
{
var incoming = context.Context.PhysicalMessage;
context.Bus.Send(incoming.ReplyToAddress, String.IsNullOrEmpty(incoming.CorrelationId) ? incoming.Id : incoming.CorrelationId, message);
}
public static void PublishAsync<T>(this IHandleContext context, Action<T> message)
{
context.Bus.Publish<T>(message);
}
public static void PublishAsync(this IHandleContext context, object message)
{
context.Bus.Publish(message);
}
public static void SendAsync<T>(this IHandleContext context, Action<T> message)
{
context.Bus.Send(message);
}
public static void SendAsync(this IHandleContext context, object message)
{
context.Bus.Send(message);
}
public static void SendAsync<T>(this IHandleContext context, String destination, Action<T> message)
{
context.Bus.Send(destination, message);
}
public static void SendAsync(this IHandleContext context, String destination, object message)
{
context.Bus.Send(destination, message);
}
}
}
| using Aggregates.Internal;
using NServiceBus;
using NServiceBus.Unicast;
using NServiceBus.Unicast.Messages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aggregates.Extensions
{
public static class BusExtensions
{
public static void ReplyAsync(this IHandleContext context, object message)
{
var incoming = context.Context.PhysicalMessage;
context.Bus.Send(incoming.ReplyToAddress, String.IsNullOrEmpty( incoming.CorrelationId ) ? incoming.Id : incoming.CorrelationId, message);
}
public static void ReplyAsync<T>(this IHandleContext context, Action<T> message)
{
var incoming = context.Context.PhysicalMessage;
context.Bus.Send(incoming.ReplyToAddress, String.IsNullOrEmpty(incoming.CorrelationId) ? incoming.Id : incoming.CorrelationId, message);
}
}
}
| mit | C# |
508f357137d043b193da5aee058609fac344a126 | Add test showing success message | nunit/nunit3-vs-adapter,nunit/nunit-vs-adapter | src/NUnitTestDemo/NUnitTestDemo/SimpleTests.cs | src/NUnitTestDemo/NUnitTestDemo/SimpleTests.cs | using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace NUnitTestDemo
{
public class SimpleTests
{
[Test]
public void TestSucceeds()
{
Assert.That(2 + 2, Is.EqualTo(4));
}
[Test]
public void TestSucceeds_Message()
{
Assert.That(2 + 2, Is.EqualTo(4));
Assert.Pass("Simple arithmetic!");
}
[Test, ExpectedException(typeof(ApplicationException))]
public void TestSucceeds_ExpectedException()
{
throw new ApplicationException("Expected");
}
[Test]
public void TestFails()
{
Assert.That(2 + 2, Is.EqualTo(5));
}
[Test]
public void TestIsInconclusive()
{
Assert.Inconclusive("Testing");
}
[Test, Ignore("Ignoring this test deliberately")]
public void TestIsIgnored_Attribute()
{
}
[Test]
public void TestIsIgnored_Assert()
{
Assert.Ignore("Ignoring this test deliberately");
}
[Test]
public void TestThrowsException()
{
throw new Exception("Deliberate exception thrown");
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace NUnitTestDemo
{
public class SimpleTests
{
[Test]
public void TestSucceeds()
{
Assert.That(2 + 2, Is.EqualTo(4));
}
[Test, ExpectedException(typeof(ApplicationException))]
public void TestSucceeds_ExpectedException()
{
throw new ApplicationException("Expected");
}
[Test]
public void TestFails()
{
Assert.That(2 + 2, Is.EqualTo(5));
}
[Test]
public void TestIsInconclusive()
{
Assert.Inconclusive("Testing");
}
[Test, Ignore("Ignoring this test deliberately")]
public void TestIsIgnored_Attribute()
{
}
[Test]
public void TestIsIgnored_Assert()
{
Assert.Ignore("Ignoring this test deliberately");
}
[Test]
public void TestThrowsException()
{
throw new Exception("Deliberate exception thrown");
}
}
}
| mit | C# |
fbfadf5cf46f1e1a1e1fedf9a94655bde1190dcf | Add constructor with parameters for coordinate | stranne/Vasttrafik.NET,stranne/Vasttrafik.NET | src/Stranne.VasttrafikNET/Models/Coordinate.cs | src/Stranne.VasttrafikNET/Models/Coordinate.cs | namespace Stranne.VasttrafikNET.Models
{
/// <summary>
/// Describes a coordinate in WGS84 decimal
/// </summary>
public class Coordinate
{
/// <summary>
/// Latitude in WGS84 decimal form
/// </summary>
public double Latitude { get; set; }
/// <summary>
/// Longitude in WGS84 decimal form
/// </summary>
public double Longitude { get; set; }
/// <summary>
/// Create a new coordinate.
/// </summary>
public Coordinate()
{ }
/// <summary>
/// Create a coordinate with latitude and longitude pre defined.
/// </summary>
/// <param name="latitude">Latitude in WGS84 decimal form</param>
/// <param name="longitude">Longitude in WGS84 decimal form</param>
public Coordinate(double latitude, double longitude)
{
Latitude = latitude;
Longitude = longitude;
}
}
} | namespace Stranne.VasttrafikNET.Models
{
/// <summary>
/// Describes a coordinate in WGS84 decimal
/// </summary>
public class Coordinate
{
/// <summary>
/// Latitude in WGS84 decimal form
/// </summary>
public double Latitude { get; set; }
/// <summary>
/// Longitude in WGS84 decimal form
/// </summary>
public double Longitude { get; set; }
}
} | mit | C# |
ff9f605b7d7eaaad8ecfe54c786e87858869fb69 | Add StackExchange sites to Equivalent Domains (#242) | bitwarden/core,bitwarden/core,bitwarden/core,bitwarden/core | src/Core/Enums/GlobalEquivalentDomainsType.cs | src/Core/Enums/GlobalEquivalentDomainsType.cs | namespace Bit.Core.Enums
{
public enum GlobalEquivalentDomainsType : byte
{
Google = 0,
Apple = 1,
Ameritrade = 2,
BoA = 3,
Sprint = 4,
WellsFargo = 5,
Merrill = 6,
Citi = 7,
Cnet = 8,
Gap = 9,
Microsoft = 10,
United = 11,
Yahoo = 12,
Zonelabs = 13,
Paypal = 14,
Avon = 15,
Diapers = 16,
Contacts = 17,
Amazon = 18,
Cox = 19,
Norton = 20,
Verizon = 21,
Buy = 22,
Sirius = 23,
Ea = 24,
Basecamp = 25,
Steam = 26,
Chart = 27,
Gotomeeting = 28,
Gogo = 29,
Oracle = 30,
Discover = 31,
Dcu = 32,
Healthcare = 33,
Pepco = 34,
Century21 = 35,
Comcast = 36,
Cricket = 37,
Mtb = 38,
Dropbox = 39,
Snapfish = 40,
Alibaba = 41,
Playstation = 42,
Mercado = 43,
Zendesk = 44,
Autodesk = 45,
RailNation = 46,
Wpcu = 47,
Mathletics = 48,
Discountbank = 49,
Mi = 50,
Facebook = 51,
Postepay = 52,
Skysports = 53,
Disney = 54,
Pokemon = 55,
Uv = 56,
Yahavo = 57,
Mdsol = 58,
Sears = 59,
Xiami = 60,
Belkin = 61,
Turbotax = 62,
Shopify = 63,
Ebay = 64,
Techdata = 65,
Schwab = 66,
Mozilla = 67, // deprecated
Tesla = 68,
MorganStanley = 69,
TaxAct = 70,
Wikimedia = 71,
Airbnb = 72,
Eventbrite = 73,
StackExchange = 74,
}
}
| namespace Bit.Core.Enums
{
public enum GlobalEquivalentDomainsType : byte
{
Google = 0,
Apple = 1,
Ameritrade = 2,
BoA = 3,
Sprint = 4,
WellsFargo = 5,
Merrill = 6,
Citi = 7,
Cnet = 8,
Gap = 9,
Microsoft = 10,
United = 11,
Yahoo = 12,
Zonelabs = 13,
Paypal = 14,
Avon = 15,
Diapers = 16,
Contacts = 17,
Amazon = 18,
Cox = 19,
Norton = 20,
Verizon = 21,
Buy = 22,
Sirius = 23,
Ea = 24,
Basecamp = 25,
Steam = 26,
Chart = 27,
Gotomeeting = 28,
Gogo = 29,
Oracle = 30,
Discover = 31,
Dcu = 32,
Healthcare = 33,
Pepco = 34,
Century21 = 35,
Comcast = 36,
Cricket = 37,
Mtb = 38,
Dropbox = 39,
Snapfish = 40,
Alibaba = 41,
Playstation = 42,
Mercado = 43,
Zendesk = 44,
Autodesk = 45,
RailNation = 46,
Wpcu = 47,
Mathletics = 48,
Discountbank = 49,
Mi = 50,
Facebook = 51,
Postepay = 52,
Skysports = 53,
Disney = 54,
Pokemon = 55,
Uv = 56,
Yahavo = 57,
Mdsol = 58,
Sears = 59,
Xiami = 60,
Belkin = 61,
Turbotax = 62,
Shopify = 63,
Ebay = 64,
Techdata = 65,
Schwab = 66,
Mozilla = 67, // deprecated
Tesla = 68,
MorganStanley = 69,
TaxAct = 70,
Wikimedia = 71,
Airbnb = 72,
Eventbrite = 73,
}
}
| agpl-3.0 | C# |
b9217b85627b5b6e5a0738bb5b2a943e9ecacc87 | add iequatable for layergene | jobeland/NeuralNetwork | NeuralNetwork/NeuralNetwork/Genes/LayerGene.cs | NeuralNetwork/NeuralNetwork/Genes/LayerGene.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace ArtificialNeuralNetwork.Genes
{
public class LayerGene : IEquatable<LayerGene>
{
public IList<NeuronGene> Neurons;
#region Equality Members
/// <summary>
/// Returns true if the fields of the LayerGene objects are the same.
/// </summary>
/// <param name="obj">The LayerGene object to compare with.</param>
/// <returns>
/// True if the fields of the LayerGene objects are the same; false otherwise.
/// </returns>
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
return Equals(obj as LayerGene);
}
/// <summary>
/// Returns true if the fields of the LayerGene objects are the same.
/// </summary>
/// <param name="layerGene">The LayerGene object to compare with.</param>
/// <returns>
/// True if the fields of the LayerGene objects are the same; false otherwise.
/// </returns>
public bool Equals(LayerGene layerGene)
{
if (layerGene == null)
{
return false;
}
if (layerGene.Neurons.Count != Neurons.Count)
{
return false;
}
return !Neurons.Where((t, i) => t != layerGene.Neurons[i]).Any();
}
/// <summary>
/// Returns true if the fields of the LayerGene objects are the same.
/// </summary>
/// <param name="a">The LayerGene object to compare.</param>
/// <param name="b">The LayerGene object to compare.</param>
/// <returns>
/// True if the objects are the same, are both null, or have the same values;
/// false otherwise.
/// </returns>
public static bool operator ==(LayerGene a, LayerGene b)
{
// If both are null, or both are same instance, return true.
if (ReferenceEquals(a, b))
{
return true;
}
// If one or the other is null, return false.
if (ReferenceEquals(a, null) || ReferenceEquals(b, null))
{
return false;
}
return a.Equals(b);
}
public static bool operator !=(LayerGene a, LayerGene b)
{
return !(a == b);
}
// Following this algorithm: http://stackoverflow.com/a/263416
/// <summary>
/// Returns the hash code of the LayerGene.
/// </summary>
/// <returns>The hash code of the LayerGene.</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hash = (int)2166136261;
hash = hash * 16777619 ^ Neurons.GetHashCode();
return hash;
}
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace ArtificialNeuralNetwork.Genes
{
public class LayerGene
{
public IList<NeuronGene> Neurons;
}
}
| mit | C# |
1ec7f87df27b5ae23f1183021334f157ce4be3ad | Add sub-jobs to JobInfo object | Narochno/Narochno.Jenkins | src/Narochno.Jenkins/Entities/Jobs/JobInfo.cs | src/Narochno.Jenkins/Entities/Jobs/JobInfo.cs | using Narochno.Jenkins.Entities.Builds;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Narochno.Jenkins.Entities.Jobs
{
public class JobInfo : Job
{
public bool Buildable { get; set; }
public bool ConcurrentBuild { get; set; }
public string Description { get; set; }
public string DisplayName { get; set; }
public string DisplayNameOrNull { get; set; }
public bool InQueue { get; set; }
public bool KeepDependencies { get; set; }
public long NextBuildNumber { get; set; }
public IList<HealthReport> HealthReport { get; set; } = new List<HealthReport>();
public IList<Build> Builds { get; set; } = new List<Build>();
public IList<Job> Jobs { get; set; } = new List<Job>();
public Build FirstBuild { get; set; }
public Build LastBuild { get; set; }
public Build LastCompletedBuild { get; set; }
public Build LastFailedBuild { get; set; }
public Build LastStableBuild { get; set; }
public Build LastSuccessfulBuild { get; set; }
public Build LastUnstableBuild { get; set; }
public Build LastUnsuccessfulBuild { get; set; }
public JArray Actions { get; set; }
public JArray Property { get; set; }
public override string ToString() => DisplayName;
}
}
| using Narochno.Jenkins.Entities.Builds;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Narochno.Jenkins.Entities.Jobs
{
public class JobInfo : Job
{
public bool Buildable { get; set; }
public bool ConcurrentBuild { get; set; }
public string Description { get; set; }
public string DisplayName { get; set; }
public string DisplayNameOrNull { get; set; }
public bool InQueue { get; set; }
public bool KeepDependencies { get; set; }
public long NextBuildNumber { get; set; }
public IList<HealthReport> HealthReport { get; set; } = new List<HealthReport>();
public IList<Build> Builds { get; set; } = new List<Build>();
public Build FirstBuild { get; set; }
public Build LastBuild { get; set; }
public Build LastCompletedBuild { get; set; }
public Build LastFailedBuild { get; set; }
public Build LastStableBuild { get; set; }
public Build LastSuccessfulBuild { get; set; }
public Build LastUnstableBuild { get; set; }
public Build LastUnsuccessfulBuild { get; set; }
public JArray Actions { get; set; }
public JArray Property { get; set; }
public override string ToString() => DisplayName;
}
}
| mit | C# |
39a01f91033fc2cacd1d3e4ce82daf338a191dc8 | Update ContextState.cs | geertdoornbos/Orchard,AdvantageCS/Orchard,Fogolan/OrchardForWork,AdvantageCS/Orchard,bedegaming-aleksej/Orchard,hbulzy/Orchard,jagraz/Orchard,Praggie/Orchard,yersans/Orchard,LaserSrl/Orchard,jtkech/Orchard,phillipsj/Orchard,bedegaming-aleksej/Orchard,Serlead/Orchard,jimasp/Orchard,OrchardCMS/Orchard,sfmskywalker/Orchard,mvarblow/Orchard,sfmskywalker/Orchard,aaronamm/Orchard,SzymonSel/Orchard,jtkech/Orchard,ehe888/Orchard,mvarblow/Orchard,rtpHarry/Orchard,Fogolan/OrchardForWork,jtkech/Orchard,omidnasri/Orchard,gcsuk/Orchard,hbulzy/Orchard,AdvantageCS/Orchard,omidnasri/Orchard,sfmskywalker/Orchard,ehe888/Orchard,Serlead/Orchard,hannan-azam/Orchard,Lombiq/Orchard,jtkech/Orchard,jersiovic/Orchard,SzymonSel/Orchard,Fogolan/OrchardForWork,AdvantageCS/Orchard,mvarblow/Orchard,aaronamm/Orchard,jimasp/Orchard,ehe888/Orchard,omidnasri/Orchard,hbulzy/Orchard,sfmskywalker/Orchard,hbulzy/Orchard,Lombiq/Orchard,jimasp/Orchard,bedegaming-aleksej/Orchard,IDeliverable/Orchard,ehe888/Orchard,gcsuk/Orchard,fassetar/Orchard,geertdoornbos/Orchard,omidnasri/Orchard,phillipsj/Orchard,LaserSrl/Orchard,Dolphinsimon/Orchard,Lombiq/Orchard,hbulzy/Orchard,fassetar/Orchard,jagraz/Orchard,LaserSrl/Orchard,yersans/Orchard,armanforghani/Orchard,armanforghani/Orchard,geertdoornbos/Orchard,johnnyqian/Orchard,Serlead/Orchard,rtpHarry/Orchard,jimasp/Orchard,johnnyqian/Orchard,IDeliverable/Orchard,jagraz/Orchard,hannan-azam/Orchard,Lombiq/Orchard,jtkech/Orchard,sfmskywalker/Orchard,omidnasri/Orchard,Serlead/Orchard,gcsuk/Orchard,omidnasri/Orchard,fassetar/Orchard,gcsuk/Orchard,Dolphinsimon/Orchard,Praggie/Orchard,mvarblow/Orchard,Dolphinsimon/Orchard,Fogolan/OrchardForWork,OrchardCMS/Orchard,yersans/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,jagraz/Orchard,jersiovic/Orchard,OrchardCMS/Orchard,LaserSrl/Orchard,IDeliverable/Orchard,Praggie/Orchard,OrchardCMS/Orchard,armanforghani/Orchard,phillipsj/Orchard,hannan-azam/Orchard,jimasp/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard,mvarblow/Orchard,omidnasri/Orchard,Praggie/Orchard,fassetar/Orchard,OrchardCMS/Orchard,aaronamm/Orchard,IDeliverable/Orchard,Serlead/Orchard,gcsuk/Orchard,yersans/Orchard,armanforghani/Orchard,SzymonSel/Orchard,aaronamm/Orchard,rtpHarry/Orchard,armanforghani/Orchard,Lombiq/Orchard,jersiovic/Orchard,jersiovic/Orchard,johnnyqian/Orchard,Fogolan/OrchardForWork,SzymonSel/Orchard,LaserSrl/Orchard,bedegaming-aleksej/Orchard,fassetar/Orchard,IDeliverable/Orchard,sfmskywalker/Orchard,SzymonSel/Orchard,aaronamm/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,phillipsj/Orchard,phillipsj/Orchard,geertdoornbos/Orchard,rtpHarry/Orchard,hannan-azam/Orchard,bedegaming-aleksej/Orchard,jagraz/Orchard,yersans/Orchard,Praggie/Orchard,jersiovic/Orchard,geertdoornbos/Orchard,omidnasri/Orchard,johnnyqian/Orchard,Dolphinsimon/Orchard,ehe888/Orchard,sfmskywalker/Orchard,AdvantageCS/Orchard | src/Orchard/Environment/State/ContextState.cs | src/Orchard/Environment/State/ContextState.cs | using System;
using System.Runtime.Remoting.Messaging;
using System.Web;
using Orchard.Mvc.Extensions;
namespace Orchard.Environment.State {
/// <summary>
/// Holds some state for the current HttpContext or Logical Context
/// </summary>
/// <typeparam name="T">The type of data to store</typeparam>
public class ContextState<T> where T : class {
private readonly string _name;
private readonly Func<T> _defaultValue;
public ContextState(string name) {
_name = name;
}
public ContextState(string name, Func<T> defaultValue) {
_name = name;
_defaultValue = defaultValue;
}
public T GetState() {
if (HttpContext.Current.IsBackgroundHttpContext()) {
var handle = CallContext.LogicalGetData(_name) as ObjectHandle;
var data = handle != null ? handle.Unwrap() : null;
if (data == null) {
if (_defaultValue != null) {
CallContext.LogicalSetData(_name, new ObjectHandle(data = _defaultValue()));
return data as T;
}
}
return data as T;
}
if (HttpContext.Current.Items[_name] == null) {
HttpContext.Current.Items[_name] = _defaultValue == null ? null : _defaultValue();
}
return HttpContext.Current.Items[_name] as T;
}
public void SetState(T state) {
if (HttpContext.Current.IsBackgroundHttpContext()) {
CallContext.LogicalSetData(_name, new ObjectHandle(state));
}
else {
HttpContext.Current.Items[_name] = state;
}
}
internal class ObjectHandle : System.Runtime.Remoting.ObjectHandle {
public ObjectHandle(object o) : base(o) { }
public override object InitializeLifetimeService() {
return null;
}
}
}
}
| using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;
using System.Web;
using Orchard.Mvc.Extensions;
namespace Orchard.Environment.State {
/// <summary>
/// Holds some state for the current HttpContext or Logical Context
/// </summary>
/// <typeparam name="T">The type of data to store</typeparam>
public class ContextState<T> where T : class {
private readonly string _name;
private readonly Func<T> _defaultValue;
public ContextState(string name) {
_name = name;
}
public ContextState(string name, Func<T> defaultValue) {
_name = name;
_defaultValue = defaultValue;
}
public T GetState() {
if (HttpContext.Current.IsBackgroundHttpContext()) {
var handle = CallContext.LogicalGetData(_name) as ObjectHandle;
var data = handle != null ? handle.Unwrap() : null;
if (data == null) {
if (_defaultValue != null) {
CallContext.LogicalSetData(_name, new ObjectHandle(data = _defaultValue()));
return data as T;
}
}
return data as T;
}
if (HttpContext.Current.Items[_name] == null) {
HttpContext.Current.Items[_name] = _defaultValue == null ? null : _defaultValue();
}
return HttpContext.Current.Items[_name] as T;
}
public void SetState(T state) {
if (HttpContext.Current.IsBackgroundHttpContext()) {
CallContext.LogicalSetData(_name, new ObjectHandle(state));
}
else {
HttpContext.Current.Items[_name] = state;
}
}
}
}
| bsd-3-clause | C# |
35f9952a6cca4de6504ef56a8c2aa1b9a9b1252a | debug messaging improved | yvanin/TfsDiffReport | TfsDiffReport/Program.cs | TfsDiffReport/Program.cs | using System;
namespace TfsDiffReport
{
public class Program
{
public static void Main(string[] args)
{
try
{
var options = CommandLineArgsParser.Parse(args);
new DiffReportRunner(options).GenerateReport();
}
catch (Exception ex)
{
Console.Error.WriteLine("TfsDiffReport failed. Exception: {0}", ex.Message);
}
#if DEBUG
Console.WriteLine("All done.");
Console.ReadLine();
#endif
}
}
}
| using System;
namespace TfsDiffReport
{
public class Program
{
public static void Main(string[] args)
{
try
{
var options = CommandLineArgsParser.Parse(args);
new DiffReportRunner(options).GenerateReport();
}
catch (Exception ex)
{
Console.Error.WriteLine("TfsDiffReport failed. Exception: {0}", ex.Message);
}
#if DEBUG
Console.ReadLine();
#endif
}
}
}
| mit | C# |
7c75c810ce34aa3d769e5883f2966442dce8cbfb | Implement SegmentedArray.Clear<T> and Copy<T> | ErikSchierboom/roslyn,ErikSchierboom/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,eriawan/roslyn,KevinRansom/roslyn,wvdd007/roslyn,mavasani/roslyn,ErikSchierboom/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,eriawan/roslyn,KevinRansom/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,dotnet/roslyn,physhi/roslyn,AlekseyTs/roslyn,sharwell/roslyn,mavasani/roslyn,weltkante/roslyn,physhi/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,sharwell/roslyn,tannergooding/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,mavasani/roslyn,sharwell/roslyn,diryboy/roslyn,weltkante/roslyn,bartdesmet/roslyn,tmat/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,AmadeusW/roslyn,tannergooding/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,wvdd007/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn | src/Dependencies/Collections/SegmentedArray.cs | src/Dependencies/Collections/SegmentedArray.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Collections.Internal;
namespace Microsoft.CodeAnalysis.Collections
{
internal static class SegmentedArray
{
/// <seealso cref="Array.Clear(Array, int, int)"/>
internal static void Clear<T>(SegmentedArray<T> buckets, int index, int length)
{
if (index < 0 || length < 0 || (uint)(index + length) > (uint)buckets.Length)
ThrowHelper.ThrowArgumentOutOfRangeException();
// TODO: Improve this algorithm
for (var i = 0; i < length; i++)
{
buckets[i + index] = default!;
}
}
/// <seealso cref="Array.Copy(Array, Array, int)"/>
internal static void Copy<T>(SegmentedArray<T> sourceArray, SegmentedArray<T> destinationArray, int length)
{
if (length == 0)
return;
if ((uint)length <= (uint)sourceArray.Length
&& (uint)length <= (uint)destinationArray.Length)
{
var sourcePages = (T[][])sourceArray.SyncRoot;
var destinationPages = (T[][])destinationArray.SyncRoot;
var remaining = length;
for (var i = 0; i < sourcePages.Length; i++)
{
var sourcePage = sourcePages[i];
var destinationPage = destinationPages[i];
if (remaining <= sourcePage.Length)
{
Array.Copy(sourcePage, destinationPage, remaining);
return;
}
else
{
Debug.Assert(sourcePage.Length == destinationPage.Length);
Array.Copy(sourcePage, destinationPage, sourcePage.Length);
remaining -= sourcePage.Length;
}
}
throw new InvalidOperationException("This program location is thought to be unreachable.");
}
if (length < 0)
throw new ArgumentOutOfRangeException(nameof(length));
if (length > sourceArray.Length)
throw new ArgumentException(SR.Arg_LongerThanSrcArray, nameof(sourceArray));
if (length > destinationArray.Length)
throw new ArgumentException(SR.Arg_LongerThanDestArray, nameof(destinationArray));
throw new InvalidOperationException("This program location is thought to be unreachable.");
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.CodeAnalysis.Collections
{
internal static class SegmentedArray
{
/// <seealso cref="Array.Clear(Array, int, int)"/>
internal static void Clear<T>(SegmentedArray<T> buckets, int index, int length)
{
throw new NotImplementedException();
}
/// <seealso cref="Array.Copy(Array, Array, int)"/>
internal static void Copy<T>(SegmentedArray<T> sourceArray, SegmentedArray<T> destinationArray, int length)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
b037f2bf3958c0e70d2563ea2d7a1dc75c2c0a26 | Use whole line as method if we can't parse | awseward/Bugsnag.NET,awseward/Bugsnag.NET | lib/Bugsnag.Common/Extensions/CommonExtensions.cs | lib/Bugsnag.Common/Extensions/CommonExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Bugsnag.Common.Extensions
{
public static class CommonExtensions
{
public static IEnumerable<Exception> Unwrap(this Exception ex)
{
if (ex == null)
{
return Enumerable.Empty<Exception>();
}
else if (ex.InnerException == null)
{
return new Exception[] { ex };
}
return new Exception[] { ex }.Concat(ex.InnerException.Unwrap());
}
public static IEnumerable<string> ToLines(this Exception ex)
{
if (ex == null || ex.StackTrace == null)
{
return new string[] { string.Empty };
}
return ex.StackTrace.Split(
new string[] { Environment.NewLine },
StringSplitOptions.RemoveEmptyEntries
);
}
public static string ParseFile(this string line)
{
var match = Regex.Match(line, "in (.+):line");
if (match.Groups.Count < 2) { return "[file]"; }
return match.Groups[1].Value;
}
public static string ParseMethodName(this string line)
{
// to extract the full method name (with namespace)
var match = Regex.Match(line, "at ([^)]+[)])");
if (match.Groups.Count < 2) { return line; }
return match.Groups[1].Value;
}
public static int ParseLineNumber(this string line)
{
var match = Regex.Match(line, ":line ([0-9]+)");
if (match.Groups.Count < 2) { return -1; }
return Convert.ToInt32(match.Groups[1].Value);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Bugsnag.Common.Extensions
{
public static class CommonExtensions
{
public static IEnumerable<Exception> Unwrap(this Exception ex)
{
if (ex == null)
{
return Enumerable.Empty<Exception>();
}
else if (ex.InnerException == null)
{
return new Exception[] { ex };
}
return new Exception[] { ex }.Concat(ex.InnerException.Unwrap());
}
public static IEnumerable<string> ToLines(this Exception ex)
{
if (ex == null || ex.StackTrace == null)
{
return new string[] { string.Empty };
}
return ex.StackTrace.Split(
new string[] { Environment.NewLine },
StringSplitOptions.RemoveEmptyEntries
);
}
public static string ParseFile(this string line)
{
var match = Regex.Match(line, "in (.+):line");
if (match.Groups.Count < 2) { return "[file]"; }
return match.Groups[1].Value;
}
public static string ParseMethodName(this string line)
{
// to extract the full method name (with namespace)
var match = Regex.Match(line, "at ([^)]+[)])");
if (match.Groups.Count < 2) { return "[method]"; }
return match.Groups[1].Value;
}
public static int ParseLineNumber(this string line)
{
var match = Regex.Match(line, ":line ([0-9]+)");
if (match.Groups.Count < 2) { return -1; }
return Convert.ToInt32(match.Groups[1].Value);
}
}
}
| mit | C# |
4c2371b2fa866088ccd7bf41ba8aa9297e4e31fa | add missing typedRouteBuilder tests | Pondidum/Conifer,Pondidum/Conifer | Tests/TypedRouteBuilderTests.cs | Tests/TypedRouteBuilderTests.cs | using System;
using System.Linq;
using System.Reflection;
using System.Web.Http.Controllers;
using RestRouter;
using Shouldly;
using Xunit;
namespace Tests
{
public class TypedRouteBuilderTests
{
private readonly TypedRouteBuilder _builder;
private readonly Type _controller;
private readonly MethodInfo _method;
public TypedRouteBuilderTests()
{
_controller = typeof(IHttpController);
_method = _controller.GetMethods().First();
_builder = new TypedRouteBuilder(_controller, _method);
_builder.Parts.Add("First");
_builder.Parts.Add("Second");
}
[Fact]
public void When_building_a_route_with_parts()
{
var route = _builder.Build(Enumerable.Empty<IRouteConvention>().ToList());
route.ShouldSatisfyAllConditions(
() => route.Template.ShouldBe("First/Second"),
() => route.ControllerType.ShouldBe(_controller),
() => route.ActionName.ShouldBe(_method.Name)
);
}
[Fact]
public void When_conventions_are_specified()
{
var route = _builder.Build(new IRouteConvention[] {new TestConvention()}.ToList());
route.Template.ShouldBeEmpty();
}
private class TestConvention : IRouteConvention
{
public void Execute(TypedRouteBuilder template)
{
template.Parts.Clear();
}
}
}
}
| using System;
using System.Linq;
using System.Reflection;
using System.Web.Http.Controllers;
using RestRouter;
using Shouldly;
using Xunit;
namespace Tests
{
public class TypedRouteBuilderTests
{
private readonly TypedRoute _route;
private readonly Type _controller;
private readonly MethodInfo _method;
public TypedRouteBuilderTests()
{
_controller = typeof(IHttpController);
_method = _controller.GetMethods().First();
var builder = new TypedRouteBuilder(_controller, _method);
builder.Parts.Add("First");
builder.Parts.Add("Second");
_route = builder.Build(Enumerable.Empty<IRouteConvention>().ToList());
}
[Fact]
public void When_building_a_route_with_parts()
{
_route.Template.ShouldBe("First/Second");
}
[Fact]
public void The_controller_is_named()
{
_route.ControllerType.ShouldBe(_controller);
}
[Fact]
public void The_action_is_named()
{
_route.ActionName.ShouldBe(_method.Name);
}
}
}
| lgpl-2.1 | C# |
de87d4771951b1fe9dd8634ec0dbdca5351c5cbf | Call GetTypesSafely extension method instead of GetTypes method. | RockFramework/Rock.Messaging,bfriesen/Rock.Messaging,peteraritchie/Rock.Messaging | Rock.Messaging/Routing/AppDomainTypeLocator.cs | Rock.Messaging/Routing/AppDomainTypeLocator.cs | using System;
using System.Linq;
using Rock.Reflection;
namespace Rock.Messaging.Routing
{
public class AppDomainTypeLocator : ITypeLocator
{
private readonly IMessageParser _messageParser;
private readonly AppDomain _appDomain;
public AppDomainTypeLocator(IMessageParser messageParser, AppDomain appDomain = null)
{
_messageParser = messageParser;
_appDomain = appDomain ?? AppDomain.CurrentDomain;
}
public Type GetMessageType(string typeName)
{
return
(from a in _appDomain.GetAssemblies()
from t in a.GetTypesSafely()
where !t.IsAbstract && _messageParser.GetTypeName(t) == typeName
select t).Single();
}
public Type GetMessageHandlerType(Type messageType)
{
return
(from a in _appDomain.GetAssemblies()
from t in a.GetTypesSafely()
where !t.IsAbstract
from i in t.GetInterfaces()
where i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMessageHandler<>) && i.GetGenericArguments()[0] == messageType
select t).Single();
}
}
} | using System;
using System.Linq;
namespace Rock.Messaging.Routing
{
public class AppDomainTypeLocator : ITypeLocator
{
private readonly IMessageParser _messageParser;
private readonly AppDomain _appDomain;
public AppDomainTypeLocator(IMessageParser messageParser, AppDomain appDomain = null)
{
_messageParser = messageParser;
_appDomain = appDomain ?? AppDomain.CurrentDomain;
}
public Type GetMessageType(string typeName)
{
return
(from a in _appDomain.GetAssemblies()
from t in a.GetTypes()
where !t.IsAbstract && _messageParser.GetTypeName(t) == typeName
select t).Single();
}
public Type GetMessageHandlerType(Type messageType)
{
return
(from a in _appDomain.GetAssemblies()
from t in a.GetTypes()
where !t.IsAbstract
from i in t.GetInterfaces()
where i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMessageHandler<>) && i.GetGenericArguments()[0] == messageType
select t).Single();
}
}
} | mit | C# |
6aaa0136e8b8746bd3bb9f82e4079a655e9937fe | Add some restricted trade item properties | villermen/runescape-cache-tools,villermen/runescape-cache-tools | RuneScapeCacheTools/Model/ItemProperty.cs | RuneScapeCacheTools/Model/ItemProperty.cs | using Villermen.RuneScapeCacheTools.File;
namespace Villermen.RuneScapeCacheTools.Model
{
/// <summary>
/// The identifier for a parameter of an <see cref="ItemDefinitionFile" />.
/// </summary>
public enum ItemProperty
{
WeaponRange = 13,
EquipOption1 = 528,
EquipOption2 = 529,
EquipOption3 = 530,
EquipOption4 = 531,
DropSoundId = 537,
StrengthBonus = 641,
RangedBonus = 643,
/// <summary>
/// Can only be traded for an equal amount of items with the same category.
/// </summary>
RestrictedTrade = 689,
MobilisingArmiesSquad = 802,
MagicBonus = 965,
/// <summary>
/// 0 = attack, 1 = defence, 2= strength, 4 = ranged, 5 = prayer, 6 = magic
/// </summary>
EquipSkillRequired = 749,
EquipLevelRequired = 750,
EquipSkillRequired2 = 751,
EquipLevelRequired2 = 752,
LifePointBonus = 1326,
UnknownRestrictedTradeRelated = 1397,
GeCategory = 2195,
BeastOfBurdenStorable = 2240,
MeleeAffinity = 2866,
RangedAffinity = 2867,
MagicAffinity = 2868,
ArmourBonus = 2870,
PrayerBonus = 2946,
PotionEffectValue = 3000,
UnknownPopItemCharge = 3109,
WeaponAccuracy = 3267,
RepairCost = 3383,
CombatCharges = 3385,
PortentOfDegradationHealAmount = 3698,
Broken = 3793,
MtxDescription = 4085,
SpecialAttackCost = 4332,
SpecialAttackName = 4333,
SpecialAttackDescription = 4334,
DestroyForGp = 4907,
DestroyText = 5417,
ZarosItem = 5440,
UnknownBookcaseReclaimCost = 5637,
UnknownFayreTokenRelated = 6405,
SigilCooldownDefault = 6520,
SigilCooldown = 6521,
SigilMaxCharges = 6522,
PofFarmLevel = 7477,
}
}
| using Villermen.RuneScapeCacheTools.File;
namespace Villermen.RuneScapeCacheTools.Model
{
/// <summary>
/// The identifier for a parameter of an <see cref="ItemDefinitionFile" />.
/// </summary>
public enum ItemProperty
{
WeaponRange = 13,
EquipOption1 = 528,
EquipOption2 = 529,
EquipOption3 = 530,
EquipOption4 = 531,
DropSoundId = 537,
StrengthBonus = 641,
RangedBonus = 643,
MobilisingArmiesSquad = 802,
MagicBonus = 965,
/// <summary>
/// 0 = attack, 1 = defence, 2= strength, 4 = ranged, 5 = prayer, 6 = magic
/// </summary>
EquipSkillRequired = 749,
EquipLevelRequired = 750,
EquipSkillRequired2 = 751,
EquipLevelRequired2 = 752,
LifePointBonus = 1326,
GeCategory = 2195,
BeastOfBurdenStorable = 2240,
MeleeAffinity = 2866,
RangedAffinity = 2867,
MagicAffinity = 2868,
ArmourBonus = 2870,
PrayerBonus = 2946,
PotionEffectValue = 3000,
UnknownPopItemCharge = 3109,
WeaponAccuracy = 3267,
RepairCost = 3383,
CombatCharges = 3385,
PortentOfDegradationHealAmount = 3698,
Broken = 3793,
MtxDescription = 4085,
SpecialAttackCost = 4332,
SpecialAttackName = 4333,
SpecialAttackDescription = 4334,
DestroyText = 5417,
ZarosItem = 5440,
UnknownBookcaseReclaimCost = 5637,
UnknownFayreTokenRelated = 6405,
SigilCooldownDefault = 6520,
SigilCooldown = 6521,
SigilMaxCharges = 6522,
PofFarmLevel = 7477,
}
}
| mit | C# |
6eeef8a86663fd5a1c13eb122f1b825a81c6f4d4 | Remove XFrame on the checkout page | btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver,btcpayserver/btcpayserver | BTCPayServer/Filters/XFrameOptionsAttribute.cs | BTCPayServer/Filters/XFrameOptionsAttribute.cs | using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BTCPayServer.Filters
{
public class XFrameOptionsAttribute : Attribute, IActionFilter
{
public XFrameOptionsAttribute(string value)
{
Value = value;
}
public string Value
{
get; set;
}
public void OnActionExecuted(ActionExecutedContext context)
{
}
public void OnActionExecuting(ActionExecutingContext context)
{
if (context.IsEffectivePolicy<XFrameOptionsAttribute>(this))
{
context.HttpContext.Response.SetHeaderOnStarting("X-Frame-Options", Value);
}
}
}
}
| using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BTCPayServer.Filters
{
public class XFrameOptionsAttribute : Attribute, IActionFilter
{
public XFrameOptionsAttribute(string value)
{
Value = value;
}
public string Value
{
get; set;
}
public void OnActionExecuted(ActionExecutedContext context)
{
}
public void OnActionExecuting(ActionExecutingContext context)
{
context.HttpContext.Response.SetHeaderOnStarting("X-Frame-Options", Value);
}
}
}
| mit | C# |
2bc4a35409cc87666086f4edee2f569b4c0226b3 | fix MemberAssignBinder exception code | maul-esel/CobaltAHK,maul-esel/CobaltAHK | CobaltAHK/ExpressionTree/MemberAssignBinder.cs | CobaltAHK/ExpressionTree/MemberAssignBinder.cs | using System;
using System.Dynamic;
using System.Linq;
#if CustomDLR
using Microsoft.Scripting.Ast;
#else
using System.Linq.Expressions;
#endif
using System.Reflection;
namespace CobaltAHK.ExpressionTree
{
public class MemberAssignBinder : SetMemberBinder
{
public MemberAssignBinder(string member) : base(member, true) { }
public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
{
if (!target.HasValue || !value.HasValue) {
return Defer(target, value);
}
// todo: special properties like base, builtin obj functions etc.
// todo: .NET types
return errorSuggestion ?? new DynamicMetaObject(
ThrowOnFailure(target.Expression, value.Expression),
BindingRestrictions.GetTypeRestriction(target.Expression, target.LimitType));
}
private Expression ThrowOnFailure(Expression target, Expression value)
{
return Expression.Throw(Expression.New(typeof(InvalidOperationException))); // todo: supply message
}
}
} | using System;
using System.Dynamic;
using System.Linq;
#if CustomDLR
using Microsoft.Scripting.Ast;
#else
using System.Linq.Expressions;
#endif
using System.Reflection;
namespace CobaltAHK.ExpressionTree
{
public class MemberAssignBinder : SetMemberBinder
{
public MemberAssignBinder(string member) : base(member, true) { }
public override DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
{
if (!target.HasValue || !value.HasValue) {
return Defer(target, value);
}
// todo: special properties like base, builtin obj functions etc.
// todo: .NET types
return errorSuggestion ?? new DynamicMetaObject(
ThrowOnFailure(target.Expression, value.Expression),
BindingRestrictions.GetTypeRestriction(target.Expression, target.LimitType));
}
private static Expression ThrowOnFailure(Expression target, Expression value)
{
return Expression.Throw(Expression.Constant(""), typeof(InvalidOperationException)); // todo: supply message
}
}
} | mit | C# |
d9fc08dc72cce2dcda709e380aec2bbc35a37278 | Add out parameter to Parser | linerlock/parseq | Parseq/Parser.cs | Parseq/Parser.cs | /*
* Copyright (C) 2012 - 2015 Takahisa Watanabe <linerlock@outlook.com> All rights reserved.
*
* 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 Parseq
{
public delegate IReply<TToken, T> Parser<TToken, out T>(ITokenStream<TToken> stream);
}
| /*
* Copyright (C) 2012 - 2015 Takahisa Watanabe <linerlock@outlook.com> All rights reserved.
*
* 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 Parseq
{
public delegate IReply<TToken, T> Parser<TToken, T>(ITokenStream<TToken> stream);
}
| mit | C# |
eeef72912bd67340d3018573b52ee78af588ecb9 | Remove testing outputs #75. | techyian/MMALSharp | src/MMALSharp.Common/Handlers/InMemoryCaptureHandler.cs | src/MMALSharp.Common/Handlers/InMemoryCaptureHandler.cs | using System;
using System.Collections.Generic;
namespace MMALSharp.Handlers
{
public class InMemoryCaptureHandler : ICaptureHandler
{
public List<byte> WorkingData { get; set; }
public InMemoryCaptureHandler()
{
this.WorkingData = new List<byte>();
}
public void Dispose()
{
// Not required.
}
public virtual ProcessResult Process(uint allocSize)
{
return new ProcessResult();
}
public virtual void Process(byte[] data)
{
this.WorkingData.AddRange(data);
}
public virtual void PostProcess()
{
}
}
} | using System;
using System.Collections.Generic;
namespace MMALSharp.Handlers
{
public class InMemoryCaptureHandler : ICaptureHandler
{
public List<byte> WorkingData { get; set; }
public InMemoryCaptureHandler()
{
this.WorkingData = new List<byte>();
}
public void Dispose()
{
// Not required.
}
public virtual ProcessResult Process(uint allocSize)
{
return new ProcessResult();
}
public virtual void Process(byte[] data)
{
this.WorkingData.AddRange(data);
Console.WriteLine($"Total data processed: {this.WorkingData.Count}");
}
public virtual void PostProcess()
{
Console.WriteLine("Finishing up....");
}
}
} | mit | C# |
2d5fdde4723ece483da78b96929a63a2746fb064 | Add sorting | SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery | AstroPhotoGallery/AstroPhotoGallery/Controllers/TagController.cs | AstroPhotoGallery/AstroPhotoGallery/Controllers/TagController.cs | using AstroPhotoGallery.Extensions;
using AstroPhotoGallery.Models;
using PagedList;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
namespace AstroPhotoGallery.Controllers
{
public class TagController : Controller
{
//
// GET: Tag/List/id
public ActionResult List(int? id, int? page)
{
if (id == null)
{
this.AddNotification("No tag ID provided.", NotificationType.ERROR);
return RedirectToAction("Index", "Home");
}
using (var db = new GalleryDbContext())
{
//Get pictures from db
var pictures = db.Tags
.Include(t => t.Pictures.Select(p => p.Tags))
.Include(t => t.Pictures.Select(p => p.PicUploader))
.FirstOrDefault(t => t.Id == id)
.Pictures
.OrderByDescending(p => p.Id)
.ToList();
//Return the view
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(pictures.ToPagedList(pageNumber, pageSize));
}
}
}
} | using AstroPhotoGallery.Extensions;
using AstroPhotoGallery.Models;
using PagedList;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
namespace AstroPhotoGallery.Controllers
{
public class TagController : Controller
{
//
// GET: Tag/List/id
public ActionResult List(int? id ,int? page)
{
if (id == null)
{
this.AddNotification("No tag ID provided.", NotificationType.ERROR);
return RedirectToAction("Index", "Home");
}
using (var db = new GalleryDbContext())
{
//Get pictures from db
var pictures = db.Tags
.Include(t => t.Pictures.Select(p => p.Tags))
.Include(t => t.Pictures.Select(p => p.PicUploader))
.FirstOrDefault(t => t.Id == id)
.Pictures
.ToList();
//Return the view
int pageSize = 8;
int pageNumber = (page ?? 1);
return View(pictures.ToPagedList(pageNumber, pageSize));
}
}
}
} | mit | C# |
f0c62e517e4f75d2c208b05c8a96e57b0e57fe9e | Change the Global file. | SoftwareDesign/Library,SoftwareDesign/Library,SoftwareDesign/Library | MMLibrarySystem/MMLibrarySystem/Global.asax.cs | MMLibrarySystem/MMLibrarySystem/Global.asax.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Data.Entity;
using MMLibrarySystem.Models;
using MMLibrarySystem.Schedule;
namespace MMLibrarySystem
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
#if DEBUG
Database.SetInitializer(new BookLibraryInitializer());
#else
Database.SetInitializer(new CreateDatabaseIfNotExists<BookLibraryContext>());
#endif
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
protected void Session_Start(object sender, EventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
var loginName = Models.User.CurrentLoginName;
var current = Models.User.FindUserByLoginName(loginName);
if (current == null)
{
using (var db = new BookLibraryContext())
{
var debgger = new User { LoginName = loginName, Role = (int)Roles.Admin };
db.Users.Add(debgger);
db.SaveChanges();
}
}
}
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Data.Entity;
using MMLibrarySystem.Models;
namespace MMLibrarySystem
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
#if DEBUG
Database.SetInitializer(new BookLibraryInitializer());
#else
Database.SetInitializer(new CreateDatabaseIfNotExists<BookLibraryContext>());
#endif
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
protected void Session_Start(object sender, EventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
var loginName = Models.User.CurrentLoginName;
var current = Models.User.FindUserByLoginName(loginName);
if (current == null)
{
using (var db = new BookLibraryContext())
{
var debgger = new User { LoginName = loginName, Role = (int)Roles.Admin };
db.Users.Add(debgger);
db.SaveChanges();
}
}
}
}
}
} | apache-2.0 | C# |
41bc1852d4ba251800df3e2cd490ed3ec65bfde6 | Fix unit test | jMarkP/hcl-net | hcl-net.Test/Parse/HCL/TokenTests.cs | hcl-net.Test/Parse/HCL/TokenTests.cs | using hcl_net.Parse.HCL;
using NUnit.Framework;
namespace hcl_net.Test.Parse.HCL
{
[TestFixture]
class TokenTests
{
[TestCase(TokenType.BOOL, "true", true)]
[TestCase(TokenType.BOOL, "false", false)]
[TestCase(TokenType.FLOAT, "3.14", (double)3.14)]
[TestCase(TokenType.NUMBER, "42", (long)42)]
[TestCase(TokenType.IDENT, "foo", "foo")]
[TestCase(TokenType.STRING, @"""foo""", "foo")]
[TestCase(TokenType.STRING, @"""foo\nbar""", "foo\nbar")]
[TestCase(TokenType.STRING, @"""${file(""foo"")}""", "${file(\"foo\")}")]
[TestCase(TokenType.STRING, @"""${replace(var.foo, ""."", ""\\."")}""", "${replace(var.foo, \".\", \"\\\\.\")}")]
[TestCase(TokenType.HEREDOC, "<<EOF\nfoo\nbar\nEOF", "foo\nbar")]
[TestCase(TokenType.HEREDOC, "<<-EOF\n\t\t foo\n\t\t bar\n\t\t EOF", "foo\n bar\n")]
[TestCase(TokenType.HEREDOC, "<<-EOF\n\t\t foo\n\tbar\n\t\t EOF", "\t\t foo\n\tbar\n")]
public void TestTokenValue(TokenType type, string text, object value)
{
var SUT = new Token(type, new Pos(), text, false);
Assert.That(SUT.Value, Is.EqualTo(value));
}
}
}
| using hcl_net.Parse.HCL;
using NUnit.Framework;
namespace hcl_net.Test.Parse.HCL
{
[TestFixture]
class TokenTests
{
[TestCase(TokenType.BOOL, "true", true)]
[TestCase(TokenType.BOOL, "false", false)]
[TestCase(TokenType.FLOAT, "3.14", (double)3.14)]
[TestCase(TokenType.NUMBER, "42", (long)42)]
[TestCase(TokenType.IDENT, "foo", "foo")]
[TestCase(TokenType.STRING, @"""foo""", "foo")]
[TestCase(TokenType.STRING, @"""foo\nbar""", "foo\nbar")]
[TestCase(TokenType.STRING, @"""${file(""foo"")}""", "${file(\"foo\")}")]
[TestCase(TokenType.STRING, @"""${replace(var.foo, ""."", ""\\."")}""")]
[TestCase(TokenType.HEREDOC, "<<EOF\nfoo\nbar\nEOF", "foo\nbar")]
[TestCase(TokenType.HEREDOC, "<<-EOF\n\t\t foo\n\t\t bar\n\t\t EOF", "foo\n bar\n")]
[TestCase(TokenType.HEREDOC, "<<-EOF\n\t\t foo\n\tbar\n\t\t EOF", "\t\t foo\n\tbar\n")]
public void TestTokenValue(TokenType type, string text, object value)
{
var SUT = new Token(type, new Pos(), text, false);
Assert.That(SUT.Value, Is.EqualTo(value));
}
}
}
| mit | C# |
2cf528158bdc74bdf31d95e0c728876cecfda072 | Change default RowDelimiter to CRLF regardless of OS (as by RFC4180) | nortal/Utilities.Csv | Csv/CsvSettings.cs | Csv/CsvSettings.cs | /*
Copyright 2013 Imre Pühvel, AS Nortal
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file is from project https://github.com/NortalLTD/Utilities.Csv, Nortal.Utilities.Csv, file 'CsvSettings.cs'.
*/
using System;
namespace Nortal.Utilities.Csv
{
/// <summary>
/// Defines Csv syntax (field delimiter, etc). Defaults to values from RFC4180
/// </summary>
public class CsvSettings
{
public CsvSettings()
{
// Load ISO4180 settings
this.FieldDelimiter = ',';
this.QuotingCharacter = '"';
this.RowDelimiter = "\r\n";
}
/// <summary>
/// Symbol to separate values within a csv row. Default is comma (',').
/// </summary>
public char FieldDelimiter { get; set; }
/// <summary>
/// Line separator, default is newline. Any string up to length of 2 could be used.
/// </summary>
public String RowDelimiter { get; set; }
/// <summary>
/// Symbol to optionally wrap values with. Defaults to '"'.
/// </summary>
public char QuotingCharacter { get; set; }
}
}
| /*
Copyright 2013 Imre Pühvel, AS Nortal
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file is from project https://github.com/NortalLTD/Utilities.Csv, Nortal.Utilities.Csv, file 'CsvSettings.cs'.
*/
using System;
namespace Nortal.Utilities.Csv
{
/// <summary>
/// Defines Csv syntax (field delimiter, etc). Defaults to values from RFC4180
/// </summary>
public class CsvSettings
{
public CsvSettings()
{
// Load ISO4801 settings
this.FieldDelimiter = ',';
this.QuotingCharacter = '"';
this.RowDelimiter = Environment.NewLine;
}
/// <summary>
/// Symbol to separate values within a csv row. Default is comma (',').
/// </summary>
public char FieldDelimiter { get; set; }
/// <summary>
/// Line separator, default is newline. Any string up to length of 2 could be used.
/// </summary>
public String RowDelimiter { get; set; }
/// <summary>
/// Symbol to optionally wrap values with. Defaults to '"'.
/// </summary>
public char QuotingCharacter { get; set; }
}
}
| apache-2.0 | C# |
43d27b843b1b7f8e62c464242fdf177c3df75d76 | Add issue to track vstest break | mlorbetske/cli,weshaggard/cli,jonsequitur/cli,mlorbetske/cli,blackdwarf/cli,dasMulli/cli,Faizan2304/cli,weshaggard/cli,mlorbetske/cli,ravimeda/cli,AbhitejJohn/cli,blackdwarf/cli,mlorbetske/cli,blackdwarf/cli,EdwardBlair/cli,johnbeisner/cli,EdwardBlair/cli,weshaggard/cli,nguerrera/cli,weshaggard/cli,johnbeisner/cli,svick/cli,livarcocc/cli-1,dasMulli/cli,ravimeda/cli,nguerrera/cli,livarcocc/cli-1,svick/cli,svick/cli,AbhitejJohn/cli,Faizan2304/cli,nguerrera/cli,weshaggard/cli,harshjain2/cli,blackdwarf/cli,AbhitejJohn/cli,jonsequitur/cli,harshjain2/cli,livarcocc/cli-1,jonsequitur/cli,jonsequitur/cli,EdwardBlair/cli,AbhitejJohn/cli,harshjain2/cli,nguerrera/cli,dasMulli/cli,ravimeda/cli,Faizan2304/cli,johnbeisner/cli | test/dotnet-vstest.Tests/VSTestTests.cs | test/dotnet-vstest.Tests/VSTestTests.cs | // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using System;
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Cli.VSTest.Tests
{
public class VSTestTests : TestBase
{
[Fact(Skip="https://github.com/dotnet/cli/issues/4526")]
public void TestsFromAGivenContainerShouldRunWithExpectedOutput()
{
// Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests
string testAppName = "VSTestDotNetCoreProject";
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
string testProjectDirectory = testInstance.TestRoot;
// Restore project VSTestDotNetCoreProject
new RestoreCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
// Build project VSTestDotNetCoreProject
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
// Prepare args to send vstest
string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0");
string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll");
string argsForVstest = string.Concat("\"", outputDll, "\"");
// Call vstest
CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);
// Verify
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
}
}
}
| // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using System;
using System.IO;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Cli.VSTest.Tests
{
public class VSTestTests : TestBase
{
//[Fact]
public void TestsFromAGivenContainerShouldRunWithExpectedOutput()
{
// Copy DotNetCoreTestProject project in output directory of project dotnet-vstest.Tests
string testAppName = "VSTestDotNetCoreProject";
TestInstance testInstance = TestAssetsManager.CreateTestInstance(testAppName);
string testProjectDirectory = testInstance.TestRoot;
// Restore project VSTestDotNetCoreProject
new RestoreCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
// Build project VSTestDotNetCoreProject
new BuildCommand()
.WithWorkingDirectory(testProjectDirectory)
.Execute()
.Should()
.Pass();
// Prepare args to send vstest
string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug";
string testAdapterPath = Path.Combine(testProjectDirectory, "bin", configuration, "netcoreapp1.0");
string outputDll = Path.Combine(testAdapterPath, $"{testAppName}.dll");
string argsForVstest = string.Concat("\"", outputDll, "\"");
// Call vstest
CommandResult result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);
// Verify
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");
result.StdOut.Should().Contain("Failed TestNamespace.VSTestTests.VSTestFailTest");
}
}
}
| mit | C# |
17cf9d56e94969eca8d54c9fc734f3a805283f8a | add assemblyinfo | WasimAhmad/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,WasimAhmad/Serenity,dfaruque/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,dfaruque/Serenity,dfaruque/Serenity,volkanceylan/Serenity | SharedAssemblyInfo.cs | SharedAssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Serenity")]
[assembly: AssemblyProduct("Serenity Platform")]
[assembly: AssemblyCopyright("Copyright © Volkan Ceylan")]
[assembly: AssemblyVersion("1.8.3")]
[assembly: AssemblyFileVersion("1.8.")]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Serenity")]
[assembly: AssemblyProduct("Serenity Platform")]
[assembly: AssemblyCopyright("Copyright © Volkan Ceylan")]
[assembly: AssemblyVersion("1.8.2")]
[assembly: AssemblyFileVersion("1.8.2")]
| mit | C# |
e0bb535c8056f02e669ab83ded379d2b3e38dfc3 | Make sealed | MarkKhromov/The-Log | TheLog/LogSettings.cs | TheLog/LogSettings.cs | namespace TheLog {
public sealed class LogSettings {
internal LogSettings() { }
public bool ShowMessageTime = true;
}
} | namespace TheLog {
public class LogSettings {
internal LogSettings() { }
public bool ShowMessageTime = true;
}
} | mit | C# |
771792bae243f42f2e0f9bc239f08fc6e639bf18 | Remove the next and previous links | Calvinverse/calvinverse.docs,Calvinverse/calvinverse.docs | src/_BlogIndex.cshtml | src/_BlogIndex.cshtml | Title: Blog
ShowInNavbar: true
Order: 5500
---
@{
bool fullContent = Model.String(Keys.RelativeFilePath) == $"{Context.String(DocsKeys.BlogPath)}/index.html" && Model.Get<int>(Keys.CurrentPage) == 1;
foreach(IDocument post in Model.DocumentList(Keys.PageDocuments))
{
<!-- <h2><a href="@Context.GetLink(post)">@post.WithoutSettings.String(Keys.Title)</a></h2>-->
@Html.Partial("_BlogPostDetails", Tuple.Create(Model, post))
<div>
@Html.Raw(post.Content)
</div>
}
<!--
<nav>
@{
string directory = Model.FilePath(Keys.RelativeFilePath).Directory.FullPath;
}
<ul class="pager">
<li class="previous">
@if(Model.Bool(Keys.HasPreviousPage))
{
string previousPage = Context.GetLink(Model.Get<int>(Keys.CurrentPage) == 2
? $"/{directory}" : $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) - 1}");
<a href="@previousPage"><span aria-hidden="true">←</span> Newer</a>
}
</li>
<li class="next">
@if(Model.Bool(Keys.HasNextPage))
{
string nextPage = Context.GetLink($"/{directory}/page{Model.Get<int>(Keys.CurrentPage) + 1}");
<a href="@nextPage">Older <span aria-hidden="true">→</span></a>
}
</li>
</ul>
</nav>
-->
} | Title: Blog
ShowInNavbar: true
Order: 5500
---
@{
bool fullContent = Model.String(Keys.RelativeFilePath) == $"{Context.String(DocsKeys.BlogPath)}/index.html" && Model.Get<int>(Keys.CurrentPage) == 1;
foreach(IDocument post in Model.DocumentList(Keys.PageDocuments))
{
<!-- <h2><a href="@Context.GetLink(post)">@post.WithoutSettings.String(Keys.Title)</a></h2>-->
@Html.Partial("_BlogPostDetails", Tuple.Create(Model, post))
<div>
@Html.Raw(post.Content)
</div>
}
<nav>
@{
string directory = Model.FilePath(Keys.RelativeFilePath).Directory.FullPath;
}
<ul class="pager">
<li class="previous">
@if(Model.Bool(Keys.HasPreviousPage))
{
string previousPage = Context.GetLink(Model.Get<int>(Keys.CurrentPage) == 2
? $"/{directory}" : $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) - 1}");
<a href="@previousPage"><span aria-hidden="true">←</span> Newer</a>
}
</li>
<li class="next">
@if(Model.Bool(Keys.HasNextPage))
{
string nextPage = Context.GetLink($"/{directory}/page{Model.Get<int>(Keys.CurrentPage) + 1}");
<a href="@nextPage">Older <span aria-hidden="true">→</span></a>
}
</li>
</ul>
</nav>
} | apache-2.0 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.