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 |
|---|---|---|---|---|---|---|---|---|
bfcbe428421ef79e4bdfe645890fc68a0b291324
|
Update BinaryFormatSerializer to produce and consume a byte array
|
turtle-box-games/leaf-csharp
|
Leaf/Leaf/Serialization/BinaryFormatSerializer.cs
|
Leaf/Leaf/Serialization/BinaryFormatSerializer.cs
|
using System.IO;
using System.Text;
using Leaf.IO;
using Leaf.Nodes;
namespace Leaf.Serialization
{
/// <summary>
/// Serializes node data to a compact, non-human readable format.
/// </summary>
public class BinaryFormatSerializer : IFormatSerializer<byte[]>
{
/// <summary>
/// Flag indicating whether or not to use big-endian during serialization.
/// </summary>
private const bool BigEndian = true;
/// <summary>
/// Text encoding used for serialization.
/// </summary>
private static readonly Encoding StreamEncoding = Encoding.UTF8;
/// <summary>
/// Generate a byte array containing the node data from a container.
/// </summary>
/// <param name="container">Container holding the root node and associated data to be serialized.</param>
/// <returns>Output containing the serialized node data.</returns>
public byte[] Serialize(Container container)
{
var root = container.Root;
var header = new BinaryFormatHeader(root.Type, root.Version);
using(var stream = new MemoryStream())
using(var writer = new EndianAwareBinaryWriter(stream, BigEndian, StreamEncoding))
{
var serializer = new BinaryNodeSerializer(writer);
header.Write(writer);
root.Serialize(serializer);
return stream.ToArray();
}
}
/// <summary>
/// Create a container from serialized node data.
/// </summary>
/// <param name="input">Byte array containing previously serialized node data.</param>
/// <returns>Container holding the root node and associated data pull from the input.</returns>
public Container Deserialize(byte[] input)
{
Node root;
using(var stream = new MemoryStream(input))
using(var reader = new EndianAwareBinaryReader(stream, BigEndian, StreamEncoding))
{
var header = BinaryFormatHeader.Read(reader);
var serializer = new BinaryNodeSerializer(reader);
root = serializer.ReadNode(header.RootType);
}
return new Container(root);
}
}
}
|
using System.IO;
using System.Text;
using Leaf.IO;
using Leaf.Nodes;
namespace Leaf.Serialization
{
/// <summary>
/// Serializes node data to a compact, non-human readable format.
/// This format is ideal for saving in a compact format.
/// </summary>
public class BinaryFormatSerializer : IFormatSerializer
{
/// <summary>
/// Flag indicating whether or not to use big-endian during serialization.
/// </summary>
private const bool BigEndian = true;
/// <summary>
/// Text encoding used for serialization.
/// </summary>
private static readonly Encoding StreamEncoding = Encoding.UTF8;
/// <summary>
/// Write node data to a stream.
/// </summary>
/// <param name="container">Container holding the root node and associated data
/// to be written to the stream.</param>
/// <param name="output">Output stream to write data to.</param>
public void Serialize(Container container, Stream output)
{
var root = container.Root;
var header = new BinaryFormatHeader(root.Type, root.Version);
using(var writer = new EndianAwareBinaryWriter(output, BigEndian, StreamEncoding, true))
{
var serializer = new BinaryNodeSerializer(writer);
header.Write(writer);
root.Serialize(serializer);
}
}
/// <summary>
/// Read node data from a stream.
/// </summary>
/// <param name="input">Input stream to read data from.</param>
/// <returns>Container holding the root node and associated data read from the stream.</returns>
public Container Deserialize(Stream input)
{
Node root;
using(var reader = new EndianAwareBinaryReader(input, BigEndian, StreamEncoding, true))
{
var header = BinaryFormatHeader.Read(reader);
var serializer = new BinaryNodeSerializer(reader);
root = serializer.ReadNode(header.RootType);
}
return new Container(root);
}
}
}
|
mit
|
C#
|
1aa4804cdf101040f3116ae5f62bca1ff73916d7
|
add enum
|
ratoy/twilight
|
twilight/Style/EnumPointStyle.cs
|
twilight/Style/EnumPointStyle.cs
|
using System;
namespace twilight
{
public enum EnumPointStyle
{
Circle,
Rectangle,
Cross,
Triangle,
Image
}
}
|
using System;
namespace twilight
{
public enum EnumPointStyle
{
Circle,
Rectangle,
Cross,
Image
}
}
|
apache-2.0
|
C#
|
11f8bb13574e5993134f52b2a20adb37ad163bc1
|
fix issue with not wrapped long text
|
SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery,SoftwareFans/AstroPhotoGallery
|
AstroPhotoGallery/AstroPhotoGallery/Views/Home/ListPictures.cshtml
|
AstroPhotoGallery/AstroPhotoGallery/Views/Home/ListPictures.cshtml
|
@model List<AstroPhotoGallery.Models.Picture>
@{
ViewBag.Title = "List Pictures";
}
<div class="container">
<h2>@TempData["CategoryName"]</h2>
<div class="row">
@foreach (var picture in Model)
{
<div class="col-sm-6 text-center">
<article>
<header>
<h3>
@Html.ActionLink(@picture.PicTitle, "Details", "Picture", new { @id = picture.Id }, null)
</h3>
</header>
<div class="img-thumbnail">
<img src="@Url.Content(picture.ImagePath)" style="width: 360px" class="img-responsive img-rounded center-block" alt="Astro picture" />
</div>
<p>
<br />
<div style="word-wrap: break-word;">
@picture.PicDescription
</div>
</p>
<footer>
<small>
Uploader: @picture.PicUploader.Email
</small>
</footer>
</article>
</div>
}
</div>
</div>
|
@model List<AstroPhotoGallery.Models.Picture>
@{
ViewBag.Title = "List Pictures";
}
<div class="container">
<h2>@TempData["CategoryName"]</h2>
<div class="row">
@foreach (var picture in Model)
{
<div class="col-sm-6 text-center">
<article>
<header>
<h3>
@Html.ActionLink(@picture.PicTitle, "Details", "Picture", new { @id = picture.Id }, null)
</h3>
</header>
<div class="img-thumbnail">
<img src="@Url.Content(picture.ImagePath)" style="width: 360px" class="img-responsive img-rounded center-block" alt="Astro picture" />
</div>
<p>
<br />
@picture.PicDescription
</p>
<footer>
<small>
Uploader: @picture.PicUploader.Email
</small>
</footer>
</article>
</div>
}
</div>
</div>
|
mit
|
C#
|
93053203f850598e2a19eac10f94d295316215f0
|
change the env project properties
|
gaochundong/Knifer
|
Gimela.Toolkit.CommandLines.Environment/Properties/AssemblyInfo.cs
|
Gimela.Toolkit.CommandLines.Environment/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("Gimela.Toolkit.CommandLines.Environment")]
[assembly: AssemblyDescription("Gimela.Toolkit.CommandLines.Environment")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chundong Gao")]
[assembly: AssemblyProduct("Gimela Toolkit")]
[assembly: AssemblyCopyright("Copyright © 2011-2012 Chundong Gao. All rights reserved.")]
[assembly: AssemblyTrademark("Gimela")]
[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("90a22ac3-2c0b-4bf0-a4ab-afae74844840")]
// 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: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "env")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gimela", Scope = "namespace", Target = "Gimela.Toolkit.CommandLines.Environment")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")]
|
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("Gimela.Toolkit.CommandLines.Environment")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("IGT")]
[assembly: AssemblyProduct("Gimela.Toolkit.CommandLines.Environment")]
[assembly: AssemblyCopyright("Copyright © IGT 2012")]
[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("90a22ac3-2c0b-4bf0-a4ab-afae74844840")]
// 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: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "env")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gimela", Scope = "namespace", Target = "Gimela.Toolkit.CommandLines.Environment")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")]
|
mit
|
C#
|
2e246b3041af9333f9a15730faa6f4c72fb512f3
|
Handle invalid user/group IDs
|
FubarDevelopment/FtpServer
|
src/FubarDev.FtpServer.Abstractions/PermissionsExtensions.cs
|
src/FubarDev.FtpServer.Abstractions/PermissionsExtensions.cs
|
// <copyright file="PermissionsExtensions.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
using System;
using FubarDev.FtpServer.AccountManagement;
using FubarDev.FtpServer.FileSystem;
using FubarDev.FtpServer.FileSystem.Generic;
using JetBrains.Annotations;
namespace FubarDev.FtpServer
{
/// <summary>
/// Extension methods for <see cref="IUnixPermissions"/>.
/// </summary>
public static class PermissionsExtensions
{
/// <summary>
/// Gets the effective access mode for an <paramref name="entity"/> for the given <paramref name="user"/>.
/// </summary>
/// <param name="permissions">The permissions used to build the access mode.</param>
/// <param name="entity">The entity owner information.</param>
/// <param name="user">The FTP user to determine the access mode for.</param>
/// <returns>The effective access mode for the <paramref name="user"/>.</returns>
[NotNull]
public static IAccessMode GetAccessModeFor([NotNull] this IUnixPermissions permissions, [NotNull] IUnixOwner entity, [NotNull] IFtpUser user)
{
var isUser = string.Equals(entity.GetOwner(), user.Name, StringComparison.OrdinalIgnoreCase);
var group = entity.GetGroup();
var isGroup = group != null && user.IsInGroup(group);
var canRead = (isUser && permissions.User.Read)
|| (isGroup && permissions.Group.Read)
|| permissions.Other.Read;
var canWrite = (isUser && permissions.User.Write)
|| (isGroup && permissions.Group.Write)
|| permissions.Other.Write;
var canExecute = (isUser && permissions.User.Execute)
|| (isGroup && permissions.Group.Execute)
|| permissions.Other.Execute;
return new GenericAccessMode(canRead, canWrite, canExecute);
}
[CanBeNull]
private static string GetOwner([NotNull] this IUnixOwner entity)
{
try
{
return entity.Owner;
}
catch (ArgumentException)
{
return null;
}
}
[CanBeNull]
private static string GetGroup([NotNull] this IUnixOwner entity)
{
try
{
return entity.Group;
}
catch (ArgumentException)
{
return null;
}
}
}
}
|
// <copyright file="PermissionsExtensions.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
using System;
using FubarDev.FtpServer.AccountManagement;
using FubarDev.FtpServer.FileSystem;
using FubarDev.FtpServer.FileSystem.Generic;
using JetBrains.Annotations;
namespace FubarDev.FtpServer
{
/// <summary>
/// Extension methods for <see cref="IUnixPermissions"/>.
/// </summary>
public static class PermissionsExtensions
{
/// <summary>
/// Gets the effective access mode for an <paramref name="entity"/> for the given <paramref name="user"/>.
/// </summary>
/// <param name="permissions">The permissions used to build the access mode.</param>
/// <param name="entity">The entity owner information.</param>
/// <param name="user">The FTP user to determine the access mode for.</param>
/// <returns>The effective access mode for the <paramref name="user"/>.</returns>
[NotNull]
public static IAccessMode GetAccessModeFor([NotNull] this IUnixPermissions permissions, [NotNull] IUnixOwner entity, [NotNull] IFtpUser user)
{
var isUser = string.Equals(entity.Owner, user.Name, StringComparison.OrdinalIgnoreCase);
var isGroup = user.IsInGroup(entity.Group);
var canRead = (isUser && permissions.User.Read)
|| (isGroup && permissions.Group.Read)
|| permissions.Other.Read;
var canWrite = (isUser && permissions.User.Write)
|| (isGroup && permissions.Group.Write)
|| permissions.Other.Write;
var canExecute = (isUser && permissions.User.Execute)
|| (isGroup && permissions.Group.Execute)
|| permissions.Other.Execute;
return new GenericAccessMode(canRead, canWrite, canExecute);
}
}
}
|
mit
|
C#
|
47c1cc2fc0777d7cc64fdb589cfa0f20ea564e0c
|
Tweak logging on QueuedSender
|
mattgwagner/CertiPay.Common
|
CertiPay.Common.Notifications/Notifications/QueuedSender.cs
|
CertiPay.Common.Notifications/Notifications/QueuedSender.cs
|
using CertiPay.Common.Logging;
using CertiPay.Common.WorkQueue;
using System.Threading.Tasks;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Sends notifications to the background worker queue for async processing and retries
/// </summary>
public partial class QueuedSender :
INotificationSender<SMSNotification>,
INotificationSender<EmailNotification>
{
private static readonly ILog Log = LogManager.GetLogger<QueuedSender>();
private readonly IQueueManager _queue;
public QueuedSender(IQueueManager queue)
{
this._queue = queue;
}
public async Task SendAsync(EmailNotification notification)
{
using (Log.Timer("QueuedSender.SendAsync", context: notification))
{
await _queue.Enqueue(EmailNotification.QueueName, notification);
}
}
public async Task SendAsync(SMSNotification notification)
{
using (Log.Timer("QueuedSender.SendAsync", context: notification))
{
await _queue.Enqueue(SMSNotification.QueueName, notification);
}
}
}
}
|
using CertiPay.Common.Logging;
using CertiPay.Common.WorkQueue;
using System.Threading.Tasks;
namespace CertiPay.Common.Notifications
{
/// <summary>
/// Sends notifications to the background worker queue for async processing and retries
/// </summary>
public partial class QueuedSender :
INotificationSender<SMSNotification>,
INotificationSender<EmailNotification>
{
private static readonly ILog Log = LogManager.GetLogger<QueuedSender>();
private readonly IQueueManager _queue;
public QueuedSender(IQueueManager queue)
{
this._queue = queue;
}
public async Task SendAsync(EmailNotification notification)
{
Log.Info("Sending Notification via Queue {Queue}: {@Notification}", EmailNotification.QueueName, notification);
await _queue.Enqueue(EmailNotification.QueueName, notification);
}
public async Task SendAsync(SMSNotification notification)
{
Log.Info("Sending Notification via Queue {Queue}: {@Notification}", SMSNotification.QueueName, notification);
await _queue.Enqueue(SMSNotification.QueueName, notification);
}
}
}
|
mit
|
C#
|
14f070e064fc5b5541cae1c051e75923a7b97c5d
|
Update OpeningSpreadsheetMLFiles.cs
|
maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
|
Examples/CSharp/Files/Handling/OpeningSpreadsheetMLFiles.cs
|
Examples/CSharp/Files/Handling/OpeningSpreadsheetMLFiles.cs
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Files.Handling
{
public class OpeningSpreadsheetMLFiles
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Opening SpreadsheetML Files
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions3 = new LoadOptions(LoadFormat.SpreadsheetML);
//Create a Workbook object and opening the file from its path
Workbook wbSpreadSheetML = new Workbook(dataDir + "Book3.xml", loadOptions3);
Console.WriteLine("SpreadSheetML file opened successfully!");
//ExEnd:1
}
}
}
|
using System.IO;
using Aspose.Cells;
using System;
namespace Aspose.Cells.Examples.Files.Handling
{
public class OpeningSpreadsheetMLFiles
{
public static void Main(string[] args)
{
//Exstart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Opening SpreadsheetML Files
//Instantiate LoadOptions specified by the LoadFormat.
LoadOptions loadOptions3 = new LoadOptions(LoadFormat.SpreadsheetML);
//Create a Workbook object and opening the file from its path
Workbook wbSpreadSheetML = new Workbook(dataDir + "Book3.xml", loadOptions3);
Console.WriteLine("SpreadSheetML file opened successfully!");
//ExEnd:1
}
}
}
|
mit
|
C#
|
c8a755bfdea00ad8943b1b4516e1ae508fd89599
|
Add service and container clients
|
selvasingh/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,Azure/azure-sdk-for-java,selvasingh/azure-sdk-for-java,Azure/azure-sdk-for-java,selvasingh/azure-sdk-for-java
|
net/Azure.Storage.Blobs.PerfStress/Core/StorageTest.cs
|
net/Azure.Storage.Blobs.PerfStress/Core/StorageTest.cs
|
using Azure.Core.Pipeline;
using Azure.Test.PerfStress;
using System;
using System.Net.Http;
namespace Azure.Storage.Blobs.PerfStress
{
public abstract class StorageTest<TOptions> : PerfStressTest<TOptions> where TOptions: PerfStressOptions
{
private const string _containerName = "perfstress";
protected BlobServiceClient BlobServiceClient { get; private set; }
protected BlobContainerClient BlobContainerClient { get; private set; }
protected BlobClient BlobClient { get; private set; }
public StorageTest(string id, TOptions options) : base(id, options)
{
var blobName = this.GetType().Name.ToLowerInvariant() + id;
var connectionString = Environment.GetEnvironmentVariable("STORAGE_CONNECTION_STRING");
if (string.IsNullOrEmpty(connectionString))
{
throw new InvalidOperationException("Undefined environment variable STORAGE_CONNECTION_STRING");
}
var httpClientHandler = new HttpClientHandler();
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true;
var httpClient = new HttpClient(httpClientHandler);
var blobClientOptions = new BlobClientOptions();
blobClientOptions.Transport = new HttpClientTransport(httpClient);
BlobServiceClient = new BlobServiceClient(connectionString, blobClientOptions);
try
{
BlobServiceClient.CreateBlobContainer(_containerName);
}
catch (StorageRequestFailedException)
{
}
BlobContainerClient = BlobServiceClient.GetBlobContainerClient(_containerName);
BlobClient = BlobContainerClient.GetBlobClient(blobName);
}
}
}
|
using Azure.Core.Pipeline;
using Azure.Test.PerfStress;
using System;
using System.Net.Http;
namespace Azure.Storage.Blobs.PerfStress
{
public abstract class StorageTest<TOptions> : PerfStressTest<TOptions> where TOptions: PerfStressOptions
{
private const string _containerName = "perfstress";
protected BlobClient BlobClient { get; private set; }
public StorageTest(string id, TOptions options) : base(id, options)
{
var blobName = this.GetType().Name.ToLowerInvariant() + id;
var connectionString = Environment.GetEnvironmentVariable("STORAGE_CONNECTION_STRING");
if (string.IsNullOrEmpty(connectionString))
{
throw new InvalidOperationException("Undefined environment variable STORAGE_CONNECTION_STRING");
}
var httpClientHandler = new HttpClientHandler();
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true;
var httpClient = new HttpClient(httpClientHandler);
var blobClientOptions = new BlobClientOptions();
blobClientOptions.Transport = new HttpClientTransport(httpClient);
var serviceClient = new BlobServiceClient(connectionString, blobClientOptions);
try
{
serviceClient.CreateBlobContainer(_containerName);
}
catch (StorageRequestFailedException)
{
}
BlobClient = new BlobClient(connectionString, _containerName, blobName, blobClientOptions);
}
}
}
|
mit
|
C#
|
e692cd2c942c6e2cbb703afee1de86ace3c4ccd2
|
Set mixed as default system
|
DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer
|
Client/Systems/SettingsSys/SettingsStructures.cs
|
Client/Systems/SettingsSys/SettingsStructures.cs
|
using LunaClient.Systems.PlayerColorSys;
using LunaClient.Systems.Toolbar;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace LunaClient.Systems.SettingsSys
{
[Serializable]
public class SettingStructure
{
public string PlayerName { get; set; } = "Player";
public int ConnectionTries { get; set; } = 3;
public int InitialConnectionMsTimeout { get; set; } = 5000;
public int SendReceiveMsInterval { get; set; } = 5;
public int MsBetweenConnectionTries { get; set; } = 3000;
public int HearbeatMsInterval { get; set; } = 2000;
public bool DisclaimerAccepted { get; set; } = false;
public Color PlayerColor { get; set; } = PlayerColorSystem.GenerateRandomColor();
public KeyCode ChatKey { get; set; } = KeyCode.BackQuote;
public string SelectedFlag { get; set; } = "Squad/Flags/default";
public LmpToolbarType ToolbarType { get; set; } = LmpToolbarType.BlizzyIfInstalled;
public List<ServerEntry> Servers { get; set; } = new List<ServerEntry>();
public string PrivateKey { get; set; }
public string PublicKey { get; set; }
public int InitialConnectionSyncTimeRequests { get; set; } = 10;
public bool RevertEnabled { get; set; }
public bool InterpolationEnabled { get; set; } = false;
public bool CloseBtnInConnectionWindow { get; set; } = true;
public int MaxGroupsPerPlayer { get; set; } = 1;
public int PositionSystem { get; set; } = 3;
#if DEBUG
/*
* You can use this debug switches for testing purposes.
* For example do one part or the code or another in case the debugX is on/off
* NEVER upload the code with those switches in use as some other developer might need them!!!!!
*/
public bool Debug1 { get; set; } = false;
public bool Debug2 { get; set; } = false;
public bool Debug3 { get; set; } = false;
public bool Debug4 { get; set; } = false;
public bool Debug5 { get; set; } = false;
public bool Debug6 { get; set; } = false;
public bool Debug7 { get; set; } = false;
public bool Debug8 { get; set; } = false;
public bool Debug9 { get; set; } = false;
#endif
}
[Serializable]
public class ServerEntry
{
public int Port;
public string Name { get; set; }
public string Address { get; set; }
}
}
|
using LunaClient.Systems.PlayerColorSys;
using LunaClient.Systems.Toolbar;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace LunaClient.Systems.SettingsSys
{
[Serializable]
public class SettingStructure
{
public string PlayerName { get; set; } = "Player";
public int ConnectionTries { get; set; } = 3;
public int InitialConnectionMsTimeout { get; set; } = 5000;
public int SendReceiveMsInterval { get; set; } = 5;
public int MsBetweenConnectionTries { get; set; } = 3000;
public int HearbeatMsInterval { get; set; } = 2000;
public bool DisclaimerAccepted { get; set; } = false;
public Color PlayerColor { get; set; } = PlayerColorSystem.GenerateRandomColor();
public KeyCode ChatKey { get; set; } = KeyCode.BackQuote;
public string SelectedFlag { get; set; } = "Squad/Flags/default";
public LmpToolbarType ToolbarType { get; set; } = LmpToolbarType.BlizzyIfInstalled;
public List<ServerEntry> Servers { get; set; } = new List<ServerEntry>();
public string PrivateKey { get; set; }
public string PublicKey { get; set; }
public int InitialConnectionSyncTimeRequests { get; set; } = 10;
public bool RevertEnabled { get; set; }
public bool InterpolationEnabled { get; set; } = false;
public bool CloseBtnInConnectionWindow { get; set; } = true;
public int MaxGroupsPerPlayer { get; set; } = 1;
public int PositionSystem { get; set; } = 0;
#if DEBUG
/*
* You can use this debug switches for testing purposes.
* For example do one part or the code or another in case the debugX is on/off
* NEVER upload the code with those switches in use as some other developer might need them!!!!!
*/
public bool Debug1 { get; set; } = false;
public bool Debug2 { get; set; } = false;
public bool Debug3 { get; set; } = false;
public bool Debug4 { get; set; } = false;
public bool Debug5 { get; set; } = false;
public bool Debug6 { get; set; } = false;
public bool Debug7 { get; set; } = false;
public bool Debug8 { get; set; } = false;
public bool Debug9 { get; set; } = false;
#endif
}
[Serializable]
public class ServerEntry
{
public int Port;
public string Name { get; set; }
public string Address { get; set; }
}
}
|
mit
|
C#
|
8694b03ef374e88a02a1a6f627dd983390a98590
|
Update asset info
|
PhannGor/Screen-Shooter
|
Assets/ScreenShooter/Editor/Scripts/Info/AssetInfo.cs
|
Assets/ScreenShooter/Editor/Scripts/Info/AssetInfo.cs
|
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
namespace Borodar.ScreenShooter
{
public class AssetInfo
{
public const string NAME = "ScreenShooter";
public const string STORE_ID = "58659";
public const string VERSION = "1.3";
}
}
|
/*
* 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 Borodar.ScreenShooter
{
public class AssetInfo
{
public const string NAME = "ScreenShooter";
public const string STORE_ID = "58659";
public const string VERSION = "1.2";
}
}
|
apache-2.0
|
C#
|
556771bf6a1c8e4e3e67b7d41beaa296908c51b6
|
Change output to CCLog.
|
zmaruo/CocosSharp,haithemaraissia/CocosSharp,hig-ag/CocosSharp,mono/CocosSharp,mono/CocosSharp,MSylvia/CocosSharp,netonjm/CocosSharp,TukekeSoft/CocosSharp,mono/cocos2d-xna,TukekeSoft/CocosSharp,netonjm/CocosSharp,haithemaraissia/CocosSharp,hig-ag/CocosSharp,mono/cocos2d-xna,MSylvia/CocosSharp,zmaruo/CocosSharp
|
cocos2d/Win8IOExtensions.cs
|
cocos2d/Win8IOExtensions.cs
|
using System;
using System.IO;
using System.Reflection;
using System.Xml;
namespace cocos2d
{
public static class Win8IOExtensions
{
public static void Close(this Stream stream)
{
//stream.Flush();
stream.Close();
}
public static MethodInfo GetMethod(this Type type, string name)
{
return type.GetTypeInfo().GetDeclaredMethod(name);
}
public static FieldInfo GetField(this Type type, string name)
{
return type.GetTypeInfo().GetDeclaredField(name);
}
public static AssemblyName GetAssemblyName(this Type type)
{
return type.GetTypeInfo().Assembly.GetName();
}
public static void Close(this XmlWriter writer)
{
//writer.Flush();
writer.Dispose();
}
}
}
|
using System;
using System.IO;
using System.Reflection;
using System.Xml;
namespace cocos2d
{
public static class Win8IOExtensions
{
public static void Close(this Stream stream)
{
stream.Flush();
stream.Close();
}
public static MethodInfo GetMethod(this Type type, string name)
{
return type.GetTypeInfo().GetDeclaredMethod(name);
}
public static FieldInfo GetField(this Type type, string name)
{
return type.GetTypeInfo().GetDeclaredField(name);
}
public static AssemblyName GetAssemblyName(this Type type)
{
return type.GetTypeInfo().Assembly.GetName();
}
public static void Close(this XmlWriter writer)
{
writer.Flush();
writer.Dispose();
}
}
}
namespace System {
public class Console {
public static void WriteLine(string message) {
System.Diagnostics.Debug.WriteLine(message);
}
public static void WriteLine(string message, params object[] args){
System.Diagnostics.Debug.WriteLine(message, args);
}
}
}
|
mit
|
C#
|
4880da70f94f24b3104db881e755829e92c23174
|
Fix #125
|
tfsaggregator/tfsaggregator-webhooks,tfsaggregator/tfsaggregator
|
Aggregator.Core/Extensions/InvalidValueFieldValueValidator.cs
|
Aggregator.Core/Extensions/InvalidValueFieldValueValidator.cs
|
using System.Collections;
using Aggregator.Core.Context;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace Aggregator.Core.Extensions
{
internal class InvalidValueFieldValueValidator : BaseFieldValueValidator
{
internal InvalidValueFieldValueValidator(IRuntimeContext context)
: base(context)
{
}
public override bool ValidateFieldValue(Field field, object value)
{
if (value != null && field.IsLimitedToAllowedValues)
{
bool valid = true;
bool hasAllowedvalues = field.HasAllowedValuesList;
#if TFS2015 || TFS2015u1
bool isIdentity = field.FieldDefinition.IsIdentity;
#else
bool isIdentity = false;
#endif
if (hasAllowedvalues && !isIdentity)
{
valid &= ((IList)field.FieldDefinition.AllowedValues).Contains(value);
}
#if TFS2015 || TFS2015u1
else if (hasAllowedvalues && isIdentity)
{
valid &= ((IList)field.FieldDefinition.IdentityFieldAllowedValues).Contains(value);
}
#endif
if (!valid)
{
this.Logger.FieldValidationFailedValueNotAllowed(
field.WorkItem.Id,
field.ReferenceName,
value);
return false;
}
}
return true;
}
}
}
|
using System.Collections;
using Aggregator.Core.Context;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace Aggregator.Core.Extensions
{
internal class InvalidValueFieldValueValidator : BaseFieldValueValidator
{
internal InvalidValueFieldValueValidator(IRuntimeContext context)
: base(context)
{
}
public override bool ValidateFieldValue(Field field, object value)
{
if (value != null && field.IsLimitedToAllowedValues)
{
bool valid = true;
bool hasAllowedvalues = field.HasAllowedValuesList;
#if TFS2015 || TFS2015u1
bool isIdentity = field.FieldDefinition.IsIdentity;
#else
bool isIdentity = false;
#endif
if (hasAllowedvalues && !isIdentity)
{
valid &= ((IList)field.FieldDefinition.AllowedValues).Contains(value);
}
#if TFS2015 || TFS2015u1
else if (hasAllowedvalues && isIdentity)
{
valid &= ((IList)field.FieldDefinition.IdentityFieldAllowedValues).Contains(value);
}
#endif
if (valid)
{
this.Logger.FieldValidationFailedValueNotAllowed(
field.WorkItem.Id,
field.ReferenceName,
value);
return false;
}
}
return true;
}
}
}
|
apache-2.0
|
C#
|
cdedff88fcd70f98a3f0820aad19a75f366b7be5
|
Fix annoying bug with hidden manga actions.
|
MonkAlex/MangaReader
|
MangaReader.Avalonia/ViewModel/Command/BaseCommand.cs
|
MangaReader.Avalonia/ViewModel/Command/BaseCommand.cs
|
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia.Threading;
using MangaReader.Core.Services;
namespace MangaReader.Avalonia.ViewModel.Command
{
public abstract class BaseCommand : ICommand, INotifyPropertyChanged
{
private string name;
private string icon;
private bool isVisible = true;
public string Name
{
get { return name; }
set
{
name = value;
OnPropertyChanged();
}
}
public string Icon
{
get { return icon; }
set
{
icon = value;
OnPropertyChanged();
}
}
public bool IsVisible
{
get { return isVisible; }
set
{
isVisible = value;
OnPropertyChanged();
}
}
bool ICommand.CanExecute(object parameter)
{
var canExecute = this.CanExecute(parameter);
IsVisible = canExecute;
return canExecute;
}
async void ICommand.Execute(object parameter)
{
var commandName = Name ?? GetType().Name;
Log.Add($"Command '{commandName}' started.");
await Execute(parameter).ConfigureAwait(true);
}
public virtual bool CanExecute(object parameter)
{
return true;
}
public abstract Task Execute(object parameter);
public event EventHandler CanExecuteChanged;
public virtual void OnCanExecuteChanged()
{
void InvokeCanExecuteChanged()
{
//HACK: if button deattach from logical tree when isvisible = false, button not attach on next show.
// Not attach -> not subscribe to CanExecuteChanged.
if (CanExecuteChanged == null && !IsVisible)
IsVisible = true;
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
if (Dispatcher.UIThread.CheckAccess())
InvokeCanExecuteChanged();
else
Dispatcher.UIThread.InvokeAsync(InvokeCanExecuteChanged);
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia.Threading;
using MangaReader.Core.Services;
namespace MangaReader.Avalonia.ViewModel.Command
{
public abstract class BaseCommand : ICommand, INotifyPropertyChanged
{
private string name;
private string icon;
private bool isVisible = true;
public string Name
{
get { return name; }
set
{
name = value;
OnPropertyChanged();
}
}
public string Icon
{
get { return icon; }
set
{
icon = value;
OnPropertyChanged();
}
}
public bool IsVisible
{
get { return isVisible; }
set
{
isVisible = value;
OnPropertyChanged();
}
}
bool ICommand.CanExecute(object parameter)
{
var canExecute = this.CanExecute(parameter);
IsVisible = canExecute;
return canExecute;
}
async void ICommand.Execute(object parameter)
{
var commandName = Name ?? GetType().Name;
Log.Add($"Command '{commandName}' started.");
await Execute(parameter).ConfigureAwait(true);
}
public virtual bool CanExecute(object parameter)
{
return true;
}
public abstract Task Execute(object parameter);
public event EventHandler CanExecuteChanged;
public virtual void OnCanExecuteChanged()
{
if (Dispatcher.UIThread.CheckAccess())
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
else
Dispatcher.UIThread.InvokeAsync(() => CanExecuteChanged?.Invoke(this, EventArgs.Empty));
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
|
mit
|
C#
|
69a7d488faaa38fe373fa6bb610bbf0eac70a6b1
|
Test Major/Minor versions - Commit 2
|
ravi-msi/practicegit,ravi-msi/practicegit,ravi-msi/practicegit
|
PracticeGit/PracticeGit/Controllers/HomeController.cs
|
PracticeGit/PracticeGit/Controllers/HomeController.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
// ADDED FIRST LINE
// ADDED SECOND LINE
namespace PracticeGit.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Title = "Home Page";
return View();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
// ADDED FIRST LINE
namespace PracticeGit.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Title = "Home Page";
return View();
}
}
}
|
mit
|
C#
|
9e4f3f9edf3463399c99fa910333a52d319d5bcf
|
Fix "Picture Slideshow" "Maximum File Size" default value
|
danielchalmers/DesktopWidgets
|
DesktopWidgets/Widgets/PictureSlideshow/Settings.cs
|
DesktopWidgets/Widgets/PictureSlideshow/Settings.cs
|
using System;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.PictureSlideshow
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Width = 384;
Height = 216;
}
[Category("General")]
[DisplayName("Image Folder Path")]
public string RootPath { get; set; }
[Category("General")]
[DisplayName("Maximum File Size (bytes)")]
public double FileFilterSize { get; set; } = 1048576;
[Category("General")]
[DisplayName("Next Image Interval")]
public TimeSpan ChangeInterval { get; set; } = TimeSpan.FromSeconds(15);
[Category("General")]
[DisplayName("Shuffle")]
public bool Shuffle { get; set; } = true;
[Category("General")]
[DisplayName("Recursive")]
public bool Recursive { get; set; } = false;
[Category("General")]
[DisplayName("Current Image Path")]
public string ImageUrl { get; set; }
[Category("General")]
[DisplayName("Allow Dropping Images")]
public bool AllowDropFiles { get; set; } = true;
[Category("General")]
[DisplayName("Freeze")]
public bool Freeze { get; set; }
}
}
|
using System;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;
namespace DesktopWidgets.Widgets.PictureSlideshow
{
public class Settings : WidgetSettingsBase
{
public Settings()
{
Width = 384;
Height = 216;
}
[Category("General")]
[DisplayName("Image Folder Path")]
public string RootPath { get; set; }
[Category("General")]
[DisplayName("Maximum File Size (bytes)")]
public double FileFilterSize { get; set; } = 1024000;
[Category("General")]
[DisplayName("Next Image Interval")]
public TimeSpan ChangeInterval { get; set; } = TimeSpan.FromSeconds(15);
[Category("General")]
[DisplayName("Shuffle")]
public bool Shuffle { get; set; } = true;
[Category("General")]
[DisplayName("Recursive")]
public bool Recursive { get; set; } = false;
[Category("General")]
[DisplayName("Current Image Path")]
public string ImageUrl { get; set; }
[Category("General")]
[DisplayName("Allow Dropping Images")]
public bool AllowDropFiles { get; set; } = true;
[Category("General")]
[DisplayName("Freeze")]
public bool Freeze { get; set; }
}
}
|
apache-2.0
|
C#
|
a8b5218234d6a42df951b96c2103f98ca76d9f1d
|
Add failing test
|
ParticularLabs/GitVersion,ermshiperete/GitVersion,ermshiperete/GitVersion,asbjornu/GitVersion,asbjornu/GitVersion,ermshiperete/GitVersion,ermshiperete/GitVersion,gep13/GitVersion,GitTools/GitVersion,gep13/GitVersion,ParticularLabs/GitVersion,GitTools/GitVersion
|
src/GitVersionCore.Tests/IntegrationTests/TagCheckoutScenarios.cs
|
src/GitVersionCore.Tests/IntegrationTests/TagCheckoutScenarios.cs
|
using GitTools.Testing;
using NUnit.Framework;
namespace GitVersionCore.Tests.IntegrationTests
{
[TestFixture]
public class TagCheckoutScenarios
{
[Test]
public void GivenARepositoryWithSingleCommit()
{
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
fixture.AssertFullSemver(taggedVersion);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranch()
{
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.BranchTo("task1");
fixture.Checkout(taggedVersion);
fixture.AssertFullSemver(taggedVersion);
}
[Test]
public void GivenARepositoryWithTwoTagsAndADevelopBranch()
{
using var fixture = new EmptyRepositoryFixture();
const string firstVersion = "1.0";
const string hotfixVersion = "1.0.1";
fixture.MakeACommit("init master");
fixture.ApplyTag(firstVersion);
fixture.MakeACommit("hotfix");
fixture.ApplyTag(hotfixVersion);
fixture.BranchTo("develop");
fixture.MakeACommit("new feature");
fixture.Checkout(hotfixVersion);
fixture.BranchTo("tags/1.0.1");
fixture.AssertFullSemver(hotfixVersion);
}
}
}
|
using GitTools.Testing;
using NUnit.Framework;
namespace GitVersionCore.Tests.IntegrationTests
{
[TestFixture]
public class TagCheckoutScenarios
{
[Test]
public void GivenARepositoryWithSingleCommit()
{
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
fixture.AssertFullSemver(taggedVersion);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranch()
{
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.BranchTo("task1");
fixture.Checkout(taggedVersion);
fixture.AssertFullSemver(taggedVersion);
}
}
}
|
mit
|
C#
|
fd9fc2faca3cf7020d08da329610ac38bda63102
|
Add missing object mapping configuration.
|
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Roles/Dto/RoleMapProfile.cs
|
aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Roles/Dto/RoleMapProfile.cs
|
using System.Linq;
using AutoMapper;
using Abp.Authorization;
using Abp.Authorization.Roles;
using AbpCompanyName.AbpProjectName.Authorization.Roles;
namespace AbpCompanyName.AbpProjectName.Roles.Dto
{
public class RoleMapProfile : Profile
{
public RoleMapProfile()
{
// Role and permission
CreateMap<Permission, string>().ConvertUsing(r => r.Name);
CreateMap<RolePermissionSetting, string>().ConvertUsing(r => r.Name);
CreateMap<CreateRoleDto, Role>();
CreateMap<RoleDto, Role>();
CreateMap<Role, RoleDto>().ForMember(x => x.GrantedPermissions,
opt => opt.MapFrom(x => x.Permissions.Where(p => p.IsGranted)));
CreateMap<Role, RoleListDto>();
CreateMap<Role, RoleEditDto>();
CreateMap<Permission, FlatPermissionDto>();
}
}
}
|
using System.Linq;
using AutoMapper;
using Abp.Authorization;
using Abp.Authorization.Roles;
using AbpCompanyName.AbpProjectName.Authorization.Roles;
namespace AbpCompanyName.AbpProjectName.Roles.Dto
{
public class RoleMapProfile : Profile
{
public RoleMapProfile()
{
// Role and permission
CreateMap<Permission, string>().ConvertUsing(r => r.Name);
CreateMap<RolePermissionSetting, string>().ConvertUsing(r => r.Name);
CreateMap<CreateRoleDto, Role>();
CreateMap<RoleDto, Role>();
CreateMap<Role, RoleDto>().ForMember(x => x.GrantedPermissions,
opt => opt.MapFrom(x => x.Permissions.Where(p => p.IsGranted)));
}
}
}
|
mit
|
C#
|
b17809759f360453c975056472c71cbdc0c0cd48
|
Remove redundant qualifier.
|
naoey/osu-framework,peppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,default0/osu-framework,EVAST9919/osu-framework,paparony03/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,ppy/osu-framework,naoey/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,RedNesto/osu-framework,paparony03/osu-framework,RedNesto/osu-framework
|
osu.Framework.Desktop/Platform/Linux/LinuxClipboard.cs
|
osu.Framework.Desktop/Platform/Linux/LinuxClipboard.cs
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Windows.Forms;
namespace osu.Framework.Desktop.Platform.Linux
{
public class LinuxClipboard : Framework.Platform.Clipboard
{
public override string GetText()
{
return Clipboard.GetText(TextDataFormat.UnicodeText);
}
public override void SetText(string selectedText)
{
//Clipboard.SetText(selectedText);
//This works within osu but will hang any application you try to paste to afterwards until osu is closed.
//Likely requires the use of X libraries directly to fix
}
}
}
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Windows.Forms;
namespace osu.Framework.Desktop.Platform.Linux
{
public class LinuxClipboard : osu.Framework.Platform.Clipboard
{
public override string GetText()
{
return Clipboard.GetText(TextDataFormat.UnicodeText);
}
public override void SetText(string selectedText)
{
//Clipboard.SetText(selectedText);
//This works within osu but will hang any application you try to paste to afterwards until osu is closed.
//Likely requires the use of X libraries directly to fix
}
}
}
|
mit
|
C#
|
5b4433bf2e1161ea56add2007448f945836864a4
|
Add menu item to create AOT configuration
|
jacobdufault/fullserializer,jacobdufault/fullserializer,jacobdufault/fullserializer
|
Assets/FullSerializer/Source/Aot/fsAotConfiguration.cs
|
Assets/FullSerializer/Source/Aot/fsAotConfiguration.cs
|
#if !NO_UNITY
using System;
using System.Collections.Generic;
using UnityEngine;
namespace FullSerializer {
[CreateAssetMenu(menuName = "Full Serializer AOT Configuration")]
public class fsAotConfiguration : ScriptableObject {
public enum AotState {
Default, Enabled, Disabled
}
[Serializable]
public struct Entry {
public AotState State;
public string FullTypeName;
public Entry(Type type) {
FullTypeName = type.FullName;
State = AotState.Default;
}
public Entry(Type type, AotState state) {
FullTypeName = type.FullName;
State = state;
}
}
public List<Entry> aotTypes = new List<Entry>();
public string outputDirectory = "Assets/AotModels";
public bool TryFindEntry(Type type, out Entry result) {
string searchFor = type.FullName;
foreach (Entry entry in aotTypes) {
if (entry.FullTypeName == searchFor) {
result = entry;
return true;
}
}
result = default(Entry);
return false;
}
public void UpdateOrAddEntry(Entry entry) {
for (int i = 0; i < aotTypes.Count; ++i) {
if (aotTypes[i].FullTypeName == entry.FullTypeName) {
aotTypes[i] = entry;
return;
}
}
aotTypes.Add(entry);
}
}
}
#endif
|
#if !NO_UNITY
using System;
using System.Collections.Generic;
using UnityEngine;
namespace FullSerializer {
public class fsAotConfiguration : ScriptableObject {
public enum AotState {
Default, Enabled, Disabled
}
[Serializable]
public struct Entry {
public AotState State;
public string FullTypeName;
public Entry(Type type) {
FullTypeName = type.FullName;
State = AotState.Default;
}
public Entry(Type type, AotState state) {
FullTypeName = type.FullName;
State = state;
}
}
public List<Entry> aotTypes = new List<Entry>();
public string outputDirectory = "Assets/AotModels";
public bool TryFindEntry(Type type, out Entry result) {
string searchFor = type.FullName;
foreach (Entry entry in aotTypes) {
if (entry.FullTypeName == searchFor) {
result = entry;
return true;
}
}
result = default(Entry);
return false;
}
public void UpdateOrAddEntry(Entry entry) {
for (int i = 0; i < aotTypes.Count; ++i) {
if (aotTypes[i].FullTypeName == entry.FullTypeName) {
aotTypes[i] = entry;
return;
}
}
aotTypes.Add(entry);
}
}
}
#endif
|
mit
|
C#
|
79bea8b4402dc9ecad20d6a01cc2dfadf8e9af04
|
Update umbracoUser2NodeNotify in SuperZero migration
|
robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,madsoulswe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,leekelleher/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,bjarnef/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,leekelleher/Umbraco-CMS,NikRimington/Umbraco-CMS,umbraco/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,leekelleher/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mattbrailsford/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,leekelleher/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,arknu/Umbraco-CMS,madsoulswe/Umbraco-CMS,arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,marcemarc/Umbraco-CMS
|
src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/SuperZero.cs
|
src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/SuperZero.cs
|
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class SuperZero : MigrationBase
{
public SuperZero(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
var exists = Database.Fetch<int>("select id from umbracoUser where id=-1;").Count > 0;
if (exists) return;
Database.Execute("update umbracoUser set userLogin = userLogin + '__' where id=0");
Database.Execute("set identity_insert umbracoUser on;");
Database.Execute(@"
insert into umbracoUser (id,
userDisabled, userNoConsole, userName, userLogin, userPassword, passwordConfig,
userEmail, userLanguage, securityStampToken, failedLoginAttempts, lastLockoutDate,
lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate,
createDate, updateDate, avatar, tourData)
select
-1 id,
userDisabled, userNoConsole, userName, substring(userLogin, 1, len(userLogin) - 2) userLogin, userPassword, passwordConfig,
userEmail, userLanguage, securityStampToken, failedLoginAttempts, lastLockoutDate,
lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate,
createDate, updateDate, avatar, tourData
from umbracoUser where id=0;");
Database.Execute("set identity_insert umbracoUser off;");
Database.Execute("update umbracoUser2UserGroup set userId=-1 where userId=0;");
Database.Execute("update umbracoUser2NodeNotify set userId=-1 where userId=0;");
Database.Execute("update umbracoNode set nodeUser=-1 where nodeUser=0;");
Database.Execute("update umbracoUserLogin set userId=-1 where userId=0;");
Database.Execute($"update {Constants.DatabaseSchema.Tables.ContentVersion} set userId=-1 where userId=0;");
Database.Execute("delete from umbracoUser where id=0;");
}
}
}
|
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0
{
public class SuperZero : MigrationBase
{
public SuperZero(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
var exists = Database.Fetch<int>("select id from umbracoUser where id=-1;").Count > 0;
if (exists) return;
Database.Execute("update umbracoUser set userLogin = userLogin + '__' where id=0");
Database.Execute("set identity_insert umbracoUser on;");
Database.Execute(@"
insert into umbracoUser (id,
userDisabled, userNoConsole, userName, userLogin, userPassword, passwordConfig,
userEmail, userLanguage, securityStampToken, failedLoginAttempts, lastLockoutDate,
lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate,
createDate, updateDate, avatar, tourData)
select
-1 id,
userDisabled, userNoConsole, userName, substring(userLogin, 1, len(userLogin) - 2) userLogin, userPassword, passwordConfig,
userEmail, userLanguage, securityStampToken, failedLoginAttempts, lastLockoutDate,
lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate,
createDate, updateDate, avatar, tourData
from umbracoUser where id=0;");
Database.Execute("set identity_insert umbracoUser off;");
Database.Execute("update umbracoUser2UserGroup set userId=-1 where userId=0;");
Database.Execute("update umbracoNode set nodeUser=-1 where nodeUser=0;");
Database.Execute("update umbracoUserLogin set userId=-1 where userId=0;");
Database.Execute($"update {Constants.DatabaseSchema.Tables.ContentVersion} set userId=-1 where userId=0;");
Database.Execute("delete from umbracoUser where id=0;");
}
}
}
|
mit
|
C#
|
bf0dea45e3bd5c49ec19035182ea99330b418e2d
|
transform "Local variable not part of this frame's method" into an EvaluatorException
|
mono/debugger-libs,Unity-Technologies/debugger-libs,joj/debugger-libs,joj/debugger-libs,Unity-Technologies/debugger-libs,mono/debugger-libs
|
Mono.Debugging.Soft/VariableValueReference.cs
|
Mono.Debugging.Soft/VariableValueReference.cs
|
//
// VariableValueReference.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using Mono.Debugging.Evaluation;
using Mono.Debugging.Client;
using Mono.Debugger.Soft;
namespace Mono.Debugging.Soft
{
public class VariableValueReference : ValueReference
{
string name;
LocalVariable variable;
public VariableValueReference (EvaluationContext ctx, string name, LocalVariable variable): base (ctx)
{
this.name = name;
this.variable = variable;
}
public override ObjectValueFlags Flags {
get {
return ObjectValueFlags.Variable;
}
}
public override string Name {
get {
return name;
}
}
public override object Type {
get {
return variable.Type;
}
}
public override object Value {
get {
SoftEvaluationContext ctx = (SoftEvaluationContext) Context;
try {
var value = ctx.Frame.GetValue (variable);
if (variable.Type.IsPointer) {
long addr = (long) ((PrimitiveValue) value).Value;
value = new PointerValue (value.VirtualMachine, variable.Type, addr);
}
return value;
} catch (AbsentInformationException) {
throw new EvaluatorException ("Value not available");
} catch (ArgumentException ex) {
throw new EvaluatorException (ex.Message);
}
}
set {
SoftEvaluationContext ctx = (SoftEvaluationContext) Context;
ctx.Frame.SetValue (variable, (Value) value);
}
}
}
}
|
//
// VariableValueReference.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections.Generic;
using Mono.Debugging.Evaluation;
using Mono.Debugging.Client;
using Mono.Debugger.Soft;
namespace Mono.Debugging.Soft
{
public class VariableValueReference : ValueReference
{
string name;
LocalVariable variable;
public VariableValueReference (EvaluationContext ctx, string name, LocalVariable variable): base (ctx)
{
this.name = name;
this.variable = variable;
}
public override ObjectValueFlags Flags {
get {
return ObjectValueFlags.Variable;
}
}
public override string Name {
get {
return name;
}
}
public override object Type {
get {
return variable.Type;
}
}
public override object Value {
get {
SoftEvaluationContext ctx = (SoftEvaluationContext) Context;
try {
var value = ctx.Frame.GetValue (variable);
if (variable.Type.IsPointer) {
long addr = (long) ((PrimitiveValue) value).Value;
value = new PointerValue (value.VirtualMachine, variable.Type, addr);
}
return value;
} catch (AbsentInformationException) {
throw new EvaluatorException ("Value not available");
}
}
set {
SoftEvaluationContext ctx = (SoftEvaluationContext) Context;
ctx.Frame.SetValue (variable, (Value) value);
}
}
}
}
|
mit
|
C#
|
89f8fec4f26e0b200a978ac5f9154be905ab3cf5
|
Bring iOS prototype inline with Android for errors
|
moljac/Xamarin.Mobile,xamarin/Xamarin.Mobile,xamarin/Xamarin.Mobile,haithemaraissia/Xamarin.Mobile,nexussays/Xamarin.Mobile,orand/Xamarin.Mobile
|
MonoTouch/MonoMobile.Extensions/GeolocationSingleUpdateDelegate.cs
|
MonoTouch/MonoMobile.Extensions/GeolocationSingleUpdateDelegate.cs
|
using System;
using MonoTouch.CoreLocation;
using System.Threading.Tasks;
namespace MonoMobile.Extensions
{
internal class GeolocationSingleUpdateDelegate
: CLLocationManagerDelegate
{
public GeolocationSingleUpdateDelegate (CLLocationManager manager)
{
this.locations = manager;
this.tcs = new TaskCompletionSource<Position> (manager);
}
public Task<Position> Task
{
get { return this.tcs.Task; }
}
public override void AuthorizationChanged (CLLocationManager manager, CLAuthorizationStatus status)
{
// BUG: If user has services disables, but goes and reenables them fromt he prompt, this still cancels
if (status == CLAuthorizationStatus.Denied || status == CLAuthorizationStatus.Restricted)
this.tcs.TrySetCanceled();
}
public override void Failed (CLLocationManager manager, MonoTouch.Foundation.NSError error)
{
this.tcs.TrySetCanceled();
//this.tcs.TrySetException (new GeolocationException (error.Domain + ": " + (CLError)error.Code));
}
public override void MonitoringFailed (CLLocationManager manager, CLRegion region, MonoTouch.Foundation.NSError error)
{
this.tcs.TrySetCanceled();
//this.tcs.TrySetException (new GeolocationException (error.Domain + ": " + (CLError)error.Code));
}
public override void UpdatedLocation (CLLocationManager manager, CLLocation newLocation, CLLocation oldLocation)
{
this.locations.StopUpdatingLocation();
this.position.Altitude = this.locations.Location.Altitude;
this.position.Latitude = this.locations.Location.Coordinate.Latitude;
this.position.Longitude = this.locations.Location.Coordinate.Longitude;
this.position.Speed = this.locations.Location.Speed;
this.haveLocation = true;
if (!CLLocationManager.HeadingAvailable || this.haveHeading)
this.tcs.TrySetResult (this.position);
}
public override void UpdatedHeading (CLLocationManager manager, CLHeading newHeading)
{
this.locations.StopUpdatingHeading();
this.position.Heading = newHeading.TrueHeading;
this.haveHeading = true;
if (this.haveLocation)
this.tcs.TrySetResult (this.position);
}
private bool haveLocation;
private bool haveHeading;
private readonly Position position = new Position();
private readonly TaskCompletionSource<Position> tcs;
private readonly CLLocationManager locations;
}
}
|
using System;
using MonoTouch.CoreLocation;
using System.Threading.Tasks;
namespace MonoMobile.Extensions
{
internal class GeolocationSingleUpdateDelegate
: CLLocationManagerDelegate
{
public GeolocationSingleUpdateDelegate (CLLocationManager manager)
{
this.locations = manager;
this.tcs = new TaskCompletionSource<Position> (manager);
}
public Task<Position> Task
{
get { return this.tcs.Task; }
}
public override void AuthorizationChanged (CLLocationManager manager, CLAuthorizationStatus status)
{
// BUG: If user has services disables, but goes and reenables them fromt he prompt, this still cancels
if (status == CLAuthorizationStatus.Denied || status == CLAuthorizationStatus.Restricted)
this.tcs.TrySetCanceled();
}
public override void Failed (CLLocationManager manager, MonoTouch.Foundation.NSError error)
{
this.tcs.TrySetException (new GeolocationException (error.Domain + ": " + (CLError)error.Code));
}
public override void MonitoringFailed (CLLocationManager manager, CLRegion region, MonoTouch.Foundation.NSError error)
{
this.tcs.TrySetException (new GeolocationException (error.Domain + ": " + (CLError)error.Code));
}
public override void UpdatedLocation (CLLocationManager manager, CLLocation newLocation, CLLocation oldLocation)
{
this.locations.StopUpdatingLocation();
this.position.Altitude = this.locations.Location.Altitude;
this.position.Latitude = this.locations.Location.Coordinate.Latitude;
this.position.Longitude = this.locations.Location.Coordinate.Longitude;
this.position.Speed = this.locations.Location.Speed;
this.haveLocation = true;
if (!CLLocationManager.HeadingAvailable || this.haveHeading)
this.tcs.TrySetResult (this.position);
}
public override void UpdatedHeading (CLLocationManager manager, CLHeading newHeading)
{
this.locations.StopUpdatingHeading();
this.position.Heading = newHeading.TrueHeading;
this.haveHeading = true;
if (this.haveLocation)
this.tcs.TrySetResult (this.position);
}
private bool haveLocation;
private bool haveHeading;
private readonly Position position = new Position();
private readonly TaskCompletionSource<Position> tcs;
private readonly CLLocationManager locations;
}
}
|
apache-2.0
|
C#
|
6bcb5670ad7f114caf83b53a39b9961b7145e36b
|
Add migration comment
|
ronaldme/Watcher,ronaldme/Watcher,ronaldme/Watcher
|
Watcher.DAL/WatcherDbContext.cs
|
Watcher.DAL/WatcherDbContext.cs
|
using Microsoft.EntityFrameworkCore;
using Watcher.DAL.Entities;
namespace Watcher.DAL
{
/// <summary>
/// Add-Migration NAME -StartupProject Watcher.Service -Project Watcher.DAL
/// </summary>
public class WatcherDbContext : DbContext
{
public virtual DbSet<Person> Persons { get; set; }
public virtual DbSet<Movie> Movies { get; set; }
public virtual DbSet<Show> Shows { get; set; }
public virtual DbSet<User> Users { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserMovie>().HasKey(bc => new { bc.UserId, bc.MovieId });
modelBuilder.Entity<UserMovie>()
.HasOne(bc => bc.User)
.WithMany(b => b.UserMovies)
.HasForeignKey(bc => bc.UserId);
modelBuilder.Entity<UserMovie>()
.HasOne(bc => bc.Movie)
.WithMany(c => c.UserMovies)
.HasForeignKey(bc => bc.MovieId);
modelBuilder.Entity<UserShow>().HasKey(bc => new { bc.UserId, bc.ShowId });
modelBuilder.Entity<UserShow>()
.HasOne(bc => bc.User)
.WithMany(b => b.UserShows)
.HasForeignKey(bc => bc.UserId);
modelBuilder.Entity<UserShow>()
.HasOne(bc => bc.Show)
.WithMany(c => c.UserShows)
.HasForeignKey(bc => bc.ShowId);
modelBuilder.Entity<UserPerson>().HasKey(bc => new { bc.UserId, bc.PersonId });
modelBuilder.Entity<UserPerson>()
.HasOne(bc => bc.User)
.WithMany(b => b.UserPersons)
.HasForeignKey(bc => bc.UserId);
modelBuilder.Entity<UserPerson>()
.HasOne(bc => bc.Person)
.WithMany(c => c.UserPersons)
.HasForeignKey(bc => bc.PersonId);
}
}
}
|
using Microsoft.EntityFrameworkCore;
using Watcher.DAL.Entities;
namespace Watcher.DAL
{
public class WatcherDbContext : DbContext
{
public virtual DbSet<Person> Persons { get; set; }
public virtual DbSet<Movie> Movies { get; set; }
public virtual DbSet<Show> Shows { get; set; }
public virtual DbSet<User> Users { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserMovie>().HasKey(bc => new { bc.UserId, bc.MovieId });
modelBuilder.Entity<UserMovie>()
.HasOne(bc => bc.User)
.WithMany(b => b.UserMovies)
.HasForeignKey(bc => bc.UserId);
modelBuilder.Entity<UserMovie>()
.HasOne(bc => bc.Movie)
.WithMany(c => c.UserMovies)
.HasForeignKey(bc => bc.MovieId);
modelBuilder.Entity<UserShow>().HasKey(bc => new { bc.UserId, bc.ShowId });
modelBuilder.Entity<UserShow>()
.HasOne(bc => bc.User)
.WithMany(b => b.UserShows)
.HasForeignKey(bc => bc.UserId);
modelBuilder.Entity<UserShow>()
.HasOne(bc => bc.Show)
.WithMany(c => c.UserShows)
.HasForeignKey(bc => bc.ShowId);
modelBuilder.Entity<UserPerson>().HasKey(bc => new { bc.UserId, bc.PersonId });
modelBuilder.Entity<UserPerson>()
.HasOne(bc => bc.User)
.WithMany(b => b.UserPersons)
.HasForeignKey(bc => bc.UserId);
modelBuilder.Entity<UserPerson>()
.HasOne(bc => bc.Person)
.WithMany(c => c.UserPersons)
.HasForeignKey(bc => bc.PersonId);
}
}
}
|
mit
|
C#
|
266ba5535e6e5900a9451de5f40aa1eba4289c35
|
add Format to PredictSimpleResult
|
MehdyKarimpour/extensions,MehdyKarimpour/extensions,signumsoftware/framework,AlejandroCano/extensions,signumsoftware/extensions,signumsoftware/extensions,AlejandroCano/extensions,signumsoftware/framework
|
Signum.Entities.Extensions/MachineLearning/PredictSimpleResults.cs
|
Signum.Entities.Extensions/MachineLearning/PredictSimpleResults.cs
|
using Signum.Entities;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Entities.MachineLearning
{
[Serializable, EntityKind(EntityKind.System, EntityData.Transactional)]
public class PredictSimpleResultEntity : Entity
{
[NotNullable]
[NotNullValidator]
public Lite<PredictorEntity> Predictor { get; internal set; }
[ImplementedByAll]
public Lite<Entity> Target { get; set; }
[SqlDbType(Size = 100)]
[StringLengthValidator(AllowNulls = true, Max = 100)]
public string Key0 { get; set; }
[SqlDbType(Size = 100)]
[StringLengthValidator(AllowNulls = true, Max = 100)]
public string Key1 { get; set; }
[SqlDbType(Size = 100)]
[StringLengthValidator(AllowNulls = true, Max = 100)]
public string Key2 { get; set; }
public PredictionSet Type { get; set; }
[SqlDbType(Size = 200)]
[StringLengthValidator(AllowNulls = true, Max = 200)]
public string OriginalCategory { get; set; }
[Format("0.0000")]
public double? OriginalValue { get; set; }
[SqlDbType(Size = 200)]
[StringLengthValidator(AllowNulls = true, Max = 200)]
public string PredictedCategory { get; set; }
[Format("0.0000")]
public double? PredictedValue { get; set; }
}
public enum PredictionSet
{
Validation,
Training
}
}
|
using Signum.Entities;
using Signum.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Signum.Entities.MachineLearning
{
[Serializable, EntityKind(EntityKind.System, EntityData.Transactional)]
public class PredictSimpleResultEntity : Entity
{
[NotNullable]
[NotNullValidator]
public Lite<PredictorEntity> Predictor { get; internal set; }
[ImplementedByAll]
public Lite<Entity> Target { get; set; }
[SqlDbType(Size = 100)]
[StringLengthValidator(AllowNulls = true, Max = 100)]
public string Key0 { get; set; }
[SqlDbType(Size = 100)]
[StringLengthValidator(AllowNulls = true, Max = 100)]
public string Key1 { get; set; }
[SqlDbType(Size = 100)]
[StringLengthValidator(AllowNulls = true, Max = 100)]
public string Key2 { get; set; }
public PredictionSet Type { get; set; }
[SqlDbType(Size = 200)]
[StringLengthValidator(AllowNulls = true, Max = 200)]
public string OriginalCategory { get; set; }
public double? OriginalValue { get; set; }
[SqlDbType(Size = 200)]
[StringLengthValidator(AllowNulls = true, Max = 200)]
public string PredictedCategory { get; set; }
public double? PredictedValue { get; set; }
}
public enum PredictionSet
{
Validation,
Training
}
}
|
mit
|
C#
|
2f3dcf3ad17aa55bb5293209f1e30edb91b7b369
|
Fix CallRouterResolver threadsafety issue
|
jbialobr/NSubstitute,jbialobr/NSubstitute,jbialobr/NSubstitute,jbialobr/NSubstitute,jbialobr/NSubstitute
|
Source/NSubstitute/Core/CallRouterResolver.cs
|
Source/NSubstitute/Core/CallRouterResolver.cs
|
using System;
#if NET4
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
using NSubstitute.Exceptions;
namespace NSubstitute.Core
{
public class CallRouterResolver : ICallRouterResolver
{
#if NET4
IDictionary<object, ICallRouter> _callRouterMappings = new ConcurrentDictionary<object, ICallRouter>();
#else
IDictionary<object, ICallRouter> _callRouterMappings = new Dictionary<object, ICallRouter>();
#endif
public ICallRouter ResolveFor(object substitute)
{
if (substitute == null) throw new NullSubstituteReferenceException();
if (substitute is ICallRouter) return (ICallRouter)substitute;
if (substitute is ICallRouterProvider) return ((ICallRouterProvider) substitute).CallRouter;
ICallRouter callRouter;
if (_callRouterMappings.TryGetValue(substitute, out callRouter))
{
return callRouter;
}
throw new NotASubstituteException();
}
public void Register(object proxy, ICallRouter callRouter)
{
if (proxy is ICallRouter) return;
if (proxy is ICallRouterProvider) return;
#if NET4
_callRouterMappings.Add(proxy, callRouter);
#else
lock (_callRouterMappings)
{
_callRouterMappings.Add(proxy, callRouter);
}
#endif
}
}
}
|
using System;
using System.Collections.Generic;
using NSubstitute.Exceptions;
namespace NSubstitute.Core
{
public class CallRouterResolver : ICallRouterResolver
{
IDictionary<object, ICallRouter> _callRouterMappings = new Dictionary<object, ICallRouter>();
public ICallRouter ResolveFor(object substitute)
{
if (substitute == null) throw new NullSubstituteReferenceException();
if (substitute is ICallRouter) return (ICallRouter)substitute;
if (substitute is ICallRouterProvider) return ((ICallRouterProvider) substitute).CallRouter;
ICallRouter callRouter;
if (_callRouterMappings.TryGetValue(substitute, out callRouter))
{
return callRouter;
}
throw new NotASubstituteException();
}
public void Register(object proxy, ICallRouter callRouter)
{
if (proxy is ICallRouter) return;
if (proxy is ICallRouterProvider) return;
_callRouterMappings.Add(proxy, callRouter);
}
}
}
|
bsd-3-clause
|
C#
|
83881fc59b9a71ef48055bc1ff7b5e8c487894b4
|
add fullname to finance list page
|
leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net
|
JoinRpg.Portal/Views/Finances/_Operations.cshtml
|
JoinRpg.Portal/Views/Finances/_Operations.cshtml
|
@using JoinRpg.Web.Models.Money
@model IEnumerable<JoinRpg.Web.Models.FinOperationListItemViewModel>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.FinanceOperationId)
</th>
<th>
@Html.DisplayNameFor(model => model.Money)
</th>
<th>
@Html.DisplayNameFor(model => model.PaymentMaster)
</th>
<th>
@Html.DisplayNameFor(model => model.PaymentTypeName)
</th>
<th>
@Html.DisplayNameFor(model => model.Claim)
</th>
<th>
@Html.DisplayNameFor(model => model.Player)
</th>
<th>
@Html.DisplayNameFor(model => model.OperationDate)
</th>
<th>
@Html.DisplayNameFor(model => model.MarkingMaster)
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@item.FinanceOperationId
</td>
<td>
<partial name="Money" model="new Money(item.Money)" />
</td>
<td>
@Html.DisplayFor(modelItem => item.PaymentMaster)
</td>
<td>
@item.PaymentTypeName
</td>
<td>
<a href="@item.ClaimLink">@item.Claim</a>
</td>
<td>
@Html.DisplayFor(model => item.Player) <br/>
@item.Player.FullName
</td>
<td>
@item.OperationDate.ToShortDateString()
</td>
<td>
@Html.DisplayFor(modelItem => item.MarkingMaster)
</td>
</tr>
}
</table>
|
@using JoinRpg.Web.Models.Money
@model IEnumerable<JoinRpg.Web.Models.FinOperationListItemViewModel>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.FinanceOperationId)
</th>
<th>
@Html.DisplayNameFor(model => model.Money)
</th>
<th>
@Html.DisplayNameFor(model => model.PaymentMaster)
</th>
<th>
@Html.DisplayNameFor(model => model.PaymentTypeName)
</th>
<th>
@Html.DisplayNameFor(model => model.Claim)
</th>
<th>
@Html.DisplayNameFor(model => model.Player)
</th>
<th>
@Html.DisplayNameFor(model => model.OperationDate)
</th>
<th>
@Html.DisplayNameFor(model => model.MarkingMaster)
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@item.FinanceOperationId
</td>
<td>
@Html.Partial("Money", new Money(item.Money))
</td>
<td>
@Html.DisplayFor(modelItem => item.PaymentMaster)
</td>
<td>
@item.PaymentTypeName
</td>
<td>
<a href="@item.ClaimLink">@item.Claim</a>
</td>
<td>
@Html.DisplayFor(model => item.Player)
</td>
<td>
@item.OperationDate.ToShortDateString()
</td>
<td>
@Html.DisplayFor(modelItem => item.MarkingMaster)
</td>
</tr>
}
</table>
|
mit
|
C#
|
8c53edaf078932caef9dbc87c9681d28b8b2cfda
|
add ITestResult.Subject
|
tinyplasticgreyknight/BareBonesTest
|
BareBonesTest.Core/ITestResult.cs
|
BareBonesTest.Core/ITestResult.cs
|
namespace BareBonesTest.Core {
public interface ITestResult {
ITestable Subject { get; }
TestStatus Status { get; }
}
}
|
namespace BareBonesTest.Core {
public interface ITestResult {
TestStatus Status { get; }
}
}
|
mit
|
C#
|
95cdebcefe3fdf394878a8e95b15a7f2ed2dcc8d
|
Clear comment fields after publish (#143)
|
VenusInterns/BlogTemplate,VenusInterns/BlogTemplate,VenusInterns/BlogTemplate
|
BlogTemplate/Pages/Post.cshtml.cs
|
BlogTemplate/Pages/Post.cshtml.cs
|
using System;
using System.ComponentModel.DataAnnotations;
using BlogTemplate._1.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace BlogTemplate._1.Pages
{
public class PostModel : PageModel
{
private readonly BlogDataStore _dataStore;
public PostModel(BlogDataStore dataStore)
{
_dataStore = dataStore;
}
[BindProperty]
public CommentViewModel NewComment { get; set; }
public Post Post { get; set; }
public void OnGet([FromRoute] int id)
{
Post = _dataStore.GetPost(id);
if (Post == null)
{
RedirectToPage("/Index");
}
}
[ValidateAntiForgeryToken]
public IActionResult OnPostPublishComment([FromRoute] int id)
{
Post = _dataStore.GetPost(id);
if (Post == null)
{
RedirectToPage("/Index");
}
else if (ModelState.IsValid)
{
Comment comment = new Comment
{
AuthorName = NewComment.AuthorName,
Body = NewComment.Body,
};
comment.IsPublic = true;
comment.UniqueId = Guid.NewGuid();
Post.Comments.Add(comment);
_dataStore.SavePost(Post);
return Redirect("/post/" + id + "/" + Post.Slug);
}
return Page();
}
public class CommentViewModel
{
[Required]
public string AuthorName { get; set; }
[Required]
public string Body { get; set; }
}
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
using BlogTemplate._1.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace BlogTemplate._1.Pages
{
public class PostModel : PageModel
{
private readonly BlogDataStore _dataStore;
public PostModel(BlogDataStore dataStore)
{
_dataStore = dataStore;
}
[BindProperty]
public CommentViewModel NewComment { get; set; }
public Post Post { get; set; }
public void OnGet([FromRoute] int id)
{
Post = _dataStore.GetPost(id);
if (Post == null)
{
RedirectToPage("/Index");
}
}
[ValidateAntiForgeryToken]
public IActionResult OnPostPublishComment([FromRoute] int id)
{
Post = _dataStore.GetPost(id);
if (Post == null)
{
RedirectToPage("/Index");
}
else if (ModelState.IsValid)
{
Comment comment = new Comment
{
AuthorName = NewComment.AuthorName,
Body = NewComment.Body,
};
comment.IsPublic = true;
comment.UniqueId = Guid.NewGuid();
Post.Comments.Add(comment);
_dataStore.SavePost(Post);
}
return Page();
}
public class CommentViewModel
{
[Required]
public string AuthorName { get; set; }
[Required]
public string Body { get; set; }
}
}
}
|
mit
|
C#
|
abe38e2e6c56d71fcadd28384dd813a2aedd0766
|
Update Start.cs
|
DYanis/UniversalNumeralSystems
|
ConvertorFromBaseToDecimalNumeralSystem/ConvertorFromBaseToDecimalNumeralSystem/Start.cs
|
ConvertorFromBaseToDecimalNumeralSystem/ConvertorFromBaseToDecimalNumeralSystem/Start.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
internal class Start
{
internal static void Main()
{
// Add numeral system keys.
List<string> keys = new List<string>();
keys.Add("KKK0"); // 0
keys.Add("KKK1"); // 1
keys.Add("KKK2"); // 2
keys.Add("KKK3"); // 3
keys.Add("KKK4"); // 4
keys.Add("KKK5"); // 5
keys.Add("KKK6"); // 6
keys.Add("KKK7"); // 7
keys.Add("KKK8"); // 8
string baseNumber = Console.ReadLine();
ulong convertedNumber = ConvertFromBaseToDecimal(keys, baseNumber);
Console.WriteLine(convertedNumber);
}
internal static ulong ConvertFromBaseToDecimal(List<string> keys, string baseNumber)
{
List<ulong> numL = new List<ulong>();
string currentKey = string.Empty;
for (int i = 0; i < baseNumber.Length; i++)
{
currentKey += baseNumber[i].ToString();
if (keys.IndexOf(currentKey) > -1)
{
numL.Add((ulong)keys.IndexOf(currentKey));
currentKey = string.Empty;
}
}
ulong[] decimalNumbers = numL.ToArray();
Array.Reverse(decimalNumbers);
ulong result = 0;
for (int i = 0; i < numL.Count; i++)
{
result += (decimalNumbers[i] * Pow((ulong)keys.Count, (ulong)i));
}
return result;
}
internal static ulong Pow(ulong number, ulong pow)
{
ulong result = 1;
for (ulong i = 0; i < pow; i++)
{
result *= number;
}
return result;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
internal class Start
{
internal static void Main()
{
// Add numeral system keys.
List<string> keys = new List<string>();
keys.Add("KKK0"); // 1
keys.Add("KKK1"); // 2
keys.Add("KKK2"); // 3
keys.Add("KKK3"); // 4
keys.Add("KKK4"); // 5
keys.Add("KKK5"); // 6
keys.Add("KKK6"); // 7
keys.Add("KKK7"); // 8
keys.Add("KKK8"); // 9
string baseNumber = Console.ReadLine();
ulong convertedNumber = ConvertFromBaseToDecimal(keys, baseNumber);
Console.WriteLine(convertedNumber);
}
internal static ulong ConvertFromBaseToDecimal(List<string> keys, string baseNumber)
{
List<ulong> numL = new List<ulong>();
string currentKey = string.Empty;
for (int i = 0; i < baseNumber.Length; i++)
{
currentKey += baseNumber[i].ToString();
if (keys.IndexOf(currentKey) > -1)
{
numL.Add((ulong)keys.IndexOf(currentKey));
currentKey = string.Empty;
}
}
ulong[] decimalNumbers = numL.ToArray();
Array.Reverse(decimalNumbers);
ulong result = 0;
for (int i = 0; i < numL.Count; i++)
{
result += (decimalNumbers[i] * Pow((ulong)keys.Count, (ulong)i));
}
return result;
}
internal static ulong Pow(ulong number, ulong pow)
{
ulong result = 1;
for (ulong i = 0; i < pow; i++)
{
result *= number;
}
return result;
}
}
|
mit
|
C#
|
aba7d74a18dc4c2427a11e32a18b9ce0e0d8734e
|
fix typo
|
haithemaraissia/RestSharp,PKRoma/RestSharp,KraigM/RestSharp,SaltyDH/RestSharp,benfo/RestSharp,dgreenbean/RestSharp,mattleibow/RestSharp,dmgandini/RestSharp,kouweizhong/RestSharp,lydonchandra/RestSharp,periface/RestSharp,huoxudong125/RestSharp,chengxiaole/RestSharp,wparad/RestSharp,jiangzm/RestSharp,dyh333/RestSharp,who/RestSharp,rucila/RestSharp,mwereda/RestSharp,wparad/RestSharp,rivy/RestSharp,mattwalden/RestSharp,eamonwoortman/RestSharp.Unity,cnascimento/RestSharp,amccarter/RestSharp,uQr/RestSharp,fmmendo/RestSharp,RestSharp-resurrected/RestSharp,felipegtx/RestSharp,restsharp/RestSharp
|
RestSharp.Net4/Extensions/ResponseStatusExtensions.cs
|
RestSharp.Net4/Extensions/ResponseStatusExtensions.cs
|
using System;
using System.Net;
namespace RestSharp.Extensions
{
public static class ResponseStatusExtensions
{
/// <summary>
/// Convert a <see cref="ResponseStatus"/> to a <see cref="WebException"/> instance.
/// </summary>
/// <param name="responseStatus">The response status.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentOutOfRangeException">responseStatus</exception>
public static WebException ToWebException(this ResponseStatus responseStatus)
{
switch (responseStatus)
{
case ResponseStatus.None:
return new WebException("The request could not be processed.", WebExceptionStatus.ServerProtocolViolation);
case ResponseStatus.Error:
return new WebException("An error occurred while processing the request.", WebExceptionStatus.ServerProtocolViolation);
case ResponseStatus.TimedOut:
return new WebException("The request timed-out.", WebExceptionStatus.Timeout);
case ResponseStatus.Aborted:
return new WebException("The request was aborted.", WebExceptionStatus.Timeout);
default:
throw new ArgumentOutOfRangeException("responseStatus");
}
}
}
}
|
using System;
using System.Net;
namespace RestSharp.Extensions
{
public static class ResponseStatusExtensions
{
/// <summary>
/// Convert a <see cref="ResponseStatus"/> to a <see cref="WebException"/> instance.
/// </summary>
/// <param name="responseStatus">The response status.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentOutOfRangeException">responseStatus</exception>
public static WebException ToWebException(this ResponseStatus responseStatus)
{
switch (responseStatus)
{
case ResponseStatus.None:
return new WebException("The request could not be processed.", WebExceptionStatus.ServerProtocolViolation);
case ResponseStatus.Error:
return new WebException("An error occured while processing the request.", WebExceptionStatus.ServerProtocolViolation);
case ResponseStatus.TimedOut:
return new WebException("The request timed-out.", WebExceptionStatus.Timeout);
case ResponseStatus.Aborted:
return new WebException("The request was aborted.", WebExceptionStatus.Timeout);
default:
throw new ArgumentOutOfRangeException("responseStatus");
}
}
}
}
|
apache-2.0
|
C#
|
41121fad5dc2d8cc96afa7b94b872838cb90d6ea
|
Bump version 0.1.5
|
celeron533/KeepOn
|
KeepOn/Properties/AssemblyInfo.cs
|
KeepOn/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("KeepOn")]
[assembly: AssemblyDescription("This tool prevents Windows to run the screensaver, auto lock or sleep.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("https://github.com/celeron533")]
[assembly: AssemblyProduct("KeepOn")]
[assembly: AssemblyCopyright("Copyright © 2017 celeron533")]
[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("45350b9b-0d28-46ad-bd0d-6719d5f26177")]
// 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.5.0")]
[assembly: AssemblyFileVersion("0.1.5.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("KeepOn")]
[assembly: AssemblyDescription("This tool prevents Windows to run the screensaver, auto lock or sleep.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("https://github.com/celeron533")]
[assembly: AssemblyProduct("KeepOn")]
[assembly: AssemblyCopyright("Copyright © 2017 celeron533")]
[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("45350b9b-0d28-46ad-bd0d-6719d5f26177")]
// 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.4.0")]
[assembly: AssemblyFileVersion("0.1.4.0")]
|
mit
|
C#
|
e683dd29cc5d94350ef046672b11b009d1907727
|
Remove "initialized" message
|
ryanewtaylor/snagit-jira-output-accessory,ryanewtaylor/snagit-jira-output-accessory
|
SnagitJiraOutputAccessory/SnagitJiraOutputButton.cs
|
SnagitJiraOutputAccessory/SnagitJiraOutputButton.cs
|
namespace SnagitJiraOutputAccessory
{
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using SnagitJiraOutputAccessory.Commands;
using SNAGITLib;
[ClassInterface(ClassInterfaceType.None)]
[Guid("D3B2FCA3-7A2C-4AF9-86D4-2E542118E8F8")]
public class SnagitJiraOutputButton : MarshalByRefObject, IComponentInitialize, IOutput, IOutputMenu, IComponentWantsCategoryPreferences
{
private ISnagIt _snagit;
private CommandFactory _commandFactory;
public void InitializeComponent(object pExtensionHost, IComponent pComponent, componentInitializeType initType)
{
try
{
_snagit = pExtensionHost as ISnagIt;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public void Output()
{
_commandFactory.CreateDefaultCommand().Execute();
}
public string GetOutputMenuData()
{
var formatter = new SnagitMenuFormatter();
return formatter.Format();
}
public void SelectOutputMenuItem(string pStrID)
{
_commandFactory.CreateCommand(pStrID).Execute();
}
public void SetComponentCategoryPreferences(SnagItOutputPreferences pIComponentCategoryPreferences)
{
_commandFactory = new CommandFactory();
}
}
}
|
namespace SnagitJiraOutputAccessory
{
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using SnagitJiraOutputAccessory.Commands;
using SNAGITLib;
[ClassInterface(ClassInterfaceType.None)]
[Guid("D3B2FCA3-7A2C-4AF9-86D4-2E542118E8F8")]
public class SnagitJiraOutputButton : MarshalByRefObject, IComponentInitialize, IOutput, IOutputMenu, IComponentWantsCategoryPreferences
{
private ISnagIt _snagit;
private CommandFactory _commandFactory;
public void InitializeComponent(object pExtensionHost, IComponent pComponent, componentInitializeType initType)
{
try
{
_snagit = pExtensionHost as ISnagIt;
MessageBox.Show("initialized!");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public void Output()
{
_commandFactory.CreateDefaultCommand().Execute();
}
public string GetOutputMenuData()
{
var formatter = new SnagitMenuFormatter();
return formatter.Format();
}
public void SelectOutputMenuItem(string pStrID)
{
_commandFactory.CreateCommand(pStrID).Execute();
}
public void SetComponentCategoryPreferences(SnagItOutputPreferences pIComponentCategoryPreferences)
{
_commandFactory = new CommandFactory();
}
}
}
|
mit
|
C#
|
50872ad5344e551ca1d49b95bbdc4d093e6f11ac
|
fix mono build
|
gregoryyoung/fsprivateeye,gregoryyoung/fsprivateeye,gregoryyoung/fsprivateeye,gregoryyoung/fsprivateeye
|
src/crap/host/Native.cs
|
src/crap/host/Native.cs
|
using System;
using System.ComponentModel;
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;
#if __MonoCS__
using Mono.Unix.Native;
using Mono.Unix;
#endif
namespace host
{
public static unsafe class Native
{
#if __MonoCS__
private static readonly int EAGAIN = NativeConvert.FromErrno(Errno.EAGAIN);
#endif
public static SafeFileHandle OpenPipeNonBlocking(string filename)
{
#if __MonoCS__
var flags = OpenFlags.O_RDONLY | OpenFlags.O_NONBLOCK;
var han = Syscall.open(filename, flags, FilePermissions.S_IRWXU);
if(han < 0) {
Console.WriteLine("handle is " + han);
throw new Win32Exception();
}
var handle = new SafeFileHandle((IntPtr) han, true);
if(handle.IsInvalid) throw new Exception("Invalid handle");
return handle;
#else
return new SafeFileHandle(new IntPtr(0), false);
#endif
}
public static int Read(SafeFileHandle handle, byte[] buffer, int offset, int count)
{
#if __MonoCS__
int r;
fixed(byte *p = buffer) {
do {
r = (int) Syscall.read (handle.DangerousGetHandle().ToInt32(), p, (ulong) count);
} while (UnixMarshal.ShouldRetrySyscall ((int) r));
if(r == -1) {
int errno = Marshal.GetLastWin32Error();
if (errno == EAGAIN) {
return 0;
}
throw new Win32Exception();
}
return r;
}
#else
return 0;
#endif
}
}
}
|
using System;
using System.ComponentModel;
using Microsoft.Win32.SafeHandles;
using System.Runtime.InteropServices;
#if __MonoCS__
using Mono.Unix.Native;
using Mono.Unix;
#endif
namespace host
{
public static unsafe class Native
{
#if __MonoCS__
private static readonly int EAGAIN = NativeConvert.FromErrno(Errno.EAGAIN);
#endif
public static SafeFileHandle OpenPipeNonBlocking(string filename)
{
#if __MonoCS__
var flags = OpenFlags.O_RDONLY | OpenFlags.O_NONBLOCK;
var han = Syscall.open(filename, flags, FilePermissions.S_IRWXU);
if(han < 0) {
Console.WriteLine("handle is " + han);
throw new Win32Exception();
}
var handle = new SafeFileHandle((IntPtr) han, true);
if(handle.IsInvalid) throw new Exception("Invalid handle");
return handle;
#else
return new SafeFileHandle(new IntPtr(0), false);
#endif
}
public static int Read(SafeFileHandle handle, byte[] buffer, int offset, int count)
{
#if __MonoCS__
int r;
fixed(byte *p = buffer) {
do {
r = (int) Syscall.read (handle.DangerousGetHandle().ToInt32(), p, (ulong) count);
} while (UnixMarshal.ShouldRetrySyscall ((int) r));
if(r == -1) {
int errno = Marshal.GetLastWin32Error();
if (errno == EAGAIN) {
return 0;
}
throw new Win32Exception();
}
return r;
#else
return 0;
#endif
}
}
}
|
mit
|
C#
|
9015447170033ea9eac2e2566cd4fb434a40f4c6
|
Set version number to 1.5.3
|
tommy-carlier/photo-importer
|
PhotoImporter/TC.PhotoImporter/Properties/AssemblyInfo.cs
|
PhotoImporter/TC.PhotoImporter/Properties/AssemblyInfo.cs
|
using System.Resources;
using System.Reflection;
using System.Runtime.InteropServices;
using System;
[assembly: AssemblyTitle("Photo Importer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tommy Carlier")]
[assembly: AssemblyProduct("Photo Importer")]
[assembly: AssemblyCopyright("Copyright © 2016-2018 Tommy Carlier")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: Guid("a40f1a12-4e38-455c-8449-be43d1922daa")]
[assembly: AssemblyVersion("1.5.3.0")]
[assembly: AssemblyFileVersion("1.5.3.0")]
[assembly: NeutralResourcesLanguage("en-US")]
|
using System.Resources;
using System.Reflection;
using System.Runtime.InteropServices;
using System;
[assembly: AssemblyTitle("Photo Importer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Tommy Carlier")]
[assembly: AssemblyProduct("Photo Importer")]
[assembly: AssemblyCopyright("Copyright © 2016 Tommy Carlier")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: Guid("a40f1a12-4e38-455c-8449-be43d1922daa")]
[assembly: AssemblyVersion("1.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: NeutralResourcesLanguage("en-US")]
|
mit
|
C#
|
e55ad154df6f3d5e49f2d6dd4a4bdb379db72c3a
|
Tweak SMTP test "From" address.
|
toolhouse/monitoring-dotnet
|
Toolhouse.Monitoring/Dependencies/SmtpDependency.cs
|
Toolhouse.Monitoring/Dependencies/SmtpDependency.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
namespace Toolhouse.Monitoring.Dependencies
{
public class SmtpDependency : IDependency
{
public SmtpDependency(string name)
{
this.Name = name;
}
public string Name
{
get;
private set;
}
public DependencyStatus Check()
{
// TODO: A more sophisticated test here would be opening up a socket and actually attempting to speak SMTP.
using (var client = new System.Net.Mail.SmtpClient())
{
var message = new MailMessage("test@example.org", "smtpdependencycheck@example.org", "SMTP test", "");
client.Send(message);
}
return new DependencyStatus(this, true, "");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
namespace Toolhouse.Monitoring.Dependencies
{
public class SmtpDependency : IDependency
{
public SmtpDependency(string name)
{
this.Name = name;
}
public string Name
{
get;
private set;
}
public DependencyStatus Check()
{
// TODO: A more sophisticated test here would be opening up a socket and actually attempting to speak SMTP.
using (var client = new System.Net.Mail.SmtpClient())
{
var message = new MailMessage("test@example.org", "smtpdependencycheck@toolhouse.com", "SMTP test", "");
client.Send(message);
}
return new DependencyStatus(this, true, "");
}
}
}
|
apache-2.0
|
C#
|
76a6817d836d2658ff54923f7f94846667452405
|
Fix type name error due to temporarily excluded project
|
lasiproject/LASI,lasiproject/LASI
|
LASI.WebApp.Tests/TestAttributes/PreconfigureLASIAttribute.cs
|
LASI.WebApp.Tests/TestAttributes/PreconfigureLASIAttribute.cs
|
using System;
using System.Reflection;
//using System.IO;
//using System.Reflection;
using LASI.Utilities;
namespace LASI.WebApp.Tests.TestAttributes
{
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class PreconfigureLASIAttribute : Xunit.Sdk.BeforeAfterTestAttribute
{
private const string ConfigFileName = "config.json";
private const string LASIComponentConfigSubkey = "Resources";
public override void Before(MethodInfo methodUnderTest)
{
base.Before(methodUnderTest);
ConfigureLASIComponents(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), ConfigFileName), LASIComponentConfigSubkey);
}
private static void ConfigureLASIComponents(string fileName, string subkey)
{
Interop.ResourceUsageManager.SetPerformanceLevel(Interop.PerformanceProfile.High);
try
{
Interop.Configuration.Initialize(fileName, Interop.ConfigFormat.Json, subkey);
}
catch (Interop.AlreadyConfiguredException)
{
//Console.WriteLine("LASI was already setup by a previous test; continuing");
}
Logger.SetToSilent();
}
}
}
|
using System;
using System.Reflection;
//using System.IO;
//using System.Reflection;
using LASI.Utilities;
namespace LASI.WebApp.Tests.TestAttributes
{
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class PreconfigureLASIAttribute : Xunit.Sdk.BeforeAfterTestAttribute
{
private const string ConfigFileName = "config.json";
private const string LASIComponentConfigSubkey = "Resources";
public override void Before(MethodInfo methodUnderTest)
{
base.Before(methodUnderTest);
ConfigureLASIComponents(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), ConfigFileName), LASIComponentConfigSubkey);
}
private static void ConfigureLASIComponents(string fileName, string subkey)
{
Interop.ResourceUsageManager.SetPerformanceLevel(Interop.PerformanceProfile.High);
try
{
Interop.Configuration.Initialize(fileName, Interop.ConfigFormat.Json, subkey);
}
catch (Interop.SystemAlreadyConfiguredException)
{
//Console.WriteLine("LASI was already setup by a previous test; continuing");
}
Logger.SetToSilent();
}
}
}
|
mit
|
C#
|
bef09525df20d9422ab349fa8914188feb7d284f
|
fix AdvanceBy() overrides in MidiTimeManagerBase impl.
|
atsushieno/managed-midi
|
lib/base/MidiTimeManager.cs
|
lib/base/MidiTimeManager.cs
|
using System;
using System.Threading;
namespace Commons.Music.Midi
{
public interface IMidiTimeManager
{
//void AdvanceByTicks (long addedTicks, int currentTempo, int smfDeltaTimeSpec, double speed = 1.0);
void AdvanceBy (int addedMilliseconds);
//void AdvanceTo (long targetMilliseconds);
//long TicksToMilliseconds (long ticks)
}
public abstract class MidiTimeManagerBase : IMidiTimeManager
{
public static int GetDeltaTimeInMilliseconds (int deltaTime, int currentTempo, int smfDeltaTimeSpec, double speed = 1.0)
{
if (smfDeltaTimeSpec < 0)
throw new NotSupportedException ("SMPTe-basd delta time is not implemented yet");
return (int) (currentTempo / 1000 * deltaTime / smfDeltaTimeSpec / speed);
}
//public virtual long TotalTicks { get; private set; }
public virtual void AdvanceBy (int addedMilliseconds)
{
if (addedTicks < 0)
throw new InvalidOperationException ("Added ticks must be non-negative.");
//TotalTicks += addedTicks;
}
/*
public virtual void AdvanceTo (long targetTicks)
{
if (targetTicks < TotalTicks)
throw new InvalidOperationException ("target ticks must not be less than current total ticks.");
TotalTicks = targetTicks;
}
*/
}
public class VirtualMidiTimeManager : MidiTimeManagerBase
{
public void AdvanceBy (int addedMilliseconds)
{
}
//void AdvanceTo (long targetTicks);
}
public class SimpleMidiTimeManager : MidiTimeManagerBase
{
public void AdvanceBy (int addedMilliseconds)
{
Thread.Sleep (addedMilliseconds);
base.AdvanceBy (addedMilliseconds);
}
/*
public void AdvanceTo (long targetTicks)
{
}
*/
}
}
|
using System;
using System.Threading;
namespace Commons.Music.Midi
{
public interface IMidiTimeManager
{
//void AdvanceByTicks (long addedTicks, int currentTempo, int smfDeltaTimeSpec, double speed = 1.0);
void AdvanceBy (int addedMilliseconds);
//void AdvanceTo (long targetMilliseconds);
//long TicksToMilliseconds (long ticks)
}
public abstract class MidiTimeManagerBase : IMidiTimeManager
{
public static int GetDeltaTimeInMilliseconds (int deltaTime, int currentTempo, int smfDeltaTimeSpec, double speed = 1.0)
{
if (smfDeltaTimeSpec < 0)
throw new NotSupportedException ("SMPTe-basd delta time is not implemented yet");
return (int) (currentTempo / 1000 * deltaTime / smfDeltaTimeSpec / speed);
}
//public virtual long TotalTicks { get; private set; }
public virtual void AdvanceBy (int addedTicks)
{
if (addedTicks < 0)
throw new InvalidOperationException ("Added ticks must be non-negative.");
//TotalTicks += addedTicks;
}
/*
public virtual void AdvanceTo (long targetTicks)
{
if (targetTicks < TotalTicks)
throw new InvalidOperationException ("target ticks must not be less than current total ticks.");
TotalTicks = targetTicks;
}
*/
}
public class VirtualMidiTimeManager : MidiTimeManagerBase
{
public void AdvanceBy (int addedMilliseconds)
{
}
//void AdvanceTo (long targetTicks);
}
public class SimpleMidiTimeManager : MidiTimeManagerBase
{
public void AdvanceBy (int addedMilliseconds)
{
Thread.Sleep (addedMilliseconds);
base.AdvanceBy (addedMilliseconds);
}
/*
public void AdvanceTo (long targetTicks)
{
}
*/
}
}
|
mit
|
C#
|
e1c1cef87456045a5f0309a871d29ec66dc18b2f
|
use string.Concat
|
acple/ParsecSharp
|
ParsecSharp/Parser/Text.Combinator.Extensions.cs
|
ParsecSharp/Parser/Text.Combinator.Extensions.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace ParsecSharp
{
public static partial class Text
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, string> ToStr(this Parser<char, IEnumerable<char>> parser)
=> parser.Map(x => new string(x.ToArray()));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, int> ToInt(this Parser<char, IEnumerable<char>> parser)
=> parser.ToStr().ToInt();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, int> ToInt(this Parser<char, string> parser)
=> parser.Bind(digits => (int.TryParse(digits, out var integer)) ? Pure(integer) : Fail<int>());
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, string> Join(this Parser<char, IEnumerable<string>> parser)
=> parser.Map(x => string.Concat(x));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, string> Join(this Parser<char, IEnumerable<string>> parser, string separator)
=> parser.Map(x => string.Join(separator, x));
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace ParsecSharp
{
public static partial class Text
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, string> ToStr(this Parser<char, IEnumerable<char>> parser)
=> parser.Map(x => new string(x.ToArray()));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, int> ToInt(this Parser<char, IEnumerable<char>> parser)
=> parser.ToStr().ToInt();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, int> ToInt(this Parser<char, string> parser)
=> parser.Bind(digits => (int.TryParse(digits, out var integer)) ? Pure(integer) : Fail<int>());
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, string> Join(this Parser<char, IEnumerable<string>> parser)
=> parser.Join(string.Empty);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Parser<char, string> Join(this Parser<char, IEnumerable<string>> parser, string separator)
=> parser.Map(x => string.Join(separator, x));
}
}
|
mit
|
C#
|
fcd3bcf2629386a63248b79897e7414f3d7a0399
|
Support for property type to DataTableConstructor
|
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
|
R7.University/components/DataTableConstructor.cs
|
R7.University/components/DataTableConstructor.cs
|
//
// DataTableConstructor.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015
//
// 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.
// based on:
// http://www.c-sharpcorner.com/UploadFile/1a81c5/list-to-datatable-converter-using-C-Sharp/
using System;
using System.Data;
using System.Reflection;
using System.Collections.Generic;
namespace R7.University
{
public static class DataTableConstructor
{
public static DataTable FromIEnumerable<T> (IEnumerable<T> items)
{
var dataTable = new DataTable (typeof (T).Name);
// get all the properties
var props = typeof (T).GetProperties (BindingFlags.Public | BindingFlags.Instance);
foreach (var prop in props)
dataTable.Columns.Add (prop.Name, prop.PropertyType);
foreach (T item in items)
{
var values = new object [props.Length];
for (var i = 0; i < props.Length; i++)
{
// inserting property values to datatable rows
values [i] = props [i].GetValue (item, null);
}
dataTable.Rows.Add (values);
}
return dataTable;
}
}
}
|
//
// DataTableConstructor.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015
//
// 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.
// based on:
// http://www.c-sharpcorner.com/UploadFile/1a81c5/list-to-datatable-converter-using-C-Sharp/
using System;
using System.Data;
using System.Reflection;
using System.Collections.Generic;
namespace R7.University
{
public static class DataTableConstructor
{
public static DataTable FromIEnumerable<T> (IEnumerable<T> items)
{
var dataTable = new DataTable (typeof (T).Name);
// get all the properties
var props = typeof (T).GetProperties (BindingFlags.Public | BindingFlags.Instance);
foreach (var prop in props)
dataTable.Columns.Add (prop.Name);
foreach (T item in items)
{
var values = new object [props.Length];
for (var i = 0; i < props.Length; i++)
{
// inserting property values to datatable rows
values [i] = props [i].GetValue (item, null);
}
dataTable.Rows.Add (values);
}
return dataTable;
}
}
}
|
agpl-3.0
|
C#
|
77c55aa9338c045c91b495087098b745b6abbe7d
|
Bump version
|
NJAldwin/Pequot
|
Pequot/Properties/AssemblyInfo.cs
|
Pequot/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("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[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("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.2.*")]
[assembly: AssemblyFileVersion("0.4.2.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Pequot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Shaken Software")]
[assembly: AssemblyProduct("Pequot")]
[assembly: AssemblyCopyright("©2009-2011 Shaken Software")]
[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("83e5cf5c-13c9-4367-b1be-e9574b2e4680")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.4.1.*")]
[assembly: AssemblyFileVersion("0.4.1.0")]
|
mit
|
C#
|
daae9d2258f178ff87f91f44fa9e4232dbe14e84
|
Fix mistake in create sprint validator - was allowing null Name
|
csf-dev/agiil,csf-dev/agiil,csf-dev/agiil,csf-dev/agiil
|
Agiil.Domain.Impl/Sprints/CreateSprintValidatorFactory.cs
|
Agiil.Domain.Impl/Sprints/CreateSprintValidatorFactory.cs
|
using System;
using Agiil.Domain.Validation;
using CSF.Validation;
using CSF.Validation.Manifest.Fluent;
using CSF.Validation.StockRules;
namespace Agiil.Domain.Sprints
{
public class CreateSprintValidatorFactory : ValidatorFactoryBase<CreateSprintRequest>
{
protected override void ConfigureManifest(IManifestBuilder<CreateSprintRequest> builder)
{
builder.AddRule<NotNullRule>();
builder.AddMemberRule<NotNullValueRule>(x => x.Name);
builder.AddMemberRule<RegexMatchValueRule>(x => x.Name, c => {
c.Configure(r => r.Pattern = @"^\S+");
});
builder.AddRule<EndDateMustNotBeBeforeStartDateRule>();
}
public CreateSprintValidatorFactory(IValidatorFactory validatorFactory) : base(validatorFactory) {}
}
}
|
using System;
using Agiil.Domain.Validation;
using CSF.Validation;
using CSF.Validation.Manifest.Fluent;
using CSF.Validation.StockRules;
namespace Agiil.Domain.Sprints
{
public class CreateSprintValidatorFactory : ValidatorFactoryBase<CreateSprintRequest>
{
protected override void ConfigureManifest(IManifestBuilder<CreateSprintRequest> builder)
{
builder.AddRule<NotNullRule>();
builder.AddMemberRule<RegexMatchValueRule>(x => x.Name, c => {
c.Configure(r => r.Pattern = @"^\S+");
});
builder.AddRule<EndDateMustNotBeBeforeStartDateRule>();
}
public CreateSprintValidatorFactory(IValidatorFactory validatorFactory) : base(validatorFactory) {}
}
}
|
mit
|
C#
|
ee4da774ead204b90018348a8faa021d1031f0ff
|
add clean attributes extension method
|
wtertinek/Linq2Acad
|
Sources/Linq2Acad/Extensions/AttributeCollectionExtensions.cs
|
Sources/Linq2Acad/Extensions/AttributeCollectionExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.DatabaseServices;
namespace Linq2Acad
{
public static class AttributeCollectionExtensions
{
public static bool Contains(this AttributeCollection attributes, string tag)
{
return GetAttributeReferences(attributes, OpenMode.ForRead)
.Any(a => a.Tag == tag);
}
public static string GetValue(this AttributeCollection attributes, string tag)
{
var attribute = GetAttributeReference(attributes, tag, OpenMode.ForRead);
return attribute.TextString;
}
public static void SetValue(this AttributeCollection attributes, string tag, string value)
{
var attribute = GetAttributeReference(attributes, tag, OpenMode.ForWrite);
attribute.TextString = value;
}
public static void CleanValues(this AttributeCollection attributes)
{
GetAttributeReferences(attributes, OpenMode.ForWrite)
.ForEach(ar => ar.TextString = "");
}
private static AttributeReference GetAttributeReference(AttributeCollection attributes, string tag, OpenMode openMode)
{
var attribute = GetAttributeReferences(attributes, openMode)
.FirstOrDefault(a => a.Tag == tag);
Require.ObjectNotNull(attribute, $"No {nameof(AttributeReference)} with Tag '{tag}' found");
return attribute;
}
private static IEnumerable<AttributeReference> GetAttributeReferences(AttributeCollection attributes, OpenMode openMode)
{
Require.ParameterNotNull(attributes, nameof(attributes));
if (attributes.Count > 0)
{
if (attributes[0].Database.TransactionManager.TopTransaction == null)
{
throw new InvalidOperationException("No transaction available");
}
var transaction = attributes[0].Database.TransactionManager.TopTransaction;
return attributes.Cast<ObjectId>()
.Select(id => (AttributeReference)transaction.GetObject(id, openMode));
}
else
{
return Array.Empty<AttributeReference>();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.DatabaseServices;
namespace Linq2Acad
{
public static class AttributeCollectionExtensions
{
public static bool Contains(this AttributeCollection attributes, string tag)
{
return GetAttributeReferences(attributes, OpenMode.ForRead)
.Any(a => a.Tag == tag);
}
public static string GetValue(this AttributeCollection attributes, string tag)
{
var attribute = GetAttributeReference(attributes, tag, OpenMode.ForRead);
return attribute.TextString;
}
public static void SetValue(this AttributeCollection attributes, string tag, string value)
{
var attribute = GetAttributeReference(attributes, tag, OpenMode.ForWrite);
attribute.TextString = value;
}
private static AttributeReference GetAttributeReference(AttributeCollection attributes, string tag, OpenMode openMode)
{
var attribute = GetAttributeReferences(attributes, openMode)
.FirstOrDefault(a => a.Tag == tag);
Require.ObjectNotNull(attribute, $"No {nameof(AttributeReference)} with Tag '{tag}' found");
return attribute;
}
private static IEnumerable<AttributeReference> GetAttributeReferences(AttributeCollection attributes, OpenMode openMode)
{
Require.ParameterNotNull(attributes, nameof(attributes));
if (attributes.Count > 0)
{
if (attributes[0].Database.TransactionManager.TopTransaction == null)
{
throw new InvalidOperationException("No transaction available");
}
var transaction = attributes[0].Database.TransactionManager.TopTransaction;
return attributes.Cast<ObjectId>()
.Select(id => (AttributeReference)transaction.GetObject(id, openMode));
}
else
{
return Array.Empty<AttributeReference>();
}
}
}
}
|
mit
|
C#
|
10a645794003e90144d7ff28a2ea3a82befd52b0
|
add stub tests
|
SpectraLogic/tpfr_client
|
TpftClientIntegrationTest/TpftClientIntegrationTest.cs
|
TpftClientIntegrationTest/TpftClientIntegrationTest.cs
|
/*
* ******************************************************************************
* Copyright 2014 - 2016 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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 NUnit.Framework;
using TpfrClient;
using TpfrClient.Calls;
namespace TpftClientIntegrationTest
{
[TestFixture]
public class TpftClientIntegrationTest
{
private ITpftClient _client;
[SetUp]
public void Setup()
{
_client = new TpftClient("HostServerName", 60792).WithProxy(new Uri("http://localhost:8888"));
}
[Test]
public void TestFileIndex()
{
_client.IndexFile(new IndexFileRequest(@"C:\Media\SampleFile.mxf"));
}
[Test]
public void TestFileStatus()
{
_client.IndexStatus(new IndexStatusRequest(@"C:\Media\SampleFile.mxf"));
}
[Test]
public void TestQuestionTimecode()
{
_client.QuestionTimecode(new QuestionTimecodeRequest("", "", new List<TimecodeRange>()));
}
[Test]
public void TestReWrap()
{
_client.ReWrap(new ReWrapRequest("", "", new List<TimecodeRange>()));
}
}
}
|
/*
* ******************************************************************************
* Copyright 2014 - 2016 Spectra Logic Corporation. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file.
* This file 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 NUnit.Framework;
using TpfrClient;
using TpfrClient.Calls;
namespace TpftClientIntegrationTest
{
[TestFixture]
public class TpftClientIntegrationTest
{
private ITpftClient _client;
[SetUp]
public void Setup()
{
_client = new TpftClient("HostServerName", 60792).WithProxy(new Uri("http://localhost:8888"));
}
[Test]
public void TestFileIndex()
{
_client.IndexFile(new IndexFileRequest(@"C:\Media\SampleFile.mxf"));
}
}
}
|
apache-2.0
|
C#
|
e97419436e847233ca5e33bd9ed22598812f6d91
|
Update ExceptionlessEventTelemeter.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Analytics/Telemetry/ExceptionlessEventTelemeter.cs
|
TIKSN.Core/Analytics/Telemetry/ExceptionlessEventTelemeter.cs
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Exceptionless;
namespace TIKSN.Analytics.Telemetry
{
public class ExceptionlessEventTelemeter : ExceptionlessTelemeterBase, IEventTelemeter
{
public Task TrackEventAsync(string name)
{
try
{
ExceptionlessClient.Default.CreateFeatureUsage(name).Submit();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
return Task.CompletedTask;
}
public Task TrackEventAsync(string name, IDictionary<string, string> properties)
{
try
{
var eventBuilder = ExceptionlessClient.Default.CreateFeatureUsage(name);
foreach (var property in properties)
{
_ = eventBuilder.SetProperty(property.Key, property.Value);
}
eventBuilder.Submit();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
return Task.CompletedTask;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Exceptionless;
namespace TIKSN.Analytics.Telemetry
{
public class ExceptionlessEventTelemeter : ExceptionlessTelemeterBase, IEventTelemeter
{
public async Task TrackEvent(string name)
{
try
{
ExceptionlessClient.Default.CreateFeatureUsage(name).Submit();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
public async Task TrackEvent(string name, IDictionary<string, string> properties)
{
try
{
var eventBuilder = ExceptionlessClient.Default.CreateFeatureUsage(name);
foreach (var property in properties)
{
eventBuilder.SetProperty(property.Key, property.Value);
}
eventBuilder.Submit();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
}
}
|
mit
|
C#
|
dadd6bdf026725797c3384085760d33041773146
|
move bomb handler ID check to static IsAuthorizedDefuser
|
samfun123/KtaneTwitchPlays,CaitSith2/KtaneTwitchPlays
|
TwitchPlaysAssembly/Src/MessageResponders/MessageResponder.cs
|
TwitchPlaysAssembly/Src/MessageResponders/MessageResponder.cs
|
using System;
using System.Linq;
using UnityEngine;
public abstract class MessageResponder : MonoBehaviour
{
protected CoroutineQueue _coroutineQueue = null;
private void OnDestroy()
{
IRCConnection.Instance?.OnMessageReceived.RemoveListener(OnInternalMessageReceived);
}
public void SetupResponder(CoroutineQueue coroutineQueue)
{
_coroutineQueue = coroutineQueue;
IRCConnection.Instance?.OnMessageReceived.AddListener(OnInternalMessageReceived);
}
public static bool IsAuthorizedDefuser(string userNickName, bool silent=false)
{
if (userNickName.EqualsAny("Bomb Factory") || BombMessageResponder.Instance.BombHandles.Select(x => x.nameText.text).Contains(userNickName))
return true;
BanData ban = UserAccess.IsBanned(userNickName);
if (ban != null)
{
if (silent) return false;
if (double.IsPositiveInfinity(ban.BanExpiry))
{
IRCConnection.Instance?.SendMessage("Sorry @{0}, You were banned permanently from Twitch Plays by {1}{2}", userNickName, ban.BannedBy, string.IsNullOrEmpty(ban.BannedReason) ? "." : $", for the following reason: {ban.BannedReason}");
}
else
{
int secondsRemaining = (int)(ban.BanExpiry - DateTime.Now.TotalSeconds());
int daysRemaining = secondsRemaining / 86400; secondsRemaining %= 86400;
int hoursRemaining = secondsRemaining / 3600; secondsRemaining %= 3600;
int minutesRemaining = secondsRemaining / 60; secondsRemaining %= 60;
string timeRemaining = $"{secondsRemaining} seconds.";
if (daysRemaining > 0) timeRemaining = $"{daysRemaining} days, {hoursRemaining} hours, {minutesRemaining} minutes, {secondsRemaining} seconds.";
else if (hoursRemaining > 0) timeRemaining = $"{hoursRemaining} hours, {minutesRemaining} minutes, {secondsRemaining} seconds.";
else if (minutesRemaining > 0) timeRemaining = $"{minutesRemaining} minutes, {secondsRemaining} seconds.";
IRCConnection.Instance?.SendMessage("Sorry @{0}, You were timed out from Twitch Plays by {1}{2} You can participate again in {3}", userNickName, ban.BannedBy, string.IsNullOrEmpty(ban.BannedReason) ? "." : $", For the following reason: {ban.BannedReason}", timeRemaining);
}
return false;
}
bool result = (TwitchPlaySettings.data.EnableTwitchPlaysMode || UserAccess.HasAccess(userNickName, AccessLevel.Defuser, true));
if (!result && !silent)
IRCConnection.Instance?.SendMessage(TwitchPlaySettings.data.TwitchPlaysDisabled, userNickName);
return result;
}
protected abstract void OnMessageReceived(string userNickName, string userColorCode, string text);
private void OnInternalMessageReceived(string userNickName, string userColorCode, string text)
{
if (gameObject.activeInHierarchy && isActiveAndEnabled)
{
OnMessageReceived(userNickName, userColorCode, text);
}
}
}
|
using System;
using UnityEngine;
public abstract class MessageResponder : MonoBehaviour
{
protected CoroutineQueue _coroutineQueue = null;
private void OnDestroy()
{
IRCConnection.Instance?.OnMessageReceived.RemoveListener(OnInternalMessageReceived);
}
public void SetupResponder(CoroutineQueue coroutineQueue)
{
_coroutineQueue = coroutineQueue;
IRCConnection.Instance?.OnMessageReceived.AddListener(OnInternalMessageReceived);
}
public static bool IsAuthorizedDefuser(string userNickName, bool silent=false)
{
BanData ban = UserAccess.IsBanned(userNickName);
if (ban != null)
{
if (silent) return false;
if (double.IsPositiveInfinity(ban.BanExpiry))
{
IRCConnection.Instance?.SendMessage("Sorry @{0}, You were banned permanently from Twitch Plays by {1}{2}", userNickName, ban.BannedBy, string.IsNullOrEmpty(ban.BannedReason) ? "." : $", for the following reason: {ban.BannedReason}");
}
else
{
int secondsRemaining = (int)(ban.BanExpiry - DateTime.Now.TotalSeconds());
int daysRemaining = secondsRemaining / 86400; secondsRemaining %= 86400;
int hoursRemaining = secondsRemaining / 3600; secondsRemaining %= 3600;
int minutesRemaining = secondsRemaining / 60; secondsRemaining %= 60;
string timeRemaining = $"{secondsRemaining} seconds.";
if (daysRemaining > 0) timeRemaining = $"{daysRemaining} days, {hoursRemaining} hours, {minutesRemaining} minutes, {secondsRemaining} seconds.";
else if (hoursRemaining > 0) timeRemaining = $"{hoursRemaining} hours, {minutesRemaining} minutes, {secondsRemaining} seconds.";
else if (minutesRemaining > 0) timeRemaining = $"{minutesRemaining} minutes, {secondsRemaining} seconds.";
IRCConnection.Instance?.SendMessage("Sorry @{0}, You were timed out from Twitch Plays by {1}{2} You can participate again in {3}", userNickName, ban.BannedBy, string.IsNullOrEmpty(ban.BannedReason) ? "." : $", For the following reason: {ban.BannedReason}", timeRemaining);
}
return false;
}
bool result = (TwitchPlaySettings.data.EnableTwitchPlaysMode || UserAccess.HasAccess(userNickName, AccessLevel.Defuser, true));
if (!result && !silent)
IRCConnection.Instance?.SendMessage(TwitchPlaySettings.data.TwitchPlaysDisabled, userNickName);
return result;
}
protected abstract void OnMessageReceived(string userNickName, string userColorCode, string text);
private void OnInternalMessageReceived(string userNickName, string userColorCode, string text)
{
if (gameObject.activeInHierarchy && isActiveAndEnabled)
{
OnMessageReceived(userNickName, userColorCode, text);
}
}
}
|
mit
|
C#
|
46fcb2a2480abc2b623716ea0443e4fb8f8cfcb6
|
increment to version 0.15.0
|
config-r/config-r
|
src/ConfigR/Properties/AssemblyInfo.cs
|
src/ConfigR/Properties/AssemblyInfo.cs
|
// <copyright file="AssemblyInfo.cs" company="ConfigR contributors">
// Copyright (c) ConfigR contributors. (configr.net@gmail.com)
// </copyright>
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("ConfigR")]
[assembly: AssemblyDescription("Write your .NET configuration files in C#.")]
[assembly: AssemblyCompany("ConfigR contributors")]
[assembly: AssemblyProduct("ConfigR")]
[assembly: AssemblyCopyright("Copyright (c) ConfigR contributors. (configr.net@gmail.com)")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("0.15.0")]
[assembly: AssemblyFileVersion("0.15.0")]
[assembly: AssemblyInformationalVersion("0.15.0")]
|
// <copyright file="AssemblyInfo.cs" company="ConfigR contributors">
// Copyright (c) ConfigR contributors. (configr.net@gmail.com)
// </copyright>
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("ConfigR")]
[assembly: AssemblyDescription("Write your .NET configuration files in C#.")]
[assembly: AssemblyCompany("ConfigR contributors")]
[assembly: AssemblyProduct("ConfigR")]
[assembly: AssemblyCopyright("Copyright (c) ConfigR contributors. (configr.net@gmail.com)")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyVersion("0.14.0")]
[assembly: AssemblyFileVersion("0.14.0")]
[assembly: AssemblyInformationalVersion("0.14.0")]
|
mit
|
C#
|
347facba02eb24fac150dedf52b4d0dcf2cde4b0
|
Return NotFound on teams user is not a member of
|
mycroes/SupportManager,mycroes/SupportManager,mycroes/SupportManager
|
SupportManager.Web/Areas/Teams/BaseController.cs
|
SupportManager.Web/Areas/Teams/BaseController.cs
|
using System.Data.Entity;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using SupportManager.DAL;
namespace SupportManager.Web.Areas.Teams
{
[Area("Teams")]
[Authorize]
public abstract class BaseController : Controller
{
protected int TeamId => int.Parse((string) ControllerContext.RouteData.Values["teamId"]);
protected SupportTeam Team { get; private set; }
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
var db = (SupportManagerContext) context.HttpContext.RequestServices.GetService(typeof(SupportManagerContext));
Team = await db.Teams.FindAsync(TeamId);
if (Team == null)
{
context.Result = NotFound();
return;
}
var userName = context.HttpContext.User.Identity.Name;
if (!await db.TeamMembers.AnyAsync(x => x.TeamId == Team.Id && x.User.Login == userName))
{
context.Result = NotFound();
return;
}
ViewData["TeamName"] = Team.Name;
await base.OnActionExecutionAsync(context, next);
}
}
}
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using SupportManager.DAL;
namespace SupportManager.Web.Areas.Teams
{
[Area("Teams")]
[Authorize]
public abstract class BaseController : Controller
{
protected int TeamId => int.Parse((string) ControllerContext.RouteData.Values["teamId"]);
protected SupportTeam Team { get; private set; }
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
var db = (SupportManagerContext) context.HttpContext.RequestServices.GetService(typeof(SupportManagerContext));
Team = await db.Teams.FindAsync(TeamId);
if (Team == null)
{
context.Result = NotFound();
return;
}
ViewData["TeamName"] = Team.Name;
await base.OnActionExecutionAsync(context, next);
}
}
}
|
mit
|
C#
|
156483bf717ca9d11d9331c08e4f32511b25a2a6
|
Rename `overridenType` to `overridenTypeReader`
|
LassieME/Discord.Net,RogueException/Discord.Net,Confruggy/Discord.Net,AntiTcb/Discord.Net
|
src/Discord.Net.Commands/Attributes/OverrideTypeReaderAttribute.cs
|
src/Discord.Net.Commands/Attributes/OverrideTypeReaderAttribute.cs
|
using System;
using System.Reflection;
namespace Discord.Commands
{
[AttributeUsage(AttributeTargets.Parameter)]
public class OverrideTypeReaderAttribute : Attribute
{
private readonly TypeInfo _typeReaderTypeInfo = typeof(TypeReader).GetTypeInfo();
public Type TypeReader { get; }
public OverrideTypeReaderAttribute(Type overridenTypeReader)
{
if (!_typeReaderTypeInfo.IsAssignableFrom(overridenTypeReader.GetTypeInfo()))
throw new ArgumentException($"{nameof(overridenTypeReader)} must inherit from {nameof(TypeReader)}");
TypeReader = overridenTypeReader;
}
}
}
|
using System;
using System.Reflection;
namespace Discord.Commands
{
[AttributeUsage(AttributeTargets.Parameter)]
public class OverrideTypeReaderAttribute : Attribute
{
private readonly TypeInfo _typeReaderTypeInfo = typeof(TypeReader).GetTypeInfo();
public Type TypeReader { get; }
public OverrideTypeReaderAttribute(Type overridenType)
{
if (!_typeReaderTypeInfo.IsAssignableFrom(overridenType.GetTypeInfo()))
throw new ArgumentException($"{nameof(overridenType)} must inherit from {nameof(TypeReader)}");
TypeReader = overridenType;
}
}
}
|
mit
|
C#
|
003e280cb99c298dac4c247d9d5160af14588a1e
|
Disable 'Delete all variables' when no environment is selected.
|
MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS
|
src/Package/Impl/DataInspect/Commands/DeleteAllVariablesCommand.cs
|
src/Package/Impl/DataInspect/Commands/DeleteAllVariablesCommand.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Globalization;
using Microsoft.Common.Core;
using Microsoft.Common.Core.Shell;
using Microsoft.R.Host.Client;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Packages.R;
using Microsoft.VisualStudio.R.Package.Utilities;
namespace Microsoft.VisualStudio.R.Package.DataInspect.Commands {
internal sealed class DeleteAllVariablesCommand : SessionCommand {
public DeleteAllVariablesCommand(IRSession session) :
base(session, RGuidList.RCmdSetGuid, RPackageCommandId.icmdDeleteAllVariables) {
}
protected override void SetStatus() {
var variableWindowPane = ToolWindowUtilities.FindWindowPane<VariableWindowPane>(0);
// 'Delete all variables' button should be enabled only when the Global environment
// is selected in Variable Explorer.
Enabled = (variableWindowPane?.IsGlobalREnvironment()) ?? false;
}
protected override void Handle() {
if(MessageButtons.No == VsAppShell.Current.ShowMessage(Resources.Warning_DeleteAllVariables, MessageButtons.YesNo)) {
return;
}
try {
RSession.ExecuteAsync("rm(list = ls(all = TRUE))").DoNotWait();
} catch(RException ex) {
VsAppShell.Current.ShowErrorMessage(
string.Format(CultureInfo.InvariantCulture, Resources.Error_UnableToDeleteVariable, ex.Message));
} catch(MessageTransportException) { }
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Globalization;
using Microsoft.Common.Core;
using Microsoft.Common.Core.Shell;
using Microsoft.R.Host.Client;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Packages.R;
using Microsoft.VisualStudio.R.Package.Utilities;
namespace Microsoft.VisualStudio.R.Package.DataInspect.Commands {
internal sealed class DeleteAllVariablesCommand : SessionCommand {
public DeleteAllVariablesCommand(IRSession session) :
base(session, RGuidList.RCmdSetGuid, RPackageCommandId.icmdDeleteAllVariables) {
}
protected override void SetStatus() {
var variableWindowPane = ToolWindowUtilities.FindWindowPane<VariableWindowPane>(0);
Enabled = (variableWindowPane?.IsGlobalREnvironment()) ?? true;
}
protected override void Handle() {
if(MessageButtons.No == VsAppShell.Current.ShowMessage(Resources.Warning_DeleteAllVariables, MessageButtons.YesNo)) {
return;
}
try {
RSession.ExecuteAsync("rm(list = ls(all = TRUE))").DoNotWait();
} catch(RException ex) {
VsAppShell.Current.ShowErrorMessage(
string.Format(CultureInfo.InvariantCulture, Resources.Error_UnableToDeleteVariable, ex.Message));
} catch(MessageTransportException) { }
}
}
}
|
mit
|
C#
|
681264d233e36fcfef16cfbb29c5e4ae3496d8d8
|
Remove temporary index
|
arknu/Umbraco-CMS,KevinJump/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,tcmorris/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,umbraco/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,madsoulswe/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,marcemarc/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,NikRimington/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,NikRimington/Umbraco-CMS,bjarnef/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,NikRimington/Umbraco-CMS,dawoe/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,hfloyd/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,robertjf/Umbraco-CMS,bjarnef/Umbraco-CMS,umbraco/Umbraco-CMS,mattbrailsford/Umbraco-CMS,hfloyd/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,bjarnef/Umbraco-CMS,leekelleher/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,tcmorris/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,umbraco/Umbraco-CMS,abryukhov/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,abryukhov/Umbraco-CMS,abjerner/Umbraco-CMS,leekelleher/Umbraco-CMS,KevinJump/Umbraco-CMS,robertjf/Umbraco-CMS,leekelleher/Umbraco-CMS
|
src/Umbraco.Core/Migrations/Upgrade/Common/CreateKeysAndIndexes.cs
|
src/Umbraco.Core/Migrations/Upgrade/Common/CreateKeysAndIndexes.cs
|
using Umbraco.Core.Migrations.Install;
namespace Umbraco.Core.Migrations.Upgrade.Common
{
public class CreateKeysAndIndexes : MigrationBase
{
public CreateKeysAndIndexes(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
// remove those that may already have keys
Delete.KeysAndIndexes(Constants.DatabaseSchema.Tables.KeyValue).Do();
Delete.KeysAndIndexes(Constants.DatabaseSchema.Tables.PropertyData).Do();
// re-create *all* keys and indexes
foreach (var x in DatabaseSchemaCreator.OrderedTables)
Create.KeysAndIndexes(x).Do();
}
}
}
|
using Umbraco.Core.Migrations.Install;
namespace Umbraco.Core.Migrations.Upgrade.Common
{
public class CreateKeysAndIndexes : MigrationBase
{
public CreateKeysAndIndexes(IMigrationContext context)
: base(context)
{ }
public override void Migrate()
{
// remove those that may already have keys
Delete.KeysAndIndexes(Constants.DatabaseSchema.Tables.KeyValue).Do();
// re-create *all* keys and indexes
foreach (var x in DatabaseSchemaCreator.OrderedTables)
Create.KeysAndIndexes(x).Do();
}
}
}
|
mit
|
C#
|
50d1e4aa0f598810d98f647f3c98f7dcd2b48d83
|
Create backup directory if missing
|
Nuterra/Nuterra,Exund/nuterra,maritaria/terratech-mod
|
src/Nuterra.Installer/InstallerUtil.cs
|
src/Nuterra.Installer/InstallerUtil.cs
|
using System;
using System.IO;
using System.Security.Cryptography;
namespace Nuterra.Installer
{
public static class InstallerUtil
{
public static string GetFileHash(string filePath)
{
if (!File.Exists(filePath))
{
return null;
}
using (var md5 = MD5.Create())
using (var stream = File.OpenRead(filePath))
{
return Convert.ToBase64String(md5.ComputeHash(stream));
}
}
public static string CreateAssemblyBackup(string sourceAssembly, string assemblyBackupDir, string hash)
{
string targetFile = Path.Combine(assemblyBackupDir, $"{hash}.dll");
if (!Directory.Exists(assemblyBackupDir))
{
Directory.CreateDirectory(assemblyBackupDir);
}
if (!File.Exists(targetFile))
{
File.Copy(sourceAssembly, targetFile);
}
return targetFile;
}
public static string FormatBackupPath(string assemblyBackupDir, string hash)
{
return Path.Combine(assemblyBackupDir, $"{hash}.dll");
}
}
}
|
using System;
using System.IO;
using System.Security.Cryptography;
namespace Nuterra.Installer
{
public static class InstallerUtil
{
public static string GetFileHash(string filePath)
{
if (!File.Exists(filePath))
{
return null;
}
using (var md5 = MD5.Create())
using (var stream = File.OpenRead(filePath))
{
return Convert.ToBase64String(md5.ComputeHash(stream));
}
}
public static string CreateAssemblyBackup(string sourceAssembly, string assemblyBackupDir, string hash)
{
string targetFile = Path.Combine(assemblyBackupDir, $"{hash}.dll");
if (Directory.Exists(assemblyBackupDir))
{
Directory.CreateDirectory(assemblyBackupDir);
}
if (!File.Exists(targetFile))
{
File.Copy(sourceAssembly, targetFile);
}
return targetFile;
}
public static string FormatBackupPath(string assemblyBackupDir, string hash)
{
return Path.Combine(assemblyBackupDir, $"{hash}.dll");
}
}
}
|
mit
|
C#
|
7fe841dd76f4f406b3020e8760e6c7aab3f52664
|
Add DangerousAddRef/Release guard.
|
benjamin-bader/corefx,gkhanna79/corefx,billwert/corefx,Alcaro/corefx,mazong1123/corefx,nchikanov/corefx,CherryCxldn/corefx,Petermarcu/corefx,andyhebear/corefx,manu-silicon/corefx,Petermarcu/corefx,benpye/corefx,dkorolev/corefx,Chrisboh/corefx,YoupHulsebos/corefx,ViktorHofer/corefx,stone-li/corefx,jcme/corefx,mazong1123/corefx,stormleoxia/corefx,ptoonen/corefx,jeremymeng/corefx,stephenmichaelf/corefx,oceanho/corefx,Jiayili1/corefx,ravimeda/corefx,elijah6/corefx,rjxby/corefx,dhoehna/corefx,krytarowski/corefx,manu-silicon/corefx,krk/corefx,mellinoe/corefx,rajansingh10/corefx,benjamin-bader/corefx,kkurni/corefx,dotnet-bot/corefx,dhoehna/corefx,jlin177/corefx,marksmeltzer/corefx,seanshpark/corefx,Ermiar/corefx,wtgodbe/corefx,lggomez/corefx,jhendrixMSFT/corefx,marksmeltzer/corefx,iamjasonp/corefx,billwert/corefx,n1ghtmare/corefx,cartermp/corefx,alexperovich/corefx,ericstj/corefx,larsbj1988/corefx,SGuyGe/corefx,alexperovich/corefx,shahid-pk/corefx,MaggieTsang/corefx,the-dwyer/corefx,stormleoxia/corefx,KrisLee/corefx,yizhang82/corefx,dtrebbien/corefx,ptoonen/corefx,krk/corefx,Petermarcu/corefx,vidhya-bv/corefx-sorting,anjumrizwi/corefx,jeremymeng/corefx,alexperovich/corefx,YoupHulsebos/corefx,Alcaro/corefx,vidhya-bv/corefx-sorting,weltkante/corefx,rajansingh10/corefx,stone-li/corefx,lggomez/corefx,janhenke/corefx,mmitche/corefx,jhendrixMSFT/corefx,matthubin/corefx,JosephTremoulet/corefx,ViktorHofer/corefx,jcme/corefx,benpye/corefx,alphonsekurian/corefx,pgavlin/corefx,Petermarcu/corefx,gregg-miskelly/corefx,Petermarcu/corefx,chaitrakeshav/corefx,rubo/corefx,cydhaselton/corefx,wtgodbe/corefx,zmaruo/corefx,iamjasonp/corefx,n1ghtmare/corefx,krk/corefx,gregg-miskelly/corefx,cnbin/corefx,mafiya69/corefx,seanshpark/corefx,anjumrizwi/corefx,twsouthwick/corefx,s0ne0me/corefx,richlander/corefx,jlin177/corefx,seanshpark/corefx,mafiya69/corefx,ellismg/corefx,PatrickMcDonald/corefx,nchikanov/corefx,dotnet-bot/corefx,Ermiar/corefx,jcme/corefx,chaitrakeshav/corefx,rjxby/corefx,ellismg/corefx,tijoytom/corefx,gregg-miskelly/corefx,manu-silicon/corefx,krytarowski/corefx,richlander/corefx,huanjie/corefx,uhaciogullari/corefx,cydhaselton/corefx,Jiayili1/corefx,benpye/corefx,twsouthwick/corefx,yizhang82/corefx,vs-team/corefx,billwert/corefx,CherryCxldn/corefx,cydhaselton/corefx,dhoehna/corefx,ViktorHofer/corefx,josguil/corefx,khdang/corefx,nchikanov/corefx,wtgodbe/corefx,andyhebear/corefx,zhenlan/corefx,alexperovich/corefx,mmitche/corefx,BrennanConroy/corefx,shmao/corefx,elijah6/corefx,rubo/corefx,690486439/corefx,nchikanov/corefx,mokchhya/corefx,cnbin/corefx,ellismg/corefx,heXelium/corefx,richlander/corefx,Priya91/corefx-1,YoupHulsebos/corefx,wtgodbe/corefx,dhoehna/corefx,nelsonsar/corefx,huanjie/corefx,rahku/corefx,rahku/corefx,dhoehna/corefx,rubo/corefx,690486439/corefx,shana/corefx,kyulee1/corefx,jlin177/corefx,zhangwenquan/corefx,CloudLens/corefx,elijah6/corefx,DnlHarvey/corefx,nbarbettini/corefx,cartermp/corefx,jhendrixMSFT/corefx,MaggieTsang/corefx,ptoonen/corefx,dkorolev/corefx,weltkante/corefx,alexandrnikitin/corefx,jhendrixMSFT/corefx,gabrielPeart/corefx,zmaruo/corefx,ravimeda/corefx,alexandrnikitin/corefx,mellinoe/corefx,parjong/corefx,axelheer/corefx,mmitche/corefx,josguil/corefx,Alcaro/corefx,kyulee1/corefx,gkhanna79/corefx,jhendrixMSFT/corefx,vidhya-bv/corefx-sorting,vs-team/corefx,shimingsg/corefx,rahku/corefx,Chrisboh/corefx,Ermiar/corefx,tstringer/corefx,Priya91/corefx-1,stormleoxia/corefx,zhenlan/corefx,shrutigarg/corefx,gabrielPeart/corefx,jcme/corefx,axelheer/corefx,ViktorHofer/corefx,manu-silicon/corefx,gkhanna79/corefx,nbarbettini/corefx,ericstj/corefx,mokchhya/corefx,shrutigarg/corefx,dotnet-bot/corefx,DnlHarvey/corefx,iamjasonp/corefx,MaggieTsang/corefx,jlin177/corefx,billwert/corefx,stone-li/corefx,krk/corefx,CherryCxldn/corefx,billwert/corefx,nchikanov/corefx,rjxby/corefx,BrennanConroy/corefx,shmao/corefx,zhenlan/corefx,cartermp/corefx,Petermarcu/corefx,matthubin/corefx,axelheer/corefx,YoupHulsebos/corefx,chaitrakeshav/corefx,JosephTremoulet/corefx,comdiv/corefx,cydhaselton/corefx,janhenke/corefx,richlander/corefx,shahid-pk/corefx,kkurni/corefx,dhoehna/corefx,tijoytom/corefx,Ermiar/corefx,pallavit/corefx,jlin177/corefx,mmitche/corefx,690486439/corefx,vs-team/corefx,twsouthwick/corefx,Chrisboh/corefx,690486439/corefx,DnlHarvey/corefx,pgavlin/corefx,lydonchandra/corefx,n1ghtmare/corefx,elijah6/corefx,dtrebbien/corefx,wtgodbe/corefx,ravimeda/corefx,krytarowski/corefx,alphonsekurian/corefx,yizhang82/corefx,pallavit/corefx,oceanho/corefx,the-dwyer/corefx,zhenlan/corefx,tstringer/corefx,Frank125/corefx,SGuyGe/corefx,ptoonen/corefx,Chrisboh/corefx,stone-li/corefx,elijah6/corefx,nelsonsar/corefx,shrutigarg/corefx,matthubin/corefx,lydonchandra/corefx,lggomez/corefx,krk/corefx,n1ghtmare/corefx,690486439/corefx,ViktorHofer/corefx,SGuyGe/corefx,krk/corefx,stormleoxia/corefx,fgreinacher/corefx,yizhang82/corefx,cartermp/corefx,parjong/corefx,JosephTremoulet/corefx,chaitrakeshav/corefx,dkorolev/corefx,huanjie/corefx,nelsonsar/corefx,krytarowski/corefx,rjxby/corefx,mazong1123/corefx,pallavit/corefx,mmitche/corefx,mellinoe/corefx,parjong/corefx,khdang/corefx,janhenke/corefx,marksmeltzer/corefx,Ermiar/corefx,anjumrizwi/corefx,gabrielPeart/corefx,krytarowski/corefx,adamralph/corefx,mellinoe/corefx,comdiv/corefx,YoupHulsebos/corefx,zhenlan/corefx,ravimeda/corefx,alexandrnikitin/corefx,lggomez/corefx,vrassouli/corefx,Ermiar/corefx,s0ne0me/corefx,alphonsekurian/corefx,marksmeltzer/corefx,iamjasonp/corefx,cydhaselton/corefx,brett25/corefx,benjamin-bader/corefx,ericstj/corefx,marksmeltzer/corefx,rahku/corefx,elijah6/corefx,josguil/corefx,billwert/corefx,MaggieTsang/corefx,dtrebbien/corefx,seanshpark/corefx,ptoonen/corefx,tstringer/corefx,kkurni/corefx,the-dwyer/corefx,tijoytom/corefx,fgreinacher/corefx,ravimeda/corefx,parjong/corefx,dotnet-bot/corefx,mazong1123/corefx,shmao/corefx,Yanjing123/corefx,parjong/corefx,benpye/corefx,alphonsekurian/corefx,stephenmichaelf/corefx,tijoytom/corefx,CloudLens/corefx,vrassouli/corefx,JosephTremoulet/corefx,zmaruo/corefx,wtgodbe/corefx,benpye/corefx,zhangwenquan/corefx,PatrickMcDonald/corefx,ravimeda/corefx,janhenke/corefx,pallavit/corefx,zhangwenquan/corefx,s0ne0me/corefx,KrisLee/corefx,YoupHulsebos/corefx,Petermarcu/corefx,shimingsg/corefx,JosephTremoulet/corefx,tstringer/corefx,JosephTremoulet/corefx,Ermiar/corefx,SGuyGe/corefx,n1ghtmare/corefx,rajansingh10/corefx,billwert/corefx,twsouthwick/corefx,cydhaselton/corefx,rajansingh10/corefx,tstringer/corefx,shimingsg/corefx,nelsonsar/corefx,vidhya-bv/corefx-sorting,ptoonen/corefx,weltkante/corefx,rubo/corefx,vidhya-bv/corefx-sorting,heXelium/corefx,cnbin/corefx,nbarbettini/corefx,nchikanov/corefx,jhendrixMSFT/corefx,richlander/corefx,Jiayili1/corefx,vs-team/corefx,dsplaisted/corefx,ellismg/corefx,richlander/corefx,bitcrazed/corefx,seanshpark/corefx,rahku/corefx,tijoytom/corefx,cartermp/corefx,jcme/corefx,SGuyGe/corefx,Jiayili1/corefx,rjxby/corefx,PatrickMcDonald/corefx,ViktorHofer/corefx,jlin177/corefx,ptoonen/corefx,twsouthwick/corefx,janhenke/corefx,Priya91/corefx-1,zhenlan/corefx,uhaciogullari/corefx,lggomez/corefx,krytarowski/corefx,Chrisboh/corefx,tijoytom/corefx,kkurni/corefx,Yanjing123/corefx,shahid-pk/corefx,stephenmichaelf/corefx,mafiya69/corefx,alexperovich/corefx,nbarbettini/corefx,axelheer/corefx,dsplaisted/corefx,wtgodbe/corefx,benjamin-bader/corefx,adamralph/corefx,fgreinacher/corefx,BrennanConroy/corefx,shahid-pk/corefx,shana/corefx,kkurni/corefx,Frank125/corefx,gkhanna79/corefx,akivafr123/corefx,alphonsekurian/corefx,stephenmichaelf/corefx,mazong1123/corefx,lggomez/corefx,bitcrazed/corefx,josguil/corefx,dkorolev/corefx,mellinoe/corefx,oceanho/corefx,pgavlin/corefx,zmaruo/corefx,Yanjing123/corefx,jcme/corefx,mafiya69/corefx,nchikanov/corefx,SGuyGe/corefx,DnlHarvey/corefx,alexperovich/corefx,parjong/corefx,twsouthwick/corefx,dsplaisted/corefx,dotnet-bot/corefx,shmao/corefx,pallavit/corefx,alexperovich/corefx,heXelium/corefx,MaggieTsang/corefx,mokchhya/corefx,rjxby/corefx,weltkante/corefx,mazong1123/corefx,stone-li/corefx,huanjie/corefx,jeremymeng/corefx,PatrickMcDonald/corefx,lydonchandra/corefx,ravimeda/corefx,marksmeltzer/corefx,gregg-miskelly/corefx,shimingsg/corefx,brett25/corefx,seanshpark/corefx,mmitche/corefx,MaggieTsang/corefx,larsbj1988/corefx,kkurni/corefx,mokchhya/corefx,fgreinacher/corefx,krytarowski/corefx,stone-li/corefx,shimingsg/corefx,brett25/corefx,alphonsekurian/corefx,comdiv/corefx,ericstj/corefx,Alcaro/corefx,KrisLee/corefx,bitcrazed/corefx,alexandrnikitin/corefx,parjong/corefx,Priya91/corefx-1,stephenmichaelf/corefx,adamralph/corefx,larsbj1988/corefx,mokchhya/corefx,manu-silicon/corefx,Priya91/corefx-1,manu-silicon/corefx,cartermp/corefx,alphonsekurian/corefx,khdang/corefx,heXelium/corefx,nbarbettini/corefx,dtrebbien/corefx,yizhang82/corefx,josguil/corefx,Frank125/corefx,rjxby/corefx,Frank125/corefx,shrutigarg/corefx,gkhanna79/corefx,zhenlan/corefx,mmitche/corefx,cydhaselton/corefx,janhenke/corefx,shmao/corefx,bitcrazed/corefx,kyulee1/corefx,akivafr123/corefx,DnlHarvey/corefx,larsbj1988/corefx,CloudLens/corefx,benjamin-bader/corefx,rahku/corefx,yizhang82/corefx,PatrickMcDonald/corefx,Priya91/corefx-1,DnlHarvey/corefx,ellismg/corefx,comdiv/corefx,josguil/corefx,axelheer/corefx,shmao/corefx,DnlHarvey/corefx,the-dwyer/corefx,MaggieTsang/corefx,andyhebear/corefx,weltkante/corefx,benjamin-bader/corefx,akivafr123/corefx,shimingsg/corefx,KrisLee/corefx,shahid-pk/corefx,manu-silicon/corefx,lggomez/corefx,axelheer/corefx,dotnet-bot/corefx,Jiayili1/corefx,uhaciogullari/corefx,shimingsg/corefx,seanshpark/corefx,jeremymeng/corefx,rubo/corefx,rahku/corefx,khdang/corefx,khdang/corefx,shahid-pk/corefx,shana/corefx,cnbin/corefx,nbarbettini/corefx,brett25/corefx,bitcrazed/corefx,tstringer/corefx,oceanho/corefx,akivafr123/corefx,lydonchandra/corefx,vrassouli/corefx,iamjasonp/corefx,Jiayili1/corefx,yizhang82/corefx,gabrielPeart/corefx,jlin177/corefx,uhaciogullari/corefx,mafiya69/corefx,pallavit/corefx,Chrisboh/corefx,kyulee1/corefx,mokchhya/corefx,ericstj/corefx,twsouthwick/corefx,ellismg/corefx,Jiayili1/corefx,vrassouli/corefx,the-dwyer/corefx,weltkante/corefx,ericstj/corefx,krk/corefx,tijoytom/corefx,JosephTremoulet/corefx,dhoehna/corefx,andyhebear/corefx,elijah6/corefx,benpye/corefx,gkhanna79/corefx,stephenmichaelf/corefx,Yanjing123/corefx,marksmeltzer/corefx,the-dwyer/corefx,CherryCxldn/corefx,mellinoe/corefx,stephenmichaelf/corefx,mazong1123/corefx,mafiya69/corefx,Yanjing123/corefx,shana/corefx,jhendrixMSFT/corefx,CloudLens/corefx,anjumrizwi/corefx,shmao/corefx,richlander/corefx,zhangwenquan/corefx,khdang/corefx,iamjasonp/corefx,pgavlin/corefx,matthubin/corefx,the-dwyer/corefx,dotnet-bot/corefx,YoupHulsebos/corefx,jeremymeng/corefx,gkhanna79/corefx,ViktorHofer/corefx,weltkante/corefx,s0ne0me/corefx,stone-li/corefx,alexandrnikitin/corefx,nbarbettini/corefx,akivafr123/corefx,ericstj/corefx,iamjasonp/corefx
|
src/Common/src/Interop/Unix/libcrypto/Interop.EcKey.cs
|
src/Common/src/Interop/Unix/libcrypto/Interop.EcKey.cs
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using Microsoft.Win32.SafeHandles;
internal static partial class Interop
{
internal static partial class libcrypto
{
[DllImport(Libraries.LibCrypto)]
internal static extern void EC_KEY_free(IntPtr r);
[DllImport(Libraries.LibCrypto)]
internal static extern SafeEcKeyHandle EC_KEY_new_by_curve_name(int nid);
[DllImport(Libraries.LibCrypto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EC_KEY_generate_key(SafeEcKeyHandle eckey);
[DllImport(Libraries.LibCrypto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EC_KEY_up_ref(IntPtr r);
internal static int EcKeyGetCurveName(SafeEcKeyHandle ecKey)
{
bool mustRelease = false;
try
{
ecKey.DangerousAddRef(ref mustRelease);
IntPtr ecGroup = EC_KEY_get0_group(ecKey.DangerousGetHandle());
int nid = EC_GROUP_get_curve_name(ecGroup);
return nid;
}
finally
{
if (mustRelease)
{
ecKey.DangerousRelease();
}
}
}
// This P/Invoke is a classic GC trap, so we're only exposing it via a safe helper (EcKeyGetCurveName)
[DllImport(Libraries.LibCrypto)]
private static extern IntPtr EC_KEY_get0_group(IntPtr key);
// This P/Invoke is a classic GC trap, so we're only exposing it via a safe helper (EcKeyGetCurveName)
[DllImport(Libraries.LibCrypto)]
private static extern int EC_GROUP_get_curve_name(IntPtr ecGroup);
}
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using Microsoft.Win32.SafeHandles;
internal static partial class Interop
{
internal static partial class libcrypto
{
[DllImport(Libraries.LibCrypto)]
internal static extern void EC_KEY_free(IntPtr r);
[DllImport(Libraries.LibCrypto)]
internal static extern SafeEcKeyHandle EC_KEY_new_by_curve_name(int nid);
[DllImport(Libraries.LibCrypto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EC_KEY_generate_key(SafeEcKeyHandle eckey);
[DllImport(Libraries.LibCrypto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EC_KEY_up_ref(IntPtr r);
internal static int EcKeyGetCurveName(SafeEcKeyHandle ecKey)
{
IntPtr ecGroup = EC_KEY_get0_group(ecKey.DangerousGetHandle());
int nid = EC_GROUP_get_curve_name(ecGroup);
GC.KeepAlive(ecKey);
return nid;
}
// This P/Invoke is a classic GC trap, so we're only exposing it via a safe helper (EcKeyGetCurveName)
[DllImport(Libraries.LibCrypto)]
private static extern IntPtr EC_KEY_get0_group(IntPtr key);
// This P/Invoke is a classic GC trap, so we're only exposing it via a safe helper (EcKeyGetCurveName)
[DllImport(Libraries.LibCrypto)]
private static extern int EC_GROUP_get_curve_name(IntPtr ecGroup);
}
}
|
mit
|
C#
|
62e35dfa9d4308fdeb5f379228484c3b59b980ea
|
update Copyright
|
tainicom/Aether
|
Source/Properties/AssemblyInfo.cs
|
Source/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("Aether")]
[assembly: AssemblyProduct("Aether Engine")]
[assembly: AssemblyDescription("Modular game engine")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © Kastellanos Nikolaos 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
// 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.
// Only Windows assemblies support COM.
[assembly: ComVisible(false)]
// On Windows, the following GUID is for the ID of the typelib if this
// project is exposed to COM. On other platforms, it unique identifies the
// title storage container when deploying this assembly to the device.
[assembly: Guid("62df5d37-ce4d-4a92-b5b1-ff1910ef2448")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("0.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.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("Aether")]
[assembly: AssemblyProduct("Aether Engine")]
[assembly: AssemblyDescription("Modular game engine")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © Kastellanos Nikolaos 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]
// 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.
// Only Windows assemblies support COM.
[assembly: ComVisible(false)]
// On Windows, the following GUID is for the ID of the typelib if this
// project is exposed to COM. On other platforms, it unique identifies the
// title storage container when deploying this assembly to the device.
[assembly: Guid("62df5d37-ce4d-4a92-b5b1-ff1910ef2448")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("0.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
|
apache-2.0
|
C#
|
3f3e5d87fc15a848781ddfab5c76c36062a0ee69
|
Change Player.User to private set and add Player.Points
|
coldstorm/cac
|
cac/Player.cs
|
cac/Player.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetIRC;
namespace cac
{
public class Player
{
public User User { get; private set; }
public List<WhiteCard> Hand;
public int Points;
public Player(User user)
{
this.User = user;
this.Hand = new List<WhiteCard>();
this.Points = 0;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetIRC;
namespace cac
{
public class Player
{
private User User;
public List<WhiteCard> Hand;
public Player(User user)
{
this.User = user;
this.Hand = new List<WhiteCard>();
}
}
}
|
mit
|
C#
|
d65299e1144d361dd1b7a677fe07b5219fda1690
|
Simplify GetPassedTestsInfo with XDocument and XPath
|
abock/roslyn,bartdesmet/roslyn,KirillOsenkov/roslyn,genlu/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,KirillOsenkov/roslyn,weltkante/roslyn,jmarolf/roslyn,eriawan/roslyn,AlekseyTs/roslyn,eriawan/roslyn,agocke/roslyn,gafter/roslyn,tmat/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,tannergooding/roslyn,sharwell/roslyn,agocke/roslyn,reaction1989/roslyn,davkean/roslyn,wvdd007/roslyn,abock/roslyn,ErikSchierboom/roslyn,gafter/roslyn,mavasani/roslyn,weltkante/roslyn,diryboy/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,brettfo/roslyn,reaction1989/roslyn,tmat/roslyn,wvdd007/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,tmat/roslyn,shyamnamboodiripad/roslyn,panopticoncentral/roslyn,abock/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,KirillOsenkov/roslyn,davkean/roslyn,heejaechang/roslyn,physhi/roslyn,physhi/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,agocke/roslyn,aelij/roslyn,nguerrera/roslyn,brettfo/roslyn,stephentoub/roslyn,aelij/roslyn,physhi/roslyn,brettfo/roslyn,tannergooding/roslyn,bartdesmet/roslyn,dotnet/roslyn,davkean/roslyn,jasonmalinowski/roslyn,genlu/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,jasonmalinowski/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,ErikSchierboom/roslyn,genlu/roslyn,weltkante/roslyn,AlekseyTs/roslyn,tannergooding/roslyn,gafter/roslyn,diryboy/roslyn,panopticoncentral/roslyn,KevinRansom/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,reaction1989/roslyn,nguerrera/roslyn,jmarolf/roslyn,stephentoub/roslyn,AmadeusW/roslyn,dotnet/roslyn,KevinRansom/roslyn,dotnet/roslyn,AmadeusW/roslyn,eriawan/roslyn,diryboy/roslyn,panopticoncentral/roslyn
|
src/EditorFeatures/TestUtilities/Threading/TestInfo.cs
|
src/EditorFeatures/TestUtilities/Threading/TestInfo.cs
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using System.IO;
using System.Xml.Linq;
using System.Xml.XPath;
namespace Roslyn.Test.Utilities
{
public readonly struct TestInfo
{
public decimal Time { get; }
public TestInfo(decimal time)
{
Time = time;
}
public static ImmutableDictionary<string, TestInfo> GetPassedTestsInfo()
{
var result = ImmutableDictionary.CreateBuilder<string, TestInfo>();
var filePath = System.Environment.GetEnvironmentVariable("OutputXmlFilePath");
if (filePath != null)
{
if (File.Exists(filePath))
{
var doc = XDocument.Load(filePath);
foreach (var test in doc.XPathSelectElements("/assemblies/assembly/collection/test[@result='Pass']"))
{
if (decimal.TryParse(test.Attribute("time").Value, out var time))
{
result.Add(test.Attribute("name").Value, new TestInfo(time));
}
}
}
}
return result.ToImmutable();
}
}
}
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.IO;
using System.Xml;
namespace Roslyn.Test.Utilities
{
public struct TestInfo
{
public decimal Time { get; }
public TestInfo(decimal time)
{
Time = time;
}
public static IDictionary<string, TestInfo> GetPassedTestsInfo()
{
var result = new Dictionary<string, TestInfo>();
var filePath = System.Environment.GetEnvironmentVariable("OutputXmlFilePath");
if (filePath != null)
{
if (File.Exists(filePath))
{
var doc = new XmlDocument();
doc.Load(filePath);
foreach (XmlNode assemblies in doc.SelectNodes("assemblies"))
{
foreach (XmlNode assembly in assemblies.SelectNodes("assembly"))
{
foreach (XmlNode collection in assembly.SelectNodes("collection"))
{
foreach (XmlNode test in assembly.SelectNodes("test"))
{
if (test.SelectNodes("failure").Count == 0)
{
if (decimal.TryParse(test.Attributes["time"].InnerText, out var time))
{
result.Add(test.Name, new TestInfo(time));
}
}
}
}
}
}
}
}
return result;
}
}
}
|
mit
|
C#
|
a951730cb24aaeb52c144e63196add9eff427dc3
|
Add FolderId to Surveys
|
bcemmett/SurveyMonkeyApi-v3
|
SurveyMonkey/Containers/Survey.cs
|
SurveyMonkey/Containers/Survey.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class Survey : IPageableContainer
{
public long? Id { get; set; }
public string Title { get; set; }
public string Nickname { get; set; }
public string Category { get; set; }
public string Language { get; set; }
public bool? IsOwner { get; set; }
public int? PageCount { get; set; }
public int? QuestionCount { get; set; }
public int? ResponseCount { get; set; }
public DateTime? DateCreated { get; set; }
public DateTime? DateModified { get; set; }
public ButtonsText ButtonsText { get; set; }
internal string Href { get; set; }
public long? FolderId { get; set; }
public string Preview { get; set; }
public string EditUrl { get; set; }
public string CollectUrl { get; set; }
public string AnalyzeUrl { get; set; }
public string SummaryUrl { get; set; }
public bool? Footer { get; set; }
public Dictionary<string, string> CustomVariables { get; set; }
public List<Page> Pages { get; set; }
public List<Collector> Collectors { get; set; }
public List<Response> Responses { get; set; }
public List<Question> Questions {
get { return Pages?.SelectMany(page => page.Questions).ToList(); }
}
internal Dictionary<long, Question> QuestionsLookup { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
namespace SurveyMonkey.Containers
{
[JsonConverter(typeof(TolerantJsonConverter))]
public class Survey : IPageableContainer
{
public long? Id { get; set; }
public string Title { get; set; }
public string Nickname { get; set; }
public string Category { get; set; }
public string Language { get; set; }
public bool? IsOwner { get; set; }
public int? PageCount { get; set; }
public int? QuestionCount { get; set; }
public int? ResponseCount { get; set; }
public DateTime? DateCreated { get; set; }
public DateTime? DateModified { get; set; }
public ButtonsText ButtonsText { get; set; }
internal string Href { get; set; }
public string Preview { get; set; }
public string EditUrl { get; set; }
public string CollectUrl { get; set; }
public string AnalyzeUrl { get; set; }
public string SummaryUrl { get; set; }
public bool? Footer { get; set; }
public Dictionary<string, string> CustomVariables { get; set; }
public List<Page> Pages { get; set; }
public List<Collector> Collectors { get; set; }
public List<Response> Responses { get; set; }
public List<Question> Questions {
get { return Pages?.SelectMany(page => page.Questions).ToList(); }
}
internal Dictionary<long, Question> QuestionsLookup { get; set; }
}
}
|
mit
|
C#
|
919c37293714c18cd024d3c7ac298d3b9f4038ed
|
make ref internal
|
titanium007/Titanium-Web-Proxy,justcoding121/Titanium-Web-Proxy,titanium007/Titanium
|
Titanium.Web.Proxy/Helpers/Ref.cs
|
Titanium.Web.Proxy/Helpers/Ref.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Titanium.Web.Proxy.Helpers
{
internal class Ref<T>
{
internal Ref()
{
}
internal Ref(T value)
{
Value = value;
}
internal T Value { get; set; }
public override string ToString()
{
T value = Value;
return value == null ? string.Empty : value.ToString();
}
public static implicit operator T(Ref<T> r)
{
return r.Value;
}
public static implicit operator Ref<T>(T value)
{
return new Ref<T>(value);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Titanium.Web.Proxy.Helpers
{
public class Ref<T>
{
public Ref()
{
}
public Ref(T value)
{
Value = value;
}
public T Value { get; set; }
public override string ToString()
{
T value = Value;
return value == null ? string.Empty : value.ToString();
}
public static implicit operator T(Ref<T> r)
{
return r.Value;
}
public static implicit operator Ref<T>(T value)
{
return new Ref<T>(value);
}
}
}
|
mit
|
C#
|
574e726d3610d1df3f31f2ac1af7af7021e817cb
|
Fix null category search bug
|
wrightg42/todo-list,It423/todo-list
|
Todo-List/Todo-List/NoteSorter.cs
|
Todo-List/Todo-List/NoteSorter.cs
|
// NoteSorter.cs
// <copyright file="NoteSorter.cs"> This code is protected under the MIT License. </copyright>
using System.Collections.Generic;
using System.Linq;
namespace Todo_List
{
/// <summary>
/// A static class containing a list of notes and methods for sorting them.
/// </summary>
public static class NoteSorter
{
/// <summary>
/// Initializes static members of the <see cref="NoteSorter" /> class.
/// </summary>
public static NoteSorter()
{
Notes = new List<Note>();
}
/// <summary>
/// Gets or sets the list of notes currently stored in the program.
/// </summary>
public static List<Note> Notes { get; set; }
/// <summary>
/// Gets all the notes with certain category tags.
/// </summary>
/// <param name="categoryNames"> The list of categories. </param>
/// <returns> The list of notes under the category. </returns>
/// <remarks> No category names in the list means all categories. </remarks>
public static List<Note> GetNotesByCatagory(List<string> categoryNames)
{
IEnumerable<Note> notesUnderCategories = Notes;
foreach (string catergory in categoryNames)
{
notesUnderCategories = notesUnderCategories.Where(n => n.Categories.Contains(catergory.ToUpper()));
}
return notesUnderCategories.ToList();
}
}
}
|
// NoteSorter.cs
// <copyright file="NoteSorter.cs"> This code is protected under the MIT License. </copyright>
using System.Collections.Generic;
using System.Linq;
namespace Todo_List
{
/// <summary>
/// A static class containing a list of notes and methods for sorting them.
/// </summary>
public static class NoteSorter
{
/// <summary>
/// Initializes static members of the <see cref="NoteSorter" /> class.
/// </summary>
public static NoteSorter()
{
Notes = new List<Note>();
}
/// <summary>
/// Gets or sets the list of notes currently stored in the program.
/// </summary>
public static List<Note> Notes { get; set; }
/// <summary>
/// Gets all the notes with certain category tags.
/// </summary>
/// <param name="categoryNames"> The list of categories. </param>
/// <returns> The list of notes under the category. </returns>
/// <remarks> Null categories means all categories.</remarks>
public static List<Note> GetNotesByCatagory(List<string> categoryNames = null)
{
IEnumerable<Note> notesUnderCategories = Notes;
foreach (string catergory in categoryNames)
{
notesUnderCategories = notesUnderCategories.Where(n => n.Categories.Contains(catergory.ToUpper()));
}
return notesUnderCategories.ToList();
}
}
}
|
mit
|
C#
|
67cff7307dffdb8294cfb2cd1192867f079ee634
|
Fix test name and assertion.
|
elastic/elasticsearch-net,elastic/elasticsearch-net
|
src/Tests/Reproduce/GithubIssue2985.cs
|
src/Tests/Reproduce/GithubIssue2985.cs
|
using System;
using Elastic.Xunit.Sdk;
using Elastic.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Tests.Framework.ManagedElasticsearch.Clusters;
namespace Tests.Reproduce
{
public class GithubIssue2985 : IClusterFixture<WritableCluster>
{
private readonly WritableCluster _cluster;
public GithubIssue2985(WritableCluster cluster) => _cluster = cluster;
protected static string RandomString() => Guid.NewGuid().ToString("N").Substring(0, 8);
[I]
public void BadRequestErrorShouldBeWrappedInElasticsearchClientException()
{
var client = _cluster.Client;
var index = $"gh2985-{RandomString()}";
var response = client.CreateIndex(index, i=> i
.Settings(s=>s
.Analysis(a=>a
.Analyzers(an=>an
.Custom("custom", c=>c.Filters("ascii_folding").Tokenizer("standard"))
)
)
)
);
response.OriginalException.Should().NotBeNull().And.BeOfType<ElasticsearchClientException>();
response.OriginalException.Message.Should()
.Contain(
"Type: illegal_argument_exception Reason: \"Custom Analyzer [custom] failed to find filter under name [ascii_folding]\""
);
client.DeleteIndex(index);
}
}
}
|
using System;
using Elastic.Xunit.Sdk;
using Elastic.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Tests.Framework.ManagedElasticsearch.Clusters;
namespace Tests.Reproduce
{
public class GithubIssue2985 : IClusterFixture<WritableCluster>
{
private readonly WritableCluster _cluster;
public GithubIssue2985(WritableCluster cluster) => _cluster = cluster;
protected static string RandomString() => Guid.NewGuid().ToString("N").Substring(0, 8);
[I]
public void CanReadSingleOrMultipleCommonGramsCommonWordsItem()
{
var client = _cluster.Client;
var index = $"gh2985-{RandomString()}";
var response = client.CreateIndex(index, i=> i
.Settings(s=>s
.Analysis(a=>a
.Analyzers(an=>an
.Custom("custom", c=>c.Filters("ascii_folding").Tokenizer("standard"))
)
)
)
);
response.OriginalException.Should().NotBeNull().And.BeOfType<ElasticsearchClientException>();
response.OriginalException.Message.Should()
.StartWith("Request failed to execute")
.And.EndWith(
"Type: illegal_argument_exception Reason: \"Custom Analyzer [custom] failed to find filter under name [ascii_folding]\""
);
client.DeleteIndex(index);
}
}
}
|
apache-2.0
|
C#
|
85c803d981f34c7632ad0a70e8619106e8fd745c
|
Update TestExtensions.cs
|
SimonCropp/NServiceBus.Serilog
|
src/Tests/TestConfig/TestExtensions.cs
|
src/Tests/TestConfig/TestExtensions.cs
|
using System.Collections.Generic;
using System.Linq;
using NServiceBus;
using Serilog.Events;
public static class TestExtensions
{
public static void DisableRetries(this EndpointConfiguration configuration)
{
var recoverability = configuration.Recoverability();
recoverability.Delayed(settings => { settings.NumberOfRetries(0); });
recoverability.Immediate(settings => { settings.NumberOfRetries(0); });
}
public static IEnumerable<LogEventEx> LogsForNsbSerilog(this IEnumerable<LogEventEx> logs)
{
return logs.Where(log =>
{
var sourceContext = log.StringSourceContext();
return sourceContext != null && sourceContext.StartsWith("NServiceBus.Serilog.");
})
.OrderBy(x => x.MessageTemplate.Text);
}
public static IEnumerable<LogEventEx> LogsWithExceptions(this IEnumerable<LogEventEx> logs)
{
return logs.Where(x => x.Exception!=null);
}
public static IEnumerable<LogEventEx> LogsForType<T>(this IEnumerable<LogEventEx> logs)
{
return LogsForName(logs, typeof(T).Name)
.OrderBy(x => x.MessageTemplate.Text);
}
public static IEnumerable<LogEventEx> LogsForName(this IEnumerable<LogEventEx> logs, string name)
{
return logs.Where(log => log.StringSourceContext() == name)
.OrderBy(x => x.StringSourceContext());
}
public static string StringSourceContext(this LogEventEx log)
{
if (log.Properties.TryGetValue("SourceContext", out var sourceContext))
{
if (sourceContext is ScalarValue scalarValue)
{
if (scalarValue.Value is string temp)
{
return temp;
}
}
}
return null;
}
}
|
using System.Collections.Generic;
using System.Linq;
using NServiceBus;
using Serilog.Events;
public static class TestExtensions
{
public static void DisableRetries(this EndpointConfiguration configuration)
{
var recoverability = configuration.Recoverability();
recoverability.Delayed(settings => { settings.NumberOfRetries(0); });
recoverability.Immediate(settings => { settings.NumberOfRetries(0); });
}
public static IEnumerable<LogEventEx> LogsForNsbSerilog(this IEnumerable<LogEventEx> logs)
{
return logs.Where(log =>
{
var sourceContext = log.StringSourceContext();
return sourceContext != null && sourceContext.StartsWith("NServiceBus.Serilog.");
})
.OrderBy(x => x.MessageTemplate.Text);
}
public static IEnumerable<LogEventEx> LogsWithExceptions(this IEnumerable<LogEventEx> logs)
{
return logs.Where(x=>x.Exception!=null);
}
public static IEnumerable<LogEventEx> LogsForType<T>(this IEnumerable<LogEventEx> logs)
{
return LogsForName(logs, typeof(T).Name)
.OrderBy(x => x.MessageTemplate.Text);
}
public static IEnumerable<LogEventEx> LogsForName(this IEnumerable<LogEventEx> logs, string name)
{
return logs.Where(log => log.StringSourceContext() == name)
.OrderBy(x => x.StringSourceContext());
}
public static string StringSourceContext(this LogEventEx log)
{
if (log.Properties.TryGetValue("SourceContext", out var sourceContext))
{
if (sourceContext is ScalarValue scalarValue)
{
if (scalarValue.Value is string temp)
{
return temp;
}
}
}
return null;
}
}
|
mit
|
C#
|
acef2e50c00017edf9c6c0620bff189e4436a42a
|
add try/catch to 'sendToSplunk'
|
sebastus/AzureFunctionForSplunk
|
shared/sendToSplunkLAD30.csx
|
shared/sendToSplunkLAD30.csx
|
#r "Newtonsoft.Json"
using System;
using System.Dynamic;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public class SingleHttpClientInstance
{
private static readonly HttpClient HttpClient;
static SingleHttpClientInstance()
{
HttpClient = new HttpClient();
}
public static async Task<HttpResponseMessage> SendToSplunk(HttpRequestMessage req)
{
HttpResponseMessage response = await HttpClient.SendAsync(req);
return response;
}
}
static async Task SendMessagesToSplunk(string[] messages, TraceWriter log)
{
var converter = new ExpandoObjectConverter();
ServicePointManager.ServerCertificateValidationCallback =
new System.Net.Security.RemoteCertificateValidationCallback(
delegate { return true; });
var client = new SingleHttpClientInstance();
string newClientContent = "";
foreach (var message in messages)
{
try {
dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(message, converter);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
newClientContent += "{\"event\": " + json + "}";
} catch (Exception e) {
log.Info($"Error {e} caught while parsing message: {message}");
}
}
try {
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "https://asplunktest.westus.cloudapp.azure.com:8088/services/collector/event");
req.Headers.Accept.Clear();
req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
req.Headers.Add("Authorization", "Splunk 73A24AB7-60DD-4235-BF71-D892AE47F49D");
req.Content = new StringContent(newClientContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = await SingleHttpClientInstance.SendToSplunk(req);
} catch (Exception e) {
log.Info($"Error {e} caught while sending to Splunk: {message}");
}
}
|
#r "Newtonsoft.Json"
using System;
using System.Dynamic;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public class SingleHttpClientInstance
{
private static readonly HttpClient HttpClient;
static SingleHttpClientInstance()
{
HttpClient = new HttpClient();
}
public static async Task<HttpResponseMessage> SendToSplunk(HttpRequestMessage req)
{
HttpResponseMessage response = await HttpClient.SendAsync(req);
return response;
}
}
static async Task SendMessagesToSplunk(string[] messages, TraceWriter log)
{
var converter = new ExpandoObjectConverter();
ServicePointManager.ServerCertificateValidationCallback =
new System.Net.Security.RemoteCertificateValidationCallback(
delegate { return true; });
var client = new SingleHttpClientInstance();
string newClientContent = "";
foreach (var message in messages)
{
try {
dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(message, converter);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
newClientContent += "{\"event\": " + json + "}";
} catch (Exception e) {
log.Info($"Error {e} caught while parsing message: {message}");
}
}
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "https://asplunktest.westus.cloudapp.azure.com:8088/services/collector/event");
req.Headers.Accept.Clear();
req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
req.Headers.Add("Authorization", "Splunk 73A24AB7-60DD-4235-BF71-D892AE47F49D");
req.Content = new StringContent(newClientContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = await SingleHttpClientInstance.SendToSplunk(req);
}
|
mit
|
C#
|
702ff1538f85ae4947a71eb61388ce68de615d36
|
Change version
|
simplic-systems/simplic-cxui
|
src/Simplic.CXUI.IronPython/Properties/AssemblyInfo.cs
|
src/Simplic.CXUI.IronPython/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("Simplic.CXUI.IronPython")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Simplic.CXUI.IronPython")]
[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("be99abc0-c57a-4baa-9ea3-338bff47f20e")]
// 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.20.321")]
[assembly: AssemblyFileVersion("1.1.20.321")]
|
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("Simplic.CXUI.IronPython")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Simplic.CXUI.IronPython")]
[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("be99abc0-c57a-4baa-9ea3-338bff47f20e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.20.321")]
[assembly: AssemblyFileVersion("1.1.20.321")]
|
mit
|
C#
|
eee98ac1680735f777f52ac57980d63df56d30cb
|
change 'Service' to 'Rpc' for less name collisions
|
Kukkimonsuta/Odachi
|
src/Odachi.CodeModel.Providers.JsonRpc/PackageExtensions.cs
|
src/Odachi.CodeModel.Providers.JsonRpc/PackageExtensions.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using Odachi.AspNetCore.JsonRpc.Model;
using Odachi.CodeModel.Builders;
using Odachi.CodeModel.Mapping;
using Odachi.CodeModel.Providers.JsonRpc.Description;
using Odachi.Extensions.Formatting;
namespace Odachi.CodeModel
{
public static class PackageBuilderExtensions
{
public static PackageBuilder UseJsonRpc(this PackageBuilder builder)
{
builder.Context.MethodDescriptors.Add(new JsonRpcMethodDescriptor());
return builder;
}
public static PackageBuilder Modules_Class_JsonRpcService(this PackageBuilder builder, IEnumerable<JsonRpcMethod> methods)
{
if (methods == null)
throw new ArgumentNullException(nameof(methods));
var modules = methods.GroupBy(m => m.ModuleName, (k, g) => new
{
Name = k,
Methods = g.ToArray(),
});
foreach (var module in modules)
{
Module_Class_JsonRpcService(builder, $"{module.Name}Rpc", module.Methods);
}
return builder;
}
public static PackageBuilder Module_Class_JsonRpcService(this PackageBuilder builder, string fragmentName, IEnumerable<JsonRpcMethod> methods)
{
if (methods == null)
throw new ArgumentNullException(nameof(methods));
var moduleName = builder.Context.GlobalDescriptor.GetModuleName(builder.Context, fragmentName);
return builder
.Module(moduleName, module => module
.Class(fragmentName, c =>
{
c.Hint("logical-kind", "jsonrpc-service");
foreach (var method in methods)
{
c.Method(method.MethodName.ToPascalInvariant(), ClrTypeReference.Create(method.ReturnType?.NetType ?? typeof(void)), method, m =>
{
foreach (var parameter in method.Parameters.Where(p => !p.IsInternal))
{
m.Parameter(parameter.Name, ClrTypeReference.Create(parameter.Type.NetType), parameter);
}
});
}
})
);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Odachi.AspNetCore.JsonRpc.Model;
using Odachi.CodeModel.Builders;
using Odachi.CodeModel.Mapping;
using Odachi.CodeModel.Providers.JsonRpc.Description;
using Odachi.Extensions.Formatting;
namespace Odachi.CodeModel
{
public static class PackageBuilderExtensions
{
public static PackageBuilder UseJsonRpc(this PackageBuilder builder)
{
builder.Context.MethodDescriptors.Add(new JsonRpcMethodDescriptor());
return builder;
}
public static PackageBuilder Modules_Class_JsonRpcService(this PackageBuilder builder, IEnumerable<JsonRpcMethod> methods)
{
if (methods == null)
throw new ArgumentNullException(nameof(methods));
var modules = methods.GroupBy(m => m.ModuleName, (k, g) => new
{
Name = k,
Methods = g.ToArray(),
});
foreach (var module in modules)
{
Module_Class_JsonRpcService(builder, $"{module.Name}Service", module.Methods);
}
return builder;
}
public static PackageBuilder Module_Class_JsonRpcService(this PackageBuilder builder, string fragmentName, IEnumerable<JsonRpcMethod> methods)
{
if (methods == null)
throw new ArgumentNullException(nameof(methods));
var moduleName = builder.Context.GlobalDescriptor.GetModuleName(builder.Context, fragmentName);
return builder
.Module(moduleName, module => module
.Class(fragmentName, c =>
{
c.Hint("logical-kind", "jsonrpc-service");
foreach (var method in methods)
{
c.Method(method.MethodName.ToPascalInvariant(), ClrTypeReference.Create(method.ReturnType?.NetType ?? typeof(void)), method, m =>
{
foreach (var parameter in method.Parameters.Where(p => !p.IsInternal))
{
m.Parameter(parameter.Name, ClrTypeReference.Create(parameter.Type.NetType), parameter);
}
});
}
})
);
}
}
}
|
apache-2.0
|
C#
|
3a50b65ec3a64ca4faf197ba53dbcfd3d5c85bd3
|
Make the namespace uniform accross the project
|
12joan/hangman
|
table.cs
|
table.cs
|
using System;
namespace Hangman {
public class Table {
public int Width;
public int Spacing;
public Table(int width, int spacing) {
Width = width;
Spacing = spacing;
}
}
}
|
using System;
namespace Table {
public class Table {
public int Width;
public int Spacing;
public Table(int width, int spacing) {
Width = width;
Spacing = spacing;
}
}
}
|
unlicense
|
C#
|
9c84ff8d1b18f2b71ee3287306ca0eca28dd9eaf
|
Use object initializer instead
|
smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework
|
osu.Framework/Bindables/BindableSize.cs
|
osu.Framework/Bindables/BindableSize.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Drawing;
namespace osu.Framework.Bindables
{
/// <summary>
/// Represents a <see cref="Size"/> bindable with defined component-wise constraints applied to it.
/// </summary>
public class BindableSize : RangeConstrainedBindable<Size>
{
protected override Size DefaultMinValue => new Size(int.MinValue, int.MinValue);
protected override Size DefaultMaxValue => new Size(int.MaxValue, int.MaxValue);
public BindableSize(Size defaultValue = default)
: base(defaultValue)
{
}
public override string ToString() => $"{Value.Width}x{Value.Height}";
public override void Parse(object input)
{
switch (input)
{
case string str:
string[] split = str.Split('x');
if (split.Length != 2)
throw new ArgumentException($"Input string was in wrong format! (expected: '<width>x<height>', actual: '{str}')");
Value = new Size(int.Parse(split[0]), int.Parse(split[1]));
break;
default:
base.Parse(input);
break;
}
}
protected sealed override Size ClampValue(Size value, Size minValue, Size maxValue)
{
return new Size
{
Width = Math.Clamp(value.Width, minValue.Width, maxValue.Width),
Height = Math.Clamp(value.Height, minValue.Height, maxValue.Height)
};
}
protected sealed override bool IsValidRange(Size min, Size max) => min.Width <= max.Width && min.Height <= max.Height;
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Drawing;
namespace osu.Framework.Bindables
{
/// <summary>
/// Represents a <see cref="Size"/> bindable with defined component-wise constraints applied to it.
/// </summary>
public class BindableSize : RangeConstrainedBindable<Size>
{
protected override Size DefaultMinValue => new Size(int.MinValue, int.MinValue);
protected override Size DefaultMaxValue => new Size(int.MaxValue, int.MaxValue);
public BindableSize(Size defaultValue = default)
: base(defaultValue)
{
}
public override string ToString() => $"{Value.Width}x{Value.Height}";
public override void Parse(object input)
{
switch (input)
{
case string str:
string[] split = str.Split('x');
if (split.Length != 2)
throw new ArgumentException($"Input string was in wrong format! (expected: '<width>x<height>', actual: '{str}')");
Value = new Size(int.Parse(split[0]), int.Parse(split[1]));
break;
default:
base.Parse(input);
break;
}
}
protected sealed override Size ClampValue(Size value, Size minValue, Size maxValue)
{
return new Size
(
Math.Clamp(value.Width, minValue.Width, maxValue.Width),
Math.Clamp(value.Height, minValue.Height, maxValue.Height)
);
}
protected sealed override bool IsValidRange(Size min, Size max) => min.Width <= max.Width && min.Height <= max.Height;
}
}
|
mit
|
C#
|
a81461ba1222a4ba232591fab088c9b3a34a110b
|
Add ability to test without nofail enabled
|
EVAST9919/osu,peppy/osu,NeoAdonis/osu,ZLima12/osu,smoogipoo/osu,ZLima12/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,DrabWeb/osu,peppy/osu-new,2yangk23/osu,ppy/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,EVAST9919/osu,DrabWeb/osu,DrabWeb/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,2yangk23/osu,peppy/osu
|
osu.Game/Tests/Visual/PlayerTestCase.cs
|
osu.Game/Tests/Visual/PlayerTestCase.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
public abstract class PlayerTestCase : RateAdjustedBeatmapTestCase
{
private readonly Ruleset ruleset;
protected Player Player;
protected PlayerTestCase(Ruleset ruleset)
{
this.ruleset = ruleset;
Add(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Depth = int.MaxValue
});
AddStep(ruleset.RulesetInfo.Name, loadPlayer);
AddUntilStep(() => Player.IsLoaded, "player loaded");
}
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);
protected virtual bool AllowFail => false;
private void loadPlayer()
{
var beatmap = CreateBeatmap(ruleset);
Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock);
if (!AllowFail)
Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
LoadComponentAsync(Player = CreatePlayer(ruleset), p =>
{
Player = p;
LoadScreen(p);
});
}
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
};
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual
{
public abstract class PlayerTestCase : RateAdjustedBeatmapTestCase
{
private readonly Ruleset ruleset;
protected Player Player;
protected PlayerTestCase(Ruleset ruleset)
{
this.ruleset = ruleset;
Add(new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Depth = int.MaxValue
});
AddStep(ruleset.RulesetInfo.Name, loadPlayer);
AddUntilStep(() => Player.IsLoaded, "player loaded");
}
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);
private void loadPlayer()
{
var beatmap = CreateBeatmap(ruleset);
Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock);
Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
LoadComponentAsync(Player = CreatePlayer(ruleset), p =>
{
Player = p;
LoadScreen(p);
});
}
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player
{
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
};
}
}
|
mit
|
C#
|
13f682f27c48fbf57e78fabc65a0d624e8672f88
|
Simplify check and fix for new DynamicGetter
|
danielwertheim/structurizer
|
src/projects/Structurizer/Schemas/StructureProperty.cs
|
src/projects/Structurizer/Schemas/StructureProperty.cs
|
using System;
using Structurizer.Extensions;
namespace Structurizer.Schemas
{
public class StructureProperty : IStructureProperty
{
private readonly DynamicGetter _getter;
public string Name { get; }
public string Path { get; }
public Type DataType { get; }
public IStructureProperty Parent { get; }
public bool IsRootMember { get; }
public bool IsEnumerable { get; }
public bool IsElement { get; }
public Type ElementDataType { get; }
public StructureProperty(StructurePropertyInfo info, DynamicGetter getter)
{
_getter = getter;
Parent = info.Parent;
Name = info.Name;
DataType = info.DataType;
IsRootMember = info.Parent == null;
IsEnumerable = !DataType.IsSimpleType() && DataType.IsEnumerableType();
IsElement = Parent != null && (Parent.IsElement || Parent.IsEnumerable);
ElementDataType = IsEnumerable ? DataType.GetEnumerableElementType() : null;
Path = PropertyPathBuilder.BuildPath(this);
}
public object GetValue(object item) => _getter(item);
}
}
|
using System;
using Structurizer.Extensions;
namespace Structurizer.Schemas
{
public class StructureProperty : IStructureProperty
{
private readonly DynamicGetter _getter;
public string Name { get; }
public string Path { get; }
public Type DataType { get; }
public IStructureProperty Parent { get; }
public bool IsRootMember { get; }
public bool IsEnumerable { get; }
public bool IsElement { get; }
public Type ElementDataType { get; }
public StructureProperty(StructurePropertyInfo info, DynamicGetter getter)
{
_getter = getter;
Parent = info.Parent;
Name = info.Name;
DataType = info.DataType;
IsRootMember = info.Parent == null;
var isSimpleOrValueType = DataType.IsSimpleType() || DataType.IsValueType;
IsEnumerable = !isSimpleOrValueType && DataType.IsEnumerableType();
IsElement = Parent != null && (Parent.IsElement || Parent.IsEnumerable);
ElementDataType = IsEnumerable ? DataType.GetEnumerableElementType() : null;
Path = PropertyPathBuilder.BuildPath(this);
}
public virtual object GetValue(object item) => _getter.GetValue(item);
}
}
|
mit
|
C#
|
603a7680cb99ae670d134c6a83edd2d29242c00e
|
Update PlatformManager.cs
|
itsMilkid/Alien-Jump
|
Assets/Scripts/PlatformManager.cs
|
Assets/Scripts/PlatformManager.cs
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformManager : MonoBehaviour {
[Header("Prefabs")]
public GameObject platformPrefab;
[Header("Platform Placement")]
public float minYCoord;
public float maxYCoord;
[Header("Pooling Settings:")]
public int poolSize;
private float maxXCoord;
private bool lerpCamera;
private float lerpTime = 1.5f;
private float lerpXValue;
public List<GameObject> pooledPlatforms = new List<GameObject>();
public List<GameObject> activePlatforms = new List<GameObject>();
private void Awake(){
pooledPlatforms.Clear ();
activePlatforms.Clear ();
EvaluateScreensize ();
PopulatePlatformPool ();
}
private void Update(){
if (lerpCamera == true)
LerpCameraPosition ();
}
private void EvaluateScreensize(){
float distanceToScreen = transform.position.z - Camera.main.transform.position.z;
maxXCoord = Camera.main.ViewportToWorldPoint (new Vector3 (1, 0, distanceToScreen)).x - 1.0f;
}
private void PopulatePlatformPool(){
for (int i = 0; i < poolSize; i++) {
GameObject obj = Instantiate (platformPrefab, new Vector3 (-20, -20, 0), Quaternion.identity);
obj.SetActive (false);
pooledPlatforms.Add (obj);
}
}
public void InitiatePlatformSpawn(float _newPos){
ReplaceAndActivatePlatform ();
lerpXValue = _newPos + (maxXCoord - 5.0f);
lerpCamera = true;
}
private void ReplaceAndActivatePlatform(){
float cameraXPos = Camera.main.transform.position.x;
float newMaxXCoord = (maxXCoord * 2) + cameraXPos;
float platformPosX = Random.Range (newMaxXCoord, newMaxXCoord - 3f);
float platformPosY = Random.Range (minYCoord, maxYCoord);
Vector3 newPlatformPos = new Vector3 (platformPosX, platformPosY, 0);
GameObject newPlatform = pooledPlatforms [0];
newPlatform.transform.position = newPlatformPos;
newPlatform.SetActive (true);
pooledPlatforms.Remove (newPlatform);
activePlatforms.Add (newPlatform);
}
private void LerpCameraPosition(){
float currentCameraPositionX = Camera.main.transform.position.x;
float lerpPosition = Mathf.Lerp (currentCameraPositionX, lerpXValue, lerpTime * Time.deltaTime);
Camera.main.transform.position = new Vector3 (lerpPosition, Camera.main.transform.position.y, Camera.main.transform.position.z);
if (Camera.main.transform.position.x == lerpXValue) {
lerpCamera = false;
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformManager : MonoBehaviour {
[Header("Prefabs")]
public GameObject platformPrefab;
[Header("Platform Placement")]
public float minYCoord;
public float maxYCoord;
[Header("Pooling Settings:")]
public int poolSize;
private float maxXCoord;
private bool lerpCamera;
private float lerpTime = 1.5f;
private float lerpXValue;
public List<GameObject> pooledPlatforms = new List<GameObject>();
public List<GameObject> activePlatforms = new List<GameObject>();
private void Awake(){
pooledPlatforms.Clear ();
activePlatforms.Clear ();
EvaluateScreensize ();
PopulatePlatformPool ();
}
private void Update(){
//RestackPool ();
if (lerpCamera == true)
LerpCameraPosition ();
}
private void EvaluateScreensize(){
float distanceToScreen = transform.position.z - Camera.main.transform.position.z;
maxXCoord = Camera.main.ViewportToWorldPoint (new Vector3 (1, 0, distanceToScreen)).x - 1.0f;
}
private void PopulatePlatformPool(){
for (int i = 0; i < poolSize; i++) {
GameObject obj = Instantiate (platformPrefab, new Vector3 (-20, -20, 0), Quaternion.identity);
obj.SetActive (false);
pooledPlatforms.Add (obj);
}
}
public void InitiatePlatformSpawn(float _newPos){
ReplaceAndActivatePlatform ();
lerpXValue = _newPos + (maxXCoord - 5.0f);
lerpCamera = true;
}
private void ReplaceAndActivatePlatform(){
float cameraXPos = Camera.main.transform.position.x;
float newMaxXCoord = (maxXCoord * 2) + cameraXPos;
float platformPosX = Random.Range (newMaxXCoord, newMaxXCoord - 3f);
float platformPosY = Random.Range (minYCoord, maxYCoord);
Vector3 newPlatformPos = new Vector3 (platformPosX, platformPosY, 0);
GameObject newPlatform = pooledPlatforms [0];
newPlatform.transform.position = newPlatformPos;
newPlatform.SetActive (true);
pooledPlatforms.Remove (newPlatform);
activePlatforms.Add (newPlatform);
}
private void LerpCameraPosition(){
float currentCameraPositionX = Camera.main.transform.position.x;
float lerpPosition = Mathf.Lerp (currentCameraPositionX, lerpXValue, lerpTime * Time.deltaTime);
Camera.main.transform.position = new Vector3 (lerpPosition, Camera.main.transform.position.y, Camera.main.transform.position.z);
if (Camera.main.transform.position.x == lerpXValue) {
lerpCamera = false;
}
}
/*private void RestackPool(){
for (int i = 0; i < activePlatforms.Count; i++) {
GameObject platform = activePlatforms [i];
if (platform.activeSelf == false) {
activePlatforms.Remove (platform);
pooledPlatforms.Add (platform);
}
}
}*/
}
|
mit
|
C#
|
e8a9fbe809bda755b0f9f07907d434140faf07dc
|
update GetConfigurationOption imp
|
AspectCore/AspectCore-Framework,AspectCore/Lite,AspectCore/Abstractions,AspectCore/AspectCore-Framework
|
src/AspectCore.Lite.Abstractions.Resolution/AspectConfiguration.cs
|
src/AspectCore.Lite.Abstractions.Resolution/AspectConfiguration.cs
|
using AspectCore.Lite.Abstractions.Resolution.Common;
using System;
using System.Collections.Concurrent;
namespace AspectCore.Lite.Abstractions.Resolution
{
public sealed class AspectConfiguration : IAspectConfiguration
{
private readonly ConcurrentDictionary<Type, object> optionCache;
public AspectConfiguration()
{
optionCache = new ConcurrentDictionary<Type, object>();
var ignoreOption = GetConfigurationOption<bool>();
ignoreOption.IgnoreAspNetCore()
.IgnoreEntityFramework()
.IgnoreOwin()
.IgnorePageGenerator()
.IgnoreSystem()
.IgnoreObjectVMethod();
}
public IConfigurationOption<TOption> GetConfigurationOption<TOption>()
{
return (ConfigurationOption<TOption>)optionCache.GetOrAdd(typeof(TOption), key => new ConfigurationOption<TOption>());
}
}
}
|
using AspectCore.Lite.Abstractions.Resolution.Common;
namespace AspectCore.Lite.Abstractions.Resolution
{
public sealed class AspectConfiguration : IAspectConfiguration
{
private readonly IConfigurationOption<IInterceptor> useOption;
private readonly IConfigurationOption<bool> ignoreOption;
public AspectConfiguration()
{
useOption = new ConfigurationOption<IInterceptor>();
ignoreOption = new ConfigurationOption<bool>()
.IgnoreAspNetCore()
.IgnoreEntityFramework()
.IgnoreOwin()
.IgnorePageGenerator()
.IgnoreSystem()
.IgnoreObjectVMethod();
}
public IConfigurationOption<TOption> GetConfigurationOption<TOption>()
{
if (typeof(TOption) == typeof(bool))
{
return ignoreOption as IConfigurationOption<TOption>;
}
if (typeof(TOption) == typeof(IInterceptor))
{
return useOption as IConfigurationOption<TOption>;
}
return null;
}
}
}
|
mit
|
C#
|
c059ccaaaafff59553d74f2fa4037079c0d9eda2
|
Fix for the NotEmpty method.
|
concordion/concordion-net,ShaKaRee/concordion-net,concordion/concordion-net,concordion/concordion-net,ShaKaRee/concordion-net,ShaKaRee/concordion-net
|
Concordion/Internal/Util/Check.cs
|
Concordion/Internal/Util/Check.cs
|
// Copyright 2009 Jeffrey Cameron
//
// 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.Text;
namespace Concordion.Internal.Util
{
public class Check
{
public static void IsTrue(bool expression, string message, params object[] args)
{
if (!expression)
{
throw new Exception(String.Format(message, args));
}
}
public static void IsFalse(bool expression, string message, params object[] args)
{
IsTrue(!expression, message, args);
}
public static void NotNull(object obj, string message, params object[] args)
{
IsTrue(obj != null, message, args);
}
public static void NotEmpty(string str, string message, params object[] args)
{
IsTrue(!String.IsNullOrEmpty(str), message, args);
}
}
}
|
// Copyright 2009 Jeffrey Cameron
//
// 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.Text;
namespace Concordion.Internal.Util
{
public class Check
{
public static void IsTrue(bool expression, string message, params object[] args)
{
if (!expression)
{
throw new Exception(String.Format(message, args));
}
}
public static void IsFalse(bool expression, string message, params object[] args)
{
IsTrue(!expression, message, args);
}
public static void NotNull(object obj, string message, params object[] args)
{
IsTrue(obj != null, message, args);
}
public static void NotEmpty(string str, string message, params object[] args)
{
IsTrue(String.IsNullOrEmpty(str), message, args);
}
}
}
|
apache-2.0
|
C#
|
791524d997ceb9473481dfdf129221d79964686f
|
Change Page Tests
|
geaz/coreDox,geaz/coreDox,geaz/coreDox
|
tests/coreDox.Core.Tests/Project/Pages/DoxPageTests.cs
|
tests/coreDox.Core.Tests/Project/Pages/DoxPageTests.cs
|
using coreDox.Core.Exceptions;
using coreDox.Core.Project;
using coreDox.Core.Project.Pages;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using System.Linq;
namespace coreDox.Core.Tests.Projects.Pages
{
[TestClass]
public class DoxPageTests
{
private string _tmpFile = Path.GetTempFileName();
private string _tmpPath = Path.Combine(Path.GetTempPath(), "testProject");
private readonly string _testProjectPath =
Path.Combine(Path.GetDirectoryName(
typeof(DoxPageTests).Assembly.Location),
"..", "..", "..", "..", "..", "doc", "testDoc");
[TestCleanup]
public void TestCleanUp()
{
if (File.Exists(_tmpFile)) File.Delete(_tmpFile);
if (Directory.Exists(_tmpPath)) Directory.Delete(_tmpPath, true);
}
[TestMethod]
public void ShouldParsePagesSuccessfully()
{
//Arrange
var project = new DoxProject();
//Act
project.Load(_testProjectPath);
//Assert
Assert.AreEqual("Test Documentation", project.PageRoot.Title);
Assert.AreEqual(1, project.PageRoot.PageList.Count);
Assert.AreEqual(2, project.PageRoot.FolderList.Count);
Assert.IsNotNull(project.PageRoot.PageList.First().AssemblyFileInfo);
}
[TestMethod]
[ExpectedException(typeof(CoreDoxException))]
public void ShouldThrowIfAssemblyFileNotPresent()
{
//Arrange
PageHelper.WritePage(_tmpFile, "API", string.Empty, "notpresent.dll");
//Act
var assemblyPage = new DoxPage(new FileInfo(_tmpFile));
//Assert - Expects Exception
}
}
}
|
using coreDox.Core.Exceptions;
using coreDox.Core.Project.Pages;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
namespace coreDox.Core.Tests.Projects.Pages
{
[TestClass]
public class DoxPageTests
{
private string _tmpFile = Path.GetTempFileName();
private string _tmpPath = Path.Combine(Path.GetTempPath(), "testProject");
private string _testDllPath =
Path.Combine(Path.GetDirectoryName(
typeof(DoxPageTests).Assembly.Location),
"coreDox.TestDataProject.dll");
[TestCleanup]
public void TestCleanUp()
{
if (File.Exists(_tmpFile)) File.Delete(_tmpFile);
if (Directory.Exists(_tmpPath)) Directory.Delete(_tmpPath, true);
}
[TestMethod]
public void ShouldParsePageSuccessfully()
{
//Arrange
PageHelper.WritePage(_tmpFile, "API", string.Empty, _testDllPath);
var assemblyPage = new DoxPage(new FileInfo(_tmpFile));
//Act - Is Done During Assert
//Assert
Assert.AreEqual("API", assemblyPage.Title);
Assert.AreEqual(_testDllPath, assemblyPage.AssemblyFileInfo.FullName);
Assert.AreEqual(string.Empty, assemblyPage.Content);
}
[TestMethod]
[ExpectedException(typeof(CoreDoxException))]
public void ShouldThrowIfAssemblyFileNotPresent()
{
//Arrange
PageHelper.WritePage(_tmpFile, "API", string.Empty, "notpresent.dll");
//Act
var assemblyPage = new DoxPage(new FileInfo(_tmpFile));
//Assert - Expects Exception
}
}
}
|
mit
|
C#
|
2b0b1a27421a535da710608358786d05e3bd7125
|
fix codesmell
|
arsouza/Aritter,aritters/Ritter,arsouza/Aritter
|
src/Infra.Crosscutting/Caching/CachingProvider.cs
|
src/Infra.Crosscutting/Caching/CachingProvider.cs
|
using System.Collections.Generic;
namespace Ritter.Infra.Crosscutting.Caching
{
public abstract class CachingProvider
{
private readonly Dictionary<string, object> cache = new Dictionary<string, object>();
static readonly object padlock = new object();
protected virtual void AddItem(string key, object value)
{
lock (padlock)
{
cache.Add(key, value);
}
}
protected virtual void RemoveItem(string key)
{
lock (padlock)
{
cache.Remove(key);
}
}
protected virtual object GetItem(string key)
{
return GetItem(key, false);
}
protected virtual object GetItem(string key, bool remove)
{
lock (padlock)
{
if (cache.TryGetValue(key, out object res))
{
if (remove)
cache.Remove(key);
}
return res;
}
}
}
}
|
using System.Collections.Generic;
namespace Ritter.Infra.Crosscutting.Caching
{
public abstract class CachingProvider
{
private readonly Dictionary<string, object> cache = new Dictionary<string, object>();
static readonly object padlock = new object();
protected virtual void AddItem(string key, object value)
{
lock (padlock)
{
cache.Add(key, value);
}
}
protected virtual void RemoveItem(string key)
{
lock (padlock)
{
cache.Remove(key);
}
}
protected virtual object GetItem(string key)
{
return GetItem(key, false);
}
protected virtual object GetItem(string key, bool remove)
{
lock (padlock)
{
if (cache.TryGetValue(key, out object res))
{
if (remove == true)
cache.Remove(key);
}
return res;
}
}
}
}
|
mit
|
C#
|
f1f35fa10ecc0fd7c898a7f23aad9a0210dabb83
|
fix build warning of ThisAssembly (#1039)
|
kubernetes-client/csharp,kubernetes-client/csharp
|
src/KubernetesClient.Basic/GeneratedApiVersion.cs
|
src/KubernetesClient.Basic/GeneratedApiVersion.cs
|
namespace k8s;
public static class GeneratedApiVersion
{
// Now API version is the same as model version
// Change this if api is generated from a separate swagger spec
public const string AssemblyVersion = GeneratedModelVersion.AssemblyVersion;
public const string SwaggerVersion = GeneratedModelVersion.SwaggerVersion;
}
|
namespace k8s;
public static class GeneratedApiVersion
{
public const string AssemblyVersion = ThisAssembly.AssemblyInformationalVersion;
public const string SwaggerVersion = ThisAssembly.KubernetesSwaggerVersion;
}
|
apache-2.0
|
C#
|
ef2ec3e9fd382c4e96d1743c45f0fd993e4300c6
|
Change icon classes.
|
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
|
source/Nuke.Common/IconClasses.cs
|
source/Nuke.Common/IconClasses.cs
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.Tools.DocFx;
using Nuke.Common.Tools.DotCover;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.DupFinder;
using Nuke.Common.Tools.GitLink2;
using Nuke.Common.Tools.GitLink3;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.InspectCode;
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Tools.Nunit3;
using Nuke.Common.Tools.OpenCover;
using Nuke.Common.Tools.Paket;
using Nuke.Common.Tools.ReportGenerator;
using Nuke.Common.Tools.Xunit2;
using Nuke.Core.Execution;
[assembly: IconClass(typeof(DefaultSettings), "equalizer")]
[assembly: IconClass(typeof(DocFxTasks), "books")]
[assembly: IconClass(typeof(DotCoverTasks), "shield2")]
[assembly: IconClass(typeof(DotNetTasks), "fire")]
[assembly: IconClass(typeof(DupFinderTasks), "code")]
[assembly: IconClass(typeof(GitLink2Tasks), "link")]
[assembly: IconClass(typeof(GitLink3Tasks), "link")]
[assembly: IconClass(typeof(GitRepository), "git")]
[assembly: IconClass(typeof(GitVersionTasks), "podium")]
[assembly: IconClass(typeof(InspectCodeTasks), "code")]
[assembly: IconClass(typeof(MSBuildTasks), "download2")]
[assembly: IconClass(typeof(NuGetTasks), "box")]
[assembly: IconClass(typeof(Nunit3Tasks), "bug2")]
[assembly: IconClass(typeof(OpenCoverTasks), "shield2")]
[assembly: IconClass(typeof(PaketTasks), "box")]
[assembly: IconClass(typeof(ReportGeneratorTasks), "flag3")]
[assembly: IconClass(typeof(SerializationTasks), "barcode")]
[assembly: IconClass(typeof(TextTasks), "file-text3")]
[assembly: IconClass(typeof(XmlTasks), "file-empty2")]
[assembly: IconClass(typeof(Xunit2Tasks), "bug2")]
#if !NETCORE
[assembly: IconClass(typeof(FtpTasks), "sphere2")]
[assembly: IconClass(typeof(HttpTasks), "sphere2")]
#endif
|
// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.Tools.DocFx;
using Nuke.Common.Tools.DotCover;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.DupFinder;
using Nuke.Common.Tools.GitLink2;
using Nuke.Common.Tools.GitLink3;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.InspectCode;
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Tools.Nunit3;
using Nuke.Common.Tools.OpenCover;
using Nuke.Common.Tools.Paket;
using Nuke.Common.Tools.ReportGenerator;
using Nuke.Common.Tools.Xunit2;
using Nuke.Core.Execution;
[assembly: IconClass(typeof(DefaultSettings), "equalizer")]
[assembly: IconClass(typeof(DocFxTasks), "book")]
[assembly: IconClass(typeof(DotCoverTasks), "shield2")]
[assembly: IconClass(typeof(DotNetTasks), "fire")]
[assembly: IconClass(typeof(DupFinderTasks), "code")]
[assembly: IconClass(typeof(GitLink2Tasks), "link")]
[assembly: IconClass(typeof(GitLink3Tasks), "link")]
[assembly: IconClass(typeof(GitRepository), "git")]
[assembly: IconClass(typeof(GitVersionTasks), "podium")]
[assembly: IconClass(typeof(InspectCodeTasks), "code")]
[assembly: IconClass(typeof(MSBuildTasks), "download2")]
[assembly: IconClass(typeof(NuGetTasks), "box")]
[assembly: IconClass(typeof(Nunit3Tasks), "bug2")]
[assembly: IconClass(typeof(OpenCoverTasks), "shield2")]
[assembly: IconClass(typeof(PaketTasks), "box")]
[assembly: IconClass(typeof(ReportGeneratorTasks), "flag3")]
[assembly: IconClass(typeof(SerializationTasks), "barcode")]
[assembly: IconClass(typeof(TextTasks), "file-text3")]
[assembly: IconClass(typeof(XmlTasks), "file-empty2")]
[assembly: IconClass(typeof(Xunit2Tasks), "bug2")]
#if !NETCORE
[assembly: IconClass(typeof(FtpTasks), "sphere2")]
[assembly: IconClass(typeof(HttpTasks), "sphere2")]
#endif
|
mit
|
C#
|
732bfad18742b28b22226eeea9018dd9c34f4c2d
|
Add messageBack to action types.
|
yakumo/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder,stevengum97/BotBuilder,yakumo/BotBuilder,stevengum97/BotBuilder,stevengum97/BotBuilder,yakumo/BotBuilder,msft-shahins/BotBuilder,msft-shahins/BotBuilder,msft-shahins/BotBuilder,msft-shahins/BotBuilder
|
CSharp/Library/Microsoft.Bot.Connector.Shared/ActionTypes.cs
|
CSharp/Library/Microsoft.Bot.Connector.Shared/ActionTypes.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Bot.Connector
{
public class ActionTypes
{
/// <summary>
/// Client will open given url in the built-in browser.
/// </summary>
public const string OpenUrl = "openUrl";
/// <summary>
/// Client will post message to bot, so all other participants will see that was posted to the bot and who posted this.
/// </summary>
public const string ImBack = "imBack";
/// <summary>
/// Client will post message to bot privately, so other participants inside conversation will not see that was posted.
/// </summary>
public const string PostBack = "postBack";
/// <summary>
/// playback audio container referenced by url
/// </summary>
public const string PlayAudio = "playAudio";
/// <summary>
/// playback video container referenced by url
/// </summary>
public const string PlayVideo = "playVideo";
/// <summary>
/// show image referenced by url
/// </summary>
public const string ShowImage = "showImage";
/// <summary>
/// download file referenced by url
/// </summary>
public const string DownloadFile = "downloadFile";
/// <summary>
/// Signin button
/// </summary>
public const string Signin = "signin";
/// <summary>
/// Post message to bot
/// </summary>
public const string MessageBack = "messageBack";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Bot.Connector
{
public class ActionTypes
{
/// <summary>
/// Client will open given url in the built-in browser.
/// </summary>
public const string OpenUrl = "openUrl";
/// <summary>
/// Client will post message to bot, so all other participants will see that was posted to the bot and who posted this.
/// </summary>
public const string ImBack = "imBack";
/// <summary>
/// Client will post message to bot privately, so other participants inside conversation will not see that was posted.
/// </summary>
public const string PostBack = "postBack";
/// <summary>
/// playback audio container referenced by url
/// </summary>
public const string PlayAudio = "playAudio";
/// <summary>
/// playback video container referenced by url
/// </summary>
public const string PlayVideo = "playVideo";
/// <summary>
/// show image referenced by url
/// </summary>
public const string ShowImage = "showImage";
/// <summary>
/// download file referenced by url
/// </summary>
public const string DownloadFile = "downloadFile";
/// <summary>
/// Signin button
/// </summary>
public const string Signin = "signin";
}
}
|
mit
|
C#
|
c607c58a18149f6537d3034de9f55dd7e3721832
|
remove unnecessary using directive.
|
jwChung/Experimentalism,jwChung/Experimentalism
|
test/Experiment.AutoFixtureUnitTest/AssemblyLevelTest.cs
|
test/Experiment.AutoFixtureUnitTest/AssemblyLevelTest.cs
|
using System.IO;
using System.Linq;
using System.Text;
using Xunit;
using Xunit.Extensions;
namespace Jwc.Experiment
{
public class AssemblyLevelTest
{
[Fact]
public void SutReferencesOnlySpecifiedAssemblies()
{
var sut = typeof(AutoDataTheoremAttribute).Assembly;
var specifiedAssemblies = new []
{
"mscorlib",
"Jwc.Experiment",
"Ploeh.AutoFixture"
};
var actual = sut.GetReferencedAssemblies().Select(an => an.Name).Distinct().ToArray();
Assert.Equal(specifiedAssemblies.Length, actual.Length);
Assert.False(specifiedAssemblies.Except(actual).Any(), "Empty");
}
#if CI
[Theory]
#else
[Theory(Skip = "Run on CI server")]
#endif
[InlineData("AutoDataTheoremAttribute")]
[InlineData("TestFixtureAdapter")]
public void SutGeneratesTransformFiles(string originName)
{
string directory = @"..\..\..\..\src\Experiment.AutoFixture\";
var origin = directory + originName + ".cs";
var destination = directory + originName + ".pp";
Assert.True(File.Exists(origin), "exists.");
var content = File.ReadAllText(origin, Encoding.UTF8)
.Replace("namespace Jwc.Experiment", "namespace $rootnamespace$");
File.WriteAllText(destination, content, Encoding.UTF8);
Assert.True(File.Exists(destination), "exists.");
}
}
}
|
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Xunit;
using Xunit.Extensions;
namespace Jwc.Experiment
{
public class AssemblyLevelTest
{
[Fact]
public void SutReferencesOnlySpecifiedAssemblies()
{
var sut = typeof(AutoDataTheoremAttribute).Assembly;
var specifiedAssemblies = new []
{
"mscorlib",
"Jwc.Experiment",
"Ploeh.AutoFixture"
};
var actual = sut.GetReferencedAssemblies().Select(an => an.Name).Distinct().ToArray();
Assert.Equal(specifiedAssemblies.Length, actual.Length);
Assert.False(specifiedAssemblies.Except(actual).Any(), "Empty");
}
#if CI
[Theory]
#else
[Theory(Skip = "Run on CI server")]
#endif
[InlineData("AutoDataTheoremAttribute")]
[InlineData("TestFixtureAdapter")]
public void SutGeneratesTransformFiles(string originName)
{
string directory = @"..\..\..\..\src\Experiment.AutoFixture\";
var origin = directory + originName + ".cs";
var destination = directory + originName + ".pp";
Assert.True(File.Exists(origin), "exists.");
var content = File.ReadAllText(origin, Encoding.UTF8)
.Replace("namespace Jwc.Experiment", "namespace $rootnamespace$");
File.WriteAllText(destination, content, Encoding.UTF8);
Assert.True(File.Exists(destination), "exists.");
}
}
}
|
mit
|
C#
|
289fbf244a4bcff8223b14c00c75c8b1fe76b42e
|
Update WinFormsBrowserProcessHandler to use the simplest possible approach - NOT PRODUCTION READY
|
Livit/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp
|
CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs
|
CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs
|
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Threading.Tasks;
using CefSharp.Example.Handlers;
using System.Timers;
namespace CefSharp.WinForms.Example.Handlers
{
/// <summary>
/// EXPERIMENTAL - this implementation is very simplistic and not ready for production use
/// See the following link for the CEF reference implementation.
/// https://bitbucket.org/chromiumembedded/cef/commits/1ff26aa02a656b3bc9f0712591c92849c5909e04?at=2785
/// </summary>
public class WinFormsBrowserProcessHandler : BrowserProcessHandler
{
private Timer timer;
private TaskFactory factory;
public WinFormsBrowserProcessHandler(TaskScheduler scheduler)
{
factory = new TaskFactory(scheduler);
timer = new Timer { Interval = MaxTimerDelay, AutoReset = true };
timer.Start();
timer.Elapsed += TimerTick;
}
private void TimerTick(object sender, EventArgs e)
{
//Basically execute Cef.DoMessageLoopWork 30 times per second
//Execute DoMessageLoopWork on UI thread
factory.StartNew(() => Cef.DoMessageLoopWork());
}
protected override void OnScheduleMessagePumpWork(int delay)
{
//when delay <= 0 queue the Task up for execution on the UI thread.
if(delay <= 0)
{
//Update the timer to execute almost immediately
factory.StartNew(() => Cef.DoMessageLoopWork());
}
}
public override void Dispose()
{
if(timer != null)
{
timer.Stop();
timer.Dispose();
timer = null;
}
}
}
}
|
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Threading.Tasks;
using CefSharp.Example.Handlers;
using System.Timers;
namespace CefSharp.WinForms.Example.Handlers
{
/// <summary>
/// EXPERIMENTAL - this implementation is very simplistic and not ready for production use
/// See the following link for the CEF reference implementation.
/// https://bitbucket.org/chromiumembedded/cef/commits/1ff26aa02a656b3bc9f0712591c92849c5909e04?at=2785
/// </summary>
public class WinFormsBrowserProcessHandler : BrowserProcessHandler
{
private Timer timer;
private TaskFactory factory;
public WinFormsBrowserProcessHandler(TaskScheduler scheduler)
{
factory = new TaskFactory(scheduler);
timer = new Timer { Interval = MaxTimerDelay, AutoReset = true };
timer.Start();
timer.Elapsed += TimerTick;
}
private void TimerTick(object sender, EventArgs e)
{
//Reset the timer interval to maximum
timer.Interval = MaxTimerDelay;
//Execute DoMessageLoopWork on UI thread
factory.StartNew(() => Cef.DoMessageLoopWork());
}
protected override void OnScheduleMessagePumpWork(int delay)
{
//Basically execute Cef.DoMessageLoopWork 30 times per second,
//when delay <= 0 set the timer interval to really small so it's executed
// relatively quickly.
if(delay <= 0)
{
//Update the timer to execute almost immediately
timer.Interval = 1;
}
else
{
timer.Interval = delay;
}
}
public override void Dispose()
{
if(timer != null)
{
timer.Stop();
timer.Dispose();
timer = null;
}
}
}
}
|
bsd-3-clause
|
C#
|
06d053239dbc228ec98fa57b625c465847146693
|
Update TweekLegacy.cs
|
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
|
services/api/Tweek.ApiService.NetCore/Security/TweekLegacy.cs
|
services/api/Tweek.ApiService.NetCore/Security/TweekLegacy.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Tweek.ApiService.Addons;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Http.Features.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Text.Encodings.Web;
using Microsoft.Extensions.DependencyInjection;
namespace Tweek.ApiService.NetCore.Security
{
public class TweekLegacyHandler : AuthenticationHandler<TweekLegacyOptions>
{
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
if (Request.Query.ContainsKey("$tweeklegacy"))
{
return AuthenticateResult.Success(
new AuthenticationTicket(
new ClaimsPrincipal(new ClaimsIdentity(new[] {new Claim("iss", "TweekLegacy")})), null,
"TweekLegacy"));
}
return AuthenticateResult.Skip();
}
}
public class TweekLegacyOptions : AuthenticationOptions
{
public TweekLegacyOptions()
{
AutomaticAuthenticate = true;
AutomaticChallenge = true;
}
}
public class TweekLegacySupportMiddleware : AuthenticationMiddleware<TweekLegacyOptions>
{
public TweekLegacySupportMiddleware(RequestDelegate next, IOptions<TweekLegacyOptions> options, ILoggerFactory loggerFactory, UrlEncoder encoder) : base(next, options, loggerFactory, encoder)
{
}
protected override AuthenticationHandler<TweekLegacyOptions> CreateHandler()
{
return new TweekLegacyHandler();
}
}
public class TweekLegacySupport : ITweekAddon
{
public void Use(IApplicationBuilder builder, IConfiguration configuration)
{
builder.UseRewriter(new RewriteOptions().AddRewrite("^configurations/([^?]+)[?]?(.*)", "api/v1/keys/$1?$tweeklegacy=tweeklegacy&$ignoreKeyTypes=true&$2", true));
builder.UseMiddleware<TweekLegacySupportMiddleware>();
}
public void Configure(IServiceCollection services, IConfiguration configuration)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Tweek.ApiService.Addons;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.AspNetCore.Http.Authentication;
using Microsoft.AspNetCore.Http.Features.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Text.Encodings.Web;
using Microsoft.Extensions.DependencyInjection;
namespace Tweek.ApiService.NetCore.Security
{
public class TweekLegacyHandler : AuthenticationHandler<TweekLegacyOptions>
{
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
if (Request.Query.ContainsKey("$tweeklegacy"))
{
return AuthenticateResult.Success(
new AuthenticationTicket(
new ClaimsPrincipal(new ClaimsIdentity(new[] {new Claim("iss", "TweekLegacy")})), null,
"TweekLegacy"));
}
return AuthenticateResult.Skip();
}
}
public class TweekLegacyOptions : AuthenticationOptions
{
public TweekLegacyOptions()
{
AutomaticAuthenticate = true;
AutomaticChallenge = true;
}
}
public class TweekLegacySupportMiddleware : AuthenticationMiddleware<TweekLegacyOptions>
{
public TweekLegacySupportMiddleware(RequestDelegate next, IOptions<TweekLegacyOptions> options, ILoggerFactory loggerFactory, UrlEncoder encoder) : base(next, options, loggerFactory, encoder)
{
}
protected override AuthenticationHandler<TweekLegacyOptions> CreateHandler()
{
return new TweekLegacyHandler();
}
}
public class TweekLegacySupport : ITweekAddon
{
public void Use(IApplicationBuilder builder, IConfiguration configuration)
{
builder.UseRewriter(new RewriteOptions().AddRewrite("^configurations/([^?]+)[?]?(.*)", "api/v1/keys/$1?$tweeklegacy=tweeklegacy&$ignoreKeyTypes=true&$2", true));
builder.UseRewriter(new RewriteOptions().AddRewrite("^context/([^?]+)[?]?(.*)", "api/v1/context/$1?$tweeklegacy=tweeklegacy&$2", true));
builder.UseMiddleware<TweekLegacySupportMiddleware>();
}
public void Configure(IServiceCollection services, IConfiguration configuration)
{
}
}
}
|
mit
|
C#
|
afd7bf3df88844b4753afb84aa2b6c07bc1ef9f9
|
Enable nullable and don't bother null checking at every read.
|
ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework
|
osu.Framework/Audio/Callbacks/DataStreamFileProcedures.cs
|
osu.Framework/Audio/Callbacks/DataStreamFileProcedures.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
#nullable enable
namespace osu.Framework.Audio.Callbacks
{
/// <summary>
/// Implementation of <see cref="IFileProcedures"/> that supports reading from a <see cref="Stream"/>.
/// </summary>
public class DataStreamFileProcedures : IFileProcedures
{
private readonly Stream dataStream;
public DataStreamFileProcedures(Stream data)
{
dataStream = data;
}
public void Close(IntPtr user)
{
}
public long Length(IntPtr user)
{
if (!dataStream.CanSeek) return 0;
try
{
return dataStream.Length;
}
catch
{
return 0;
}
}
public unsafe int Read(IntPtr buffer, int length, IntPtr user)
{
if (!dataStream.CanRead) return 0;
try
{
return dataStream.Read(new Span<byte>((void*)buffer, length));
}
catch
{
return 0;
}
}
public bool Seek(long offset, IntPtr user)
{
if (!dataStream.CanSeek) return false;
try
{
return dataStream.Seek(offset, SeekOrigin.Begin) == offset;
}
catch
{
return false;
}
}
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
namespace osu.Framework.Audio.Callbacks
{
/// <summary>
/// Implementation of <see cref="IFileProcedures"/> that supports reading from a <see cref="Stream"/>.
/// </summary>
public class DataStreamFileProcedures : IFileProcedures
{
private readonly Stream dataStream;
public DataStreamFileProcedures(Stream data)
{
dataStream = data;
}
public void Close(IntPtr user)
{
}
public long Length(IntPtr user)
{
if (dataStream?.CanSeek != true) return 0;
try
{
return dataStream.Length;
}
catch
{
return 0;
}
}
public unsafe int Read(IntPtr buffer, int length, IntPtr user)
{
if (dataStream?.CanRead != true) return 0;
try
{
return dataStream.Read(new Span<byte>((void*)buffer, length));
}
catch
{
return 0;
}
}
public bool Seek(long offset, IntPtr user)
{
if (dataStream?.CanSeek != true) return false;
try
{
return dataStream.Seek(offset, SeekOrigin.Begin) == offset;
}
catch
{
return false;
}
}
}
}
|
mit
|
C#
|
92f2fac35de497293342ebff62d3c513119d49f6
|
Rewrite the xml doc for IResponseFilter
|
Livit/CefSharp,wangzheng888520/CefSharp,dga711/CefSharp,dga711/CefSharp,Livit/CefSharp,Livit/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,dga711/CefSharp,jamespearce2006/CefSharp,jamespearce2006/CefSharp,dga711/CefSharp,jamespearce2006/CefSharp,Livit/CefSharp,wangzheng888520/CefSharp,wangzheng888520/CefSharp,wangzheng888520/CefSharp
|
CefSharp/IResponseFilter.cs
|
CefSharp/IResponseFilter.cs
|
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.IO;
namespace CefSharp
{
public interface IResponseFilter
{
/// <summary>
/// Initialize the response filter. Will only be called a single time.
/// The filter will not be installed if this method returns false.
/// </summary>
/// <returns>The filter will not be installed if this method returns false.</returns>
bool InitFilter();
/// <summary>
/// Called to filter a chunk of data.
/// This method will be called repeatedly until there is no more data to filter (resource response is complete),
/// dataInRead matches dataIn.Length (all available pre-filter bytes have been read), and the method
/// returns FilterStatus.Done or FilterStatus.Error.
/// </summary>
/// <param name="dataIn">is a Stream wrapping the underlying input buffer containing pre-filter data. Can be null.</param>
/// <param name="dataInRead">Set to the number of bytes that were read from dataIn</param>
/// <param name="dataOut">is a Stream wrapping the underlying output buffer that can accept filtered output data.
/// Check dataOut.Length for maximum buffer size</param>
/// <param name="dataOutWritten">Set to the number of bytes that were written into dataOut</param>
/// <returns>If some or all of the pre-filter data was read successfully but more data is needed in order
/// to continue filtering (filtered output is pending) return FilterStatus.NeedMoreData. If some or all of the pre-filter
/// data was read successfully and all available filtered output has been written return FilterStatus.Done. If an error
/// occurs during filtering return FilterStatus.Error. </returns>
/// <remarks>Do not keep a reference to the buffers(Steams) passed to this method.</remarks>
FilterStatus Filter(Stream dataIn, out long dataInRead, Stream dataOut, out long dataOutWritten);
}
}
|
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.IO;
namespace CefSharp
{
public interface IResponseFilter
{
/// <summary>
/// Initialize the response filter. Will only be called a single time.
/// The filter will not be installed if this method returns false.
/// </summary>
/// <returns>The filter will not be installed if this method returns false.</returns>
bool InitFilter();
/// <summary>
/// Called to filter a chunk of data. |data_in| is the input buffer containing
/// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
/// |data_in_size| is zero). |data_out| is the output buffer that can accept up
/// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
/// number of bytes that were read from |data_in|. Set |data_out_written| to
/// the number of bytes that were written into |data_out|. If some or all of
/// the pre-filter data was read successfully but more data is needed in order
/// to continue filtering (filtered output is pending) return
/// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
/// read successfully and all available filtered output has been written return
/// RESPONSE_FILTER_DONE. If an error occurs during filtering return
/// RESPONSE_FILTER_ERROR. This method will be called repeatedly until there is
/// no more data to filter (resource response is complete), |data_in_read|
/// matches |data_in_size| (all available pre-filter bytes have been read), and
/// the method returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
/// keep a reference to the buffers passed to this method.
/// optional_param=data_in,default_retval=RESPONSE_FILTER_ERROR
/// </summary>
/// <param name="dataIn"></param>
/// <param name="dataInRead"></param>
/// <param name="dataOut"></param>
/// <param name="dataOutWritten"></param>
/// <returns></returns>
FilterStatus Filter(Stream dataIn, out long dataInRead, Stream dataOut, out long dataOutWritten);
}
}
|
bsd-3-clause
|
C#
|
e08e5f67a7c6d030cc4034d71c5dfb8e84ab8289
|
Update SerializationTests.cs
|
tiksn/TIKSN-Framework
|
TIKSN.UnitTests.Shared/Serialization/Numerics/SerializationTests.cs
|
TIKSN.UnitTests.Shared/Serialization/Numerics/SerializationTests.cs
|
using System;
using System.Numerics;
using FluentAssertions;
using Xunit;
namespace TIKSN.Serialization.Numerics.Tests
{
public class SerializationTests
{
[Fact]
public void DeserializeSerializeUnsignedBigInteger()
{
var rng = new Random();
var serializer = new UnsignedBigIntegerBinarySerializer();
var deserializer = new UnsignedBigIntegerBinaryDeserializer();
for (var i = 0; i < 10; i++)
{
var number = BigInteger.One;
number *= rng.Next();
number *= rng.Next();
number *= rng.Next();
number *= rng.Next();
var bytes = serializer.Serialize(number);
var recovered = deserializer.Deserialize(bytes);
var recoveredBytes = serializer.Serialize(recovered);
_ = recovered.Should().Be(number);
_ = recoveredBytes.Should().BeEquivalentTo(bytes);
}
}
}
}
|
using System;
using System.Numerics;
using FluentAssertions;
using Xunit;
namespace TIKSN.Serialization.Numerics.Tests
{
public class SerializationTests
{
[Fact]
public void DeserializeSerializeUnsignedBigInteger()
{
var rng = new Random();
UnsignedBigIntegerBinarySerializer serializer = new UnsignedBigIntegerBinarySerializer();
UnsignedBigIntegerBinaryDeserializer deserializer = new UnsignedBigIntegerBinaryDeserializer();
for (int i = 0; i < 10; i++)
{
var number = BigInteger.One;
number *= rng.Next();
number *= rng.Next();
number *= rng.Next();
number *= rng.Next();
var bytes = serializer.Serialize(number);
var recovered = deserializer.Deserialize(bytes);
var recoveredBytes = serializer.Serialize(recovered);
recovered.Should().Be(number);
recoveredBytes.Should().BeEquivalentTo(bytes);
}
}
}
}
|
mit
|
C#
|
30c377565caa31daffb2a6d0228c7498976bd149
|
fix sample time for ruleset/latest
|
Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek,Soluto/tweek
|
addons/Rules/Tweek.Drivers.Rules.Management/RulesManagementAddon.cs
|
addons/Rules/Tweek.Drivers.Rules.Management/RulesManagementAddon.cs
|
using System;
using System.Net.Http;
using Engine.Drivers.Rules;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Tweek.ApiService.Addons;
using System.Linq;
using App.Metrics.Core.Abstractions;
namespace Tweek.Drivers.Rules.Management
{
public class RulesManagementAddon : ITweekAddon
{
public void Use(IApplicationBuilder builder, IConfiguration configuration)
{
}
public void Configure(IServiceCollection services, IConfiguration configuration)
{
var managementServiceUrl = new Uri(configuration.GetValue<string>("Rules:Management:Url"));
var httpClient = new HttpClient()
{
BaseAddress = managementServiceUrl
};
var settings = new TweekManagementRulesDriverSettings();
settings.SampleIntervalInMs = configuration.GetValue<int>("Rules:Management:SampleIntervalInMs", 30000);
settings.FailureDelayInMs = configuration.GetValue<int>("Rules:Management:FailureDelayInMs", 60000);
services.AddSingleton<IRulesDriver>(
ctx =>
TweekManagementRulesDriver.StartNew(httpClient.GetAsync, settings, ctx.GetService<ILoggerFactory>().CreateLogger("RulesManagementDriver"),
ctx.GetService<IMeasureMetrics>()));
services.AddSingleton<IDiagnosticsProvider>(ctx => new TweekManagementHealthCheck(ctx.GetServices<IRulesDriver>().OfType<TweekManagementRulesDriver>().Single()));
}
}
}
|
using System;
using System.Net.Http;
using App.Metrics;
using Engine.Drivers.Rules;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Tweek.ApiService.Addons;
using System.Linq;
using App.Metrics.Health;
using App.Metrics.Core.Abstractions;
using LanguageExt;
using static LanguageExt.Prelude;
using LanguageExt.Trans.Linq;
namespace Tweek.Drivers.Rules.Management
{
public class RulesManagementAddon : ITweekAddon
{
public void Use(IApplicationBuilder builder, IConfiguration configuration)
{
}
public void Configure(IServiceCollection services, IConfiguration configuration)
{
var managementServiceUrl = new Uri(configuration.GetValue<string>("Rules:Management:Url"));
var httpClient = new HttpClient()
{
BaseAddress = managementServiceUrl
};
var settings = new TweekManagementRulesDriverSettings();
configuration.GetValue<string>("Rules:Management:SampleIntervalInMs")?.Iter(x=> settings.SampleIntervalInMs = x);
configuration.GetValue<string>("Rules:Management:FailureDelayInMs")?.Iter(x=> settings.FailureDelayInMs = x);
services.AddSingleton<IRulesDriver>(
ctx =>
TweekManagementRulesDriver.StartNew(httpClient.GetAsync, settings, ctx.GetService<ILoggerFactory>().CreateLogger("RulesManagementDriver"),
ctx.GetService<IMeasureMetrics>()));
services.AddSingleton<IDiagnosticsProvider>(ctx => new TweekManagementHealthCheck(ctx.GetServices<IRulesDriver>().OfType<TweekManagementRulesDriver>().Single()));
}
}
}
|
mit
|
C#
|
afdab7895aa3fa3cff46529ef7b164342fda7202
|
Fix beatmap background fade not being updated on retry
|
naoey/osu,UselessToucan/osu,NeoAdonis/osu,2yangk23/osu,Nabile-Rahmani/osu,ZLima12/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,ppy/osu,naoey/osu,naoey/osu,johnneijzen/osu,DrabWeb/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,2yangk23/osu,Frontear/osuKyzer,NeoAdonis/osu,DrabWeb/osu,smoogipooo/osu,smoogipoo/osu,ZLima12/osu,ppy/osu,peppy/osu-new,peppy/osu,EVAST9919/osu,ppy/osu,EVAST9919/osu,UselessToucan/osu,DrabWeb/osu
|
osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs
|
osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Configuration;
using osu.Game.Screens.Backgrounds;
using OpenTK;
namespace osu.Game.Screens.Play
{
public abstract class ScreenWithBeatmapBackground : OsuScreen
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
public override bool AllowBeatmapRulesetChange => false;
protected const float BACKGROUND_FADE_DURATION = 800;
protected float BackgroundOpacity => 1 - (float)DimLevel;
#region User Settings
protected Bindable<double> DimLevel;
protected Bindable<double> BlurLevel;
protected Bindable<bool> ShowStoryboard;
#endregion
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
}
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
DimLevel.ValueChanged += _ => UpdateBackgroundElements();
BlurLevel.ValueChanged += _ => UpdateBackgroundElements();
ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements();
UpdateBackgroundElements();
}
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
UpdateBackgroundElements();
}
protected virtual void UpdateBackgroundElements()
{
if (!IsCurrentScreen) return;
Background?.FadeTo(BackgroundOpacity, BACKGROUND_FADE_DURATION, Easing.OutQuint);
(Background as BackgroundScreenBeatmap)?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
}
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Configuration;
using osu.Game.Screens.Backgrounds;
using OpenTK;
namespace osu.Game.Screens.Play
{
public abstract class ScreenWithBeatmapBackground : OsuScreen
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
public override bool AllowBeatmapRulesetChange => false;
protected const float BACKGROUND_FADE_DURATION = 800;
protected float BackgroundOpacity => 1 - (float)DimLevel;
#region User Settings
protected Bindable<double> DimLevel;
protected Bindable<double> BlurLevel;
protected Bindable<bool> ShowStoryboard;
#endregion
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
}
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
DimLevel.ValueChanged += _ => UpdateBackgroundElements();
BlurLevel.ValueChanged += _ => UpdateBackgroundElements();
ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements();
UpdateBackgroundElements();
}
protected virtual void UpdateBackgroundElements()
{
if (!IsCurrentScreen) return;
Background?.FadeTo(BackgroundOpacity, BACKGROUND_FADE_DURATION, Easing.OutQuint);
(Background as BackgroundScreenBeatmap)?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
}
}
}
|
mit
|
C#
|
31c26ff2713fe76bdf2999cb191c6c024e1dc6fa
|
Remove unused code
|
TheEadie/LazyLibrary,TheEadie/LazyStorage,TheEadie/LazyStorage
|
src/LazyStorage/StorableObject.cs
|
src/LazyStorage/StorableObject.cs
|
using System.Collections.Generic;
namespace LazyStorage
{
public class StorableObject
{
public Dictionary<string, string> Info { get; }
public StorableObject()
{
Info = new Dictionary<string, string>();
}
}
}
|
using System.Collections.Generic;
namespace LazyStorage
{
public class StorableObject
{
public Dictionary<string, string> Info { get; }
public StorableObject()
{
Info = new Dictionary<string, string>();
}
internal StorableObject(Dictionary<string, string> info)
{
Info = info;
}
}
}
|
mit
|
C#
|
b81ce2eb11a6e521ce6493e9b707370eb9f955ee
|
Make FileUpdate return false to MSBUILD if it doesn't find a match.
|
ddaspit/libpalaso,andrew-polk/libpalaso,hatton/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,gtryus/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,hatton/libpalaso,JohnThomson/libpalaso,tombogle/libpalaso,darcywong00/libpalaso,chrisvire/libpalaso,gmartin7/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,darcywong00/libpalaso,marksvc/libpalaso,chrisvire/libpalaso,chrisvire/libpalaso,tombogle/libpalaso,sillsdev/libpalaso,mccarthyrb/libpalaso,darcywong00/libpalaso,ermshiperete/libpalaso,sillsdev/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,gmartin7/libpalaso,marksvc/libpalaso,gtryus/libpalaso,andrew-polk/libpalaso,JohnThomson/libpalaso,chrisvire/libpalaso,hatton/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,tombogle/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,mccarthyrb/libpalaso,ddaspit/libpalaso,sillsdev/libpalaso,marksvc/libpalaso,JohnThomson/libpalaso
|
Palaso.MSBuildTasks/FileUpdate.cs
|
Palaso.MSBuildTasks/FileUpdate.cs
|
using System;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Palaso.BuildTasks
{
public class FileUpdate : Task
{
[Required]
public string File { get; set; }
[Required]
public string Regex { get; set; }
[Required]
public string ReplacementText { get; set; }
public override bool Execute()
{
var content = System.IO.File.ReadAllText(File);
var newContents = System.Text.RegularExpressions.Regex.Replace(content, this.Regex, ReplacementText);
if(!newContents.Contains(ReplacementText))
{
SafeLogError("Did not manage to replace '{0}' with '{1}'", this.Regex, ReplacementText);
return false;//we didn't actually replace anything
}
System.IO.File.WriteAllText(File,
newContents);
return true;
}
private void SafeLogError(string msg, params object[] args)
{
try
{
Debug.WriteLine(string.Format(msg, args));
Log.LogError(msg, args);
}
catch (Exception)
{
//swallow... logging fails in the unit test environment, where the log isn't really set up
}
}
}
}
|
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Palaso.BuildTasks
{
public class FileUpdate : Task
{
[Required]
public string File { get; set; }
[Required]
public string Regex { get; set; }
[Required]
public string ReplacementText { get; set; }
public override bool Execute()
{
var content = System.IO.File.ReadAllText(File);
System.IO.File.WriteAllText(File,
System.Text.RegularExpressions.Regex.Replace(content, this.Regex, ReplacementText));
return true;
}
}
}
|
mit
|
C#
|
0b0780bd217f718fc79c1939571b07f864435e77
|
Improve FileUpdate build task to accept date format for output
|
gmartin7/libpalaso,tombogle/libpalaso,tombogle/libpalaso,gmartin7/libpalaso,ermshiperete/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,gtryus/libpalaso,sillsdev/libpalaso,sillsdev/libpalaso,ermshiperete/libpalaso,ddaspit/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,gtryus/libpalaso,mccarthyrb/libpalaso,ddaspit/libpalaso,andrew-polk/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,glasseyes/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,gmartin7/libpalaso,andrew-polk/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,sillsdev/libpalaso
|
Palaso.MSBuildTasks/FileUpdate.cs
|
Palaso.MSBuildTasks/FileUpdate.cs
|
using System;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Palaso.BuildTasks
{
public class FileUpdate : Task
{
private string _dateFormat;
[Required]
public string File { get; set; }
[Required]
public string Regex { get; set; }
[Required]
public string ReplacementText { get; set; }
/// <summary>
/// The string pattern to replace with the current date (UTC, dd/MMM/yyyy)
/// </summary>
public string DatePlaceholder { get; set; }
/// <summary>
/// The date format to output (default is dd/MMM/yyyy)
/// </summary>
public string DateFormat
{
get { return _dateFormat ?? "dd/MMM/yyyy"; }
set { _dateFormat = value; }
}
public override bool Execute()
{
var content = System.IO.File.ReadAllText(File);
var newContents = System.Text.RegularExpressions.Regex.Replace(content, Regex, ReplacementText);
if(!string.IsNullOrEmpty(DatePlaceholder))
{
newContents = newContents.Replace(DatePlaceholder, DateTime.UtcNow.Date.ToString(DateFormat));
}
if(!newContents.Contains(ReplacementText))
{
SafeLogError("Did not manage to replace '{0}' with '{1}'", Regex, ReplacementText);
return false;//we didn't actually replace anything
}
System.IO.File.WriteAllText(File, newContents);
return true;
}
private void SafeLogError(string msg, params object[] args)
{
try
{
Debug.WriteLine(msg, args);
Log.LogError(msg, args);
}
catch (Exception)
{
//swallow... logging fails in the unit test environment, where the log isn't really set up
}
}
}
}
|
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Palaso.BuildTasks
{
public class FileUpdate : Task
{
[Required]
public string File { get; set; }
[Required]
public string Regex { get; set; }
[Required]
public string ReplacementText { get; set; }
/// <summary>
/// The string pattern to replace with the current date (UTC, dd/MMM/yyyy)
/// </summary>
public string DatePlaceholder { get; set; }
public override bool Execute()
{
var content = System.IO.File.ReadAllText(File);
var newContents = System.Text.RegularExpressions.Regex.Replace(content, this.Regex, ReplacementText);
if(!string.IsNullOrEmpty(DatePlaceholder))
{
newContents = newContents.Replace(DatePlaceholder, DateTime.UtcNow.Date.ToString("dd/MMM/yyyy"));
}
if(!newContents.Contains(ReplacementText))
{
SafeLogError("Did not manage to replace '{0}' with '{1}'", this.Regex, ReplacementText);
return false;//we didn't actually replace anything
}
System.IO.File.WriteAllText(File,
newContents);
return true;
}
private void SafeLogError(string msg, params object[] args)
{
try
{
Debug.WriteLine(string.Format(msg, args));
Log.LogError(msg, args);
}
catch (Exception)
{
//swallow... logging fails in the unit test environment, where the log isn't really set up
}
}
}
}
|
mit
|
C#
|
94b858d00ef7b8edead1937526d02b01bfee08aa
|
clean code
|
bitzhuwei/CSharpGL,bitzhuwei/CSharpGL,bitzhuwei/CSharpGL
|
Demos/OrderIndependentTransparency/OITNode.build_lists.cs
|
Demos/OrderIndependentTransparency/OITNode.build_lists.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSharpGL;
namespace OrderIndependentTransparency
{
public partial class OITNode : PickableNode
{
private const string buildListsVert = @"#version 330
in vec3 vPosition;
in vec3 vNormal;
uniform mat4 mvpMatrix;
uniform float minAlpha = 0.5f;
out vec4 surface_color;
void main(void)
{
vec3 color = vNormal;
if (color.r < 0) { color.r = -color.r; }
if (color.g < 0) { color.g = -color.g; }
if (color.b < 0) { color.b = -color.b; }
vec3 normalized = normalize(color);
float variance = (normalized.r - normalized.g) * (normalized.r - normalized.g);
variance += (normalized.g - normalized.b) * (normalized.g - normalized.b);
variance += (normalized.b - normalized.r) * (normalized.b - normalized.r);
variance = variance / 2.0f;// range from 0.0f - 1.0f
float a = (0.75f - minAlpha) * (1.0f - variance) + minAlpha;
surface_color = vec4(normalized, a);
gl_Position = mvpMatrix * vec4(vPosition, 1.0f);
}
";
private const string buildListsFrag = @"#version 420 core
layout (early_fragment_tests) in;
layout (binding = 0, r32ui) uniform uimage2D head_pointer_image;
layout (binding = 1, rgba32ui) uniform writeonly uimageBuffer list_buffer;
layout (binding = 0, offset = 0) uniform atomic_uint list_counter;
in vec4 surface_color;
layout (location = 0) out vec4 color;
void main(void)
{
uint index;
uint old_head;
uvec4 item;
index = atomicCounterIncrement(list_counter);
old_head = imageAtomicExchange(head_pointer_image, ivec2(gl_FragCoord.xy), uint(index));
item.x = old_head;
item.y = packUnorm4x8(surface_color);
item.z = floatBitsToUint(gl_FragCoord.z);
item.w = 255 / 4;
imageStore(list_buffer, int(index), item);
//color = surface_color;
discard;
}
";
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSharpGL;
namespace OrderIndependentTransparency
{
public partial class OITNode : PickableNode
{
private const string buildListsVert = @"#version 330
in vec3 vPosition;
in vec3 vNormal;
uniform mat4 mvpMatrix;
uniform float minAlpha = 0.5f;
out vec4 surface_color;
void main(void)
{
vec3 color = vNormal;
if (color.r < 0) { color.r = -color.r; }
if (color.g < 0) { color.g = -color.g; }
if (color.b < 0) { color.b = -color.b; }
vec3 normalized = normalize(color);
float variance = (normalized.r - normalized.g) * (normalized.r - normalized.g);
variance += (normalized.g - normalized.b) * (normalized.g - normalized.b);
variance += (normalized.b - normalized.r) * (normalized.b - normalized.r);
variance = variance / 2.0f;// range from 0.0f - 1.0f
float a = (0.75f - minAlpha) * (1.0f - variance) + minAlpha;
surface_color = vec4(normalized, a);
gl_Position = mvpMatrix * vec4(vPosition, 1.0f);
}
";
private const string buildListsFrag = @"#version 420 core
layout (early_fragment_tests) in;
layout (binding = 0, r32ui) uniform uimage2D head_pointer_image;
layout (binding = 1, rgba32ui) uniform writeonly uimageBuffer list_buffer;
layout (binding = 0, offset = 0) uniform atomic_uint list_counter;
uniform vec3 light_position = vec3(40.0, 20.0, 100.0);
in vec4 surface_color;
layout (location = 0) out vec4 color;
void main(void)
{
uint index;
uint old_head;
uvec4 item;
index = atomicCounterIncrement(list_counter);
old_head = imageAtomicExchange(head_pointer_image, ivec2(gl_FragCoord.xy), uint(index));
item.x = old_head;
item.y = packUnorm4x8(surface_color);
item.z = floatBitsToUint(gl_FragCoord.z);
item.w = 255 / 4;
imageStore(list_buffer, int(index), item);
//color = surface_color;
discard;
}
";
}
}
|
mit
|
C#
|
57ea76e6f42b6f0467cc5ec8317effc50d1b27e7
|
update version
|
prodot/ReCommended-Extension
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
|
using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.6.3.0")]
[assembly: AssemblyFileVersion("5.6.3")]
|
using System.Reflection;
using ReCommendedExtension;
// 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(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2022 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.6.2.0")]
[assembly: AssemblyFileVersion("5.6.2")]
|
apache-2.0
|
C#
|
996e3c1570d18e4e457b06d46b3a3fb7ed377db2
|
change all to protected set
|
0culus/ElectronicCash
|
ElectronicCash/BaseActor.cs
|
ElectronicCash/BaseActor.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectronicCash
{
/// <summary>
/// The base actor abstracts all common properties of our actors (mainly Bank, Merchant, Customer)
/// </summary>
public abstract class BaseActor
{
public string Name { get; protected set; }
public Guid ActorGuid { get; protected set; }
public Int32 Money { get; protected set; }
public Dictionary<Guid, List<MoneyOrder>> Ledger { get; protected set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectronicCash
{
/// <summary>
/// The base actor abstracts all common properties of our actors (mainly Bank, Merchant, Customer)
/// </summary>
public abstract class BaseActor
{
public string Name { get; set; }
public Guid ActorGuid { get; set; }
public Int32 Money { get; set; }
public Dictionary<Guid, List<MoneyOrder>> Ledger { get; protected set; }
}
}
|
mit
|
C#
|
093fb9e26fc08a9f801e8cbc9181e6d57b2c34cc
|
Update AddingLinkToURL2.cs
|
aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET
|
Examples/CSharp/Data/AddOn/Hyperlinks/AddingLinkToURL2.cs
|
Examples/CSharp/Data/AddOn/Hyperlinks/AddingLinkToURL2.cs
|
using System.IO;
using System.Drawing;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.Hyperlinks
{
public class AddingLinkToURL2
{
public static void Main(string[] args)
{
//ExStart:1
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Workbook object
int i = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
//Putting a value to the "A1" cell
worksheet.Cells["A1"].PutValue("Visit Aspose");
//Setting the font color of the cell to Blue
worksheet.Cells["A1"].GetStyle().Font.Color = Color.Blue;
//Setting the font of the cell to Single Underline
worksheet.Cells["A1"].GetStyle().Font.Underline = FontUnderlineType.Single;
//Adding a hyperlink to a URL at "A1" cell
worksheet.Hyperlinks.Add("A1", 1, 1, "http://www.aspose.com");
//Saving the Excel file
workbook.Save(dataDir + "book1.xls");
//ExEnd:1
}
}
}
|
using System.IO;
using System.Drawing;
using Aspose.Cells;
namespace Aspose.Cells.Examples.Data.AddOn.Hyperlinks
{
public class AddingLinkToURL2
{
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Workbook object
int i = workbook.Worksheets.Add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];
//Putting a value to the "A1" cell
worksheet.Cells["A1"].PutValue("Visit Aspose");
//Setting the font color of the cell to Blue
worksheet.Cells["A1"].GetStyle().Font.Color = Color.Blue;
//Setting the font of the cell to Single Underline
worksheet.Cells["A1"].GetStyle().Font.Underline = FontUnderlineType.Single;
//Adding a hyperlink to a URL at "A1" cell
worksheet.Hyperlinks.Add("A1", 1, 1, "http://www.aspose.com");
//Saving the Excel file
workbook.Save(dataDir + "book1.xls");
}
}
}
|
mit
|
C#
|
02347caab258c5e1b5de505c81894ccc1fd21459
|
Add an error message if opening the log file fails.
|
KirillOsenkov/MSBuildStructuredLog,KirillOsenkov/MSBuildStructuredLog
|
src/StructuredLogger/BinaryLog.cs
|
src/StructuredLogger/BinaryLog.cs
|
using System.Diagnostics;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class BinaryLog
{
public static Build ReadBuild(string filePath)
{
var eventSource = new BinaryLogReplayEventSource();
byte[] sourceArchive = null;
eventSource.OnBlobRead += (kind, bytes) =>
{
if (kind == BinaryLogRecordKind.SourceArchive)
{
sourceArchive = bytes;
}
};
StructuredLogger.SaveLogToDisk = false;
StructuredLogger.CurrentBuild = null;
var structuredLogger = new StructuredLogger();
structuredLogger.Parameters = "build.buildlog";
structuredLogger.Initialize(eventSource);
var sw = Stopwatch.StartNew();
eventSource.Replay(filePath);
var elapsed = sw.Elapsed;
var build = StructuredLogger.CurrentBuild;
StructuredLogger.CurrentBuild = null;
if (build == null)
{
build = new Build() { Succeeded = false };
build.AddChild(new Error() { Text = "Error when opening the file: " + filePath });
}
build.SourceFilesArchive = sourceArchive;
// build.AddChildAtBeginning(new Message { Text = "Elapsed: " + elapsed.ToString() });
return build;
}
}
}
|
using System.Diagnostics;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class BinaryLog
{
public static Build ReadBuild(string filePath)
{
var eventSource = new BinaryLogReplayEventSource();
byte[] sourceArchive = null;
eventSource.OnBlobRead += (kind, bytes) =>
{
if (kind == BinaryLogRecordKind.SourceArchive)
{
sourceArchive = bytes;
}
};
StructuredLogger.SaveLogToDisk = false;
StructuredLogger.CurrentBuild = null;
var structuredLogger = new StructuredLogger();
structuredLogger.Parameters = "build.buildlog";
structuredLogger.Initialize(eventSource);
var sw = Stopwatch.StartNew();
eventSource.Replay(filePath);
var elapsed = sw.Elapsed;
var build = StructuredLogger.CurrentBuild;
StructuredLogger.CurrentBuild = null;
build.SourceFilesArchive = sourceArchive;
// build.AddChildAtBeginning(new Message { Text = "Elapsed: " + elapsed.ToString() });
return build;
}
}
}
|
mit
|
C#
|
84683197c7bbd4fcc81eaa0da83436d297909fbe
|
Add GPS
|
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
|
src/Firehose.Web/Authors/XajuanSmith.cs
|
src/Firehose.Web/Authors/XajuanSmith.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 XajuanSmith : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Xajuan";
public string LastName => "Smith";
public string ShortBioOrTagLine => "is a PowerShell Evangelist, Senior Enterprise Consultant at Coretek Services.";
public string StateOrRegion => "Michigan, US";
public string EmailAddress => "Xajuan@live.com";
public string TwitterHandle => "XajuanS1";
public string GravatarHash => "9084467aac5841fa7977fa8cafae76c4";
public GeoPosition Position => new GeoPosition(44.182205, -84.506836);
public Uri WebSite => new Uri("https://Powershell.city/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri(" https://powershell.city/feed/"); }
}
public string GitHubHandle => "XajuanXBTS";
public bool Filter(SyndicationItem item)
{
return item.Categories.Where(i => i.Name.Equals("PowerShell", StringComparison.OrdinalIgnoreCase)).Any();
}
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 XajuanSmith : IAmACommunityMember, IFilterMyBlogPosts
{
public string FirstName => "Xajuan";
public string LastName => "Smith";
public string ShortBioOrTagLine => "is a PowerShell Evangelist, Senior Enterprise Consultant at Coretek Services.";
public string StateOrRegion => "Michigan, US";
public string EmailAddress => "Xajuan@live.com";
public string TwitterHandle => "XajuanS1";
public string GravatarHash => "9084467aac5841fa7977fa8cafae76c4";
public GeoPosition Position => null;
public Uri WebSite => new Uri("https://Powershell.city/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri(" https://powershell.city/feed/"); }
}
public string GitHubHandle => "XajuanXBTS";
public bool Filter(SyndicationItem item)
{
return item.Categories.Where(i => i.Name.Equals("PowerShell", StringComparison.OrdinalIgnoreCase)).Any();
}
public string FeedLanguageCode => "en";
}
}
|
mit
|
C#
|
defa7b9765d30d63442fd3e47878bcb56f3f74a3
|
Update dark FSLauncher handling
|
BrianLima/UWPHook
|
UWPHook/FullScreenLauncher.xaml.cs
|
UWPHook/FullScreenLauncher.xaml.cs
|
using MaterialDesignColors;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace UWPHook
{
/// <summary>
/// Interaction logic for FullScreenLauncher.xaml
/// </summary>
public partial class FullScreenLauncher : Window
{
public PaletteHelper pallet;
public FullScreenLauncher()
{
InitializeComponent();
textLaunch.Text = GetLauncherText();
pallet = new PaletteHelper();
BaseTheme darkTheme = BaseTheme.Dark;
var theme = Theme.Create(darkTheme.GetBaseTheme(),
SwatchHelper.Lookup[(MaterialDesignColor)PrimaryColor.DeepPurple],
SwatchHelper.Lookup[(MaterialDesignColor)SecondaryColor.Lime]);
pallet.SetTheme(theme);
}
private void Chip2_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9YPV3FHEFRAUQ");
}
string GetLauncherText()
{
int n = DateTime.Now.Second;
if (n >= 0 && n <= 10)
{
return "Hold on, i'm making your stream full screen!";
}
else if (n > 10 && n <= 20)
{
return "Waiting Steam in-home Streaming to catch up";
}
else if (n > 20 && n <= 30)
{
return "Starting Stream in a few seconds!";
}
else if (n > 30 && n <= 40)
{
return "Let's get this game started!";
}
else if (n > 40 && n <= 50)
{
return "Don't forget to check for updates at github.com/brianlima";
}
else
{
return "Good game, enjoy!";
}
}
}
}
|
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace UWPHook
{
/// <summary>
/// Interaction logic for FullScreenLauncher.xaml
/// </summary>
public partial class FullScreenLauncher : Window
{
public PaletteHelper pallet;
public FullScreenLauncher()
{
InitializeComponent();
textLaunch.Text = GetLauncherText();
pallet = new PaletteHelper();
pallet.SetLightDark(true);
}
private void Chip2_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9YPV3FHEFRAUQ");
}
string GetLauncherText()
{
int n = DateTime.Now.Second;
if (n >= 0 && n <= 10)
{
return "Hold on, i'm making your stream full screen!";
}
else if (n > 10 && n <= 20)
{
return "Waiting Steam in-home Streaming to catch up";
}
else if (n > 20 && n <= 30)
{
return "Starting Stream in a few seconds!";
}
else if (n > 30 && n <= 40)
{
return "Let's get this game started!";
}
else if (n > 40 && n <= 50)
{
return "Don't forget to check for updates at github.com/brianlima";
}
else
{
return "Good game, enjoy!";
}
}
}
}
|
mit
|
C#
|
98a6c789430bdaba73b5008c1630b37793ee2c5b
|
Fix the omission on the interface declaration
|
OpenSimian/opensimulator,ft-/arribasim-dev-tests,bravelittlescientist/opensim-performance,RavenB/opensim,OpenSimian/opensimulator,ft-/arribasim-dev-tests,Michelle-Argus/ArribasimExtract,TomDataworks/opensim,ft-/opensim-optimizations-wip,M-O-S-E-S/opensim,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-tests,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,rryk/omp-server,bravelittlescientist/opensim-performance,Michelle-Argus/ArribasimExtract,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,TomDataworks/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip,ft-/opensim-optimizations-wip-tests,OpenSimian/opensimulator,ft-/arribasim-dev-tests,rryk/omp-server,justinccdev/opensim,M-O-S-E-S/opensim,OpenSimian/opensimulator,justinccdev/opensim,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip,TomDataworks/opensim,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,RavenB/opensim,ft-/arribasim-dev-extras,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,bravelittlescientist/opensim-performance,TomDataworks/opensim,ft-/opensim-optimizations-wip-extras,Michelle-Argus/ArribasimExtract,justinccdev/opensim,BogusCurry/arribasim-dev,bravelittlescientist/opensim-performance,OpenSimian/opensimulator,ft-/arribasim-dev-tests,QuillLittlefeather/opensim-1,ft-/opensim-optimizations-wip-tests,Michelle-Argus/ArribasimExtract,Michelle-Argus/ArribasimExtract,bravelittlescientist/opensim-performance,justinccdev/opensim,Michelle-Argus/ArribasimExtract,bravelittlescientist/opensim-performance,RavenB/opensim,QuillLittlefeather/opensim-1,QuillLittlefeather/opensim-1,RavenB/opensim,M-O-S-E-S/opensim,BogusCurry/arribasim-dev,TomDataworks/opensim,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,ft-/opensim-optimizations-wip-extras,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,BogusCurry/arribasim-dev,QuillLittlefeather/opensim-1,RavenB/opensim,TomDataworks/opensim,ft-/opensim-optimizations-wip,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,M-O-S-E-S/opensim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,rryk/omp-server,ft-/arribasim-dev-extras,rryk/omp-server,TomDataworks/opensim,ft-/opensim-optimizations-wip-tests,justinccdev/opensim,rryk/omp-server,BogusCurry/arribasim-dev,RavenB/opensim,M-O-S-E-S/opensim,BogusCurry/arribasim-dev,ft-/arribasim-dev-extras,justinccdev/opensim,rryk/omp-server,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-tests
|
OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
|
OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
|
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
/// <summary>
/// Interface for communication between OpenSim modules and in-world scripts
/// </summary>
///
/// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages
/// from scripts in OpenSim modules.
public interface IScriptModuleComms
{
/// <summary>
/// Modules can subscribe to this event to receive command invocations from in-world scripts
/// </summary>
event ScriptCommand OnScriptCommand;
void RegisterScriptInvocation(object target, string method);
Delegate[] GetScriptInvocationList();
Delegate LookupScriptInvocation(string fname);
string LookupModInvocation(string fname);
Type[] LookupTypeSignature(string fname);
Type LookupReturnType(string fname);
object InvokeOperation(UUID scriptId, string fname, params object[] parms);
/// <summary>
/// Send a link_message event to an in-world script
/// </summary>
/// <param name="scriptId"></param>
/// <param name="code"></param>
/// <param name="text"></param>
/// <param name="key"></param>
void DispatchReply(UUID scriptId, int code, string text, string key);
// For use ONLY by the script API
void RaiseEvent(UUID script, string id, string module, string command, string key);
}
}
|
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
/// <summary>
/// Interface for communication between OpenSim modules and in-world scripts
/// </summary>
///
/// See OpenSim.Region.ScriptEngine.Shared.Api.MOD_Api.modSendCommand() for information on receiving messages
/// from scripts in OpenSim modules.
public interface IScriptModuleComms
{
/// <summary>
/// Modules can subscribe to this event to receive command invocations from in-world scripts
/// </summary>
event ScriptCommand OnScriptCommand;
void RegisterScriptInvocation(object target, MethodInfo mi);
Delegate[] GetScriptInvocationList();
Delegate LookupScriptInvocation(string fname);
string LookupModInvocation(string fname);
Type[] LookupTypeSignature(string fname);
Type LookupReturnType(string fname);
object InvokeOperation(UUID scriptId, string fname, params object[] parms);
/// <summary>
/// Send a link_message event to an in-world script
/// </summary>
/// <param name="scriptId"></param>
/// <param name="code"></param>
/// <param name="text"></param>
/// <param name="key"></param>
void DispatchReply(UUID scriptId, int code, string text, string key);
// For use ONLY by the script API
void RaiseEvent(UUID script, string id, string module, string command, string key);
}
}
|
bsd-3-clause
|
C#
|
dbc750c4d98ccbdf15b6d047ec354ffc84f26b09
|
Enable the track editor to display the duration of tracks one hour or
|
petejohanson/hyena,dufoli/hyena,GNOME/hyena,petejohanson/hyena,dufoli/hyena,arfbtwn/hyena,GNOME/hyena,arfbtwn/hyena
|
Hyena/Hyena/DateTimeUtil.cs
|
Hyena/Hyena/DateTimeUtil.cs
|
//
// Utilities.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Hyena
{
public class DateTimeUtil
{
public static readonly DateTime LocalUnixEpoch = new DateTime (1970, 1, 1).ToLocalTime ();
public static DateTime ToDateTime (long time)
{
return FromTimeT (time);
}
public static long FromDateTime (DateTime time)
{
return ToTimeT (time);
}
private static long super_ugly_min_hack = -15768000000; // 500 yrs before epoch...ewww
public static DateTime FromTimeT (long time)
{
return (time <= super_ugly_min_hack) ? DateTime.MinValue : LocalUnixEpoch.AddSeconds (time);
}
public static long ToTimeT (DateTime time)
{
return (long)time.Subtract (LocalUnixEpoch).TotalSeconds;
}
public static string FormatDuration (long time) {
return FormatDuration (TimeSpan.FromSeconds (time));
}
public static string FormatDuration (TimeSpan time) {
return FormatDuration (time.Hours, time.Minutes, time.Seconds);
}
public static string FormatDuration (int hours, int minutes, int seconds) {
return (hours > 0 ?
String.Format ("{0}:{1:00}:{2:00}", hours, minutes, seconds) :
String.Format ("{0}:{1:00}", minutes, seconds));
}
}
}
|
//
// Utilities.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright (C) 2007 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Hyena
{
public class DateTimeUtil
{
public static readonly DateTime LocalUnixEpoch = new DateTime (1970, 1, 1).ToLocalTime ();
public static DateTime ToDateTime (long time)
{
return FromTimeT (time);
}
public static long FromDateTime (DateTime time)
{
return ToTimeT (time);
}
private static long super_ugly_min_hack = -15768000000; // 500 yrs before epoch...ewww
public static DateTime FromTimeT (long time)
{
return (time <= super_ugly_min_hack) ? DateTime.MinValue : LocalUnixEpoch.AddSeconds (time);
}
public static long ToTimeT (DateTime time)
{
return (long)time.Subtract (LocalUnixEpoch).TotalSeconds;
}
public static string FormatDuration (long time) {
return (time > 3600 ?
String.Format ("{0}:{1:00}:{2:00}", time / 3600, (time / 60) % 60, time % 60) :
String.Format ("{0}:{1:00}", time / 60, time % 60));
}
}
}
|
mit
|
C#
|
0c16dd90be33f5057ad187a9c1d4263d78110b3e
|
fix order of events when dispatching events.
|
ardalis/ddd-guestbook,ardalis/ddd-guestbook,ardalis/ddd-guestbook
|
src/CleanArchitecture.Infrastructure/Data/AppDbContext.cs
|
src/CleanArchitecture.Infrastructure/Data/AppDbContext.cs
|
using CleanArchitecture.Core.Interfaces;
using CleanArchitecture.Core.Model;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using CleanArchitecture.Core.Entities;
using CleanArchitecture.Core.SharedKernel;
using Microsoft.EntityFrameworkCore.Metadata;
namespace CleanArchitecture.Infrastructure.Data
{
public class AppDbContext : DbContext
{
private readonly IDomainEventDispatcher _dispatcher;
public AppDbContext(DbContextOptions<AppDbContext> options, IDomainEventDispatcher dispatcher)
: base(options)
{
_dispatcher = dispatcher;
}
public DbSet<ToDoItem> ToDoItems { get; set; }
public DbSet<Guestbook> Guestbooks { get; set; }
public DbSet<GuestbookEntry> GuestbookEntries { get; set; }
public override int SaveChanges()
{
var entitiesWithEvents = ChangeTracker.Entries<BaseEntity>()
.Select(e => e.Entity)
.Where(e => e.Events.Any())
.ToArray();
var result = base.SaveChanges();
foreach (var entity in entitiesWithEvents)
{
var events = entity.Events.ToArray();
entity.Events.Clear();
foreach (var domainEvent in events)
{
_dispatcher.Dispatch(domainEvent);
}
}
return result;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
var navigation = modelBuilder.Entity<Guestbook>().Metadata.FindNavigation(nameof(Guestbook.Entries));
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
}
}
}
|
using CleanArchitecture.Core.Interfaces;
using CleanArchitecture.Core.Model;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using CleanArchitecture.Core.Entities;
using CleanArchitecture.Core.SharedKernel;
using Microsoft.EntityFrameworkCore.Metadata;
namespace CleanArchitecture.Infrastructure.Data
{
public class AppDbContext : DbContext
{
private readonly IDomainEventDispatcher _dispatcher;
public AppDbContext(DbContextOptions<AppDbContext> options, IDomainEventDispatcher dispatcher)
: base(options)
{
_dispatcher = dispatcher;
}
public DbSet<ToDoItem> ToDoItems { get; set; }
public DbSet<Guestbook> Guestbooks { get; set; }
public DbSet<GuestbookEntry> GuestbookEntries { get; set; }
public override int SaveChanges()
{
var entitiesWithEvents = ChangeTracker.Entries<BaseEntity>()
.Select(e => e.Entity)
.Where(e => e.Events.Any())
.ToArray();
foreach (var entity in entitiesWithEvents)
{
var events = entity.Events.ToArray();
entity.Events.Clear();
foreach (var domainEvent in events)
{
_dispatcher.Dispatch(domainEvent);
}
}
return base.SaveChanges();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
var navigation = modelBuilder.Entity<Guestbook>().Metadata.FindNavigation(nameof(Guestbook.Entries));
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
}
}
}
|
mit
|
C#
|
03aa0602a1dd42728ad4d4894a4d41b19889db9b
|
Change order of attributes
|
stevehodgkiss/restful-routing,stevehodgkiss/restful-routing,restful-routing/restful-routing,stevehodgkiss/restful-routing,restful-routing/restful-routing,restful-routing/restful-routing
|
src/RestfulRouting.Tests/Unit/HtmlHelperExtensionsSpec.cs
|
src/RestfulRouting.Tests/Unit/HtmlHelperExtensionsSpec.cs
|
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Machine.Specifications;
using MvcContrib.TestHelper;
using RestfulRouting;
using Rhino.Mocks;
namespace HtmlExtensionsSpecs
{
[Subject(typeof(HtmlHelperExtensions))]
public abstract class base_context
{
protected static HttpRequestBase _httpRequestBase;
protected static RequestContext _requestContext;
protected static RouteData _routeData;
protected static string _form;
protected static HtmlHelper _htmlHelper;
Establish context = () =>
{
var builder = new TestControllerBuilder();
var requestContext = new RequestContext(builder.HttpContext, new RouteData());
requestContext.HttpContext.Response.Stub(x => x.ApplyAppPathModifier(null)).IgnoreArguments().Do(new Func<string, string>(s => s)).Repeat.Any();
var viewData = new ViewDataDictionary();
var viewContext = MockRepository.GenerateStub<ViewContext>();
viewContext.RequestContext = requestContext;
viewContext.ViewData = viewData;
var viewDataContainer = MockRepository.GenerateStub<IViewDataContainer>();
viewDataContainer.ViewData = viewData;
_htmlHelper = new HtmlHelper(viewContext, viewDataContainer);
};
}
public class when_generating_a_put_override : base_context
{
static MvcHtmlString _tag;
Because of = () => _tag = _htmlHelper.PutOverrideTag();
It should_return_a_hidden_field_with_method_put = () =>
_tag.ToHtmlString().ShouldBe("<input name=\"_method\" type=\"hidden\" value=\"put\" />");
}
public class when_generating_a_delete_override : base_context
{
static MvcHtmlString _tag;
Because of = () => _tag = _htmlHelper.DeleteOverrideTag();
It should_return_a_hidden_field_with_method_delete = () => _tag.ToHtmlString().ShouldBe("<input name=\"_method\" type=\"hidden\" value=\"delete\" />");
}
}
|
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Machine.Specifications;
using MvcContrib.TestHelper;
using RestfulRouting;
using Rhino.Mocks;
namespace HtmlExtensionsSpecs
{
[Subject(typeof(HtmlHelperExtensions))]
public abstract class base_context
{
protected static HttpRequestBase _httpRequestBase;
protected static RequestContext _requestContext;
protected static RouteData _routeData;
protected static string _form;
protected static HtmlHelper _htmlHelper;
Establish context = () =>
{
var builder = new TestControllerBuilder();
var requestContext = new RequestContext(builder.HttpContext, new RouteData());
requestContext.HttpContext.Response.Stub(x => x.ApplyAppPathModifier(null)).IgnoreArguments().Do(new Func<string, string>(s => s)).Repeat.Any();
var viewData = new ViewDataDictionary();
var viewContext = MockRepository.GenerateStub<ViewContext>();
viewContext.RequestContext = requestContext;
viewContext.ViewData = viewData;
var viewDataContainer = MockRepository.GenerateStub<IViewDataContainer>();
viewDataContainer.ViewData = viewData;
_htmlHelper = new HtmlHelper(viewContext, viewDataContainer);
};
}
public class when_generating_a_put_override : base_context
{
static MvcHtmlString _tag;
Because of = () => _tag = _htmlHelper.PutOverrideTag();
It should_return_a_hidden_field_with_method_put = () =>
_tag.ToHtmlString().ShouldBe("<input type=\"hidden\" name=\"_method\" value=\"put\" />");
}
public class when_generating_a_delete_override : base_context
{
static MvcHtmlString _tag;
Because of = () => _tag = _htmlHelper.DeleteOverrideTag();
It should_return_a_hidden_field_with_method_delete = () => _tag.ToHtmlString().ShouldBe("<input type=\"hidden\" name=\"_method\" value=\"delete\" />");
}
}
|
mit
|
C#
|
7f1c90a570d22dcd3dc885e7523ca98337a003b6
|
Update assembly info
|
NattyNarwhal/Sounds
|
Sounds/Properties/AssemblyInfo.cs
|
Sounds/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("Sounds")]
[assembly: AssemblyDescription("Sounds music player")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("cmpct")]
[assembly: AssemblyProduct("Sounds")]
[assembly: AssemblyCopyright("MIT license")]
[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("f59aa8c3-db9f-4017-82ae-aa529c507514")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sounds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sounds")]
[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("f59aa8c3-db9f-4017-82ae-aa529c507514")]
// 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#
|
bd8a432bee654e58896d250c6370b9def8f462e0
|
upgrade version to 0.1.0.2
|
icsharp/log4net.Kafka
|
log4net.Kafka/Properties/AssemblyInfo.cs
|
log4net.Kafka/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("log4net.Kafka")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("log4net.Kafka")]
[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("ecad735b-e4d0-479a-b9ab-1f162f192c33")]
// 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.0.2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("log4net.Kafka")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("log4net.Kafka")]
[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("ecad735b-e4d0-479a-b9ab-1f162f192c33")]
// 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.0.1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
apache-2.0
|
C#
|
bcec0f79bbf4bdf661f4e08babca2f3be8757894
|
Fix interface for IHockeyClient.
|
ChristopheLav/HockeySDK-Windows,bitstadium/HockeySDK-Windows,dkackman/HockeySDK-Windows
|
Src/Kit.UWP/IHockeyClient.cs
|
Src/Kit.UWP/IHockeyClient.cs
|
namespace Microsoft.HockeyApp
{
/// <summary>
/// Public Interface for HockeyClient.
/// </summary>
public interface IHockeyClient
{
/// <summary>
/// Bootstraps HockeyApp SDK.
/// </summary>
/// <param name="appId">App ID.</param>
/// <param name="endpointAddress">The http address where the telemetry is sent.</param>
void Configure(string appId, string endpointAddress = null);
}
}
|
namespace Microsoft.HockeyApp
{
/// <summary>
/// Public Interface for HockeyClient.
/// </summary>
public interface IHockeyClient
{
/// <summary>
/// Bootstraps HockeyApp SDK.
/// </summary>
/// <param name="appId">App ID.</param>
/// <param name="endpointAddress">The http address where the telemetry is sent.</param>
void Configure(string appId, string endpointAddress);
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.