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 |
|---|---|---|---|---|---|---|---|---|
c2069c2c8d9ba222c1c7710760c1a9e02aab83f9 | write log file to appdata folder along with everything else | ArsenShnurkov/BitSharp | BitSharp.Node/LoggingModule.cs | BitSharp.Node/LoggingModule.cs | using Ninject;
using Ninject.Modules;
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.Node
{
public class LoggingModule : NinjectModule
{
private readonly LogLevel logLevel;
public LoggingModule(LogLevel logLevel)
{
this.logLevel = logLevel;
}
public override void Load()
{
// initialize logging configuration
var config = new LoggingConfiguration();
// create console target
var consoleTarget = new ColoredConsoleTarget();
config.AddTarget("console", consoleTarget);
// console settings
consoleTarget.Layout = "${message}";
// console rules
config.LoggingRules.Add(new LoggingRule("*", logLevel, consoleTarget));
// create file target
var fileTarget = new FileTarget();
config.AddTarget("file", fileTarget);
// file settings
fileTarget.FileName = "${specialfolder:folder=localapplicationdata}/BitSharp/BitSharp.log";
fileTarget.Layout = "${message}";
fileTarget.DeleteOldFileOnStartup = true;
// file rules
config.LoggingRules.Add(new LoggingRule("*", logLevel, fileTarget));
// activate configuration and bind
LogManager.Configuration = config;
this.Kernel.Bind<Logger>().ToMethod(context => LogManager.GetLogger("BitSharp"));
}
}
}
| using Ninject;
using Ninject.Modules;
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.Node
{
public class LoggingModule : NinjectModule
{
private readonly LogLevel logLevel;
public LoggingModule(LogLevel logLevel)
{
this.logLevel = logLevel;
}
public override void Load()
{
// initialize logging configuration
var config = new LoggingConfiguration();
// create console target
var consoleTarget = new ColoredConsoleTarget();
config.AddTarget("console", consoleTarget);
// console settings
consoleTarget.Layout = "${message}";
// console rules
config.LoggingRules.Add(new LoggingRule("*", logLevel, consoleTarget));
// create file target
var fileTarget = new FileTarget();
config.AddTarget("file", fileTarget);
// file settings
fileTarget.FileName = "${basedir}/BitSharp.log";
fileTarget.Layout = "${message}";
fileTarget.DeleteOldFileOnStartup = true;
// file rules
config.LoggingRules.Add(new LoggingRule("*", logLevel, fileTarget));
// activate configuration and bind
LogManager.Configuration = config;
this.Kernel.Bind<Logger>().ToMethod(context => LogManager.GetLogger("BitSharp"));
}
}
}
| unlicense | C# |
89013e65ca66f6e1c1180e7ecbc290acbf64c884 | Add upload property to file | contentful/contentful.net | Contentful.Core/Models/File.cs | Contentful.Core/Models/File.cs | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Contentful.Core.Models
{
/// <summary>
/// Represents information about the actual binary file of an <see cref="Asset"/>.
/// </summary>
public class File
{
/// <summary>
/// The original name of the file.
/// </summary>
public string FileName { get; set; }
/// <summary>
/// The content type of the data contained within this file.
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// An absolute URL to this file.
/// </summary>
public string Url { get; set; }
/// <summary>
/// The url to upload this file from.
/// </summary>
[JsonProperty("upload")]
public string UploadUrl { get; set; }
/// <summary>
/// Detailed information about the file stored by Contentful.
/// </summary>
public FileDetails Details { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Contentful.Core.Models
{
/// <summary>
/// Represents information about the actual binary file of an <see cref="Asset"/>.
/// </summary>
public class File
{
/// <summary>
/// The original name of the file.
/// </summary>
public string FileName { get; set; }
/// <summary>
/// The content type of the data contained within this file.
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// An absolute URL to this file.
/// </summary>
public string Url { get; set; }
/// <summary>
/// Detailed information about the file stored by Contentful.
/// </summary>
public FileDetails Details { get; set; }
}
}
| mit | C# |
83a6d455333df58d338e2561e0633212fae1969d | make Entity and Lite nullable | signumsoftware/framework,signumsoftware/framework | Signum.React.Extensions/Word/WordController.cs | Signum.React.Extensions/Word/WordController.cs | using System.ComponentModel.DataAnnotations;
using Signum.React.Facades;
using Signum.Entities.Word;
using Signum.Engine.Word;
using Signum.React.Files;
using Microsoft.AspNetCore.Mvc;
using Signum.React.Filters;
namespace Signum.React.Word;
[ValidateModelFilter]
public class WordController : ControllerBase
{
[HttpPost("api/word/createReport")]
public FileStreamResult CreateReport([Required, FromBody]CreateWordReportRequest request)
{
var template = request.Template.RetrieveAndRemember();
var modifiableEntity = request.Entity ?? request.Lite!.RetrieveAndRemember();
var file = template.CreateReportFileContent(modifiableEntity);
return FilesController.GetFileStreamResult(file);
}
public class CreateWordReportRequest
{
public Lite<WordTemplateEntity> Template { get; set; }
public Lite<Entity>? Lite { get; set; }
public ModifiableEntity? Entity { get; set; }
}
[HttpPost("api/word/constructorType")]
public string GetConstructorType([Required, FromBody]WordModelEntity wordModel)
{
var type = WordModelLogic.GetEntityType(wordModel.ToType());
return ReflectionServer.GetTypeName(type);
}
[HttpPost("api/word/wordTemplates")]
public List<Lite<WordTemplateEntity>> GetWordTemplates(string queryKey, WordTemplateVisibleOn visibleOn, [Required, FromBody]GetWordTemplatesRequest request)
{
object type = QueryLogic.ToQueryName(queryKey);
var entity = request.Lite?.Retrieve();
return WordTemplateLogic.GetApplicableWordTemplates(type, entity, visibleOn);
}
public class GetWordTemplatesRequest
{
public Lite<Entity> Lite { get; set; }
}
}
| using System.ComponentModel.DataAnnotations;
using Signum.React.Facades;
using Signum.Entities.Word;
using Signum.Engine.Word;
using Signum.React.Files;
using Microsoft.AspNetCore.Mvc;
using Signum.React.Filters;
namespace Signum.React.Word;
[ValidateModelFilter]
public class WordController : ControllerBase
{
[HttpPost("api/word/createReport")]
public FileStreamResult CreateReport([Required, FromBody]CreateWordReportRequest request)
{
var template = request.Template.RetrieveAndRemember();
var modifiableEntity = request.Entity ?? request.Lite.RetrieveAndRemember();
var file = template.CreateReportFileContent(modifiableEntity);
return FilesController.GetFileStreamResult(file);
}
public class CreateWordReportRequest
{
public Lite<WordTemplateEntity> Template { get; set; }
public Lite<Entity> Lite { get; set; }
public ModifiableEntity Entity { get; set; }
}
[HttpPost("api/word/constructorType")]
public string GetConstructorType([Required, FromBody]WordModelEntity wordModel)
{
var type = WordModelLogic.GetEntityType(wordModel.ToType());
return ReflectionServer.GetTypeName(type);
}
[HttpPost("api/word/wordTemplates")]
public List<Lite<WordTemplateEntity>> GetWordTemplates(string queryKey, WordTemplateVisibleOn visibleOn, [Required, FromBody]GetWordTemplatesRequest request)
{
object type = QueryLogic.ToQueryName(queryKey);
var entity = request.Lite?.Retrieve();
return WordTemplateLogic.GetApplicableWordTemplates(type, entity, visibleOn);
}
public class GetWordTemplatesRequest
{
public Lite<Entity> Lite { get; set; }
}
}
| mit | C# |
d656967d1277489f5874abf42d99fd9b167d267d | fix end date bug again and again | PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer,PapaMufflon/StandUpTimer | StandUpTimer.Web/Views/Statistics/Index.cshtml | StandUpTimer.Web/Views/Statistics/Index.cshtml | @model StandUpTimer.Web.Statistic.StatisticModel
@{
ViewBag.Title = "Statistics";
}
@section styles
{
@Styles.Render("~/Content/Statistics.css")
}
<h2>Statistics</h2>
<div id="gantt" style="width: 100%; height: 400px"></div>
@section scripts
{
@Scripts.Render("~/bundles/d3")
<script>
function mingleDateTimes(date, time) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), 0);
}
var tasks = [
@foreach (var item in Model.Statuses)
{
var startDate = string.Format("new Date({0})", Html.DisplayFor(modelItem => item.StartDate));
var endDate = item.EndDate.Equals("now")
? string.Format("mingleDateTimes(new Date({0}), new Date())", item.StartDate)
: string.Format("new Date({0})", Html.DisplayFor(modelItem => item.EndDate));
var taskName = Html.DisplayFor(modelItem => item.Day);
var status = Html.DisplayFor(modelItem => item.DeskState);
@:{ "startDate": @startDate, "endDate": @endDate, "taskName": "@taskName", "status": "@status" },
}
];
var taskStatus = {
"Standing": "standing",
"Sitting": "sitting",
"Inactive": "inactive"
};
var taskNames = [
@foreach (var day in Model.Days)
{
@:"@Html.DisplayFor(modelItem => day)",
}
];
tasks.sort(function (a, b) {
return a.endDate - b.endDate;
});
var maxDate = tasks[tasks.length - 1].endDate;
tasks.sort(function (a, b) {
return a.startDate - b.startDate;
});
var minDate = tasks[0].startDate;
var format = "%H:%M";
var gantt = d3.gantt("#gantt").taskTypes(taskNames).taskStatus(taskStatus).tickFormat(format);
gantt(tasks);
</script>
} | @model StandUpTimer.Web.Statistic.StatisticModel
@{
ViewBag.Title = "Statistics";
}
@section styles
{
@Styles.Render("~/Content/Statistics.css")
}
<h2>Statistics</h2>
<div id="gantt" style="width: 100%; height: 400px"></div>
@section scripts
{
@Scripts.Render("~/bundles/d3")
<script>
function mingleDateTimes(date, time) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(), time.getSeconds(), 0);
}
var tasks = [
@foreach (var item in Model.Statuses)
{
var startDate = string.Format("new Date({0})", Html.DisplayFor(modelItem => item.StartDate));
var endDate = item.EndDate.Equals("now")
? string.Format("mingleDateTimes({0}, new Date())", item.StartDate)
: string.Format("new Date({0})", Html.DisplayFor(modelItem => item.EndDate));
var taskName = Html.DisplayFor(modelItem => item.Day);
var status = Html.DisplayFor(modelItem => item.DeskState);
@:{ "startDate": @startDate, "endDate": @endDate, "taskName": "@taskName", "status": "@status" },
}
];
var taskStatus = {
"Standing": "standing",
"Sitting": "sitting",
"Inactive": "inactive"
};
var taskNames = [
@foreach (var day in Model.Days)
{
@:"@Html.DisplayFor(modelItem => day)",
}
];
tasks.sort(function (a, b) {
return a.endDate - b.endDate;
});
var maxDate = tasks[tasks.length - 1].endDate;
tasks.sort(function (a, b) {
return a.startDate - b.startDate;
});
var minDate = tasks[0].startDate;
var format = "%H:%M";
var gantt = d3.gantt("#gantt").taskTypes(taskNames).taskStatus(taskStatus).tickFormat(format);
gantt(tasks);
</script>
} | mit | C# |
fcae543017ed76b489ea8311ceda2142d4ecc295 | Add docs | mavasani/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,physhi/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,AmadeusW/roslyn,physhi/roslyn,eriawan/roslyn,sharwell/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,sharwell/roslyn,bartdesmet/roslyn,tmat/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,diryboy/roslyn,diryboy/roslyn,physhi/roslyn,KevinRansom/roslyn,tannergooding/roslyn,bartdesmet/roslyn,mavasani/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,sharwell/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,mgoertz-msft/roslyn,wvdd007/roslyn,tmat/roslyn,ErikSchierboom/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,tmat/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,CyrusNajmabadi/roslyn,eriawan/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,wvdd007/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,dotnet/roslyn | src/Features/Core/Portable/NavigateTo/NavigateToSearchResultComparer.cs | src/Features/Core/Portable/NavigateTo/NavigateToSearchResultComparer.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.NavigateTo
{
/// <summary>
/// Comparer that considers to navigate to results the same if they will navigate to the same document and span.
/// This ensures that we don't see tons of results for the same symbol when a file is linked into many projects.
/// <para/>
/// This also has the impact that a linked file (say from a shared project) will only show up for a single project
/// that it is linked into. This is believed to actually be desirable as showing multiple hits for effectively the
/// same symbol, just for different projects just feels like clutter in the UI without real benefit for the user
/// (since navigating will just take the user to the same location).
/// </summary>
internal class NavigateToSearchResultComparer : IEqualityComparer<INavigateToSearchResult>
{
public static readonly IEqualityComparer<INavigateToSearchResult> Instance = new NavigateToSearchResultComparer();
private NavigateToSearchResultComparer()
{
}
public bool Equals(INavigateToSearchResult? x, INavigateToSearchResult? y)
=> x?.NavigableItem.Document.FilePath == y?.NavigableItem.Document.FilePath &&
x?.NavigableItem.SourceSpan == y?.NavigableItem.SourceSpan;
public int GetHashCode(INavigateToSearchResult? obj)
=> Hash.Combine(obj?.NavigableItem.Document.FilePath, obj?.NavigableItem.SourceSpan.GetHashCode() ?? 0);
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.NavigateTo
{
/// <summary>
/// Comparer that considers to navigate to results the same if they will navigate to the same document and span.
/// This ensures that we don't see tons of results for the same symbol when a file is linked into many projects.
/// </summary>
internal class NavigateToSearchResultComparer : IEqualityComparer<INavigateToSearchResult>
{
public static readonly IEqualityComparer<INavigateToSearchResult> Instance = new NavigateToSearchResultComparer();
private NavigateToSearchResultComparer()
{
}
public bool Equals(INavigateToSearchResult? x, INavigateToSearchResult? y)
=> x?.NavigableItem.Document.FilePath == y?.NavigableItem.Document.FilePath &&
x?.NavigableItem.SourceSpan == y?.NavigableItem.SourceSpan;
public int GetHashCode(INavigateToSearchResult? obj)
=> Hash.Combine(obj?.NavigableItem.Document.FilePath, obj?.NavigableItem.SourceSpan.GetHashCode() ?? 0);
}
}
| mit | C# |
93b4168d52e09564fc2adc47e8d5557039955d97 | Remove unused import | MHeasell/Mappy,MHeasell/Mappy | Mappy/Models/IMapSelectionModel.cs | Mappy/Models/IMapSelectionModel.cs | namespace Mappy.Models
{
using System.ComponentModel;
public interface IMapSelectionModel : INotifyPropertyChanged
{
bool HasSelection { get; }
int? SelectedFeature { get; }
int? SelectedTile { get; }
int? SelectedStartPosition { get; }
void SelectAtPoint(int x, int y);
void ClearSelection();
void DeleteSelection();
void TranslateSelection(int x, int y);
void FlushTranslation();
void DragDropFeature(string name, int x, int y);
void DragDropTile(int id, int x, int y);
void DragDropStartPosition(int index, int x, int y);
}
}
| namespace Mappy.Models
{
using System.ComponentModel;
using Mappy.Data;
public interface IMapSelectionModel : INotifyPropertyChanged
{
bool HasSelection { get; }
int? SelectedFeature { get; }
int? SelectedTile { get; }
int? SelectedStartPosition { get; }
void SelectAtPoint(int x, int y);
void ClearSelection();
void DeleteSelection();
void TranslateSelection(int x, int y);
void FlushTranslation();
void DragDropFeature(string name, int x, int y);
void DragDropTile(int id, int x, int y);
void DragDropStartPosition(int index, int x, int y);
}
}
| mit | C# |
dfd793cfa2fe851c89f8eb86599d3f42f2fc7603 | Revert "Try fix cookie" | gyrosworkshop/Wukong,gyrosworkshop/Wukong | Wukong/Options/AzureOpenIdConnectionOptions.cs | Wukong/Options/AzureOpenIdConnectionOptions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
namespace Wukong.Options
{
public class AzureOpenIdConnectionOptions
{
public static Action<OpenIdConnectOptions> Options(AzureAdB2COptions option, string policy)
=> options =>
{
options.ClientId = option.ClientId;
options.ResponseType = OpenIdConnectResponseType.IdToken;
options.Authority = $"{option.Instance}/{option.Tenant}/{policy}/v2.0";
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.GetClaimsFromUserInfoEndpoint = true;
options.UseTokenLifetime = true;
};
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
namespace Wukong.Options
{
public class AzureOpenIdConnectionOptions
{
public static Action<OpenIdConnectOptions> Options(AzureAdB2COptions option, string policy)
=> options =>
{
options.ClientId = option.ClientId;
options.ResponseType = OpenIdConnectResponseType.IdToken;
options.Authority = $"{option.Instance}/{option.Tenant}/{policy}/v2.0";
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.GetClaimsFromUserInfoEndpoint = true;
options.UseTokenLifetime = true;
options.RemoteAuthenticationTimeout = TimeSpan.FromDays(30);
};
}
} | mit | C# |
a8bc7ba612402cca7b5db6687510b2315a3d383f | Change btn class for delete button (#24002) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/PersonalData.cshtml | src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Manage/PersonalData.cshtml | @page
@model PersonalDataModel
@{
ViewData["Title"] = "Personal Data";
ViewData["ActivePage"] = ManageNavPages.PersonalData;
}
<h4>@ViewData["Title"]</h4>
<div class="row">
<div class="col-md-6">
<p>Your account contains personal data that you have given us. This page allows you to download or delete that data.</p>
<p>
<strong>Deleting this data will permanently remove your account, and this cannot be recovered.</strong>
</p>
<form id="download-data" asp-page="DownloadPersonalData" method="post" class="form-group">
<button class="btn btn-primary" type="submit">Download</button>
</form>
<p>
<a id="delete" asp-page="DeletePersonalData" class="btn btn-secondary">Delete</a>
</p>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
| @page
@model PersonalDataModel
@{
ViewData["Title"] = "Personal Data";
ViewData["ActivePage"] = ManageNavPages.PersonalData;
}
<h4>@ViewData["Title"]</h4>
<div class="row">
<div class="col-md-6">
<p>Your account contains personal data that you have given us. This page allows you to download or delete that data.</p>
<p>
<strong>Deleting this data will permanently remove your account, and this cannot be recovered.</strong>
</p>
<form id="download-data" asp-page="DownloadPersonalData" method="post" class="form-group">
<button class="btn btn-primary" type="submit">Download</button>
</form>
<p>
<a id="delete" asp-page="DeletePersonalData" class="btn btn-primary">Delete</a>
</p>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
| apache-2.0 | C# |
7bf6009482519641901ab1eb0eda76ce0086f891 | Update copyright year | PintaProject/Pinta,PintaProject/Pinta,PintaProject/Pinta | Pinta/Dialogs/AboutPintaTabPage.cs | Pinta/Dialogs/AboutPintaTabPage.cs | // AboutPintaTabPage.cs
//
// Author:
// Viktoria Dudka (viktoriad@remobjects.com)
//
// Copyright (c) 2009 RemObjects Software
//
// 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 Gtk;
using Mono.Unix;
using Pinta.Core;
namespace Pinta
{
internal class AboutPintaTabPage : VBox
{
public AboutPintaTabPage ()
{
Label label = new Label ();
label.Markup = String.Format (
"<b>{0}</b>\n {1}",
Catalog.GetString ("Version"),
PintaCore.ApplicationVersion);
HBox hBoxVersion = new HBox ();
hBoxVersion.PackStart (label, false, false, 5);
this.PackStart (hBoxVersion, false, true, 0);
label = null;
label = new Label ();
label.Markup = string.Format ("<b>{0}</b>\n {1}", Catalog.GetString ("License"), Catalog.GetString ("Released under the MIT X11 License."));
HBox hBoxLicense = new HBox ();
hBoxLicense.PackStart (label, false, false, 5);
this.PackStart (hBoxLicense, false, true, 5);
label = null;
label = new Label ();
label.Markup = string.Format ("<b>{0}</b>\n (c) 2010-2019 {1}", Catalog.GetString ("Copyright"), Catalog.GetString ("by Pinta contributors"));
HBox hBoxCopyright = new HBox ();
hBoxCopyright.PackStart (label, false, false, 5);
this.PackStart (hBoxCopyright, false, true, 5);
this.ShowAll ();
}
}
}
| // AboutPintaTabPage.cs
//
// Author:
// Viktoria Dudka (viktoriad@remobjects.com)
//
// Copyright (c) 2009 RemObjects Software
//
// 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 Gtk;
using Mono.Unix;
using Pinta.Core;
namespace Pinta
{
internal class AboutPintaTabPage : VBox
{
public AboutPintaTabPage ()
{
Label label = new Label ();
label.Markup = String.Format (
"<b>{0}</b>\n {1}",
Catalog.GetString ("Version"),
PintaCore.ApplicationVersion);
HBox hBoxVersion = new HBox ();
hBoxVersion.PackStart (label, false, false, 5);
this.PackStart (hBoxVersion, false, true, 0);
label = null;
label = new Label ();
label.Markup = string.Format ("<b>{0}</b>\n {1}", Catalog.GetString ("License"), Catalog.GetString ("Released under the MIT X11 License."));
HBox hBoxLicense = new HBox ();
hBoxLicense.PackStart (label, false, false, 5);
this.PackStart (hBoxLicense, false, true, 5);
label = null;
label = new Label ();
label.Markup = string.Format ("<b>{0}</b>\n (c) 2010-2015 {1}", Catalog.GetString ("Copyright"), Catalog.GetString ("by Pinta contributors"));
HBox hBoxCopyright = new HBox ();
hBoxCopyright.PackStart (label, false, false, 5);
this.PackStart (hBoxCopyright, false, true, 5);
this.ShowAll ();
}
}
}
| mit | C# |
fe287acab0aca7d0409c2db538bcc027adbeee04 | allow transition to self | Pondidum/Finite,Pondidum/Finite | Sample.Common/States/NewRequest.cs | Sample.Common/States/NewRequest.cs | using Finite;
namespace Sample.Common.States
{
public class NewRequest : State<CreditRequest>
{
public NewRequest()
{
LinkTo<NewRequest>(); //explicitly allow samestate transitioning
LinkTo<AwaitingManagerApproval>(request => request.Justification.Trim() != "" && request.Amount > 0);
LinkTo<Abandoned>();
}
}
}
| using Finite;
namespace Sample.Common.States
{
public class NewRequest : State<CreditRequest>
{
public NewRequest()
{
LinkTo<AwaitingManagerApproval>(request => request.Justification.Trim() != "" && request.Amount > 0);
LinkTo<Abandoned>();
}
}
}
| lgpl-2.1 | C# |
29fad9234a637a24e77d1c6ac56d7c711e0a3f11 | Update TSA.cs | mwaltman/TextSplit | TextSplit/TSA.cs | TextSplit/TSA.cs | using System;
using System.Windows.Forms;
namespace TextSplit
{
// The window showing information about TextSplit
public partial class TextSplitAbout : Form
{
public TextSplitAbout() {
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
this.Close();
}
}
}
| using System;
using System.Windows.Forms;
namespace TextSplit
{
public partial class TextSplitAbout : Form
{
public TextSplitAbout() {
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e) {
this.Close();
}
}
}
| cc0-1.0 | C# |
c1a75ff5a40ce754feb84a1aea1575ed3da71935 | Adjust version information. | beppler/trayleds | TrayLeds/Properties/AssemblyInfo.cs | TrayLeds/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TrayLeds")]
[assembly: AssemblyDescription("Tray Notification Leds")]
[assembly: AssemblyProduct("TrayLeds")]
[assembly: AssemblyCopyright("Copyright © 2017 Carlos Alberto Costa Beppler")]
// 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("eecfb156-872b-498d-9a01-42d37066d3d4")]
// 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.3.1.0")]
[assembly: AssemblyFileVersion("0.3.1.0")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TrayLeds")]
[assembly: AssemblyDescription("Tray Notification Leds")]
[assembly: AssemblyProduct("TrayLeds")]
[assembly: AssemblyCopyright("Copyright © Carlos Alberto Costa Beppler 2017")]
// 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("eecfb156-872b-498d-9a01-42d37066d3d4")]
// 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.3.0.0")]
[assembly: AssemblyFileVersion("0.3.0.0")]
| mit | C# |
794ecf79da33db5362000fa512da8a52075549f7 | fix version into AssemblyInfo | gandarez/ssms-wakatime | WakaTime/Properties/AssemblyInfo.cs | WakaTime/Properties/AssemblyInfo.cs | using System;
using System.Reflection;
using System.Resources;
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("WakaTime")]
[assembly: AssemblyDescription("Quantify your coding with automatic time tracking and metrics about your programming.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WakaTime")]
[assembly: AssemblyProduct("WakaTime")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: NeutralResourcesLanguage("en-US")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: InternalsVisibleTo("WakaTime_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
[assembly: InternalsVisibleTo("WakaTime_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
| using System;
using System.Reflection;
using System.Resources;
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("WakaTime")]
[assembly: AssemblyDescription("Quantify your coding with automatic time tracking and metrics about your programming.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WakaTime")]
[assembly: AssemblyProduct("WakaTime")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: NeutralResourcesLanguage("en-US")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.9")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: InternalsVisibleTo("WakaTime_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
[assembly: InternalsVisibleTo("WakaTime_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
| bsd-3-clause | C# |
a1b99d12abdb0ca8289342a6adc66a1f96c44a71 | Add `Guard.NotNull()` to `BitcoinStore` | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi/Stores/BitcoinStore.cs | WalletWasabi/Stores/BitcoinStore.cs | using System.Threading.Tasks;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Blockchain.Mempool;
using WalletWasabi.Blockchain.P2p;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Stores
{
/// <summary>
/// The purpose of this class is to safely and performantly manage all the Bitcoin related data
/// that's being serialized to disk, like transactions, wallet files, keys, blocks, index files, etc...
/// </summary>
public class BitcoinStore
{
public BitcoinStore(
IndexStore indexStore,
AllTransactionStore transactionStore,
MempoolService mempoolService)
{
IndexStore = Guard.NotNull(nameof(indexStore), indexStore);
TransactionStore = Guard.NotNull(nameof(transactionStore), transactionStore);
MempoolService = Guard.NotNull(nameof(mempoolService), mempoolService);
}
public bool IsInitialized { get; private set; }
public IndexStore IndexStore { get; }
public AllTransactionStore TransactionStore { get; }
public SmartHeaderChain SmartHeaderChain => IndexStore.SmartHeaderChain;
public MempoolService MempoolService { get; }
/// <summary>
/// This should not be a property, but a creator function, because it'll be cloned left and right by NBitcoin later.
/// So it should not be assumed it's some singleton.
/// </summary>
public UntrustedP2pBehavior CreateUntrustedP2pBehavior() => new UntrustedP2pBehavior(MempoolService);
public async Task InitializeAsync()
{
using (BenchmarkLogger.Measure())
{
var initTasks = new[]
{
IndexStore.InitializeAsync(),
TransactionStore.InitializeAsync()
};
await Task.WhenAll(initTasks).ConfigureAwait(false);
IsInitialized = true;
}
}
}
}
| using System.Threading.Tasks;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Blockchain.Mempool;
using WalletWasabi.Blockchain.P2p;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Logging;
namespace WalletWasabi.Stores
{
/// <summary>
/// The purpose of this class is to safely and performantly manage all the Bitcoin related data
/// that's being serialized to disk, like transactions, wallet files, keys, blocks, index files, etc...
/// </summary>
public class BitcoinStore
{
public BitcoinStore(
IndexStore indexStore,
AllTransactionStore transactionStore,
MempoolService mempoolService)
{
IndexStore = indexStore;
TransactionStore = transactionStore;
MempoolService = mempoolService;
}
public bool IsInitialized { get; private set; }
public IndexStore IndexStore { get; }
public AllTransactionStore TransactionStore { get; }
public SmartHeaderChain SmartHeaderChain => IndexStore.SmartHeaderChain;
public MempoolService MempoolService { get; }
/// <summary>
/// This should not be a property, but a creator function, because it'll be cloned left and right by NBitcoin later.
/// So it should not be assumed it's some singleton.
/// </summary>
public UntrustedP2pBehavior CreateUntrustedP2pBehavior() => new UntrustedP2pBehavior(MempoolService);
public async Task InitializeAsync()
{
using (BenchmarkLogger.Measure())
{
var initTasks = new[]
{
IndexStore.InitializeAsync(),
TransactionStore.InitializeAsync()
};
await Task.WhenAll(initTasks).ConfigureAwait(false);
IsInitialized = true;
}
}
}
}
| mit | C# |
79237181a4f0638e16676e9dc332eb297a0dae95 | Package Update #CHANGE: Pushed AdamsLair.WinForms 1.1.8 | AdamsLair/winforms | WinForms/Properties/AssemblyInfo.cs | WinForms/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.8")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("AdamsLair.WinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdamsLair.WinForms")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.7")]
| mit | C# |
35ef68ab10cdef5274b9280a62f5d7c966c9cdff | Update build.cake | xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents | XPlat/OfficeUIFabric/iOS/build.cake | XPlat/OfficeUIFabric/iOS/build.cake |
var TARGET = Argument ("t", Argument ("target", "Default"));
var PODFILE_VERSION = "0.2.13";
var NUGET_VERSION = PODFILE_VERSION + "-pre1";
Task ("externals")
.WithCriteria (!DirectoryExists ("./externals/OfficeUIFabric.framework"))
.Does (() =>
{
EnsureDirectoryExists ("./externals");
// Download and build Dependencies
StartProcess("make", new ProcessSettings
{
Arguments = "all",
WorkingDirectory = "./externals/",
});
// Update .csproj nuget versions
XmlPoke("./source/OfficeUIFabric.iOS.csproj", "/Project/PropertyGroup/PackageVersion", NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./OfficeUIFabric.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./OfficeUIFabric.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task ("clean")
.Does (() =>
{
StartProcess("make", new ProcessSettings
{
Arguments = "clean",
WorkingDirectory = "./externals/",
});
});
RunTarget (TARGET);
|
var TARGET = Argument ("t", Argument ("target", "Default"));
var PODFILE_VERSION = "0.2.13-pre1";
var NUGET_VERSION = PODFILE_VERSION;
Task ("externals")
.WithCriteria (!DirectoryExists ("./externals/OfficeUIFabric.framework"))
.Does (() =>
{
EnsureDirectoryExists ("./externals");
// Download and build Dependencies
StartProcess("make", new ProcessSettings
{
Arguments = "all",
WorkingDirectory = "./externals/",
});
// Update .csproj nuget versions
XmlPoke("./source/OfficeUIFabric.iOS.csproj", "/Project/PropertyGroup/PackageVersion", NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./OfficeUIFabric.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./OfficeUIFabric.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task ("clean")
.Does (() =>
{
StartProcess("make", new ProcessSettings
{
Arguments = "clean",
WorkingDirectory = "./externals/",
});
});
RunTarget (TARGET);
| mit | C# |
db751a7da04b5d6c094815c0ba16a293c371ab07 | Fix typo | ChristopherHackett/VisualStudio,mariotristan/VisualStudio,GuilhermeSa/VisualStudio,luizbon/VisualStudio,bbqchickenrobot/VisualStudio,Dr0idKing/VisualStudio,naveensrinivasan/VisualStudio,github/VisualStudio,YOTOV-LIMITED/VisualStudio,modulexcite/VisualStudio,yovannyr/VisualStudio,SaarCohen/VisualStudio,github/VisualStudio,bradthurber/VisualStudio,nulltoken/VisualStudio,radnor/VisualStudio,amytruong/VisualStudio,github/VisualStudio,shaunstanislaus/VisualStudio,HeadhunterXamd/VisualStudio,8v060htwyc/VisualStudio,GProulx/VisualStudio,pwz3n0/VisualStudio,AmadeusW/VisualStudio | src/GitHub.VisualStudio/Base/TeamExplorerItemBase.cs | src/GitHub.VisualStudio/Base/TeamExplorerItemBase.cs | using NullGuard;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitHub.VisualStudio.Base
{
abstract class TeamExplorerItemBase : TeamExplorerBase, INotifyPropertySource
{
bool isEnabled;
public bool IsEnabled
{
get { return isEnabled; }
set { isEnabled = value; this.RaisePropertyChange(); }
}
bool isVisible;
public bool IsVisible
{
get { return isVisible; }
set { isVisible = value; this.RaisePropertyChange(); }
}
string text;
[AllowNull]
public string Text
{
get { return text; }
set { text = value; this.RaisePropertyChange(); }
}
public virtual void Execute()
{
}
public virtual void Invalidate()
{
}
}
}
| using NullGuard;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitHub.VisualStudio.Base
{
abstract class TeamExplorerItemBase : TeamExplorerBase, INotifyPropertySource
{
bool isEnabled;
public bool IsEnabled
{
get { return isEnabled; }
set { isEnabled = value; this.RaisePropertyChange(); }
}
bool isVisible;
public bool IsVisible
{
get { return IsVisible; }
set { IsVisible = value; this.RaisePropertyChange(); }
}
string text;
[AllowNull]
public string Text
{
get { return text; }
set { text = value; this.RaisePropertyChange(); }
}
public virtual void Execute()
{
}
public virtual void Invalidate()
{
}
}
}
| mit | C# |
2d4206480837751e3ebb10d91bcecbc4af2c73c5 | add dispose method in baseModelRepo | VladTsiukin/AirlineTicketOffice | AirlineTicketOffice.Repository/Repositories/BaseModelRepository.cs | AirlineTicketOffice.Repository/Repositories/BaseModelRepository.cs | using AirlineTicketOffice.Data;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Entity;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace AirlineTicketOffice.Repository.Repositories
{
public class BaseModelRepository<TEntity> where TEntity : class
{
protected readonly AirlineTicketOfficeEntities _context;
public BaseModelRepository()
{
this._context = new AirlineTicketOfficeEntities();
}
public int Save()
{
return _context.SaveChanges();
}
protected void RefreshAll()
{
try
{
foreach (var entity in _context.ChangeTracker.Entries())
{
entity.Reload();
}
}
catch (Exception ex)
{
Debug.WriteLine("'RefreshAll()' method fail..." + ex.Message);
}
}
protected void Close()
{
_context.Dispose();
}
}
} | using AirlineTicketOffice.Data;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Entity;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace AirlineTicketOffice.Repository.Repositories
{
public class BaseModelRepository<TEntity> where TEntity : class
{
protected readonly AirlineTicketOfficeEntities _context;
public BaseModelRepository()
{
this._context = new AirlineTicketOfficeEntities();
}
public int Save()
{
return _context.SaveChanges();
}
protected void RefreshAll()
{
try
{
foreach (var entity in _context.ChangeTracker.Entries())
{
entity.Reload();
}
}
catch (Exception ex)
{
Debug.WriteLine("'RefreshAll()' method fail..." + ex.Message);
}
}
}
} | mit | C# |
4e3ea0a2b5e3b98435822788af14bac9534c95ef | Use same namespace for serializers | davetimmins/ArcGIS.PCL,davetimmins/ArcGIS.PCL | ArcGIS.ServiceModel.Serializers.JsonDotNet/JsonDotNetSerializer.cs | ArcGIS.ServiceModel.Serializers.JsonDotNet/JsonDotNetSerializer.cs | using System;
using System.Collections.Generic;
using ArcGIS.ServiceModel;
using ArcGIS.ServiceModel.Operation;
namespace ArcGIS.ServiceModel.Serializers
{
public class JsonDotNetSerializer : ISerializer
{
static ISerializer _serializer = null;
public static void Init()
{
_serializer = new JsonDotNetSerializer();
SerializerFactory.Get = (() => _serializer ?? new JsonDotNetSerializer());
}
readonly Newtonsoft.Json.JsonSerializerSettings _settings;
public JsonDotNetSerializer()
{
_settings = new Newtonsoft.Json.JsonSerializerSettings
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore,
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
};
}
public Dictionary<String, String> AsDictionary<T>(T objectToConvert) where T : CommonParameters
{
var stringValue = Newtonsoft.Json.JsonConvert.SerializeObject(objectToConvert, _settings);
var jobject = Newtonsoft.Json.Linq.JObject.Parse(stringValue);
var dict = new Dictionary<String, String>();
foreach (var item in jobject)
{
dict.Add(item.Key, item.Value.ToString());
}
return dict;
}
public T AsPortalResponse<T>(String dataToConvert) where T : IPortalResponse
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(dataToConvert, _settings);
}
}
}
| using System;
using System.Collections.Generic;
using ArcGIS.ServiceModel;
using ArcGIS.ServiceModel.Operation;
namespace ArcGIS.Test
{
public class JsonDotNetSerializer : ISerializer
{
static ISerializer _serializer = null;
public static void Init()
{
_serializer = new JsonDotNetSerializer();
SerializerFactory.Get = (() => _serializer ?? new JsonDotNetSerializer());
}
readonly Newtonsoft.Json.JsonSerializerSettings _settings;
public JsonDotNetSerializer()
{
_settings = new Newtonsoft.Json.JsonSerializerSettings
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore,
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
};
}
public Dictionary<String, String> AsDictionary<T>(T objectToConvert) where T : CommonParameters
{
var stringValue = Newtonsoft.Json.JsonConvert.SerializeObject(objectToConvert, _settings);
var jobject = Newtonsoft.Json.Linq.JObject.Parse(stringValue);
var dict = new Dictionary<String, String>();
foreach (var item in jobject)
{
dict.Add(item.Key, item.Value.ToString());
}
return dict;
}
public T AsPortalResponse<T>(String dataToConvert) where T : IPortalResponse
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(dataToConvert, _settings);
}
}
}
| mit | C# |
6b0d1c090f86128510ac9d92e6f326d968013327 | Update Hecarim.cs | metaphorce/leaguesharp | MetaSmite/Champions/Hecarim.cs | MetaSmite/Champions/Hecarim.cs | using System;
using LeagueSharp;
using LeagueSharp.Common;
using SharpDX;
namespace MetaSmite.Champions
{
public static class Hecarim
{
internal static Spell champSpell;
private static Menu Config = MetaSmite.Config;
private static double totalDamage;
private static double spellDamage;
public static void Load()
{
//Load spells
champSpell = new Spell(SpellSlot.Q, 350f);
//Spell usage.
Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true);
//Events
Game.OnUpdate += OnGameUpdate;
}
private static void OnGameUpdate(EventArgs args)
{
if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active)
{
if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range)
{
spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot);
totalDamage = spellDamage + SmiteManager.damage;
if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() &&
SmiteManager.smite.IsReady() &&
champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health)
{
champSpell.Cast();
}
if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() &&
champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health)
{
champSpell.Cast();
}
}
}
}
}
}
| using System;
using LeagueSharp;
using LeagueSharp.Common;
using SharpDX;
namespace MetaSmite.Champions
{
public static class Hecarim
{
internal static Spell champSpell;
private static Menu Config = MetaSmite.Config;
private static double totalDamage;
private static double spellDamage;
public static void Load()
{
//Load spells
champSpell = new Spell(SpellSlot.Q, 350f);
//Spell usage.
Config.AddItem(new MenuItem("Enabled-" + MetaSmite.Player.ChampionName, MetaSmite.Player.ChampionName + "-" + champSpell.Slot)).SetValue(true);
//Events
Game.OnGameUpdate += OnGameUpdate;
}
private static void OnGameUpdate(EventArgs args)
{
if (Config.Item("Enabled").GetValue<KeyBind>().Active || Config.Item("EnabledH").GetValue<KeyBind>().Active)
{
if (SmiteManager.mob != null && Config.Item(SmiteManager.mob.BaseSkinName).GetValue<bool>() && Vector3.Distance(MetaSmite.Player.ServerPosition, SmiteManager.mob.ServerPosition) <= champSpell.Range)
{
spellDamage = MetaSmite.Player.GetSpellDamage(SmiteManager.mob, champSpell.Slot);
totalDamage = spellDamage + SmiteManager.damage;
if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() &&
SmiteManager.smite.IsReady() &&
champSpell.IsReady() && totalDamage >= SmiteManager.mob.Health)
{
champSpell.Cast();
}
if (Config.Item("Enabled-" + ObjectManager.Player.ChampionName).GetValue<bool>() &&
champSpell.IsReady() && spellDamage >= SmiteManager.mob.Health)
{
champSpell.Cast();
}
}
}
}
}
}
| mit | C# |
6b6a764523c298ac3de087896d074023f8639dc6 | Add NativeErrorCode. Fixes #17 | mj1856/SimpleImpersonation | SimpleImpersonation/ImpersonationException.cs | SimpleImpersonation/ImpersonationException.cs | using System;
using System.ComponentModel;
namespace SimpleImpersonation
{
/// <summary>
/// Exception thrown when impersonation fails.
/// </summary>
/// <remarks>
/// Inherits from <see cref="ApplicationException"/> for backwards compatibility reasons.
/// </remarks>
public class ImpersonationException : ApplicationException
{
/// <summary>
/// Initializes a new instance of the <see cref="ImpersonationException"/> class from a specific <see cref="Win32Exception"/>.
/// </summary>
/// <param name="win32Exception">The exception to base this exception on.</param>
public ImpersonationException(Win32Exception win32Exception)
: base(win32Exception.Message, win32Exception)
{
// Note that the Message is generated inside the Win32Exception class via the Win32 FormatMessage function.
}
/// <summary>
/// Returns the Win32 error code handle for the exception.
/// </summary>
public int ErrorCode => ((Win32Exception)InnerException).ErrorCode;
/// <summary>
/// Returns the Win32 native error code for the exception.
/// </summary>
public int NativeErrorCode => ((Win32Exception)InnerException).NativeErrorCode;
}
}
| using System;
using System.ComponentModel;
namespace SimpleImpersonation
{
/// <summary>
/// Exception thrown when impersonation fails.
/// </summary>
/// <remarks>
/// Inherits from <see cref="ApplicationException"/> for backwards compatibility reasons.
/// </remarks>
public class ImpersonationException : ApplicationException
{
/// <summary>
/// Initializes a new instance of the <see cref="ImpersonationException"/> class from a specific <see cref="Win32Exception"/>.
/// </summary>
/// <param name="win32Exception">The exception to base this exception on.</param>
public ImpersonationException(Win32Exception win32Exception)
: base(win32Exception.Message, win32Exception)
{
// Note that the Message is generated inside the Win32Exception class via the Win32 FormatMessage function.
}
/// <summary>
/// Returns the Win32 Error Code for the exception.
/// </summary>
public int ErrorCode => ((Win32Exception)InnerException).ErrorCode;
}
}
| mit | C# |
2bca081a679d12696dc16f4a74376631ceac69ba | Add force solve handler to Memory | samfun123/KtaneTwitchPlays,CaitSith2/KtaneTwitchPlays | TwitchPlaysAssembly/Src/ComponentSolvers/Vanilla/MemoryComponentSolver.cs | TwitchPlaysAssembly/Src/ComponentSolvers/Vanilla/MemoryComponentSolver.cs | using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Rules;
public class MemoryComponentSolver : ComponentSolver
{
public MemoryComponentSolver(BombCommander bombCommander, MemoryComponent bombComponent) :
base(bombCommander, bombComponent)
{
_buttons = bombComponent.Buttons;
modInfo = ComponentSolverFactory.GetModuleInfo("MemoryComponentSolver", "!{0} position 2, !{0} pos 2, !{0} p 2 [2nd position] | !{0} label 3, !{0} lab 3, !{0} l 3 [label 3]");
}
protected override IEnumerator RespondToCommandInternal(string inputCommand)
{
string[] commandParts = inputCommand.ToLowerInvariant().Split(' ');
if (commandParts.Length != 2)
{
yield break;
}
if (!int.TryParse(commandParts[1], out int buttonNumber))
{
yield break;
}
if (buttonNumber >= 1 && buttonNumber <= 4)
{
if (commandParts[0].EqualsAny("position", "pos", "p"))
{
yield return "position";
yield return DoInteractionClick(_buttons[buttonNumber - 1]);
}
else if (commandParts[0].EqualsAny("label", "lab", "l"))
{
foreach(KeypadButton button in _buttons)
{
if (button.GetText().Equals(buttonNumber.ToString()))
{
yield return "label";
yield return DoInteractionClick(button);
break;
}
}
}
}
}
protected override IEnumerator ForcedSolveIEnumerator()
{
MemoryComponent mc = ((MemoryComponent) BombComponent);
while (!BombComponent.IsActive) yield return true;
while (!BombComponent.IsSolved)
{
while (!mc.IsInputValid) yield return true;
List<Rule> ruleList = RuleManager.Instance.MemoryRuleSet.RulesDictionary[mc.CurrentStage];
yield return DoInteractionClick(_buttons[RuleManager.Instance.MemoryRuleSet.ExecuteRuleList(mc, ruleList)]);
}
}
private KeypadButton[] _buttons = null;
}
| using System.Collections;
public class MemoryComponentSolver : ComponentSolver
{
public MemoryComponentSolver(BombCommander bombCommander, MemoryComponent bombComponent) :
base(bombCommander, bombComponent)
{
_buttons = bombComponent.Buttons;
modInfo = ComponentSolverFactory.GetModuleInfo("MemoryComponentSolver", "!{0} position 2, !{0} pos 2, !{0} p 2 [2nd position] | !{0} label 3, !{0} lab 3, !{0} l 3 [label 3]");
}
protected override IEnumerator RespondToCommandInternal(string inputCommand)
{
string[] commandParts = inputCommand.ToLowerInvariant().Split(' ');
if (commandParts.Length != 2)
{
yield break;
}
if (!int.TryParse(commandParts[1], out int buttonNumber))
{
yield break;
}
if (buttonNumber >= 1 && buttonNumber <= 4)
{
if (commandParts[0].EqualsAny("position", "pos", "p"))
{
yield return "position";
yield return DoInteractionClick(_buttons[buttonNumber - 1]);
}
else if (commandParts[0].EqualsAny("label", "lab", "l"))
{
foreach(KeypadButton button in _buttons)
{
if (button.GetText().Equals(buttonNumber.ToString()))
{
yield return "label";
yield return DoInteractionClick(button);
break;
}
}
}
}
}
private KeypadButton[] _buttons = null;
}
| mit | C# |
0d528ff8893e3ef28b8902979071be88dccbfee0 | Check if zip input path exists. | Chaser324/unity-build-actions | UnityBuild-ZipFile/Editor/ZipFileOperation.cs | UnityBuild-ZipFile/Editor/ZipFileOperation.cs | using Ionic.Zip;
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace SuperSystems.UnityBuild
{
public class ZipFileOperation : BuildAction, IPreBuildAction, IPreBuildPerPlatformAction, IPostBuildAction, IPostBuildPerPlatformAction
{
public string inputPath = "$BUILDPATH";
public string outputPath = "$BUILDPATH";
public string outputFileName = "$PRODUCT_NAME-$RELEASE_TYPE-$YEAR_$MONTH_$DAY.zip";
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref UnityEditor.BuildOptions options, string configKey, string buildPath)
{
string resolvedOutputPath = Path.Combine(outputPath.Replace("$BUILDPATH", buildPath), outputFileName);
resolvedOutputPath = BuildProject.ResolvePath(resolvedOutputPath, releaseType, platform, architecture, distribution, buildTime);
string resolvedInputPath = inputPath.Replace("$BUILDPATH", buildPath);
resolvedInputPath = BuildProject.ResolvePath(resolvedInputPath, releaseType, platform, architecture, distribution, buildTime);
if (!resolvedOutputPath.EndsWith(".zip"))
resolvedOutputPath += ".zip";
PerformZip(Path.GetFullPath(resolvedInputPath), Path.GetFullPath(resolvedOutputPath));
}
private void PerformZip(string inputPath, string outputPath)
{
try
{
if (!Directory.Exists(inputPath))
{
BuildNotificationList.instance.AddNotification(new BuildNotification(
BuildNotification.Category.Error,
"Zip Operation Failed.", string.Format("Input path does not exist: {0}", inputPath),
true, null));
return;
}
// Make sure that all parent directories in path are already created.
string parentPath = Path.GetDirectoryName(outputPath);
if (!Directory.Exists(parentPath))
{
Directory.CreateDirectory(parentPath);
}
// Delete old file if it exists.
if (File.Exists(outputPath))
File.Delete(outputPath);
using (ZipFile zip = new ZipFile(outputPath))
{
zip.ParallelDeflateThreshold = -1; // Parallel deflate is bugged in DotNetZip, so we need to disable it.
zip.AddDirectory(inputPath);
zip.Save();
}
}
catch (Exception ex)
{
Debug.LogError(ex.ToString());
}
}
}
} | using Ionic.Zip;
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace SuperSystems.UnityBuild
{
public class ZipFileOperation : BuildAction, IPreBuildAction, IPreBuildPerPlatformAction, IPostBuildAction, IPostBuildPerPlatformAction
{
public string inputPath = "$BUILDPATH";
public string outputPath = "$BUILDPATH";
public string outputFileName = "$PRODUCT_NAME-$RELEASE_TYPE-$YEAR_$MONTH_$DAY.zip";
public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref UnityEditor.BuildOptions options, string configKey, string buildPath)
{
string resolvedOutputPath = Path.Combine(outputPath.Replace("$BUILDPATH", buildPath), outputFileName);
resolvedOutputPath = BuildProject.ResolvePath(resolvedOutputPath, releaseType, platform, architecture, distribution, buildTime);
string resolvedInputPath = inputPath.Replace("$BUILDPATH", buildPath);
resolvedInputPath = BuildProject.ResolvePath(resolvedInputPath, releaseType, platform, architecture, distribution, buildTime);
if (!resolvedOutputPath.EndsWith(".zip"))
resolvedOutputPath += ".zip";
PerformZip(Path.GetFullPath(resolvedInputPath), Path.GetFullPath(resolvedOutputPath));
}
private void PerformZip(string inputPath, string outputPath)
{
try
{
// Make sure that all parent directories in path are already created.
string parentPath = Path.GetDirectoryName(outputPath);
if (!Directory.Exists(parentPath))
{
Directory.CreateDirectory(parentPath);
}
// Delete old file if it exists.
if (File.Exists(outputPath))
File.Delete(outputPath);
using (ZipFile zip = new ZipFile(outputPath))
{
zip.ParallelDeflateThreshold = -1; // Parallel deflate is bugged in DotNetZip, so we need to disable it.
zip.AddDirectory(inputPath);
zip.Save();
}
}
catch (Exception ex)
{
Debug.LogError(ex.ToString());
}
}
}
} | mit | C# |
73393ca52a0d3b0a4ed09d0da96e08a8d39f88af | Use correct casing on public static field. | QuickenLoans/XSerializer,rlyczynski/XSerializer | XSerializer/Encryption/EncryptionMechanism.cs | XSerializer/Encryption/EncryptionMechanism.cs | namespace XSerializer.Encryption
{
/// <summary>
/// Provides a mechanism for an application to specify an instance of
/// <see cref="IEncryptionMechanism"/> to be used by XSerializer when
/// encrypting or decrypting data.
/// </summary>
public static class EncryptionMechanism
{
/// <summary>
/// The default instance of <see cref="IEncryptionMechanism"/>.
/// </summary>
public static readonly IEncryptionMechanism DefaultEncryptionMechanism = new ClearTextEncryptionMechanism();
private static IEncryptionMechanism _current = DefaultEncryptionMechanism;
/// <summary>
/// Gets or sets the instance of <see cref="IEncryptionMechanism"/>
/// to be used by XSerializer when encrypting or decrypting data.
/// When setting this property, if <paramref name="value"/> is null,
/// then <see cref="DefaultEncryptionMechanism"/> will be used instead.
/// </summary>
public static IEncryptionMechanism Current
{
internal get { return _current; }
set { _current = value ?? DefaultEncryptionMechanism; }
}
}
} | namespace XSerializer.Encryption
{
/// <summary>
/// Provides a mechanism for an application to specify an instance of
/// <see cref="IEncryptionMechanism"/> to be used by XSerializer when
/// encrypting or decrypting data.
/// </summary>
public static class EncryptionMechanism
{
/// <summary>
/// The default instance of <see cref="IEncryptionMechanism"/>.
/// </summary>
public static readonly IEncryptionMechanism _defaultEncryptionMechanism = new ClearTextEncryptionMechanism();
private static IEncryptionMechanism _current = _defaultEncryptionMechanism;
/// <summary>
/// Gets or sets the instance of <see cref="IEncryptionMechanism"/>
/// to be used by XSerializer when encrypting or decrypting data.
/// When setting this property, if <paramref name="value"/> is null,
/// then <see cref="_defaultEncryptionMechanism"/> will be used instead.
/// </summary>
public static IEncryptionMechanism Current
{
internal get { return _current; }
set { _current = value ?? _defaultEncryptionMechanism; }
}
}
} | mit | C# |
443b6a0cd6726f59e313bca7f4141820159db0cd | Switch to 2.4.1 version | jwollen/SharpDX,Ixonos-USA/SharpDX,dazerdude/SharpDX,Ixonos-USA/SharpDX,weltkante/SharpDX,andrewst/SharpDX,PavelBrokhman/SharpDX,PavelBrokhman/SharpDX,manu-silicon/SharpDX,VirusFree/SharpDX,shoelzer/SharpDX,shoelzer/SharpDX,sharpdx/SharpDX,RobyDX/SharpDX,manu-silicon/SharpDX,jwollen/SharpDX,RobyDX/SharpDX,andrewst/SharpDX,fmarrabal/SharpDX,dazerdude/SharpDX,manu-silicon/SharpDX,fmarrabal/SharpDX,TechPriest/SharpDX,weltkante/SharpDX,sharpdx/SharpDX,RobyDX/SharpDX,manu-silicon/SharpDX,VirusFree/SharpDX,jwollen/SharpDX,dazerdude/SharpDX,fmarrabal/SharpDX,shoelzer/SharpDX,shoelzer/SharpDX,TechPriest/SharpDX,shoelzer/SharpDX,jwollen/SharpDX,VirusFree/SharpDX,TigerKO/SharpDX,dazerdude/SharpDX,TechPriest/SharpDX,PavelBrokhman/SharpDX,TigerKO/SharpDX,waltdestler/SharpDX,VirusFree/SharpDX,mrvux/SharpDX,davidlee80/SharpDX-1,sharpdx/SharpDX,waltdestler/SharpDX,mrvux/SharpDX,TigerKO/SharpDX,waltdestler/SharpDX,waltdestler/SharpDX,Ixonos-USA/SharpDX,RobyDX/SharpDX,TigerKO/SharpDX,davidlee80/SharpDX-1,wyrover/SharpDX,wyrover/SharpDX,TechPriest/SharpDX,mrvux/SharpDX,davidlee80/SharpDX-1,andrewst/SharpDX,Ixonos-USA/SharpDX,PavelBrokhman/SharpDX,davidlee80/SharpDX-1,weltkante/SharpDX,weltkante/SharpDX,fmarrabal/SharpDX,wyrover/SharpDX,wyrover/SharpDX | Source/SharedAssemblyInfo.cs | Source/SharedAssemblyInfo.cs | // Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2012 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.4.1")]
[assembly:AssemblyFileVersion("2.4.1")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
| // Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly:AssemblyCompany("Alexandre Mutel")]
[assembly:AssemblyCopyright("Copyright © 2010-2012 Alexandre Mutel")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly:AssemblyVersion("2.4.0")]
[assembly:AssemblyFileVersion("2.4.0")]
[assembly: NeutralResourcesLanguage("en-us")]
#if DEBUG
[assembly:AssemblyConfiguration("Debug")]
#else
[assembly:AssemblyConfiguration("Release")]
#endif
[assembly:ComVisible(false)]
| mit | C# |
30e1f6399d51ee346cc2c32929e53fcbb8a698be | use ASP.NET consistently | IBM-Bluemix/asp.net5-cloudant,IBM-Bluemix/asp.net5-cloudant | src/dotnetCloudantWebstarter/Views/Home/Index.cshtml | src/dotnetCloudantWebstarter/Views/Home/Index.cshtml | <!DOCTYPE html>
<html>
<head>
<title>ASP.NET Core Cloudant Starter Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="~/css/style.css" />
</head>
<body>
<div class="leftHalf">
<img class="newappIcon" src="~/images/newapp-icon.png" />
<h1>
Welcome to the <span class="blue">ASP.NET Cloudant Web Starter</span> on Bluemix!
</h1>
<p class="description">To get started see the Start Coding guide under your app in your dashboard.</p>
</div>
<div class="rightHalf">
<div class="center">
<header>
<div class='title'>
ASP.NET Cloudant Web Starter
</div>
</header>
<table id='notes' class='records'><tbody></tbody></table>
<div id="loading"> Please wait while the database is being initialized ...</div>
<footer>
<div class='tips'>
Click the Add button to add a record.
<button class='addBtn' onclick="addItem()" title='add record'>
<img src='~/images/add.png' alt='add' />
</button>
</div>
</footer>
<script type="text/javascript" src="~/scripts/util.js"></script>
<script type="text/javascript" src="~/scripts/index.js"></script>
</div>
</div>
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<title>ASP.NET Core Cloudant Starter Application</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="~/css/style.css" />
</head>
<body>
<div class="leftHalf">
<img class="newappIcon" src="~/images/newapp-icon.png" />
<h1>
Welcome to the <span class="blue">.NET Cloudant Web Starter</span> on Bluemix!
</h1>
<p class="description">To get started see the Start Coding guide under your app in your dashboard.</p>
</div>
<div class="rightHalf">
<div class="center">
<header>
<div class='title'>
.NET Cloudant Web Starter
</div>
</header>
<table id='notes' class='records'><tbody></tbody></table>
<div id="loading"> Please wait while the database is being initialized ...</div>
<footer>
<div class='tips'>
Click the Add button to add a record.
<button class='addBtn' onclick="addItem()" title='add record'>
<img src='~/images/add.png' alt='add' />
</button>
</div>
</footer>
<script type="text/javascript" src="~/scripts/util.js"></script>
<script type="text/javascript" src="~/scripts/index.js"></script>
</div>
</div>
</body>
</html>
| apache-2.0 | C# |
5d450018c36ddcba3d5f4db0903aaf9b7e52615c | Rename some more nested classes | ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework | osu.Framework/Graphics/UserInterface/BasicDirectorySelectorBreadcrumbDisplay.cs | osu.Framework/Graphics/UserInterface/BasicDirectorySelectorBreadcrumbDisplay.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.IO;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osuTK;
namespace osu.Framework.Graphics.UserInterface
{
public class BasicDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay
{
protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new BreadcrumbDisplayComputer();
protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null) => new BreadcrumbDisplayDirectory(directory, displayName);
public BasicDirectorySelectorBreadcrumbDisplay()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
protected class BreadcrumbDisplayComputer : BreadcrumbDisplayDirectory
{
protected override IconUsage? Icon => null;
public BreadcrumbDisplayComputer()
: base(null, "Computer")
{
}
}
protected class BreadcrumbDisplayDirectory : BasicDirectorySelectorDirectory
{
protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? base.Icon : null;
public BreadcrumbDisplayDirectory(DirectoryInfo directory, string displayName = null)
: base(directory, displayName)
{
}
[BackgroundDependencyLoader]
private void load()
{
Flow.Add(new SpriteIcon
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.Solid.ChevronRight,
Size = new Vector2(FONT_SIZE / 2)
});
}
}
}
}
| // 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.IO;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osuTK;
namespace osu.Framework.Graphics.UserInterface
{
public class BasicDirectorySelectorBreadcrumbDisplay : DirectorySelectorBreadcrumbDisplay
{
protected override DirectorySelectorDirectory CreateRootDirectoryItem() => new ComputerPiece();
protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null) => new CurrentDisplayPiece(directory, displayName);
public BasicDirectorySelectorBreadcrumbDisplay()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
protected class ComputerPiece : CurrentDisplayPiece
{
protected override IconUsage? Icon => null;
public ComputerPiece()
: base(null, "Computer")
{
}
}
protected class CurrentDisplayPiece : BasicDirectorySelectorDirectory
{
protected override IconUsage? Icon => Directory.Name.Contains(Path.DirectorySeparatorChar) ? base.Icon : null;
public CurrentDisplayPiece(DirectoryInfo directory, string displayName = null)
: base(directory, displayName)
{
}
[BackgroundDependencyLoader]
private void load()
{
Flow.Add(new SpriteIcon
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.Solid.ChevronRight,
Size = new Vector2(FONT_SIZE / 2)
});
}
}
}
}
| mit | C# |
a2b018e8ab206cbfae6a7288f345404fe23414d7 | Comment and fix on namespace | mrvux/kgp | src/KGP.Core/Curves/ThresholdLinearCurve.cs | src/KGP.Core/Curves/ThresholdLinearCurve.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KGP
{
/// <summary>
/// Linear threshold curve, clamp while absolute value is within threshold
/// </summary>
public class ThresholdLinearCurve : ICurve
{
private float threshold;
/// <summary>
/// Current threshold
/// </summary>
public float Threshold
{
get { return this.threshold; }
set { this.threshold = value; }
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="threshold">Initial threshold value</param>
public ThresholdLinearCurve(float threshold)
{
this.threshold = threshold;
}
/// <summary>
///Apply threshold curve
/// </summary>
/// <param name="value">Intial value</param>
/// <returns>Value with curve applied</returns>
public float Apply(float value)
{
float absval = Math.Abs(value);
if (absval <= threshold)
{
return 0.0f;
}
else
{
float diff = (absval - threshold) / (1.0f - threshold);
return diff * Math.Sign(value);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KGP.Curves
{
public class ThresholdLinearCurve : ICurve
{
private float threshold;
public float Threshold
{
get { return this.threshold; }
set { this.threshold = value; }
}
public ThresholdLinearCurve(float threshold)
{
this.threshold = threshold;
}
public float Apply(float value)
{
float absval = Math.Abs(value);
if (absval <= threshold)
{
return 0.0f;
}
else
{
float diff = (absval - threshold) / (1.0f - threshold);
return diff * Math.Sign(value);
}
}
}
}
| mit | C# |
ae0136ab460a704d72b3ae28e5d299cd4287a13e | Fix NullReferenceException | tgstation/tgstation-server,tgstation/tgstation-server-tools,tgstation/tgstation-server,Cyberboss/tgstation-server,Cyberboss/tgstation-server | src/Tgstation.Server.Client/ServerClient.cs | src/Tgstation.Server.Client/ServerClient.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
namespace Tgstation.Server.Client
{
/// <inheritdoc />
sealed class ServerClient : IServerClient
{
/// <inheritdoc />
public Uri Url => apiClient.Url;
/// <inheritdoc />
public Token Token
{
get => token;
set
{
token = value ?? throw new InvalidOperationException("Cannot set a null Token!");
apiClient.Headers = new ApiHeaders(apiClient.Headers.UserAgent, token.Bearer);
}
}
/// <inheritdoc />
public TimeSpan Timeout
{
get => apiClient.Timeout;
set => apiClient.Timeout = value;
}
/// <inheritdoc />
public IInstanceManagerClient Instances { get; }
/// <inheritdoc />
public IAdministrationClient Administration { get; }
/// <inheritdoc />
public IUsersClient Users { get; }
/// <summary>
/// The <see cref="IApiClient"/> for the <see cref="ServerClient"/>
/// </summary>
readonly IApiClient apiClient;
/// <summary>
/// Backing field for <see cref="Token"/>
/// </summary>
Token token;
/// <summary>
/// Construct a <see cref="ServerClient"/>
/// </summary>
/// <param name="apiClient">The value of <see cref="apiClient"/></param>
/// <param name="token">The value of <see cref="Token"/></param>
public ServerClient(IApiClient apiClient, Token token)
{
this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
this.token = token ?? throw new ArgumentNullException(nameof(token));
if (Token.Bearer != apiClient.Headers.Token)
throw new ArgumentOutOfRangeException(nameof(token), token, "Provided token does not match apiClient headers!");
Instances = new InstanceManagerClient(apiClient);
Users = new UsersClient(apiClient);
Administration = new AdministrationClient(apiClient);
}
/// <inheritdoc />
public void Dispose() => apiClient.Dispose();
/// <inheritdoc />
public Task<ServerInformation> Version(CancellationToken cancellationToken) => apiClient.Read<ServerInformation>(Routes.Root, cancellationToken);
/// <inheritdoc />
public void AddRequestLogger(IRequestLogger requestLogger) => apiClient.AddRequestLogger(requestLogger);
}
} | using System;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
namespace Tgstation.Server.Client
{
/// <inheritdoc />
sealed class ServerClient : IServerClient
{
/// <inheritdoc />
public Uri Url => apiClient.Url;
/// <inheritdoc />
public Token Token
{
get => token;
set
{
token = value ?? throw new InvalidOperationException("Cannot set a null Token!");
apiClient.Headers = new ApiHeaders(apiClient.Headers.UserAgent, token.Bearer);
}
}
/// <inheritdoc />
public TimeSpan Timeout
{
get => apiClient.Timeout;
set => apiClient.Timeout = value;
}
/// <inheritdoc />
public IInstanceManagerClient Instances { get; }
/// <inheritdoc />
public IAdministrationClient Administration { get; }
/// <inheritdoc />
public IUsersClient Users { get; }
/// <summary>
/// The <see cref="IApiClient"/> for the <see cref="ServerClient"/>
/// </summary>
readonly IApiClient apiClient;
/// <summary>
/// Backing field for <see cref="Token"/>
/// </summary>
Token token;
/// <summary>
/// Construct a <see cref="ServerClient"/>
/// </summary>
/// <param name="apiClient">The value of <see cref="apiClient"/></param>
/// <param name="token">The value of <see cref="Token"/></param>
public ServerClient(IApiClient apiClient, Token token)
{
this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
token = token ?? throw new ArgumentNullException(nameof(token));
if (Token.Bearer != apiClient.Headers.Token)
throw new ArgumentOutOfRangeException(nameof(token), token, "Provided token does not match apiClient headers!");
Instances = new InstanceManagerClient(apiClient);
Users = new UsersClient(apiClient);
Administration = new AdministrationClient(apiClient);
}
/// <inheritdoc />
public void Dispose() => apiClient.Dispose();
/// <inheritdoc />
public Task<ServerInformation> Version(CancellationToken cancellationToken) => apiClient.Read<ServerInformation>(Routes.Root, cancellationToken);
/// <inheritdoc />
public void AddRequestLogger(IRequestLogger requestLogger) => apiClient.AddRequestLogger(requestLogger);
}
} | agpl-3.0 | C# |
c57297fb49f1cc48285235dfc1cba4b75efdda9a | change ErrorMessage | runceel/ReactiveProperty,runceel/ReactiveProperty,runceel/ReactiveProperty | Source/ReactiveProperty.Portable-NET45+WINRT+WP8/UIDispatcherScheduler.cs | Source/ReactiveProperty.Portable-NET45+WINRT+WP8/UIDispatcherScheduler.cs | using System;
using System.Reactive.Concurrency;
using System.Threading;
namespace Reactive.Bindings
{
/// <summary>
/// <para>If call Schedule on UIThread then schedule immediately else dispatch BeginInvoke.</para>
/// <para>UIDIspatcherScheduler is created when access to UIDispatcher.Default first in the whole application.</para>
/// <para>If you want to explicitly initialize, call UIDispatcherScheduler.Initialize() in App.xaml.cs.</para>
/// </summary>
public static class UIDispatcherScheduler
{
private static readonly Lazy<SynchronizationContextScheduler> defaultScheduler =
new Lazy<SynchronizationContextScheduler>(() =>
{
if (SynchronizationContext.Current == null)
{
throw new InvalidOperationException("SynchronizationContext.Current is null");
}
return new SynchronizationContextScheduler(SynchronizationContext.Current);
});
/// <summary>
/// <para>If call Schedule on UIThread then schedule immediately else dispatch BeginInvoke.</para>
/// <para>UIDIspatcherScheduler is created when access to UIDispatcher.Default first in the whole application.</para>
/// <para>If you want to explicitly initialize, call UIDispatcherScheduler.Initialize() in App.xaml.cs.</para>
/// </summary>
public static IScheduler Default
{
get
{
return defaultScheduler.Value;
}
}
/// <summary>
/// Create UIDispatcherSchedule on called thread if is not initialized yet.
/// </summary>
public static void Initialize()
{
var _ = defaultScheduler.Value;
}
}
} | using System;
using System.Reactive.Concurrency;
using System.Threading;
namespace Reactive.Bindings
{
/// <summary>
/// <para>If call Schedule on UIThread then schedule immediately else dispatch BeginInvoke.</para>
/// <para>UIDIspatcherScheduler is created when access to UIDispatcher.Default first in the whole application.</para>
/// <para>If you want to explicitly initialize, call UIDispatcherScheduler.Initialize() in App.xaml.cs.</para>
/// </summary>
public static class UIDispatcherScheduler
{
private static readonly Lazy<SynchronizationContextScheduler> defaultScheduler =
new Lazy<SynchronizationContextScheduler>(() => new SynchronizationContextScheduler(SynchronizationContext.Current));
/// <summary>
/// <para>If call Schedule on UIThread then schedule immediately else dispatch BeginInvoke.</para>
/// <para>UIDIspatcherScheduler is created when access to UIDispatcher.Default first in the whole application.</para>
/// <para>If you want to explicitly initialize, call UIDispatcherScheduler.Initialize() in App.xaml.cs.</para>
/// </summary>
public static IScheduler Default
{
get
{
return defaultScheduler.Value;
}
}
/// <summary>
/// Create UIDispatcherSchedule on called thread if is not initialized yet.
/// </summary>
public static void Initialize()
{
var _ = defaultScheduler.Value;
}
}
} | mit | C# |
4b47a44ff71d6dc1daddc36318d501a9d968bb0b | Modify behavior to avoid exception in design mode | emoacht/SnowyImageCopy | Source/SnowyImageCopy/Views/Behaviors/FrameworkElementLanguageBehavior.cs | Source/SnowyImageCopy/Views/Behaviors/FrameworkElementLanguageBehavior.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Markup;
using Microsoft.Xaml.Behaviors;
namespace SnowyImageCopy.Views.Behaviors
{
/// <summary>
/// Sets FrameworkElement language.
/// </summary>
[TypeConstraint(typeof(FrameworkElement))]
public class FrameworkElementLanguageBehavior : Behavior<FrameworkElement>
{
#region Property
public string IetfLanguageTag
{
get { return (string)GetValue(IetfLanguageTagProperty); }
set { SetValue(IetfLanguageTagProperty, value); }
}
public static readonly DependencyProperty IetfLanguageTagProperty =
DependencyProperty.Register(
"IetfLanguageTag",
typeof(string),
typeof(FrameworkElementLanguageBehavior),
new FrameworkPropertyMetadata(
string.Empty,
(d, e) => ((FrameworkElementLanguageBehavior)d).SetLanguage((string)e.NewValue)));
#endregion
private void SetLanguage(string ietfLanguageTag)
{
if (this.AssociatedObject is null) // Associated FrameworkElement can be null in design mode.
return;
if (string.IsNullOrEmpty(ietfLanguageTag))
ietfLanguageTag = CultureInfo.CurrentUICulture.ToString();
try
{
this.AssociatedObject.Language = XmlLanguage.GetLanguage(ietfLanguageTag);
}
catch
{
Debug.WriteLine("Failed to set FrameworkElement language.");
throw;
}
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Markup;
using Microsoft.Xaml.Behaviors;
namespace SnowyImageCopy.Views.Behaviors
{
/// <summary>
/// Sets FrameworkElement language.
/// </summary>
[TypeConstraint(typeof(FrameworkElement))]
public class FrameworkElementLanguageBehavior : Behavior<FrameworkElement>
{
#region Property
public string IetfLanguageTag
{
get { return (string)GetValue(IetfLanguageTagProperty); }
set { SetValue(IetfLanguageTagProperty, value); }
}
public static readonly DependencyProperty IetfLanguageTagProperty =
DependencyProperty.Register(
"IetfLanguageTag",
typeof(string),
typeof(FrameworkElementLanguageBehavior),
new FrameworkPropertyMetadata(
string.Empty,
(d, e) => ((FrameworkElementLanguageBehavior)d).SetLanguage((string)e.NewValue)));
#endregion
private void SetLanguage(string ietfLanguageTag)
{
if (string.IsNullOrEmpty(ietfLanguageTag))
ietfLanguageTag = CultureInfo.CurrentUICulture.ToString();
try
{
this.AssociatedObject.Language = XmlLanguage.GetLanguage(ietfLanguageTag);
}
catch
{
Debug.WriteLine("Failed to set FrameworkElement language.");
throw;
}
}
}
} | mit | C# |
21dbd501284a38f71584e8dae113653ee111e245 | Fix build | space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14 | Content.Server/GameObjects/EntitySystems/Body/Surgery/SurgeryToolSystem.cs | Content.Server/GameObjects/EntitySystems/Body/Surgery/SurgeryToolSystem.cs | using System.Collections.Generic;
using Content.Server.GameObjects.Components.Body.Surgery;
using Content.Server.GameObjects.Components.Body.Surgery.Messages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
using Content.Shared.GameTicking;
using Content.Shared.Utility;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems.Body.Surgery
{
[UsedImplicitly]
public class SurgeryToolSystem : EntitySystem, IResettingEntitySystem
{
private readonly HashSet<SurgeryToolComponent> _openSurgeryUIs = new();
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SurgeryWindowOpenMessage>(OnSurgeryWindowOpen);
SubscribeLocalEvent<SurgeryWindowCloseMessage>(OnSurgeryWindowClose);
}
public void Reset()
{
_openSurgeryUIs.Clear();
}
private void OnSurgeryWindowOpen(SurgeryWindowOpenMessage ev)
{
_openSurgeryUIs.Add(ev.Tool);
}
private void OnSurgeryWindowClose(SurgeryWindowCloseMessage ev)
{
_openSurgeryUIs.Remove(ev.Tool);
}
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var tool in _openSurgeryUIs)
{
if (tool.PerformerCache == null)
{
continue;
}
if (tool.BodyCache == null)
{
continue;
}
if (!ActionBlockerSystem.CanInteract(tool.PerformerCache) ||
!tool.PerformerCache.InRangeUnobstructed(tool.BodyCache))
{
tool.CloseAllSurgeryUIs();
}
}
}
}
}
| using System.Collections.Generic;
using Content.Server.GameObjects.Components.Body.Surgery;
using Content.Server.GameObjects.Components.Body.Surgery.Messages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameTicking;
using Content.Shared.Utility;
using JetBrains.Annotations;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems.Body.Surgery
{
[UsedImplicitly]
public class SurgeryToolSystem : EntitySystem, IResettingEntitySystem
{
private readonly HashSet<SurgeryToolComponent> _openSurgeryUIs = new();
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SurgeryWindowOpenMessage>(OnSurgeryWindowOpen);
SubscribeLocalEvent<SurgeryWindowCloseMessage>(OnSurgeryWindowClose);
}
public void Reset()
{
_openSurgeryUIs.Clear();
}
private void OnSurgeryWindowOpen(SurgeryWindowOpenMessage ev)
{
_openSurgeryUIs.Add(ev.Tool);
}
private void OnSurgeryWindowClose(SurgeryWindowCloseMessage ev)
{
_openSurgeryUIs.Remove(ev.Tool);
}
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var tool in _openSurgeryUIs)
{
if (tool.PerformerCache == null)
{
continue;
}
if (tool.BodyCache == null)
{
continue;
}
if (!ActionBlockerSystem.CanInteract(tool.PerformerCache) ||
!tool.PerformerCache.InRangeUnobstructed(tool.BodyCache))
{
tool.CloseAllSurgeryUIs();
}
}
}
}
}
| mit | C# |
9ea499649bfa8247100594f28c5a692d2c73b13e | Fix invalid assembly name might be copied to clipboard | Zvirja/ReSharperHelpers | code/AlexPovar.ReSharperHelpers/ContextActions/CopyFullClassNameAction.cs | code/AlexPovar.ReSharperHelpers/ContextActions/CopyFullClassNameAction.cs | using System;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.ContextActions;
using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Modules;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl;
using JetBrains.UI;
using JetBrains.Util;
namespace AlexPovar.ReSharperHelpers.ContextActions
{
[ContextAction(Group = "C#", Name = "[AlexHelpers] Copy full class name", Description = "Copy full class name.", Priority = short.MinValue)]
public class CopyFullClassNameAction : HelpersContextActionBase
{
[NotNull] private readonly Clipboard _clipboard;
[NotNull] private readonly ICSharpContextActionDataProvider _provider;
public CopyFullClassNameAction([NotNull] ICSharpContextActionDataProvider provider)
{
this._provider = provider ?? throw new ArgumentNullException(nameof(provider));
this._clipboard = Shell.Instance.GetComponent<Clipboard>().NotNull("Unable to resolve clipboard service.");
}
[CanBeNull]
private IClassLikeDeclaration Declaration { get; set; }
public override string Text
{
get
{
var type = "";
var declaredElement = this.Declaration?.DeclaredElement;
if (declaredElement != null)
{
type = DeclaredElementPresenter.Format(this.Declaration.Language, DeclaredElementPresenter.KIND_PRESENTER, declaredElement);
}
return $"[Helpers] Copy full {type} name";
}
}
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
var declaredElement = this.Declaration?.DeclaredElement;
if (declaredElement == null) return null;
var typeName = declaredElement.GetClrName().FullName;
var moduleName = declaredElement.Module.DisplayName;
if (declaredElement.Module is IProjectPsiModule projectModule)
{
var proj = projectModule.Project;
moduleName = proj.GetOutputAssemblyName(proj.GetCurrentTargetFrameworkId());
}
var fullName = $"{typeName}, {moduleName}";
this._clipboard.SetText(fullName);
return null;
}
public override bool IsAvailable(IUserDataHolder cache)
{
this.Declaration = ClassLikeDeclarationNavigator.GetByNameIdentifier(this._provider.GetSelectedElement<ICSharpIdentifier>());
return this.Declaration != null;
}
}
} | using System;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.ContextActions;
using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl;
using JetBrains.UI;
using JetBrains.Util;
namespace AlexPovar.ReSharperHelpers.ContextActions
{
[ContextAction(Group = "C#", Name = "[AlexHelpers] Copy full class name", Description = "Copy full class name.", Priority = short.MinValue)]
public class CopyFullClassNameAction : HelpersContextActionBase
{
[NotNull] private readonly Clipboard _clipboard;
[NotNull] private readonly ICSharpContextActionDataProvider _provider;
public CopyFullClassNameAction([NotNull] ICSharpContextActionDataProvider provider)
{
this._provider = provider ?? throw new ArgumentNullException(nameof(provider));
this._clipboard = Shell.Instance.GetComponent<Clipboard>().NotNull("Unable to resolve clipboard service.");
}
[CanBeNull]
private IClassLikeDeclaration Declaration { get; set; }
public override string Text
{
get
{
var type = "";
var declaredElement = this.Declaration?.DeclaredElement;
if (declaredElement != null)
{
type = DeclaredElementPresenter.Format(this.Declaration.Language, DeclaredElementPresenter.KIND_PRESENTER, declaredElement);
}
return $"[Helpers] Copy full {type} name";
}
}
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
var declaredElement = this.Declaration?.DeclaredElement;
if (declaredElement == null) return null;
var typeName = declaredElement.GetClrName().FullName;
var moduleName = declaredElement.Module.DisplayName;
var fullName = $"{typeName}, {moduleName}";
this._clipboard.SetText(fullName);
return null;
}
public override bool IsAvailable(IUserDataHolder cache)
{
this.Declaration = ClassLikeDeclarationNavigator.GetByNameIdentifier(this._provider.GetSelectedElement<ICSharpIdentifier>());
return this.Declaration != null;
}
}
} | mit | C# |
6d9dfe780fb3760158197ebb263797dc3699f126 | Add quotes and length of JSON packets being sent. | kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX,kaby76/AntlrVSIX | Server/Dup.cs | Server/Dup.cs | namespace Server
{
using System;
using System.IO;
using System.Text;
internal partial class Program
{
class Dup : Stream
{
string _name;
private Dup() { }
public Dup(string name) { _name = name; }
public override bool CanRead { get { return false; } }
public override bool CanSeek { get { return false; } }
public override bool CanWrite { get { return true; } }
public override long Length => throw new NotImplementedException();
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public override void Flush()
{
}
public override int Read(byte[] buffer, int offset, int count)
{
throw new NotImplementedException();
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotImplementedException();
}
public override void SetLength(long value)
{
throw new NotImplementedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
DateTime now = DateTime.Now;
StringBuilder sb = new StringBuilder();
sb.AppendLine("Raw message from " + _name + " " + now.ToString());
var truncated_array = new byte[count];
for (int i = offset; i < offset + count; ++i)
truncated_array[i - offset] = buffer[i];
string str = System.Text.Encoding.Default.GetString(truncated_array);
sb.AppendLine("data (length " + str.Length + ")= '" + str + "'");
LoggerNs.Logger.Log.WriteLine(sb.ToString());
}
}
}
}
| namespace Server
{
using System;
using System.IO;
using System.Text;
internal partial class Program
{
class Dup : Stream
{
string _name;
private Dup() { }
public Dup(string name) { _name = name; }
public override bool CanRead { get { return false; } }
public override bool CanSeek { get { return false; } }
public override bool CanWrite { get { return true; } }
public override long Length => throw new NotImplementedException();
public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public override void Flush()
{
}
public override int Read(byte[] buffer, int offset, int count)
{
throw new NotImplementedException();
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotImplementedException();
}
public override void SetLength(long value)
{
throw new NotImplementedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
DateTime now = DateTime.Now;
StringBuilder sb = new StringBuilder();
sb.AppendLine("Raw message from " + _name + " " + now.ToString());
var truncated_array = new byte[count];
for (int i = offset; i < offset + count; ++i)
truncated_array[i - offset] = buffer[i];
string str = System.Text.Encoding.Default.GetString(truncated_array);
sb.AppendLine("data = '" + str);
LoggerNs.Logger.Log.WriteLine(sb.ToString());
}
}
}
}
| mit | C# |
6a48272e234de3792984310833416c51c1b71920 | Update documentation now that we can point to a concrete method | dotnet/roslyn,cston/roslyn,VSadov/roslyn,brettfo/roslyn,reaction1989/roslyn,physhi/roslyn,diryboy/roslyn,dpoeschl/roslyn,panopticoncentral/roslyn,swaroop-sridhar/roslyn,xasx/roslyn,VSadov/roslyn,AlekseyTs/roslyn,eriawan/roslyn,jamesqo/roslyn,jasonmalinowski/roslyn,KirillOsenkov/roslyn,MichalStrehovsky/roslyn,wvdd007/roslyn,stephentoub/roslyn,bartdesmet/roslyn,mgoertz-msft/roslyn,xasx/roslyn,panopticoncentral/roslyn,jamesqo/roslyn,agocke/roslyn,bartdesmet/roslyn,aelij/roslyn,eriawan/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,Hosch250/roslyn,tmeschter/roslyn,weltkante/roslyn,heejaechang/roslyn,OmarTawfik/roslyn,jasonmalinowski/roslyn,davkean/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,genlu/roslyn,jasonmalinowski/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,Giftednewt/roslyn,tmat/roslyn,Hosch250/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,nguerrera/roslyn,tmat/roslyn,jcouv/roslyn,jmarolf/roslyn,bkoelman/roslyn,sharwell/roslyn,mavasani/roslyn,mavasani/roslyn,abock/roslyn,xasx/roslyn,paulvanbrenk/roslyn,wvdd007/roslyn,brettfo/roslyn,Giftednewt/roslyn,DustinCampbell/roslyn,stephentoub/roslyn,diryboy/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,bkoelman/roslyn,ErikSchierboom/roslyn,swaroop-sridhar/roslyn,jcouv/roslyn,sharwell/roslyn,abock/roslyn,gafter/roslyn,nguerrera/roslyn,MichalStrehovsky/roslyn,AlekseyTs/roslyn,OmarTawfik/roslyn,paulvanbrenk/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,genlu/roslyn,stephentoub/roslyn,eriawan/roslyn,bkoelman/roslyn,davkean/roslyn,DustinCampbell/roslyn,nguerrera/roslyn,sharwell/roslyn,tannergooding/roslyn,gafter/roslyn,DustinCampbell/roslyn,mavasani/roslyn,KevinRansom/roslyn,agocke/roslyn,heejaechang/roslyn,VSadov/roslyn,bartdesmet/roslyn,brettfo/roslyn,reaction1989/roslyn,physhi/roslyn,jcouv/roslyn,KirillOsenkov/roslyn,physhi/roslyn,genlu/roslyn,AmadeusW/roslyn,weltkante/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmat/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,heejaechang/roslyn,dpoeschl/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,cston/roslyn,tmeschter/roslyn,shyamnamboodiripad/roslyn,AmadeusW/roslyn,jmarolf/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,Giftednewt/roslyn,gafter/roslyn,tannergooding/roslyn,paulvanbrenk/roslyn,diryboy/roslyn,panopticoncentral/roslyn,dpoeschl/roslyn,jmarolf/roslyn,tmeschter/roslyn,agocke/roslyn,davkean/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,shyamnamboodiripad/roslyn,jamesqo/roslyn,mgoertz-msft/roslyn,abock/roslyn,Hosch250/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,cston/roslyn,aelij/roslyn,OmarTawfik/roslyn | src/VisualStudio/Core/Def/Implementation/CodeModel/ICodeModelInstanceFactory.cs | src/VisualStudio/Core/Def/Implementation/CodeModel/ICodeModelInstanceFactory.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
{
interface ICodeModelInstanceFactory
{
/// <summary>
/// Requests the project system to create a <see cref="EnvDTE.FileCodeModel"/> through the project system.
/// </summary>
/// <remarks>
/// This is sometimes necessary because it's possible to go from one <see cref="EnvDTE.FileCodeModel"/> to another,
/// but the language service can't create that instance directly, as it doesn't know what the <see cref="EnvDTE.FileCodeModel.Parent"/>
/// member should be. The expectation is the implementer of this will do what is necessary and call back into <see cref="IProjectCodeModel.GetOrCreateFileCodeModel(string, object)"/>
/// handing it the appropriate parent.</remarks>
EnvDTE.FileCodeModel TryCreateFileCodeModelThroughProjectSystem(string filePath);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
{
interface ICodeModelInstanceFactory
{
/// <summary>
/// Requests the project system to create a <see cref="EnvDTE.FileCodeModel"/> through the project system.
/// </summary>
/// <remarks>
/// This is sometimes necessary because it's possible to go from one <see cref="EnvDTE.FileCodeModel"/> to another,
/// but the language service can't create that instance directly, as it doesn't know what the <see cref="EnvDTE.FileCodeModel.Parent"/>
/// member should be. The expectation is the implementer of this will do what is necessary and call back into the code model implementation
/// with a parent object.</remarks>
EnvDTE.FileCodeModel TryCreateFileCodeModelThroughProjectSystem(string filePath);
}
}
| mit | C# |
fe1c33a55b9c78f9729e30cbd973ab0022cbde6d | Test case renamed to be more accurate | spektrumgeeks/Spk.Common | test/Spk.Common.Tests.Helpers/Service/ServiceResultTests.cs | test/Spk.Common.Tests.Helpers/Service/ServiceResultTests.cs | using System;
using Shouldly;
using Spk.Common.Helpers.Service;
using Xunit;
namespace Spk.Common.Tests.Helpers.Service
{
public class ServiceResultTests
{
[Theory]
[InlineData("test")]
[InlineData("")]
[InlineData(null)]
public void Success_ShouldBeTrue_WhenDataIsSet(string value)
{
// Arrange
var sr = new ServiceResult<string>();
// Act
sr.SetData(value);
// Assert
sr.Success.ShouldBeTrue();
}
[Theory]
[InlineData("error")]
public void GetFirstError_ShouldReturnFirstError(string error)
{
// Arrange
var sr = new ServiceResult<string>();
// Act
sr.AddError(error);
sr.AddError("bleh");
// Assert
sr.GetFirstError().ShouldBe(error);
}
[Fact]
public void AddError_ShouldArgumentNullException_WhenNullError()
{
// Act & assert
Assert.Throws<ArgumentNullException>(() =>
{
var sr = new ServiceResult<string>();
sr.AddError(null);
});
}
}
}
| using System;
using Shouldly;
using Spk.Common.Helpers.Service;
using Xunit;
namespace Spk.Common.Tests.Helpers.Service
{
public class ServiceResultTests
{
[Theory]
[InlineData("test")]
[InlineData("")]
[InlineData(null)]
public void SetData_SuccessShouldBeTrue(string value)
{
// Arrange
var sr = new ServiceResult<string>();
// Act
sr.SetData(value);
// Assert
sr.Success.ShouldBeTrue();
}
[Theory]
[InlineData("error")]
public void GetFirstError_ShouldReturnFirstError(string error)
{
// Arrange
var sr = new ServiceResult<string>();
// Act
sr.AddError(error);
// Assert
sr.GetFirstError().ShouldBe(error);
}
[Fact]
public void AddError_ShouldArgumentNullException_WhenNullError()
{
// Act & assert
Assert.Throws<ArgumentNullException>(() =>
{
var sr = new ServiceResult<string>();
sr.AddError(null);
});
}
}
}
| mit | C# |
2686057fe3886e755f70eda5afae2253e80677b7 | Remove unused usings and make the target class internal | AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell | src/ResourceManager/DataLakeStore/Commands.DataLakeStore/DataPlaneModels/AdlsLoggerTarget.cs | src/ResourceManager/DataLakeStore/Commands.DataLakeStore/DataPlaneModels/AdlsLoggerTarget.cs | using System.Collections.Concurrent;
using NLog;
using NLog.Targets;
namespace Microsoft.Azure.Commands.DataLakeStore.Models
{
/// <summary>
/// NLog is used by the ADLS dataplane sdk to log debug messages. We can create a custom target
/// which basically queues the debug data to the ConcurrentQueue for debug messages.
/// https://github.com/NLog/NLog/wiki/How-to-write-a-custom-target
/// </summary>
[Target("AdlsLogger")]
internal sealed class AdlsLoggerTarget : TargetWithLayout
{
internal ConcurrentQueue<string> DebugMessageQueue;
protected override void Write(LogEventInfo logEvent)
{
string logMessage = Layout.Render(logEvent);
DebugMessageQueue?.Enqueue(logMessage);
}
}
}
| using System.Collections.Concurrent;
using System.IO;
using NLog;
using NLog.Config;
using NLog.Targets;
namespace Microsoft.Azure.Commands.DataLakeStore.Models
{
/// <summary>
/// NLog is used by the ADLS dataplane sdk to log debug messages. We can create a custom target
/// which basically queues the debug data to the ConcurrentQueue for debug messages.
/// https://github.com/NLog/NLog/wiki/How-to-write-a-custom-target
/// </summary>
[Target("AdlsLogger")]
public sealed class AdlsLoggerTarget : TargetWithLayout
{
internal ConcurrentQueue<string> DebugMessageQueue;
public AdlsLoggerTarget()
{
}
protected override void Write(LogEventInfo logEvent)
{
string logMessage = Layout.Render(logEvent);
DebugMessageQueue?.Enqueue(logMessage);
}
}
}
| apache-2.0 | C# |
d90f21e140bea785d07fd33c8ef1af126c16a16b | Reword mod documentation | peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,ppy/osu | osu.Game/Rulesets/Mods/IMod.cs | osu.Game/Rulesets/Mods/IMod.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Rulesets.Mods
{
public interface IMod : IEquatable<IMod>
{
/// <summary>
/// The shortened name of this mod.
/// </summary>
string Acronym { get; }
/// <summary>
/// The name of this mod.
/// </summary>
string Name { get; }
/// <summary>
/// The user readable description of this mod.
/// </summary>
string Description { get; }
/// <summary>
/// The type of this mod.
/// </summary>
ModType Type { get; }
/// <summary>
/// The icon of this mod.
/// </summary>
IconUsage? Icon { get; }
/// <summary>
/// Whether this mod is playable by an end user.
/// Should be <c>false</c> for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example).
/// </summary>
bool UserPlayable { get; }
/// <summary>
/// Whether this mod is playable in a multiplayer match.
/// Should be <c>false</c> for mods that make gameplay duration dependent on user input (e.g. <see cref="ModAdaptiveSpeed"/>).
/// </summary>
bool PlayableInMultiplayer { get; }
/// <summary>
/// Whether this mod is valid to be a "free mod" in a multiplayer match.
/// Should be <c>false</c> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).
/// </summary>
bool ValidFreeModInMultiplayer { get; }
/// <summary>
/// Create a fresh <see cref="Mod"/> instance based on this mod.
/// </summary>
Mod CreateInstance() => (Mod)Activator.CreateInstance(GetType());
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Rulesets.Mods
{
public interface IMod : IEquatable<IMod>
{
/// <summary>
/// The shortened name of this mod.
/// </summary>
string Acronym { get; }
/// <summary>
/// The name of this mod.
/// </summary>
string Name { get; }
/// <summary>
/// The user readable description of this mod.
/// </summary>
string Description { get; }
/// <summary>
/// The type of this mod.
/// </summary>
ModType Type { get; }
/// <summary>
/// The icon of this mod.
/// </summary>
IconUsage? Icon { get; }
/// <summary>
/// Whether this mod is playable by an end user.
/// Should be <c>false</c> for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example).
/// </summary>
bool UserPlayable { get; }
/// <summary>
/// Whether this mod is playable in a multiplayer match.
/// Should be <c>false</c> for mods that affect the gameplay progress based on user input (e.g. <see cref="ModAdaptiveSpeed"/>).
/// </summary>
bool PlayableInMultiplayer { get; }
/// <summary>
/// Whether this mod is valid to be a "free mod" in a multiplayer match.
/// Should be <c>false</c> for mods that affect the gameplay progress (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).
/// </summary>
bool ValidFreeModInMultiplayer { get; }
/// <summary>
/// Create a fresh <see cref="Mod"/> instance based on this mod.
/// </summary>
Mod CreateInstance() => (Mod)Activator.CreateInstance(GetType());
}
}
| mit | C# |
4df5d6ea5c49552836d9058fc616647ec120da53 | Disable es-US for now | MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure,MCLD/greatreadingadventure | src/GRA/Culture.cs | src/GRA/Culture.cs | using System.Globalization;
namespace GRA
{
public static class Culture
{
//public const string
public const string EnglishUS = "en-US";
public const string EspanolUS = "es-US";
public const string DefaultName = EnglishUS;
public static readonly CultureInfo DefaultCulture = new CultureInfo(DefaultName);
public static readonly CultureInfo[] SupportedCultures = new[]
{
new CultureInfo(EnglishUS),
//new CultureInfo(EspanolUS)
};
}
}
| using System.Globalization;
namespace GRA
{
public static class Culture
{
//public const string
public const string EnglishUS = "en-US";
public const string EspanolUS = "es-US";
public const string DefaultName = EnglishUS;
public static readonly CultureInfo DefaultCulture = new CultureInfo(DefaultName);
public static readonly CultureInfo[] SupportedCultures = new[]
{
new CultureInfo(EnglishUS),
new CultureInfo(EspanolUS)
};
}
}
| mit | C# |
808456f9cd617094a8f49f05409ca818b6b1d74c | Update ConfigReader.cs | AnkRaiza/cordova-plugin-config-reader,AnkRaiza/cordova-plugin-config-reader,AnkRaiza/cordova-plugin-config-reader | src/wp8/ConfigReader.cs | src/wp8/ConfigReader.cs | using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Windows.Storage;
using System.Diagnostics;
using System.IO;
namespace WPCordovaClassLib.Cordova.Commands
{
public class ConfigReader : BaseCommand
{
public async void get(string options)
{
string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
string preferenceName = args[0];
try
{
// Get the pref.
IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
string val = (string)appSettings[preferenceName];
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, val));
}
catch (Exception)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR), "error");
}
}
}
}
| using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Windows.Storage;
using System.Diagnostics;
using System.IO;
namespace WPCordovaClassLib.Cordova.Commands
{
public class ConfigReader : BaseCommand
{
public async void get(string options)
{
string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
string aliasCurrentCommandCallbackId = args[2];
try
{
// Get the file.
StorageFile file = await Windows.Storage.StorageFile.GetFileFromPathAsync(args[0]);
// Launch the bug query file.
await Windows.System.Launcher.LaunchFileAsync(file);
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "{result:\"data\"}"));
}
catch (Exception)
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR), aliasCurrentCommandCallbackId);
}
}
}
}
| mit | C# |
e6f77f1726360e00cf9af387337f1e50516be07e | Fix testcase name | karolz-ms/diagnostics-eventflow | test/Microsoft.Diagnostics.EventFlow.Core.Tests/FilterParsing/HasNoPropertyEvaluatorTests.cs | test/Microsoft.Diagnostics.EventFlow.Core.Tests/FilterParsing/HasNoPropertyEvaluatorTests.cs | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
using Microsoft.Diagnostics.EventFlow.FilterEvaluators;
using Xunit;
namespace Microsoft.Diagnostics.EventFlow.Core.Tests.FilterParsing
{
public class HasNoPropertyEvaluatorTests
{
[Fact]
public void MissingProperty()
{
var evaluator = new HasNoPropertyEvaluator("InvalidPropertyName");
Assert.True(evaluator.Evaluate(FilteringTestData.ManyPropertiesEvent));
}
[Fact]
public void ExistingProperty()
{
var evaluator = new HasNoPropertyEvaluator("EventId");
Assert.False(evaluator.Evaluate(FilteringTestData.ManyPropertiesEvent));
}
[Fact]
public void HasNoPropertyEvaluatorParsing()
{
FilterParser parser = new FilterParser();
var result = parser.Parse("hasnoproperty foo");
Assert.Equal("(hasnoproperty foo)", result.SemanticsString);
// A more complicated expression, just to make sure the operator meshes in well with the rest
result = parser.Parse("(ActorId==1234) && hasnoproperty bravo || (beta > 14 && !(Level==Warning))");
Assert.Equal("(((__EqualityEvaluator:ActorId==1234)AND(hasnoproperty bravo))OR((__GreaterThanEvaluator:beta>14)AND(NOT(__EqualityEvaluator:Level==Warning))))", result.SemanticsString);
}
}
} | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
using Microsoft.Diagnostics.EventFlow.FilterEvaluators;
using Xunit;
namespace Microsoft.Diagnostics.EventFlow.Core.Tests.FilterParsing
{
public class HasNoPropertyEvaluatorTests
{
[Fact]
public void MissingProperty()
{
var evaluator = new HasNoPropertyEvaluator("InvalidPropertyName");
Assert.True(evaluator.Evaluate(FilteringTestData.ManyPropertiesEvent));
}
[Fact]
public void ExistingProperty()
{
var evaluator = new HasNoPropertyEvaluator("EventId");
Assert.False(evaluator.Evaluate(FilteringTestData.ManyPropertiesEvent));
}
[Fact]
public void HasPropertyEvaluatorParsing()
{
FilterParser parser = new FilterParser();
var result = parser.Parse("hasnoproperty foo");
Assert.Equal("(hasnoproperty foo)", result.SemanticsString);
// A more complicated expression, just to make sure the operator meshes in well with the rest
result = parser.Parse("(ActorId==1234) && hasnoproperty bravo || (beta > 14 && !(Level==Warning))");
Assert.Equal("(((__EqualityEvaluator:ActorId==1234)AND(hasnoproperty bravo))OR((__GreaterThanEvaluator:beta>14)AND(NOT(__EqualityEvaluator:Level==Warning))))", result.SemanticsString);
}
}
} | mit | C# |
231ac8a3484ea39a7a43f095f2b3059322bea875 | Fix IJSStreamReference API Param (#34847) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/JSInterop/Microsoft.JSInterop/src/Implementation/JSStreamReference.cs | src/JSInterop/Microsoft.JSInterop/src/Implementation/JSStreamReference.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.JSInterop.Implementation
{
/// <summary>
/// Implements functionality for <see cref="IJSStreamReference"/>.
/// </summary>
public sealed class JSStreamReference : JSObjectReference, IJSStreamReference
{
private readonly JSRuntime _jsRuntime;
/// <inheritdoc />
public long Length { get; }
/// <summary>
/// Inititializes a new <see cref="JSStreamReference"/> instance.
/// </summary>
/// <param name="jsRuntime">The <see cref="JSRuntime"/> used for invoking JS interop calls.</param>
/// <param name="id">The unique identifier.</param>
/// <param name="totalLength">The length of the data stream coming from JS represented by this data reference.</param>
internal JSStreamReference(JSRuntime jsRuntime, long id, long totalLength) : base(jsRuntime, id)
{
if (totalLength <= 0)
{
throw new ArgumentOutOfRangeException(nameof(totalLength), totalLength, "Length must be a positive value.");
}
_jsRuntime = jsRuntime;
Length = totalLength;
}
/// <inheritdoc />
async ValueTask<Stream> IJSStreamReference.OpenReadStreamAsync(long maxAllowedSize, CancellationToken cancellationToken)
{
if (Length > maxAllowedSize)
{
throw new ArgumentOutOfRangeException(nameof(maxAllowedSize), $"The incoming data stream of length {Length} exceeds the maximum allowed length {maxAllowedSize}.");
}
return await _jsRuntime.ReadJSDataAsStreamAsync(this, Length, cancellationToken);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.JSInterop.Implementation
{
/// <summary>
/// Implements functionality for <see cref="IJSStreamReference"/>.
/// </summary>
public sealed class JSStreamReference : JSObjectReference, IJSStreamReference
{
private readonly JSRuntime _jsRuntime;
/// <inheritdoc />
public long Length { get; }
/// <summary>
/// Inititializes a new <see cref="JSStreamReference"/> instance.
/// </summary>
/// <param name="jsRuntime">The <see cref="JSRuntime"/> used for invoking JS interop calls.</param>
/// <param name="id">The unique identifier.</param>
/// <param name="totalLength">The length of the data stream coming from JS represented by this data reference.</param>
internal JSStreamReference(JSRuntime jsRuntime, long id, long totalLength) : base(jsRuntime, id)
{
if (totalLength <= 0)
{
throw new ArgumentOutOfRangeException(nameof(totalLength), totalLength, "Length must be a positive value.");
}
_jsRuntime = jsRuntime;
Length = totalLength;
}
/// <inheritdoc />
async ValueTask<Stream> IJSStreamReference.OpenReadStreamAsync(long maxLength, CancellationToken cancellationToken)
{
if (Length > maxLength)
{
throw new ArgumentOutOfRangeException(nameof(maxLength), $"The incoming data stream of length {Length} exceeds the maximum length {maxLength}.");
}
return await _jsRuntime.ReadJSDataAsStreamAsync(this, Length, cancellationToken);
}
}
}
| apache-2.0 | C# |
b69ece3d72ffed1ad88c6fec45d0b9d7dbf6da9a | Remove leftover xmldoc from old API. | Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver | src/AsmResolver.PE/Win32Resources/SerializedResourceData.cs | src/AsmResolver.PE/Win32Resources/SerializedResourceData.cs | // AsmResolver - Executable file format inspection library
// Copyright (C) 2016-2019 Washi
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using System;
using AsmResolver.PE.File;
namespace AsmResolver.PE.Win32Resources
{
/// <summary>
/// Provides an implementation for a single data entry in a Win32 resource directory, that was read from an existing
/// PE file.
/// </summary>
public class SerializedResourceData : ResourceData
{
/// <summary>
/// Indicates the size of a single data entry in a resource directory.
/// </summary>
public const uint ResourceDataEntrySize = 4 * sizeof(uint);
private readonly PEFile _peFile;
private readonly uint _contentsRva;
private readonly uint _contentsSize;
/// <summary>
/// Reads a resource data entry from the provided input stream.
/// </summary>
/// <param name="peFile">The PE file containing the resource.</param>
/// <param name="entry">The entry to read.</param>
/// <param name="entryReader">The input stream to read the data from.</param>
public SerializedResourceData(PEFile peFile, ResourceDirectoryEntry entry, IBinaryStreamReader entryReader)
{
_peFile = peFile ?? throw new ArgumentNullException(nameof(peFile));
if (entry.IsByName)
Name = entry.Name;
else
Id = entry.IdOrNameOffset;
_contentsRva = entryReader.ReadUInt32();
_contentsSize = entryReader.ReadUInt32();
CodePage = entryReader.ReadUInt32();
}
/// <inheritdoc />
protected override ISegment GetContents()
{
return _peFile.TryCreateReaderAtRva(_contentsRva, _contentsSize, out var reader)
? DataSegment.FromReader(reader)
: null;
}
}
} | // AsmResolver - Executable file format inspection library
// Copyright (C) 2016-2019 Washi
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
using System;
using AsmResolver.PE.File;
namespace AsmResolver.PE.Win32Resources
{
/// <summary>
/// Provides an implementation for a single data entry in a Win32 resource directory, that was read from an existing
/// PE file.
/// </summary>
public class SerializedResourceData : ResourceData
{
/// <summary>
/// Indicates the size of a single data entry in a resource directory.
/// </summary>
public const uint ResourceDataEntrySize = 4 * sizeof(uint);
private readonly PEFile _peFile;
private readonly uint _contentsRva;
private readonly uint _contentsSize;
/// <summary>
/// Reads a resource data entry from the provided input stream.
/// </summary>
/// <param name="peFile">The PE file containing the resource.</param>
/// <param name="dataReader">The instance responsible for reading and interpreting the data.</param>
/// <param name="entry">The entry to read.</param>
/// <param name="entryReader">The input stream to read the data from.</param>
public SerializedResourceData(PEFile peFile, ResourceDirectoryEntry entry, IBinaryStreamReader entryReader)
{
_peFile = peFile ?? throw new ArgumentNullException(nameof(peFile));
if (entry.IsByName)
Name = entry.Name;
else
Id = entry.IdOrNameOffset;
_contentsRva = entryReader.ReadUInt32();
_contentsSize = entryReader.ReadUInt32();
CodePage = entryReader.ReadUInt32();
}
/// <inheritdoc />
protected override ISegment GetContents()
{
return _peFile.TryCreateReaderAtRva(_contentsRva, _contentsSize, out var reader)
? DataSegment.FromReader(reader)
: null;
}
}
} | mit | C# |
7f024dceb9344236fcbccf5c9c30dbafe944de56 | Optimize method TextWriterAnnouncer.Heading; [+] Added a new constructor TextWriterAnnouncer with action parameter for more flexibility in the established runners; | fluentmigrator/fluentmigrator,MetSystem/fluentmigrator,ManfredLange/fluentmigrator,lahma/fluentmigrator,lahma/fluentmigrator,KaraokeStu/fluentmigrator,daniellee/fluentmigrator,istaheev/fluentmigrator,mstancombe/fluentmig,wolfascu/fluentmigrator,dealproc/fluentmigrator,modulexcite/fluentmigrator,istaheev/fluentmigrator,schambers/fluentmigrator,tommarien/fluentmigrator,amroel/fluentmigrator,daniellee/fluentmigrator,bluefalcon/fluentmigrator,itn3000/fluentmigrator,IRlyDontKnow/fluentmigrator,ManfredLange/fluentmigrator,lcharlebois/fluentmigrator,bluefalcon/fluentmigrator,tohagan/fluentmigrator,akema-fr/fluentmigrator,FabioNascimento/fluentmigrator,drmohundro/fluentmigrator,schambers/fluentmigrator,itn3000/fluentmigrator,tommarien/fluentmigrator,igitur/fluentmigrator,DefiSolutions/fluentmigrator,alphamc/fluentmigrator,mstancombe/fluentmig,akema-fr/fluentmigrator,lcharlebois/fluentmigrator,mstancombe/fluentmigrator,alphamc/fluentmigrator,barser/fluentmigrator,FabioNascimento/fluentmigrator,DefiSolutions/fluentmigrator,mstancombe/fluentmigrator,amroel/fluentmigrator,ManfredLange/fluentmigrator,stsrki/fluentmigrator,mstancombe/fluentmig,daniellee/fluentmigrator,swalters/fluentmigrator,wolfascu/fluentmigrator,modulexcite/fluentmigrator,tohagan/fluentmigrator,swalters/fluentmigrator,jogibear9988/fluentmigrator,eloekset/fluentmigrator,drmohundro/fluentmigrator,jogibear9988/fluentmigrator,spaccabit/fluentmigrator,KaraokeStu/fluentmigrator,fluentmigrator/fluentmigrator,lahma/fluentmigrator,vgrigoriu/fluentmigrator,MetSystem/fluentmigrator,tohagan/fluentmigrator,eloekset/fluentmigrator,spaccabit/fluentmigrator,IRlyDontKnow/fluentmigrator,barser/fluentmigrator,vgrigoriu/fluentmigrator,stsrki/fluentmigrator,DefiSolutions/fluentmigrator,istaheev/fluentmigrator,dealproc/fluentmigrator,igitur/fluentmigrator | src/FluentMigrator.Runner/Announcers/TextWriterAnnouncer.cs | src/FluentMigrator.Runner/Announcers/TextWriterAnnouncer.cs | #region License
//
// Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using System;
using System.IO;
namespace FluentMigrator.Runner.Announcers
{
public class TextWriterAnnouncer : BaseAnnouncer
{
public TextWriterAnnouncer(TextWriter writer)
: this(writer.Write)
{
}
public TextWriterAnnouncer(Action<string> write)
: base(write)
{
NonSqlPrefix = "-- ";
}
public string NonSqlPrefix { get; set; }
#region IAnnouncer Members
public override void Heading(string message)
{
var value = NonSqlPrefix + message + " ";
Write(value.PadRight(78, '=') + Environment.NewLine + Environment.NewLine);
}
public override void Say(string message)
{
Info(NonSqlPrefix + message);
}
public override void Sql(string sql)
{
if (!ShowSql)
return;
if (!string.IsNullOrEmpty(sql))
Info(sql);
else
Say("No SQL statement executed.");
}
public override void ElapsedTime(TimeSpan timeSpan)
{
if (!ShowElapsedTime)
return;
Say(string.Format("-> {0}s", timeSpan.TotalSeconds));
Write(Environment.NewLine);
}
public override void Error(string message)
{
Write(NonSqlPrefix + "ERROR: ");
Write(message);
Write(Environment.NewLine);
}
#endregion
private void Info(string message)
{
Write(message);
Write(Environment.NewLine);
}
}
} | #region License
//
// Copyright (c) 2007-2009, Sean Chambers <schambers80@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using System;
using System.IO;
namespace FluentMigrator.Runner.Announcers
{
public class TextWriterAnnouncer : BaseAnnouncer
{
public TextWriterAnnouncer(TextWriter writer)
: base(msg => writer.Write(msg))
{
NonSqlPrefix = "-- ";
}
public string NonSqlPrefix { get; set; }
#region IAnnouncer Members
public override void Heading(string message)
{
Write(NonSqlPrefix + message + " ");
for (var i = 0; i < 75 - (message.Length + 1); i++)
{
Write("=");
}
Write(Environment.NewLine);
Write(Environment.NewLine);
}
public override void Say(string message)
{
Info(NonSqlPrefix + message);
}
public override void Sql(string sql)
{
if (!ShowSql)
return;
if (!string.IsNullOrEmpty(sql))
Info(sql);
else
Say("No SQL statement executed.");
}
public override void ElapsedTime(TimeSpan timeSpan)
{
if (!ShowElapsedTime)
return;
Say(string.Format("-> {0}s", timeSpan.TotalSeconds));
Write(Environment.NewLine);
}
public override void Error(string message)
{
Write(NonSqlPrefix + "ERROR: ");
Write(message);
Write(Environment.NewLine);
}
#endregion
private void Info(string message)
{
Write(message);
Write(Environment.NewLine);
}
}
} | apache-2.0 | C# |
cb91786ea97f82299847556dc9149378ec882900 | Return the given RemindOn date | schlos/denver-schedules-api,codeforamerica/denver-schedules-api,codeforamerica/denver-schedules-api,schlos/denver-schedules-api | Schedules.API/Tasks/Sending/PostRemindersEmailSend.cs | Schedules.API/Tasks/Sending/PostRemindersEmailSend.cs | using Simpler;
using System;
using Schedules.API.Models;
using Schedules.API.Tasks.Reminders;
namespace Schedules.API.Tasks.Sending
{
public class PostRemindersEmailSend : InOutTask<PostRemindersEmailSend.Input, PostRemindersEmailSend.Output>
{
public class Input
{
public Send Send { get; set; }
}
public class Output
{
public Send Send { get; set; }
}
public FetchDueReminders FetchDueReminders { get; set; }
public SendEmails SendEmails { get; set; }
public override void Execute ()
{
FetchDueReminders.In.RemindOn = In.Send.RemindOn;
FetchDueReminders.Execute();
SendEmails.In.DueReminders = FetchDueReminders.Out.DueReminders;
SendEmails.Execute();
Out.Send = new Send {
RemindOn = In.Send.RemindOn,
Sent = SendEmails.Out.Sent,
Errors = SendEmails.Out.Errors
};
}
}
}
| using Simpler;
using System;
using Schedules.API.Models;
using Schedules.API.Tasks.Reminders;
namespace Schedules.API.Tasks.Sending
{
public class PostRemindersEmailSend : InOutTask<PostRemindersEmailSend.Input, PostRemindersEmailSend.Output>
{
public class Input
{
public Send Send { get; set; }
}
public class Output
{
public Send Send { get; set; }
}
public FetchDueReminders FetchDueReminders { get; set; }
public SendEmails SendEmails { get; set; }
public override void Execute ()
{
FetchDueReminders.In.RemindOn = In.Send.RemindOn;
FetchDueReminders.Execute();
SendEmails.In.DueReminders = FetchDueReminders.Out.DueReminders;
SendEmails.Execute();
Out.Send = new Send {
Sent = SendEmails.Out.Sent,
Errors = SendEmails.Out.Errors
};
}
}
}
| mit | C# |
c3f054c0967c9ae7bd4174dd05829d13f307fdad | remove unnecessary code. | diryboy/roslyn,physhi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,reaction1989/roslyn,tmat/roslyn,VSadov/roslyn,VSadov/roslyn,jmarolf/roslyn,brettfo/roslyn,reaction1989/roslyn,agocke/roslyn,heejaechang/roslyn,gafter/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,dpoeschl/roslyn,ErikSchierboom/roslyn,mgoertz-msft/roslyn,diryboy/roslyn,davkean/roslyn,KirillOsenkov/roslyn,jcouv/roslyn,gafter/roslyn,eriawan/roslyn,stephentoub/roslyn,swaroop-sridhar/roslyn,tmeschter/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,dotnet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jasonmalinowski/roslyn,dotnet/roslyn,wvdd007/roslyn,davkean/roslyn,sharwell/roslyn,diryboy/roslyn,weltkante/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,panopticoncentral/roslyn,jcouv/roslyn,dpoeschl/roslyn,tannergooding/roslyn,heejaechang/roslyn,tmeschter/roslyn,genlu/roslyn,genlu/roslyn,AlekseyTs/roslyn,cston/roslyn,sharwell/roslyn,eriawan/roslyn,tmeschter/roslyn,weltkante/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,swaroop-sridhar/roslyn,xasx/roslyn,aelij/roslyn,eriawan/roslyn,weltkante/roslyn,dpoeschl/roslyn,brettfo/roslyn,KevinRansom/roslyn,abock/roslyn,physhi/roslyn,AlekseyTs/roslyn,abock/roslyn,nguerrera/roslyn,jmarolf/roslyn,DustinCampbell/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,nguerrera/roslyn,heejaechang/roslyn,tannergooding/roslyn,xasx/roslyn,jmarolf/roslyn,stephentoub/roslyn,swaroop-sridhar/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,DustinCampbell/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,ErikSchierboom/roslyn,mavasani/roslyn,sharwell/roslyn,brettfo/roslyn,cston/roslyn,gafter/roslyn,nguerrera/roslyn,agocke/roslyn,wvdd007/roslyn,genlu/roslyn,MichalStrehovsky/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,MichalStrehovsky/roslyn,ErikSchierboom/roslyn,MichalStrehovsky/roslyn,cston/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,AmadeusW/roslyn,aelij/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,tmat/roslyn,VSadov/roslyn,abock/roslyn,mavasani/roslyn,wvdd007/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,jcouv/roslyn,tmat/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,stephentoub/roslyn,davkean/roslyn,agocke/roslyn,DustinCampbell/roslyn,bartdesmet/roslyn,xasx/roslyn | src/EditorFeatures/Core/Shared/Utilities/ProgressTrackerAdapter.cs | src/EditorFeatures/Core/Shared/Utilities/ProgressTrackerAdapter.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;
using System.Threading;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
/// <summary>
/// An adapter between editor's <see cref="IUIThreadOperationScope"/> (which supports reporting
/// progress) and <see cref="IProgressTracker"/>.
/// </summary>
internal class ProgressTrackerAdapter : IProgressTracker
{
private readonly IUIThreadOperationScope _uiThreadOperationScope;
private int _completedItems;
private int _totalItems;
private string _description;
public ProgressTrackerAdapter(IUIThreadOperationScope uiThreadOperationScope)
{
Requires.NotNull(uiThreadOperationScope, nameof(uiThreadOperationScope));
_uiThreadOperationScope = uiThreadOperationScope;
}
public string Description
{
get => _description;
set
{
_description = value;
_uiThreadOperationScope.Description = value;
}
}
public int CompletedItems => _completedItems;
public int TotalItems => _totalItems;
public void AddItems(int count)
{
Interlocked.Add(ref _totalItems, count);
ReportProgress();
}
public void Clear()
{
Interlocked.Exchange(ref _completedItems, 0);
Interlocked.Exchange(ref _totalItems, 0);
ReportProgress();
}
public void ItemCompleted()
{
Interlocked.Increment(ref _completedItems);
ReportProgress();
}
private void ReportProgress()
=> _uiThreadOperationScope.Progress.Report(new ProgressInfo(_completedItems, _totalItems));
}
}
| // 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;
using System.Threading;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
/// <summary>
/// An adapter between editor's <see cref="IUIThreadOperationScope"/> (which supports reporting
/// progress) and <see cref="IProgressTracker"/>.
/// </summary>
internal class ProgressTrackerAdapter : IProgressTracker
{
private readonly IUIThreadOperationScope _uiThreadOperationScope;
private int _completedItems;
private int _totalItems;
private string _description;
public ProgressTrackerAdapter(IUIThreadOperationScope uiThreadOperationScope)
{
Requires.NotNull(uiThreadOperationScope, nameof(uiThreadOperationScope));
_uiThreadOperationScope = uiThreadOperationScope;
}
public string Description
{
get => _description;
set
{
_description = value;
_uiThreadOperationScope.Description = value;
ForceUpdate();
}
}
private void ForceUpdate()
{
using (_uiThreadOperationScope.Context.AddScope(true, ""))
{
}
}
public int CompletedItems => _completedItems;
public int TotalItems => _totalItems;
public void AddItems(int count)
{
Interlocked.Add(ref _totalItems, count);
ReportProgress();
}
public void Clear()
{
Interlocked.Exchange(ref _completedItems, 0);
Interlocked.Exchange(ref _totalItems, 0);
ReportProgress();
}
public void ItemCompleted()
{
Interlocked.Increment(ref _completedItems);
ReportProgress();
}
private void ReportProgress()
{
_uiThreadOperationScope.Progress.Report(new ProgressInfo(_completedItems, _totalItems));
ForceUpdate();
}
}
}
| mit | C# |
49fd4ced6369a5631b167a4014a23b924e2197af | Update ApiConventionNameMatchBehavior.cs (#17829) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Mvc/Mvc.Core/src/ApiExplorer/ApiConventionNameMatchBehavior.cs | src/Mvc/Mvc.Core/src/ApiExplorer/ApiConventionNameMatchBehavior.cs | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
/// <summary>
/// The behavior for matching the name of a convention parameter or method.
/// </summary>
public enum ApiConventionNameMatchBehavior
{
/// <summary>
/// Matches any name. Use this if the parameter does not need to be matched.
/// </summary>
Any,
/// <summary>
/// The parameter or method name must exactly match the convention.
/// </summary>
Exact,
/// <summary>
/// The parameter or method name in the convention is a proper prefix.
/// <para>
/// Casing is used to delineate words in a given name. For instance, with this behavior
/// the convention name "Get" will match "Get", "GetPerson" or "GetById", but not "getById", "Getaway".
/// </para>
/// </summary>
Prefix,
/// <summary>
/// The parameter or method name in the convention is a proper suffix.
/// <para>
/// Casing is used to delineate words in a given name. For instance, with this behavior
/// the convention name "id" will match "id", or "personId" but not "grid" or "personid".
/// </para>
/// </summary>
Suffix,
}
}
| // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
/// <summary>
/// The behavior for matching the name of a convention parameter or method.
/// </summary>
public enum ApiConventionNameMatchBehavior
{
/// <summary>
/// Matches any name. Use this if the parameter or method name does not need to be matched.
/// </summary>
Any,
/// <summary>
/// The parameter or method name must exactly match the convention.
/// </summary>
Exact,
/// <summary>
/// The parameter or method name in the convention is a proper prefix.
/// <para>
/// Casing is used to delineate words in a given name. For instance, with this behavior
/// the convention name "Get" will match "Get", "GetPerson" or "GetById", but not "getById", "Getaway".
/// </para>
/// </summary>
Prefix,
/// <summary>
/// The parameter or method name in the convention is a proper suffix.
/// <para>
/// Casing is used to delineate words in a given name. For instance, with this behavior
/// the convention name "id" will match "id", or "personId" but not "grid" or "personid".
/// </para>
/// </summary>
Suffix,
}
} | apache-2.0 | C# |
44ca6b3e1970c1ae31fffe0b96ab9736cb2c9610 | Fix DocumentFormattingParams request type | PowerShell/PowerShellEditorServices | src/PowerShellEditorServices.Protocol/LanguageServer/Formatting.cs | src/PowerShellEditorServices.Protocol/LanguageServer/Formatting.cs | //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class DocumentFormattingRequest
{
public static readonly
RequestType<DocumentFormattingParams, TextEdit[], object,TextDocumentRegistrationOptions> Type = RequestType<DocumentFormattingParams, TextEdit[], object,TextDocumentRegistrationOptions>.Create("textDocument/formatting");
}
public class DocumentFormattingParams
{
public TextDocumentIdentifier TextDocument { get; set; }
public FormattingOptions options { get; set; }
}
public class FormattingOptions
{
int TabSize { get; set; }
bool InsertSpaces { get; set; }
}
}
| //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class DocumentFormattingRequest
{
public static readonly
RequestType<DocumentFormattingParams, TextEdit[], object,TextDocumentRegistrationOptions> Type = RequestType<DocumentFormattingParams, TextEdit[], object,TextDocumentRegistrationOptions>.Create("textDocument/definition");
}
public class DocumentFormattingParams
{
public TextDocumentIdentifier TextDocument { get; set; }
public FormattingOptions options { get; set; }
}
public class FormattingOptions
{
int TabSize { get; set; }
bool InsertSpaces { get; set; }
}
}
| mit | C# |
de573a5816252f89e2e766de81033102cb57799b | Fix FindsVersionInDynamicRepo test | asbjornu/GitVersion,GitTools/GitVersion,asbjornu/GitVersion,GitTools/GitVersion | src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TaggedCommitVersionStrategy.cs | src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TaggedCommitVersionStrategy.cs | using GitVersion.Common;
using GitVersion.Model.Configuration;
namespace GitVersion.VersionCalculation;
/// <summary>
/// Version is extracted from all tags on the branch which are valid, and not newer than the current commit.
/// BaseVersionSource is the tag's commit.
/// Increments if the tag is not the current commit.
/// </summary>
public class TaggedCommitVersionStrategy : VersionStrategyBaseWithInheritSupport
{
public TaggedCommitVersionStrategy(IRepositoryStore repositoryStore, Lazy<GitVersionContext> versionContext)
: base(repositoryStore, versionContext)
{
}
public override IEnumerable<BaseVersion> GetVersions(IBranch branch, EffectiveConfiguration configuration) =>
GetTaggedVersions(Context.CurrentBranch, Context.CurrentCommit?.When);
internal IEnumerable<BaseVersion> GetTaggedVersions(IBranch currentBranch, DateTimeOffset? olderThan)
{
if (currentBranch is null)
return Enumerable.Empty<BaseVersion>();
var versionTags = RepositoryStore.GetValidVersionTags(Context.FullConfiguration.TagPrefix, olderThan);
var versionTagsByCommit = versionTags.ToLookup(vt => vt.Item3.Id.Sha);
var commitsOnBranch = currentBranch.Commits;
if (commitsOnBranch == null)
return Enumerable.Empty<BaseVersion>();
var versionTagsOnBranch = commitsOnBranch.SelectMany(commit => versionTagsByCommit[commit.Id.Sha]);
var versionTaggedCommits = versionTagsOnBranch.Select(t => new VersionTaggedCommit(t.Item3, t.Item2, t.Item1.Name.Friendly));
var taggedVersions = versionTaggedCommits.Select(versionTaggedCommit => CreateBaseVersion(Context, versionTaggedCommit)).ToList();
var taggedVersionsOnCurrentCommit = taggedVersions.Where(version => !version.ShouldIncrement).ToList();
return taggedVersionsOnCurrentCommit.Any() ? taggedVersionsOnCurrentCommit : taggedVersions;
}
private BaseVersion CreateBaseVersion(GitVersionContext context, VersionTaggedCommit version)
{
var shouldUpdateVersion = version.Commit.Sha != context.CurrentCommit?.Sha;
var baseVersion = new BaseVersion(FormatSource(version), shouldUpdateVersion, version.SemVer, version.Commit, null);
return baseVersion;
}
protected virtual string FormatSource(VersionTaggedCommit version) => $"Git tag '{version.Tag}'";
protected class VersionTaggedCommit
{
public string Tag;
public ICommit Commit;
public SemanticVersion SemVer;
public VersionTaggedCommit(ICommit commit, SemanticVersion semVer, string tag)
{
this.Tag = tag;
this.Commit = commit;
this.SemVer = semVer;
}
public override string ToString() => $"{this.Tag} | {this.Commit} | {this.SemVer}";
}
}
| using GitVersion.Common;
using GitVersion.Model.Configuration;
namespace GitVersion.VersionCalculation;
/// <summary>
/// Version is extracted from all tags on the branch which are valid, and not newer than the current commit.
/// BaseVersionSource is the tag's commit.
/// Increments if the tag is not the current commit.
/// </summary>
public class TaggedCommitVersionStrategy : VersionStrategyBaseWithInheritSupport
{
public TaggedCommitVersionStrategy(IRepositoryStore repositoryStore, Lazy<GitVersionContext> versionContext)
: base(repositoryStore, versionContext)
{
}
public override IEnumerable<BaseVersion> GetVersions(IBranch branch, EffectiveConfiguration configuration) =>
GetTaggedVersions(Context.CurrentBranch, Context.CurrentBranch.Tip?.When);
internal IEnumerable<BaseVersion> GetTaggedVersions(IBranch currentBranch, DateTimeOffset? olderThan)
{
if (currentBranch is null)
return Enumerable.Empty<BaseVersion>();
var versionTags = RepositoryStore.GetValidVersionTags(Context.FullConfiguration.TagPrefix, olderThan);
var versionTagsByCommit = versionTags.ToLookup(vt => vt.Item3.Id.Sha);
var commitsOnBranch = currentBranch.Commits;
if (commitsOnBranch == null)
return Enumerable.Empty<BaseVersion>();
var versionTagsOnBranch = commitsOnBranch.SelectMany(commit => versionTagsByCommit[commit.Id.Sha]);
var versionTaggedCommits = versionTagsOnBranch.Select(t => new VersionTaggedCommit(t.Item3, t.Item2, t.Item1.Name.Friendly));
var taggedVersions = versionTaggedCommits.Select(versionTaggedCommit => CreateBaseVersion(Context, versionTaggedCommit)).ToList();
var taggedVersionsOnCurrentCommit = taggedVersions.Where(version => !version.ShouldIncrement).ToList();
return taggedVersionsOnCurrentCommit.Any() ? taggedVersionsOnCurrentCommit : taggedVersions;
}
private BaseVersion CreateBaseVersion(GitVersionContext context, VersionTaggedCommit version)
{
var shouldUpdateVersion = version.Commit.Sha != context.CurrentCommit?.Sha;
var baseVersion = new BaseVersion(FormatSource(version), shouldUpdateVersion, version.SemVer, version.Commit, null);
return baseVersion;
}
protected virtual string FormatSource(VersionTaggedCommit version) => $"Git tag '{version.Tag}'";
protected class VersionTaggedCommit
{
public string Tag;
public ICommit Commit;
public SemanticVersion SemVer;
public VersionTaggedCommit(ICommit commit, SemanticVersion semVer, string tag)
{
this.Tag = tag;
this.Commit = commit;
this.SemVer = semVer;
}
public override string ToString() => $"{this.Tag} | {this.Commit} | {this.SemVer}";
}
}
| mit | C# |
94d966ea2bd949a0b6f5b4a04237858052bf125e | Fix compile error in TestComponent.cs | Algorithman/klawr,enlight/klawr,enlight/klawr,Algorithman/klawr,enlight/klawr,Algorithman/klawr | Engine/Plugins/Klawr/KlawrCodeGeneratorPlugin/Resources/WrapperProjectTemplate/TestComponent.cs | Engine/Plugins/Klawr/KlawrCodeGeneratorPlugin/Resources/WrapperProjectTemplate/TestComponent.cs | using Klawr.ClrHost.Interfaces;
using Klawr.ClrHost.Managed;
using Klawr.ClrHost.Managed.SafeHandles;
namespace Klawr.UnrealEngine
{
public class TestComponent : UKlawrScriptComponent
{
public TestComponent(long instanceID, UObjectHandle nativeComponent)
: base(instanceID, nativeComponent)
{
}
// TODO: figure out how to make this work
//public new static UClass StaticClass()
//{
// return (UClass)typeof(TestComponent);
//}
public override void InitializeComponent()
{
var owner = base.GetOwner();
var ownerClass = (UClass)owner.GetType();
}
}
}
| using Klawr.ClrHost.Interfaces;
using Klawr.ClrHost.Managed;
using Klawr.ClrHost.Managed.SafeHandles;
namespace Klawr.UnrealEngine
{
public class TestComponent : UKlawrScriptComponent
{
public TestComponent(long instanceID, UObjectHandle nativeComponent)
: base(instanceID, nativeComponent)
{
}
// TODO: figure out how to make this work
//public new static UClass StaticClass()
//{
// return (UClass)typeof(TestComponent);
//}
public override void InitializeComponent()
{
var owner = base.GetOwner();
var ownerClass = owner.GetActorClass();
}
}
}
| mit | C# |
9fb7f3de90575e30f9139bdaa2fe4b43757676c2 | Fix auto sizing of NumericUpDown Gtk2: NumericUpDown now has a default width of 120 | PowerOfCode/Eto,PowerOfCode/Eto,l8s/Eto,bbqchickenrobot/Eto-1,l8s/Eto,bbqchickenrobot/Eto-1,l8s/Eto,PowerOfCode/Eto,bbqchickenrobot/Eto-1 | Source/Eto.Gtk/Forms/Controls/NumericUpDownHandler.cs | Source/Eto.Gtk/Forms/Controls/NumericUpDownHandler.cs | using System;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.GtkSharp.Forms.Controls
{
public class NumericUpDownHandler : GtkControl<Gtk.SpinButton, NumericUpDown, NumericUpDown.ICallback>, NumericUpDown.IHandler
{
class EtoSpinButton : Gtk.SpinButton
{
public EtoSpinButton()
: base(double.MinValue, double.MaxValue, 1)
{
}
#if GTK3
protected override void OnGetPreferredWidth(out int minimum_width, out int natural_width)
{
// gtk calculates size based on min/max value, so give sane defaults
natural_width = 120;
minimum_width = 0;
}
#endif
}
public NumericUpDownHandler()
{
Control = new EtoSpinButton();
Control.WidthRequest = 120;
Control.Wrap = true;
Control.Adjustment.PageIncrement = 1;
Value = 0;
}
protected override void Initialize()
{
base.Initialize();
Control.ValueChanged += Connector.HandleValueChanged;
}
protected new NumericUpDownConnector Connector { get { return (NumericUpDownConnector)base.Connector; } }
protected override WeakConnector CreateConnector()
{
return new NumericUpDownConnector();
}
protected class NumericUpDownConnector : GtkControlConnector
{
public new NumericUpDownHandler Handler { get { return (NumericUpDownHandler)base.Handler; } }
public void HandleValueChanged(object sender, EventArgs e)
{
Handler.Callback.OnValueChanged(Handler.Widget, EventArgs.Empty);
}
}
public override string Text
{
get { return Control.Text; }
set { Control.Text = value; }
}
public bool ReadOnly
{
get { return !Control.IsEditable; }
set { Control.IsEditable = !value; }
}
public double Value
{
get { return Control.Value; }
set { Control.Value = value; }
}
public double MaxValue
{
get { return Control.Adjustment.Upper; }
set { Control.Adjustment.Upper = value; }
}
public double MinValue
{
get { return Control.Adjustment.Lower; }
set { Control.Adjustment.Lower = value; }
}
public double Increment
{
get { return Control.Adjustment.StepIncrement; }
set
{
Control.Adjustment.StepIncrement = value;
Control.Adjustment.PageIncrement = value;
}
}
public int DecimalPlaces
{
get { return (int)Control.Digits; }
set { Control.Digits = (uint)value; }
}
public Color TextColor
{
get { return Control.Style.Text(Gtk.StateType.Normal).ToEto(); }
set { Control.ModifyText(Gtk.StateType.Normal, value.ToGdk()); }
}
public override Color BackgroundColor
{
get { return Control.Style.Base(Gtk.StateType.Normal).ToEto(); }
set { Control.ModifyBase(Gtk.StateType.Normal, value.ToGdk()); }
}
}
}
| using System;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.GtkSharp.Forms.Controls
{
public class NumericUpDownHandler : GtkControl<Gtk.SpinButton, NumericUpDown, NumericUpDown.ICallback>, NumericUpDown.IHandler
{
public NumericUpDownHandler()
{
Control = new Gtk.SpinButton(double.MinValue, double.MaxValue, 1);
Control.WidthRequest = 80;
Control.Wrap = true;
Control.Adjustment.PageIncrement = 1;
Value = 0;
}
protected override void Initialize()
{
base.Initialize();
Control.ValueChanged += Connector.HandleValueChanged;
}
protected new NumericUpDownConnector Connector { get { return (NumericUpDownConnector)base.Connector; } }
protected override WeakConnector CreateConnector()
{
return new NumericUpDownConnector();
}
protected class NumericUpDownConnector : GtkControlConnector
{
public new NumericUpDownHandler Handler { get { return (NumericUpDownHandler)base.Handler; } }
public void HandleValueChanged(object sender, EventArgs e)
{
Handler.Callback.OnValueChanged(Handler.Widget, EventArgs.Empty);
}
}
public override string Text
{
get { return Control.Text; }
set { Control.Text = value; }
}
public bool ReadOnly
{
get { return !Control.IsEditable; }
set { Control.IsEditable = !value; }
}
public double Value
{
get { return Control.Value; }
set { Control.Value = value; }
}
public double MaxValue
{
get { return Control.Adjustment.Upper; }
set { Control.Adjustment.Upper = value; }
}
public double MinValue
{
get { return Control.Adjustment.Lower; }
set { Control.Adjustment.Lower = value; }
}
public double Increment
{
get { return Control.Adjustment.StepIncrement; }
set
{
Control.Adjustment.StepIncrement = value;
Control.Adjustment.PageIncrement = value;
}
}
public int DecimalPlaces
{
get { return (int)Control.Digits; }
set { Control.Digits = (uint)value; }
}
public Color TextColor
{
get { return Control.Style.Text(Gtk.StateType.Normal).ToEto(); }
set { Control.ModifyText(Gtk.StateType.Normal, value.ToGdk()); }
}
public override Color BackgroundColor
{
get { return Control.Style.Base(Gtk.StateType.Normal).ToEto(); }
set { Control.ModifyBase(Gtk.StateType.Normal, value.ToGdk()); }
}
}
}
| bsd-3-clause | C# |
09a4aad17f47093a3dcf9a97cfffbe077e167ab0 | Fix warning for template query usage in tests | CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,elastic/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,adam-mccoy/elasticsearch-net | src/Tests/QueryDsl/Specialized/Template/TemplateQueryUsageTests.cs | src/Tests/QueryDsl/Specialized/Template/TemplateQueryUsageTests.cs | using System.Collections.Generic;
using Nest;
using Tests.Framework.Integration;
using Tests.Framework.MockData;
namespace Tests.QueryDsl.Specialized.Template
{
public class TemplateUsageTests : QueryDslUsageTestsBase
{
public TemplateUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
private static readonly string _templateString = "{ \"match\": { \"text\": \"{{query_string}}\" }}";
protected override object QueryJson => new
{
template = new
{
_name = "named_query",
boost = 1.1,
inline = _templateString,
@params = new
{
query_string = "all about search"
}
}
};
protected override QueryContainer QueryInitializer => new TemplateQuery
{
Name = "named_query",
Boost = 1.1,
Inline = _templateString,
Params = new Dictionary<string, object>
{
{ "query_string", "all about search" }
}
};
#pragma warning disable 618
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
.Template(sn => sn
.Name("named_query")
.Boost(1.1)
.Inline(_templateString)
.Params(p=>p.Add("query_string", "all about search"))
);
#pragma warning restore 618
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<ITemplateQuery>(a => a.Template)
{
q => {
q.Inline = "";
q.Id = null;
q.File = "";
},
q => {
q.Inline = null;
q.Id = null;
q.File = null;
}
};
}
}
| using System.Collections.Generic;
using Nest;
using Tests.Framework.Integration;
using Tests.Framework.MockData;
namespace Tests.QueryDsl.Specialized.Template
{
public class TemplateUsageTests : QueryDslUsageTestsBase
{
public TemplateUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
private static readonly string _templateString = "{ \"match\": { \"text\": \"{{query_string}}\" }}";
protected override object QueryJson => new
{
template = new
{
_name = "named_query",
boost = 1.1,
inline = _templateString,
@params = new
{
query_string = "all about search"
}
}
};
protected override QueryContainer QueryInitializer => new TemplateQuery
{
Name = "named_query",
Boost = 1.1,
Inline = _templateString,
Params = new Dictionary<string, object>
{
{ "query_string", "all about search" }
}
};
protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project> q) => q
.Template(sn => sn
.Name("named_query")
.Boost(1.1)
.Inline(_templateString)
.Params(p=>p.Add("query_string", "all about search"))
);
protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen<ITemplateQuery>(a => a.Template)
{
q => {
q.Inline = "";
q.Id = null;
q.File = "";
},
q => {
q.Inline = null;
q.Id = null;
q.File = null;
}
};
}
}
| apache-2.0 | C# |
e0676f5aba3aee85616cdca3226595dc4c3d94c9 | fix #161 | micdenny/radical,RadicalFx/radical | src/net40/Radical.Windows.Presentation/Regions/SwitchingElementsRegion.cs | src/net40/Radical.Windows.Presentation/Regions/SwitchingElementsRegion.cs | using System;
using System.Windows;
using Topics.Radical.Windows.Presentation.ComponentModel;
namespace Topics.Radical.Windows.Presentation.Regions
{
/// <summary>
/// A base abstract implementation for the <see cref="ISwitchingElementsRegion"/>.
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class SwitchingElementsRegion<T> :
ElementsRegion<T>,
ISwitchingElementsRegion
where T : FrameworkElement
{
/// <summary>
/// Initializes a new instance of the <see cref="SwitchingElementsRegion<T>"/> class.
/// </summary>
protected SwitchingElementsRegion()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SwitchingElementsRegion<T>"/> class.
/// </summary>
/// <param name="name">The name.</param>
protected SwitchingElementsRegion( String name )
: base( name )
{
}
/// <summary>
/// Gets the content of the active.
/// </summary>
/// <value>
/// The content of the active.
/// </value>
public abstract DependencyObject ActiveContent { get; }
/// <summary>
/// Occurs when the active content changes.
/// </summary>
public event EventHandler<ActiveContentChangedEventArgs> ActiveContentChanged;
/// <summary>
/// Called when the active content is changed.
/// </summary>
protected virtual void OnActiveContentChanged()
{
var h = this.ActiveContentChanged;
if( h != null )
{
h( this, new ActiveContentChangedEventArgs( this.ActiveContent, this.PreviousActiveContent ) );
}
if (RegionService.Conventions != null)
{
var vm = RegionService.Conventions
.GetViewDataContext(this.ActiveContent, ViewDataContextSearchBehavior.LocalOnly) as IExpectViewActivatedCallback;
if (vm != null)
{
vm.OnViewActivated();
}
}
if( this.ActiveContent != this.PreviousActiveContent )
{
this.PreviousActiveContent = this.ActiveContent;
}
}
/// <summary>
/// Gets the content of the previous active.
/// </summary>
/// <value>
/// The content of the previous active.
/// </value>
public DependencyObject PreviousActiveContent
{
get;
private set;
}
/// <summary>
/// Activates the specified content.
/// </summary>
/// <param name="content">The content.</param>
public abstract void Activate( DependencyObject content );
}
} | using System;
using System.Windows;
using Topics.Radical.Windows.Presentation.ComponentModel;
namespace Topics.Radical.Windows.Presentation.Regions
{
/// <summary>
/// A base abstract implementation for the <see cref="ISwitchingElementsRegion"/>.
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class SwitchingElementsRegion<T> :
ElementsRegion<T>,
ISwitchingElementsRegion
where T : FrameworkElement
{
/// <summary>
/// Initializes a new instance of the <see cref="SwitchingElementsRegion<T>"/> class.
/// </summary>
protected SwitchingElementsRegion()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SwitchingElementsRegion<T>"/> class.
/// </summary>
/// <param name="name">The name.</param>
protected SwitchingElementsRegion( String name )
: base( name )
{
}
/// <summary>
/// Gets the content of the active.
/// </summary>
/// <value>
/// The content of the active.
/// </value>
public abstract DependencyObject ActiveContent { get; }
/// <summary>
/// Occurs when the active content changes.
/// </summary>
public event EventHandler<ActiveContentChangedEventArgs> ActiveContentChanged;
/// <summary>
/// Called when the active content is changed.
/// </summary>
protected virtual void OnActiveContentChanged()
{
if( this.ActiveContentChanged != null )
{
this.ActiveContentChanged( this, new ActiveContentChangedEventArgs( this.ActiveContent, this.PreviousActiveContent ) );
}
if( this.ActiveContent != this.PreviousActiveContent )
{
this.PreviousActiveContent = this.ActiveContent;
}
}
/// <summary>
/// Gets the content of the previous active.
/// </summary>
/// <value>
/// The content of the previous active.
/// </value>
public DependencyObject PreviousActiveContent
{
get;
private set;
}
/// <summary>
/// Activates the specified content.
/// </summary>
/// <param name="content">The content.</param>
public abstract void Activate( DependencyObject content );
}
} | mit | C# |
7b63937bbd8b8663a1a71ffc94aa8e8a4752fcdc | Disable build warning regarding unused private variable; this exists on purpose to test serialization behaviour on private fields | rockfordlhotka/csla,rockfordlhotka/csla,MarimerLLC/csla,rockfordlhotka/csla,MarimerLLC/csla,MarimerLLC/csla | Source/Csla.Generators/cs/Csla.Generators.CSharp.TestObjects/PersonPOCO.cs | Source/Csla.Generators/cs/Csla.Generators.CSharp.TestObjects/PersonPOCO.cs | //-----------------------------------------------------------------------
// <copyright file="PersonPOCO.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Complex class that can be used for testing serialization behaviour</summary>
//-----------------------------------------------------------------------
using System;
using Csla.Serialization;
namespace Csla.Generators.CSharp.TestObjects
{
/// <summary>
/// A class for which automatic serialization code is to be generated
/// Includes children of various types to support multiple testing scenarios
/// </summary>
/// <remarks>The class is decorated with the AutoSerializable attribute so that it is picked up by our source generator</remarks>
[AutoSerializable]
public partial class PersonPOCO
{
#pragma warning disable CS0414 // Remove unused private members
private string _fieldTest = "foo";
#pragma warning restore CS0414 // Remove unused private members
private string _lastName;
[AutoSerialized]
private string _middleName;
public int PersonId { get; set; }
public string FirstName { get; set; }
public string MiddleName => _middleName;
public void SetMiddleName(string middleName)
{
_middleName = middleName;
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
[AutoNonSerialized]
public string NonSerializedText { get; set; } = string.Empty;
[AutoSerialized]
private string PrivateSerializedText { get; set; } = string.Empty;
public string GetPrivateSerializedText()
{
return PrivateSerializedText;
}
public void SetPrivateSerializedText(string newValue)
{
PrivateSerializedText = newValue;
}
private string PrivateText { get; set; } = string.Empty;
public string GetUnderlyingPrivateText()
{
return PrivateText;
}
public void SetUnderlyingPrivateText(string value)
{
PrivateText = value;
}
internal DateTime DateOfBirth { get; set; }
public void SetDateOfBirth(DateTime newDateOfBirth)
{
DateOfBirth = newDateOfBirth;
}
public DateTime GetDateOfBirth()
{
return DateOfBirth;
}
public AddressPOCO Address { get; set; }
public EmailAddress EmailAddress { get; set; }
}
}
| //-----------------------------------------------------------------------
// <copyright file="PersonPOCO.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Complex class that can be used for testing serialization behaviour</summary>
//-----------------------------------------------------------------------
using System;
using Csla.Serialization;
namespace Csla.Generators.CSharp.TestObjects
{
/// <summary>
/// A class for which automatic serialization code is to be generated
/// Includes children of various types to support multiple testing scenarios
/// </summary>
/// <remarks>The class is decorated with the AutoSerializable attribute so that it is picked up by our source generator</remarks>
[AutoSerializable]
public partial class PersonPOCO
{
private string _fieldTest = "foo";
private string _lastName;
[AutoSerialized]
private string _middleName;
public int PersonId { get; set; }
public string FirstName { get; set; }
public string MiddleName => _middleName;
public void SetMiddleName(string middleName)
{
_middleName = middleName;
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
[AutoNonSerialized]
public string NonSerializedText { get; set; } = string.Empty;
[AutoSerialized]
private string PrivateSerializedText { get; set; } = string.Empty;
public string GetPrivateSerializedText()
{
return PrivateSerializedText;
}
public void SetPrivateSerializedText(string newValue)
{
PrivateSerializedText = newValue;
}
private string PrivateText { get; set; } = string.Empty;
public string GetUnderlyingPrivateText()
{
return PrivateText;
}
public void SetUnderlyingPrivateText(string value)
{
PrivateText = value;
}
internal DateTime DateOfBirth { get; set; }
public void SetDateOfBirth(DateTime newDateOfBirth)
{
DateOfBirth = newDateOfBirth;
}
public DateTime GetDateOfBirth()
{
return DateOfBirth;
}
public AddressPOCO Address { get; set; }
public EmailAddress EmailAddress { get; set; }
}
}
| mit | C# |
acfa4d478fa7ad5015fed8d6ff473e100c8f1f23 | Store ContentId against the LinkedResource | smolyakoff/essential-templating,smolyakoff/essential-templating,petedavis/essential-templating | src/Essential.Templating.Razor.Email/Helpers/ResourceTemplateHelperExtensions.cs | src/Essential.Templating.Razor.Email/Helpers/ResourceTemplateHelperExtensions.cs | using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net.Mail;
using System.Net.Mime;
using RazorEngine.Text;
namespace Essential.Templating.Razor.Email.Helpers
{
public static class ResourceTemplateHelperExtensions
{
public static IEncodedString Link(this ResourceTemplateHelper helper, string path, string contentId, string mediaType,
TransferEncoding transferEncoding, CultureInfo culture = null)
{
Contract.Requires<ArgumentNullException>(helper != null);
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(path));
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentId));
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(mediaType));
var resource = helper.Get(path, culture);
if (resource == null)
{
var message = string.Format("Resource [{0}] was not found.", contentId);
throw new TemplateHelperException(message);
}
var linkedResource = new LinkedResource(resource, mediaType)
{
TransferEncoding = transferEncoding,
ContentId = contentId
};
helper.AddLinkedResource(linkedResource);
var renderedResult = new RawString(string.Format("cid:{0}", contentId));
return renderedResult;
}
}
}
| using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net.Mail;
using System.Net.Mime;
using RazorEngine.Text;
namespace Essential.Templating.Razor.Email.Helpers
{
public static class ResourceTemplateHelperExtensions
{
public static IEncodedString Link(this ResourceTemplateHelper helper, string path, string contentId, string mediaType,
TransferEncoding transferEncoding, CultureInfo culture = null)
{
Contract.Requires<ArgumentNullException>(helper != null);
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(path));
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(contentId));
Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(mediaType));
var resource = helper.Get(path, culture);
if (resource == null)
{
var message = string.Format("Resource [{0}] was not found.", contentId);
throw new TemplateHelperException(message);
}
var linkedResource = new LinkedResource(resource, mediaType)
{
TransferEncoding = transferEncoding
};
helper.AddLinkedResource(linkedResource);
var renderedResult = new RawString(string.Format("cid:{0}", contentId));
return renderedResult;
}
}
}
| mit | C# |
5ff40be5a5a78f1faf29e98c35331993c933bb78 | Fix artifacts publishing | olsh/todoist-net | build.cake | build.cake | #tool "nuget:?package=OpenCover"
#addin "Cake.Incubator"
var target = Argument("target", "Default");
var extensionsVersion = Argument("version", "1.1.5");
var buildConfiguration = "Release";
var projectName = "Todoist.Net";
var testProjectName = "Todoist.Net.Tests";
var projectFolder = string.Format("./src/{0}/", projectName);
var testProjectFolder = string.Format("./src/{0}/", testProjectName);
Task("UpdateBuildVersion")
.WithCriteria(BuildSystem.AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
var buildNumber = BuildSystem.AppVeyor.Environment.Build.Number;
BuildSystem.AppVeyor.UpdateBuildVersion(string.Format("{0}.{1}", extensionsVersion, buildNumber));
});
Task("NugetRestore")
.Does(() =>
{
DotNetCoreRestore();
});
Task("UpdateAssemblyVersion")
.Does(() =>
{
var assemblyFile = string.Format("{0}/Properties/AssemblyInfo.cs", projectFolder);
AssemblyInfoSettings assemblySettings = new AssemblyInfoSettings();
assemblySettings.Title = projectName;
assemblySettings.FileVersion = extensionsVersion;
assemblySettings.Version = extensionsVersion;
assemblySettings.InternalsVisibleTo = new [] { testProjectName };
CreateAssemblyInfo(assemblyFile, assemblySettings);
});
Task("Build")
.IsDependentOn("NugetRestore")
.IsDependentOn("UpdateAssemblyVersion")
.Does(() =>
{
MSBuild(string.Format("{0}.sln", projectName), new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = buildConfiguration
});
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = buildConfiguration
};
DotNetCoreTest(testProjectFolder, settings);
});
Task("CodeCoverage")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = buildConfiguration
};
OpenCover(tool => { tool.DotNetCoreTest(testProjectFolder, settings); },
new FilePath("./coverage.xml"),
new OpenCoverSettings()
.WithFilter("+[Todoist.Net]*")
.WithFilter("-[Todoist.Net.Tests]*"));
});
Task("NugetPack")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = buildConfiguration,
OutputDirectory = "."
};
DotNetCorePack(projectFolder, settings);
});
Task("CreateArtifact")
.IsDependentOn("NugetPack")
.WithCriteria(BuildSystem.AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
BuildSystem.AppVeyor.UploadArtifact(string.Format("{0}.{1}.nupkg", projectName, extensionsVersion));
BuildSystem.AppVeyor.UploadArtifact(string.Format("{0}.{1}.symbols.nupkg", projectName, extensionsVersion));
});
Task("Default")
.IsDependentOn("Test")
.IsDependentOn("NugetPack");
Task("CI")
.IsDependentOn("UpdateBuildVersion")
.IsDependentOn("CodeCoverage")
.IsDependentOn("CreateArtifact");
RunTarget(target);
| #tool "nuget:?package=OpenCover"
#addin "Cake.Incubator"
var target = Argument("target", "Default");
var extensionsVersion = Argument("version", "1.1.4");
var buildConfiguration = "Release";
var projectName = "Todoist.Net";
var testProjectName = "Todoist.Net.Tests";
var projectFolder = string.Format("./src/{0}/", projectName);
var testProjectFolder = string.Format("./src/{0}/", testProjectName);
Task("UpdateBuildVersion")
.WithCriteria(BuildSystem.AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
var buildNumber = BuildSystem.AppVeyor.Environment.Build.Number;
BuildSystem.AppVeyor.UpdateBuildVersion(string.Format("{0}.{1}", extensionsVersion, buildNumber));
});
Task("NugetRestore")
.Does(() =>
{
DotNetCoreRestore();
});
Task("UpdateAssemblyVersion")
.Does(() =>
{
var assemblyFile = string.Format("{0}/Properties/AssemblyInfo.cs", projectFolder);
AssemblyInfoSettings assemblySettings = new AssemblyInfoSettings();
assemblySettings.Title = projectName;
assemblySettings.FileVersion = extensionsVersion;
assemblySettings.Version = extensionsVersion;
assemblySettings.InternalsVisibleTo = new [] { testProjectName };
CreateAssemblyInfo(assemblyFile, assemblySettings);
});
Task("Build")
.IsDependentOn("NugetRestore")
.IsDependentOn("UpdateAssemblyVersion")
.Does(() =>
{
MSBuild(string.Format("{0}.sln", projectName), new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = buildConfiguration
});
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = buildConfiguration
};
DotNetCoreTest(testProjectFolder, settings);
});
Task("CodeCoverage")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = buildConfiguration
};
OpenCover(tool => { tool.DotNetCoreTest(testProjectFolder, settings); },
new FilePath("./coverage.xml"),
new OpenCoverSettings()
.WithFilter("+[Todoist.Net]*")
.WithFilter("-[Todoist.Net.Tests]*"));
});
Task("NugetPack")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = buildConfiguration,
OutputDirectory = "."
};
DotNetCorePack(projectFolder, settings);
});
Task("CreateArtifact")
.IsDependentOn("NugetPack")
.WithCriteria(BuildSystem.AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
BuildSystem.AppVeyor.UploadArtifact(string.Format("{0}.{1}.nupkg", projectName, extensionsVersion));
BuildSystem.AppVeyor.UploadArtifact(string.Format("{0}.{1}.symbols.nupkg", projectName, extensionsVersion));
});
Task("Default")
.IsDependentOn("Test")
.IsDependentOn("NugetPack");
Task("CI")
.IsDependentOn("UpdateBuildVersion")
.IsDependentOn("CodeCoverage")
.IsDependentOn("CreateArtifact");
RunTarget(target);
| mit | C# |
0b3a47f55214a4fc7611d31f025a570bb4d835e8 | Update assembly info | masahikomori/timeSignal | timeSignal/Properties/AssemblyInfo.cs | timeSignal/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("timeSignal")]
[assembly: AssemblyDescription("Time signal notification")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("timeSignal")]
[assembly: AssemblyCopyright("Copyright © Masahiko Mori 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("af581c0f-48dd-43bf-a13c-3941fd484a63")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [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;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("timeSignal")]
[assembly: AssemblyDescription("Time signal notification")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("timeSignal")]
[assembly: AssemblyCopyright("Copyright © Masahiko Mori 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("af581c0f-48dd-43bf-a13c-3941fd484a63")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
| mit | C# |
88ab8c719b7c29883bd2321e53f14b8be9180a3f | Add NFW to help track down issue. | mavasani/roslyn,yeaicc/roslyn,orthoxerox/roslyn,ErikSchierboom/roslyn,bkoelman/roslyn,mattscheffer/roslyn,jmarolf/roslyn,amcasey/roslyn,khyperia/roslyn,paulvanbrenk/roslyn,sharwell/roslyn,jeffanders/roslyn,VSadov/roslyn,tmat/roslyn,jmarolf/roslyn,gafter/roslyn,jeffanders/roslyn,bartdesmet/roslyn,heejaechang/roslyn,bkoelman/roslyn,drognanar/roslyn,ErikSchierboom/roslyn,heejaechang/roslyn,agocke/roslyn,agocke/roslyn,mgoertz-msft/roslyn,dpoeschl/roslyn,gafter/roslyn,weltkante/roslyn,jamesqo/roslyn,mmitche/roslyn,bartdesmet/roslyn,MichalStrehovsky/roslyn,jmarolf/roslyn,robinsedlaczek/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,Giftednewt/roslyn,jasonmalinowski/roslyn,jcouv/roslyn,paulvanbrenk/roslyn,jkotas/roslyn,sharwell/roslyn,zooba/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,yeaicc/roslyn,mavasani/roslyn,DustinCampbell/roslyn,stephentoub/roslyn,jkotas/roslyn,stephentoub/roslyn,mattscheffer/roslyn,drognanar/roslyn,robinsedlaczek/roslyn,panopticoncentral/roslyn,weltkante/roslyn,dotnet/roslyn,zooba/roslyn,bartdesmet/roslyn,reaction1989/roslyn,mattwar/roslyn,ErikSchierboom/roslyn,amcasey/roslyn,jcouv/roslyn,MattWindsor91/roslyn,tannergooding/roslyn,TyOverby/roslyn,eriawan/roslyn,reaction1989/roslyn,srivatsn/roslyn,CyrusNajmabadi/roslyn,abock/roslyn,diryboy/roslyn,genlu/roslyn,swaroop-sridhar/roslyn,mgoertz-msft/roslyn,Hosch250/roslyn,paulvanbrenk/roslyn,sharwell/roslyn,pdelvo/roslyn,MichalStrehovsky/roslyn,tannergooding/roslyn,tmeschter/roslyn,davkean/roslyn,dpoeschl/roslyn,KevinRansom/roslyn,mavasani/roslyn,panopticoncentral/roslyn,jkotas/roslyn,akrisiun/roslyn,dpoeschl/roslyn,pdelvo/roslyn,wvdd007/roslyn,nguerrera/roslyn,diryboy/roslyn,DustinCampbell/roslyn,brettfo/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,orthoxerox/roslyn,reaction1989/roslyn,xasx/roslyn,agocke/roslyn,TyOverby/roslyn,MattWindsor91/roslyn,mattscheffer/roslyn,AmadeusW/roslyn,CaptainHayashi/roslyn,mmitche/roslyn,OmarTawfik/roslyn,eriawan/roslyn,tmat/roslyn,OmarTawfik/roslyn,swaroop-sridhar/roslyn,AnthonyDGreen/roslyn,akrisiun/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,jamesqo/roslyn,MichalStrehovsky/roslyn,xasx/roslyn,jasonmalinowski/roslyn,brettfo/roslyn,srivatsn/roslyn,akrisiun/roslyn,AlekseyTs/roslyn,KevinRansom/roslyn,jeffanders/roslyn,stephentoub/roslyn,Hosch250/roslyn,CaptainHayashi/roslyn,khyperia/roslyn,aelij/roslyn,abock/roslyn,KevinRansom/roslyn,Giftednewt/roslyn,cston/roslyn,physhi/roslyn,physhi/roslyn,tvand7093/roslyn,nguerrera/roslyn,weltkante/roslyn,AnthonyDGreen/roslyn,genlu/roslyn,mattwar/roslyn,abock/roslyn,panopticoncentral/roslyn,AlekseyTs/roslyn,jamesqo/roslyn,AnthonyDGreen/roslyn,lorcanmooney/roslyn,jasonmalinowski/roslyn,VSadov/roslyn,tvand7093/roslyn,dotnet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,diryboy/roslyn,brettfo/roslyn,tannergooding/roslyn,heejaechang/roslyn,orthoxerox/roslyn,MattWindsor91/roslyn,tmeschter/roslyn,khyperia/roslyn,shyamnamboodiripad/roslyn,lorcanmooney/roslyn,swaroop-sridhar/roslyn,OmarTawfik/roslyn,tmat/roslyn,drognanar/roslyn,wvdd007/roslyn,VSadov/roslyn,CyrusNajmabadi/roslyn,AlekseyTs/roslyn,cston/roslyn,nguerrera/roslyn,Giftednewt/roslyn,aelij/roslyn,aelij/roslyn,yeaicc/roslyn,AmadeusW/roslyn,zooba/roslyn,KirillOsenkov/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Hosch250/roslyn,amcasey/roslyn,eriawan/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,DustinCampbell/roslyn,dotnet/roslyn,kelltrick/roslyn,jcouv/roslyn,mgoertz-msft/roslyn,robinsedlaczek/roslyn,CyrusNajmabadi/roslyn,lorcanmooney/roslyn,cston/roslyn,kelltrick/roslyn,TyOverby/roslyn,genlu/roslyn,physhi/roslyn,xasx/roslyn,tmeschter/roslyn,CaptainHayashi/roslyn,pdelvo/roslyn,MattWindsor91/roslyn,mmitche/roslyn,mattwar/roslyn,bkoelman/roslyn,srivatsn/roslyn,kelltrick/roslyn,tvand7093/roslyn,davkean/roslyn | src/VisualStudio/Core/Def/Utilities/IVsEditorAdaptersFactoryServiceExtensions.cs | src/VisualStudio/Core/Def/Utilities/IVsEditorAdaptersFactoryServiceExtensions.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;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Text;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Utilities
{
internal static class IVsEditorAdaptersFactoryServiceExtensions
{
public static IOleUndoManager TryGetUndoManager(
this IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
Workspace workspace,
DocumentId contextDocumentId,
CancellationToken cancellationToken)
{
// https://github.com/dotnet/roslyn/issues/17898
// We have a report of a null ref occuring in this method. The only place we believe
// this could be would be if 'document' was null. Try to catch a reasonable
// non -fatal-watson dump to help track down what the root cause of this might be.
var document = workspace.CurrentSolution.GetDocument(contextDocumentId);
if (document == null)
{
var message = contextDocumentId == null
? $"{nameof(contextDocumentId)} was null."
: $"{nameof(contextDocumentId)} was not null.";
FatalError.ReportWithoutCrash(new InvalidOperationException(
"Could not retrieve document. " + message));
return null;
}
var text = document.GetTextAsync(cancellationToken).WaitAndGetResult(cancellationToken);
var textSnapshot = text.FindCorrespondingEditorTextSnapshot();
var textBuffer = textSnapshot?.TextBuffer;
return editorAdaptersFactoryService.TryGetUndoManager(textBuffer);
}
public static IOleUndoManager TryGetUndoManager(
this IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextBuffer subjectBuffer)
{
if (subjectBuffer != null)
{
var adapter = editorAdaptersFactoryService?.GetBufferAdapter(subjectBuffer);
if (adapter != null)
{
if (ErrorHandler.Succeeded(adapter.GetUndoManager(out var manager)))
{
return manager;
}
}
}
return null;
}
}
} | // 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.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Text;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Utilities
{
internal static class IVsEditorAdaptersFactoryServiceExtensions
{
public static IOleUndoManager TryGetUndoManager(
this IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
Workspace workspace,
DocumentId contextDocumentId,
CancellationToken cancellationToken)
{
var document = workspace.CurrentSolution.GetDocument(contextDocumentId);
var text = document?.GetTextAsync(cancellationToken).WaitAndGetResult(cancellationToken);
var textSnapshot = text.FindCorrespondingEditorTextSnapshot();
var textBuffer = textSnapshot?.TextBuffer;
return editorAdaptersFactoryService.TryGetUndoManager(textBuffer);
}
public static IOleUndoManager TryGetUndoManager(
this IVsEditorAdaptersFactoryService editorAdaptersFactoryService, ITextBuffer subjectBuffer)
{
if (subjectBuffer != null)
{
var adapter = editorAdaptersFactoryService?.GetBufferAdapter(subjectBuffer);
if (adapter != null)
{
if (ErrorHandler.Succeeded(adapter.GetUndoManager(out var manager)))
{
return manager;
}
}
}
return null;
}
}
} | mit | C# |
9b19050fafde5ebe051f7b2daa478805644552e1 | Update with slider body changes | peppy/osu,DrabWeb/osu,UselessToucan/osu,ppy/osu,DrabWeb/osu,2yangk23/osu,smoogipoo/osu,naoey/osu,naoey/osu,UselessToucan/osu,ZLima12/osu,EVAST9919/osu,NeoAdonis/osu,johnneijzen/osu,ppy/osu,johnneijzen/osu,UselessToucan/osu,smoogipoo/osu,smoogipooo/osu,DrabWeb/osu,naoey/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,ZLima12/osu,peppy/osu,peppy/osu-new,EVAST9919/osu,NeoAdonis/osu | osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.cs | osu.Game.Rulesets.Osu/Edit/Masks/SliderMasks/Components/SliderBodyPiece.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.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
{
public class SliderBodyPiece : CompositeDrawable
{
private readonly Slider slider;
private readonly SnakingSliderBody body;
public SliderBodyPiece(Slider slider)
{
this.slider = slider;
InternalChild = body = new SnakingSliderBody(slider)
{
AccentColour = Color4.Transparent,
PathWidth = slider.Scale * 64
};
slider.PositionChanged += _ => updatePosition();
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
body.BorderColour = colours.Yellow;
updatePosition();
}
private void updatePosition() => Position = slider.StackedPosition;
protected override void Update()
{
base.Update();
Size = body.Size;
OriginPosition = body.PathOffset;
// Need to cause one update
body.UpdateProgress(0);
}
}
}
| // 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.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
{
public class SliderBodyPiece : CompositeDrawable
{
private readonly Slider slider;
private readonly SliderBody body;
public SliderBodyPiece(Slider slider)
{
this.slider = slider;
InternalChild = body = new SliderBody(slider)
{
AccentColour = Color4.Transparent,
PathWidth = slider.Scale * 64
};
slider.PositionChanged += _ => updatePosition();
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
body.BorderColour = colours.Yellow;
updatePosition();
}
private void updatePosition() => Position = slider.StackedPosition;
protected override void Update()
{
base.Update();
Size = body.Size;
OriginPosition = body.PathOffset;
// Need to cause one update
body.UpdateProgress(0);
}
}
}
| mit | C# |
3df96240588a37fb4bee3412655be622944f1959 | Add note about long retry delay | rasmus/EventFlow | Source/EventFlow.MsSql/MsSqlConfiguration.cs | Source/EventFlow.MsSql/MsSqlConfiguration.cs | // The MIT License (MIT)
//
// Copyright (c) 2015-2017 Rasmus Mikkelsen
// Copyright (c) 2015-2017 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// 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 EventFlow.Core;
using EventFlow.Sql.Connections;
namespace EventFlow.MsSql
{
public class MsSqlConfiguration : SqlConfiguration<IMsSqlConfiguration>, IMsSqlConfiguration
{
public static MsSqlConfiguration New => new MsSqlConfiguration();
private MsSqlConfiguration()
{
}
// From official documentation on MSDN: "The service is currently busy. Retry the request after 10 seconds"
public RetryDelay ServerBusyRetryDelay { get; private set; } = RetryDelay.Between(
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(15));
public IMsSqlConfiguration SetServerBusyRetryDelay(RetryDelay retryDelay)
{
ServerBusyRetryDelay = retryDelay;
return this;
}
}
} | // The MIT License (MIT)
//
// Copyright (c) 2015-2017 Rasmus Mikkelsen
// Copyright (c) 2015-2017 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// 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 EventFlow.Core;
using EventFlow.Sql.Connections;
namespace EventFlow.MsSql
{
public class MsSqlConfiguration : SqlConfiguration<IMsSqlConfiguration>, IMsSqlConfiguration
{
public static MsSqlConfiguration New => new MsSqlConfiguration();
private MsSqlConfiguration()
{
}
public RetryDelay ServerBusyRetryDelay { get; private set; } = RetryDelay.Between(
TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(15));
public IMsSqlConfiguration SetServerBusyRetryDelay(RetryDelay retryDelay)
{
ServerBusyRetryDelay = retryDelay;
return this;
}
}
} | mit | C# |
5ca53008874b0cc6c0784143acd1daf2528f26fc | load animation at control loading | Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns | TCC.Core/Controls/DungeonInfoControl.xaml.cs | TCC.Core/Controls/DungeonInfoControl.xaml.cs | 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.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace TCC.Controls
{
/// <summary>
/// Interaction logic for DungeonInfoControl.xaml
/// </summary>
public partial class DungeonInfoControl : UserControl
{
TimeSpan growDuration;
DoubleAnimation scaleUp;
DoubleAnimation moveUp;
DoubleAnimation scaleDown;
DoubleAnimation moveDown;
DoubleAnimation bubbleScale;
DoubleAnimation fadeIn;
public DungeonInfoControl()
{
InitializeComponent();
}
private void UserControl_MouseEnter(object sender, MouseEventArgs e)
{
rootBorder.RenderTransform.BeginAnimation(TranslateTransform.XProperty, scaleUp);
}
private void UserControl_MouseLeave(object sender, MouseEventArgs e)
{
rootBorder.RenderTransform.BeginAnimation(TranslateTransform.XProperty, scaleDown);
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
growDuration = TimeSpan.FromMilliseconds(150);
scaleUp = new DoubleAnimation(2, growDuration) { EasingFunction = new QuadraticEase() };
moveUp = new DoubleAnimation(10, growDuration) { EasingFunction = new QuadraticEase() };
scaleDown = new DoubleAnimation(0, growDuration) { EasingFunction = new QuadraticEase() };
moveDown = new DoubleAnimation(4, growDuration) { EasingFunction = new QuadraticEase() };
bubbleScale = new DoubleAnimation(.9, 1, TimeSpan.FromMilliseconds(1000)) { EasingFunction = new ElasticEase() };
fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200));
}
public void AnimateIn()
{
Dispatcher.Invoke(() =>
{
entriesBubble.RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, bubbleScale);
entriesBubble.RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, bubbleScale);
entriesBubble.Child.BeginAnimation(OpacityProperty, fadeIn);
});
}
}
}
| 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.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace TCC.Controls
{
/// <summary>
/// Interaction logic for DungeonInfoControl.xaml
/// </summary>
public partial class DungeonInfoControl : UserControl
{
TimeSpan growDuration;
DoubleAnimation scaleUp;
DoubleAnimation moveUp;
DoubleAnimation scaleDown;
DoubleAnimation moveDown;
public DungeonInfoControl()
{
InitializeComponent();
}
private void UserControl_MouseEnter(object sender, MouseEventArgs e)
{
rootBorder.RenderTransform.BeginAnimation(TranslateTransform.XProperty, scaleUp);
}
private void UserControl_MouseLeave(object sender, MouseEventArgs e)
{
rootBorder.RenderTransform.BeginAnimation(TranslateTransform.XProperty, scaleDown);
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
growDuration = TimeSpan.FromMilliseconds(150);
scaleUp = new DoubleAnimation(2, growDuration) { EasingFunction = new QuadraticEase() };
moveUp = new DoubleAnimation(10, growDuration) { EasingFunction = new QuadraticEase() };
scaleDown = new DoubleAnimation(0, growDuration) { EasingFunction = new QuadraticEase() };
moveDown = new DoubleAnimation(4, growDuration) { EasingFunction = new QuadraticEase() };
}
public void AnimateIn()
{
Dispatcher.Invoke(() =>
{
entriesBubble.RenderTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(.9, 1, TimeSpan.FromMilliseconds(1000)) { EasingFunction = new ElasticEase() });
entriesBubble.RenderTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(.9, 1, TimeSpan.FromMilliseconds(1000)) { EasingFunction = new ElasticEase() });
entriesBubble.Child.BeginAnimation(OpacityProperty, new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(200)));
});
}
}
}
| mit | C# |
9e333292515610a718c7a05529c9a3835eec2012 | Fix failing test on machine using en-GB (#41534) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Security/samples/CustomPolicyProvider/Controllers/AccountController.cs | src/Security/samples/CustomPolicyProvider/Controllers/AccountController.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Globalization;
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc;
namespace CustomPolicyProvider.Controllers;
public class AccountController : Controller
{
[HttpGet]
public IActionResult Signin(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}
[HttpPost]
public async Task<IActionResult> Signin(string userName, string birthDate = null, string returnUrl = null)
{
if (string.IsNullOrEmpty(userName))
{
return BadRequest("A user name is required");
}
// In a real-world application, user credentials would need validated before signing in
var claims = new List<Claim>();
// Add a Name claim and, if birth date was provided, a DateOfBirth claim
claims.Add(new Claim(ClaimTypes.Name, userName));
if (DateTime.TryParse(birthDate, CultureInfo.InvariantCulture, out _))
{
claims.Add(new Claim(ClaimTypes.DateOfBirth, birthDate));
}
// Create user's identity and sign them in
var identity = new ClaimsIdentity(claims, "UserSpecified");
await HttpContext.SignInAsync(new ClaimsPrincipal(identity));
return Redirect(returnUrl ?? "/");
}
public async Task<IActionResult> Signout()
{
await HttpContext.SignOutAsync();
return Redirect("/");
}
public IActionResult Denied()
{
return View();
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc;
namespace CustomPolicyProvider.Controllers;
public class AccountController : Controller
{
[HttpGet]
public IActionResult Signin(string returnUrl = null)
{
ViewData["ReturnUrl"] = returnUrl;
return View();
}
[HttpPost]
public async Task<IActionResult> Signin(string userName, DateTime? birthDate, string returnUrl = null)
{
if (string.IsNullOrEmpty(userName))
{
return BadRequest("A user name is required");
}
// In a real-world application, user credentials would need validated before signing in
var claims = new List<Claim>();
// Add a Name claim and, if birth date was provided, a DateOfBirth claim
claims.Add(new Claim(ClaimTypes.Name, userName));
if (birthDate.HasValue)
{
claims.Add(new Claim(ClaimTypes.DateOfBirth, birthDate.Value.ToShortDateString()));
}
// Create user's identity and sign them in
var identity = new ClaimsIdentity(claims, "UserSpecified");
await HttpContext.SignInAsync(new ClaimsPrincipal(identity));
return Redirect(returnUrl ?? "/");
}
public async Task<IActionResult> Signout()
{
await HttpContext.SignOutAsync();
return Redirect("/");
}
public IActionResult Denied()
{
return View();
}
}
| apache-2.0 | C# |
f8e340b51a30c906f496363e898ef8c6d16116a9 | Fix for issue #34 where a flag was missing from project context | modesttree/Zenject,modesttree/Zenject,modesttree/Zenject | UnityProject/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs | UnityProject/Assets/Plugins/Zenject/Source/Editor/Editors/ProjectContextEditor.cs | #if !ODIN_INSPECTOR
using UnityEditor;
namespace Zenject
{
[CustomEditor(typeof(ProjectContext))]
[NoReflectionBaking]
public class ProjectContextEditor : ContextEditor
{
SerializedProperty _settingsProperty;
SerializedProperty _editorReflectionBakingCoverageModeProperty;
SerializedProperty _buildsReflectionBakingCoverageModeProperty;
SerializedProperty _parentNewObjectsUnderContextProperty;
public override void OnEnable()
{
base.OnEnable();
_settingsProperty = serializedObject.FindProperty("_settings");
_editorReflectionBakingCoverageModeProperty = serializedObject.FindProperty("_editorReflectionBakingCoverageMode");
_buildsReflectionBakingCoverageModeProperty = serializedObject.FindProperty("_buildsReflectionBakingCoverageMode");
_parentNewObjectsUnderContextProperty = serializedObject.FindProperty("_parentNewObjectsUnderContext");
}
protected override void OnGui()
{
base.OnGui();
EditorGUILayout.PropertyField(_settingsProperty, true);
EditorGUILayout.PropertyField(_editorReflectionBakingCoverageModeProperty, true);
EditorGUILayout.PropertyField(_buildsReflectionBakingCoverageModeProperty, true);
EditorGUILayout.PropertyField(_parentNewObjectsUnderContextProperty);
}
}
}
#endif
| #if !ODIN_INSPECTOR
using UnityEditor;
namespace Zenject
{
[CustomEditor(typeof(ProjectContext))]
[NoReflectionBaking]
public class ProjectContextEditor : ContextEditor
{
SerializedProperty _settingsProperty;
SerializedProperty _editorReflectionBakingCoverageModeProperty;
SerializedProperty _buildsReflectionBakingCoverageModeProperty;
public override void OnEnable()
{
base.OnEnable();
_settingsProperty = serializedObject.FindProperty("_settings");
_editorReflectionBakingCoverageModeProperty = serializedObject.FindProperty("_editorReflectionBakingCoverageMode");
_buildsReflectionBakingCoverageModeProperty = serializedObject.FindProperty("_buildsReflectionBakingCoverageMode");
}
protected override void OnGui()
{
base.OnGui();
EditorGUILayout.PropertyField(_settingsProperty, true);
EditorGUILayout.PropertyField(_editorReflectionBakingCoverageModeProperty, true);
EditorGUILayout.PropertyField(_buildsReflectionBakingCoverageModeProperty, true);
}
}
}
#endif
| mit | C# |
6ae581f2ea3677bd241c24c40bbc753014c3ec70 | Exclude _full_text_ from default IndexSchema | cris-almodovar/expando-db,cris-almodovar/expando-db,cris-almodovar/postit-db,cris-almodovar/postit-db,cris-almodovar/postit-db,cris-almodovar/expando-db | ExpandoDB/Search/IndexSchema.cs | ExpandoDB/Search/IndexSchema.cs | using ExpandoDB.Search;
using System;
using System.Collections.Concurrent;
using System.Diagnostics.Contracts;
namespace ExpandoDB
{
/// <summary>
/// Represents the set of indexed fields for a ContentCollection.
/// </summary>
public class IndexSchema
{
public string Name { get; set; }
public ConcurrentDictionary<string, IndexedField> Fields { get; set; }
public IndexSchema()
{
Fields = new ConcurrentDictionary<string, IndexedField>();
}
public IndexSchema(string name) : this()
{
Name = name;
}
/// <summary>
/// Creates a default IndexSchema, which contains the _id, _createdTimestamp, _modifiedTimestamp, and _full_text_ fields.
/// </summary>
/// <param name="name">The name of the IndexSchema.</param>
/// <returns></returns>
public static IndexSchema CreateDefault(string name = null)
{
if (String.IsNullOrWhiteSpace(name))
name = "Default";
var indexSchema = new IndexSchema(name);
indexSchema.Fields[Content.ID_FIELD_NAME] = new IndexedField { Name = Content.ID_FIELD_NAME, DataType = FieldDataType.Guid };
indexSchema.Fields[Content.CREATED_TIMESTAMP_FIELD_NAME] = new IndexedField { Name = Content.CREATED_TIMESTAMP_FIELD_NAME, DataType = FieldDataType.DateTime };
indexSchema.Fields[Content.MODIFIED_TIMESTAMP_FIELD_NAME] = new IndexedField { Name = Content.MODIFIED_TIMESTAMP_FIELD_NAME, DataType = FieldDataType.DateTime };
return indexSchema;
}
}
public class IndexedField
{
public string Name { get; set; }
public FieldDataType DataType { get; set; }
public FieldDataType ArrayElementDataType { get; set; }
public IndexSchema ObjectSchema { get; set; }
public bool IsTopLevel { get { return (Name ?? String.Empty).IndexOf('.') < 0; } }
}
public enum FieldDataType
{
Unknown,
Guid,
Text,
Number,
Boolean,
DateTime,
Array,
Object
}
}
| using ExpandoDB.Search;
using System;
using System.Collections.Concurrent;
using System.Diagnostics.Contracts;
namespace ExpandoDB
{
/// <summary>
/// Represents the set of indexed fields for a ContentCollection.
/// </summary>
public class IndexSchema
{
public string Name { get; set; }
public ConcurrentDictionary<string, IndexedField> Fields { get; set; }
public IndexSchema()
{
Fields = new ConcurrentDictionary<string, IndexedField>();
}
public IndexSchema(string name) : this()
{
Name = name;
}
/// <summary>
/// Creates a default IndexSchema, which contains the _id, _createdTimestamp, _modifiedTimestamp, and _full_text_ fields.
/// </summary>
/// <param name="name">The name of the IndexSchema.</param>
/// <returns></returns>
public static IndexSchema CreateDefault(string name = null)
{
if (String.IsNullOrWhiteSpace(name))
name = "Default";
var indexSchema = new IndexSchema(name);
indexSchema.Fields[Content.ID_FIELD_NAME] = new IndexedField { Name = Content.ID_FIELD_NAME, DataType = FieldDataType.Guid };
indexSchema.Fields[Content.CREATED_TIMESTAMP_FIELD_NAME] = new IndexedField { Name = Content.CREATED_TIMESTAMP_FIELD_NAME, DataType = FieldDataType.DateTime };
indexSchema.Fields[Content.MODIFIED_TIMESTAMP_FIELD_NAME] = new IndexedField { Name = Content.MODIFIED_TIMESTAMP_FIELD_NAME, DataType = FieldDataType.DateTime };
indexSchema.Fields[LuceneExtensions.FULL_TEXT_FIELD_NAME] = new IndexedField { Name = LuceneExtensions.FULL_TEXT_FIELD_NAME, DataType = FieldDataType.Text };
return indexSchema;
}
}
public class IndexedField
{
public string Name { get; set; }
public FieldDataType DataType { get; set; }
public FieldDataType ArrayElementDataType { get; set; }
public IndexSchema ObjectSchema { get; set; }
public bool IsTopLevel { get { return (Name ?? String.Empty).IndexOf('.') < 0; } }
}
public enum FieldDataType
{
Unknown,
Guid,
Text,
Number,
Boolean,
DateTime,
Array,
Object
}
} | apache-2.0 | C# |
4dd238ceed9d77a7d31d111c0ff237271f81634d | Insert for palindrome - DP | Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews,Gerula/interviews | GeeksForGeeks/min_insertions.cs | GeeksForGeeks/min_insertions.cs | // http://www.geeksforgeeks.org/dynamic-programming-set-28-minimum-insertions-to-form-a-palindrome/
//
// Given a string, find the minimum number of characters to be inserted to convert it to palindrome.
using System;
static class Program
{
static int Palind(this String s)
{
if (String.IsNullOrEmpty(s))
{
return int.MaxValue;
}
if (s.Length == 1)
{
return 0;
}
if (s.Length == 2)
{
return s[0] == s[1] ? 0 : 1;
}
return s[0] == s[s.Length - 1] ?
s.Substring(1, s.Length - 2).Palind() :
(Math.Min(
s.Substring(1, s.Length - 1).Palind(),
s.Substring(0, s.Length - 1).Palind()) + 1);
}
static int PalindDp(this String s)
{
var n = s.Length;
var dp = new int[n, n];
for (var length = 1; length < n; length++)
{
for (int i = 0, h = length; h < n; i++, h++)
{
dp[i, h] = (s[i] == s[h]) ?
dp[i + 1, h - 1] :
(Math.Min(dp[i, h - 1], dp[i + 1, h]) + 1);
}
}
return dp[0, n - 1];
}
static void Main()
{
foreach (var x in new [] {
Tuple.Create("ab", 1),
Tuple.Create("aa", 0),
Tuple.Create("abcd", 3),
Tuple.Create("abcda", 2),
Tuple.Create("abcde", 4)
})
{
var s = x.Item1;
var e = x.Item2;
var a = s.Palind();
var d = s.PalindDp();
Console.WriteLine("{0} [{1}, {2}, {3}]", s, e, a, d);
}
}
}
| // http://www.geeksforgeeks.org/dynamic-programming-set-28-minimum-insertions-to-form-a-palindrome/
//
// Given a string, find the minimum number of characters to be inserted to convert it to palindrome.
using System;
static class Program
{
static int Palind(this String s)
{
if (String.IsNullOrEmpty(s))
{
return int.MaxValue;
}
if (s.Length == 1)
{
return 0;
}
if (s.Length == 2)
{
return s[0] == s[1] ? 0 : 1;
}
return s[0] == s[s.Length - 1] ?
s.Substring(1, s.Length - 2).Palind() :
(Math.Min(
s.Substring(1, s.Length - 1).Palind(),
s.Substring(0, s.Length - 1).Palind()) + 1);
}
static void Main()
{
foreach (var x in new [] {
Tuple.Create("ab", 1),
Tuple.Create("aa", 0),
Tuple.Create("abcd", 3),
Tuple.Create("abcda", 2),
Tuple.Create("abcde", 4)
})
{
var s = x.Item1;
var e = x.Item2;
var a = s.Palind();
Console.WriteLine("{0} [{1}, {2}]", s, e, a);
}
}
}
| mit | C# |
a62bb9bf4ff44149c3e2d780e7ee7e6fb6e256d4 | Build and publish nuget package | bfriesen/Rock.StaticDependencyInjection,RockFramework/Rock.StaticDependencyInjection | src/Properties/AssemblyInfo.cs | src/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.StaticDependencyInjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rock.StaticDependencyInjection")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6ce9fe22-010d-441a-b954-7c924537a503")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.5")]
[assembly: AssemblyInformationalVersion("1.1.5")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Rock.StaticDependencyInjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Rock.StaticDependencyInjection")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6ce9fe22-010d-441a-b954-7c924537a503")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.4")]
[assembly: AssemblyInformationalVersion("1.1.4")]
| mit | C# |
1236ecc481c1170cd04164f7dddc9b5576067211 | Fix inverted conditional | peppy/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ppy/osu-framework | osu.Framework.Tests/Visual/Testing/TestSceneManualInputManagerTestScene.cs | osu.Framework.Tests/Visual/Testing/TestSceneManualInputManagerTestScene.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 NUnit.Framework;
using osu.Framework.Input;
using osu.Framework.Testing;
using osuTK;
using osuTK.Input;
namespace osu.Framework.Tests.Visual.Testing
{
public class TestSceneManualInputManagerTestScene : ManualInputManagerTestScene
{
protected override Vector2 InitialMousePosition => new Vector2(10f);
[Test]
public void TestResetInput()
{
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
AddStep("press mouse", () => InputManager.PressButton(MouseButton.Left));
AddStep("press key", () => InputManager.PressKey(Key.Z));
AddStep("press joystick", () => InputManager.PressJoystickButton(JoystickButton.Button1));
AddStep("reset input", ResetInput);
AddAssert("mouse position reset", () => InputManager.CurrentState.Mouse.Position == InitialMousePosition);
AddAssert("all input states released", () =>
!InputManager.CurrentState.Mouse.Buttons.HasAnyButtonPressed &&
!InputManager.CurrentState.Keyboard.Keys.HasAnyButtonPressed &&
!InputManager.CurrentState.Joystick.Buttons.HasAnyButtonPressed);
}
[Test]
public void TestMousePositionSetToInitial() => AddAssert("mouse position set to initial", () => InputManager.CurrentState.Mouse.Position == InitialMousePosition);
}
}
| // 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 NUnit.Framework;
using osu.Framework.Input;
using osu.Framework.Testing;
using osuTK;
using osuTK.Input;
namespace osu.Framework.Tests.Visual.Testing
{
public class TestSceneManualInputManagerTestScene : ManualInputManagerTestScene
{
protected override Vector2 InitialMousePosition => new Vector2(10f);
[Test]
public void TestResetInput()
{
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
AddStep("press mouse", () => InputManager.PressButton(MouseButton.Left));
AddStep("press key", () => InputManager.PressKey(Key.Z));
AddStep("press joystick", () => InputManager.PressJoystickButton(JoystickButton.Button1));
AddStep("reset input", ResetInput);
AddAssert("mouse position reset", () => InputManager.CurrentState.Mouse.Position == InitialMousePosition);
AddAssert("all input states released", () =>
InputManager.CurrentState.Mouse.Buttons.HasAnyButtonPressed &&
InputManager.CurrentState.Keyboard.Keys.HasAnyButtonPressed &&
InputManager.CurrentState.Joystick.Buttons.HasAnyButtonPressed);
}
[Test]
public void TestMousePositionSetToInitial() => AddAssert("mouse position set to initial", () => InputManager.CurrentState.Mouse.Position == InitialMousePosition);
}
}
| mit | C# |
fefc6112f3454b623bef093825619db28170403c | Update RuleUpdater.cs | win120a/ACClassRoomUtil,win120a/ACClassRoomUtil | ProcessBlockUtil/RuleUpdater.cs | ProcessBlockUtil/RuleUpdater.cs | /*
Copyright (C) 2011-2014 AC Inc. (Andy Cheung)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.IO;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading;
using NetUtil;
namespace ACProcessBlockUtil
{
class RuleUpdater
{
public static void Main(String[] a){
/*
Stop The Service.
*/
ServiceController pbuSC = new ServiceController("pbuService");
pbuSC.stop();
/*
Obtain some path.
*/
String userProfile = Environment.GetEnvironmentVariable("UserProfile");
String systemRoot = Environment.GetEnvironmentVariable("SystemRoot");
/*
Delete Exist file.
*/
if(File.Exists(userProfile + "\\ACRules.txt")){
File.Delete(userProfile + "\\ACRules.txt");
}
/*
Download File.
*/
NetUtil.writeToFile("http://win120a.github.io/Api/PBURules.txt", userProfile + "\\ACRules.txt");
/*
Restart the Service.
*/
Process.Start(systemRoot + "\\System32\\sc.exe", "start pbuService");
}
}
}
| /*
Copyright (C) 2011-2014 AC Inc. (Andy Cheung)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System;
using System.IO;
using System.Diagnostics;
using System.ServiceProcess;
using System.Threading;
using NetUtil;
namespace ACProcessBlockUtil
{
class RuleUpdater
{
public static void Main(String[] a){
/*
Stop The Service.
*/
Process.Start(systemRoot + "\\System32\\sc.exe", "stop pbuService");
Thread.Sleep(2500);
/*
Obtain some path.
*/
String userProfile = Environment.GetEnvironmentVariable("UserProfile");
String systemRoot = Environment.GetEnvironmentVariable("SystemRoot");
/*
Delete Exist file.
*/
if(File.Exists(userProfile + "\\ACRules.txt")){
File.Delete(userProfile + "\\ACRules.txt");
}
/*
Download File.
*/
NetUtil.writeToFile("http://win120a.github.io/Api/PBURules.txt", userProfile + "\\ACRules.txt");
/*
Restart the Service.
*/
Process.Start(systemRoot + "\\System32\\sc.exe", "start pbuService");
}
}
}
| apache-2.0 | C# |
2bd0b91e16e0e7e02d41cc0494f6e8cc669f8a6c | Add reply mode and a shortcut for getting admins | mattgwagner/alert-roster | AlertRoster.Web/Models/Group.cs | AlertRoster.Web/Models/Group.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AlertRoster.Web.Models
{
public class Group
{
[Key]
public int Id { get; private set; }
[Required, StringLength(25)]
public String DisplayName { get; set; }
[StringLength(25)]
public String PhoneNumber { get; set; }
public virtual ICollection<MemberGroup> Members { get; private set; }
public virtual IEnumerable<Member> Admins => Members.Where(_ => _.Role == MemberGroup.GroupRole.Administrator).Select(_ => _.Member);
public virtual ICollection<Message> Messages { get; private set; }
[Required]
public ReplyMode Replies { get; set; } = ReplyMode.ReplyAll;
private Group()
{
// Parameter-less ctor for EF
}
public Group(String displayName)
{
this.DisplayName = displayName;
this.Members = new List<MemberGroup>();
this.Messages = new List<Message>();
}
public enum ReplyMode : byte
{
ReplyAll = 0,
ReplyToAdmins = 1,
Reject = 2
}
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AlertRoster.Web.Models
{
public class Group
{
[Key]
public int Id { get; private set; }
[Required, StringLength(25)]
public String DisplayName { get; set; }
[StringLength(25)]
public String PhoneNumber { get; set; }
public virtual ICollection<MemberGroup> Members { get; private set; }
public virtual ICollection<Message> Messages { get; private set; }
// TODO Who are admins?
// TODO Reply-mode : Reply-All, Reply-to-Admin, Reject?
private Group()
{
// Parameter-less ctor for EF
}
public Group(String displayName)
{
this.DisplayName = displayName;
this.Members = new List<MemberGroup>();
this.Messages = new List<Message>();
}
}
} | mit | C# |
2f722097f5d5d8e900854fec50e391f5a051ad20 | Use binary settings storage | Mpstark/articulate,BrunoBrux/ArticulateDVS | Articulate/Settings/Settings.cs | Articulate/Settings/Settings.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml.Serialization;
using System.Diagnostics;
using System.Threading;
using System.Runtime.Serialization.Formatters.Binary;
namespace Articulate
{
public enum ListenMode
{
Continuous = 0,
PushToTalk = 1,
PushToArm = 2,
PushToIgnore = 3
}
[Serializable]
public class Settings
{
public Settings()
{
// Initialize default settings
ConfidenceMargin = 80;
EndCommandPause = 500;
Mode = ListenMode.Continuous;
Applications = new List<string>();
KeyBinds = new List<CompoundKeyBind>();
FileLock = new object();
}
private object FileLock;
#region File Handling
public static Settings Load()
{
var filePath = Environment.ExpandEnvironmentVariables(@"%AppData%\Articulate\config.dat");
if (!File.Exists(filePath)) return new Settings();
try
{
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var serializer = new BinaryFormatter();
return (Settings)serializer.Deserialize(fs);
}
}
catch (Exception ex)
{
Trace.Write(ex.Message);
return new Settings();
}
}
public void Save()
{
var filePath = Environment.ExpandEnvironmentVariables(@"%AppData%\Articulate\config.dat");
try
{
var parentDirectory = Environment.ExpandEnvironmentVariables(@"%AppData%\Articulate");
if (!Directory.Exists(parentDirectory))
Directory.CreateDirectory(parentDirectory);
ThreadPool.QueueUserWorkItem((state) =>
{
lock (FileLock)
{
try
{
using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None))
{
var serializer = new BinaryFormatter();
serializer.Serialize(fs, state);
}
}
catch (Exception ex)
{
Trace.Write(ex.Message);
}
}
}, this);
}
catch
{
}
}
#endregion
public int ConfidenceMargin
{ get; set; }
public int EndCommandPause
{ get; set; }
public List<CompoundKeyBind> KeyBinds
{ get; set; }
public ListenMode Mode
{ get; set; }
public List<string> Applications
{ get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml.Serialization;
using System.Diagnostics;
using System.Threading;
namespace Articulate
{
public enum ListenMode
{
Continuous = 0,
PushToTalk = 1,
PushToArm = 2,
PushToIgnore = 3
}
[Serializable]
public class Settings
{
public Settings()
{
// Initialize default settings
ConfidenceMargin = 80;
EndCommandPause = 500;
PTTKeys = new List<System.Windows.Forms.Keys>();
Mode = ListenMode.Continuous;
Applications = new List<string>();
FileLock = new object();
}
private object FileLock;
#region File Handling
public static Settings Load()
{
var filePath = Environment.ExpandEnvironmentVariables(@"%AppData%\Articulate\Settings.xml");
if (!File.Exists(filePath)) return new Settings();
try
{
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var serializer = new XmlSerializer(typeof(Settings));
return (Settings)serializer.Deserialize(fs);
}
}
catch (Exception ex)
{
Trace.Write(ex.Message);
return new Settings();
}
}
public void Save()
{
var filePath = Environment.ExpandEnvironmentVariables(@"%AppData%\Articulate\Settings.xml");
try
{
var parentDirectory = Environment.ExpandEnvironmentVariables(@"%AppData%\Articulate");
if (!Directory.Exists(parentDirectory))
Directory.CreateDirectory(parentDirectory);
ThreadPool.QueueUserWorkItem((state) =>
{
lock (FileLock)
{
try
{
using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.None))
{
var serializer = new XmlSerializer(typeof(Settings));
serializer.Serialize(fs, state);
}
}
catch (Exception ex)
{
Trace.Write(ex.Message);
}
}
}, this);
}
catch
{
}
}
#endregion
public int ConfidenceMargin
{ get; set; }
public int EndCommandPause
{ get; set; }
public List<System.Windows.Forms.Keys> PTTKeys
{ get; set; }
public System.Windows.Forms.MouseButtons PTTButton
{ get; set; }
public ListenMode Mode
{ get; set; }
public List<string> Applications
{ get; set; }
}
}
| mit | C# |
e5a70afded82050012e6349b9d204ff5b5d5d9c3 | fix difference between input and expected output | maca88/AsyncGenerator | Source/AsyncGenerator.Tests/ExceptionHandling/Input/DoNotPropagateOperationCanceledException.cs | Source/AsyncGenerator.Tests/ExceptionHandling/Input/DoNotPropagateOperationCanceledException.cs | using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using AsyncGenerator.TestCases;
namespace AsyncGenerator.Tests.ExceptionHandling.Input
{
public class DoNotPropagateOperationCanceledException
{
public void MethodThatCatchesTargetInvocationException()
{
try
{
SimpleFile.Read();
}
catch (TargetInvocationException ex)
{
throw new Exception("My wrapped exception", ex);
}
}
public void MethodThatCatchesOperationCanceledException()
{
try
{
SimpleFile.Read();
}
catch (OperationCanceledException ex)
{
throw new Exception("My wrapped exception", ex);
}
}
public void MethodWithoutCatch()
{
try
{
SimpleFile.Read();
}
finally
{
}
}
public void LocalFunctionThatCatchesOperationCanceledException()
{
Internal();
void Internal()
{
try
{
SimpleFile.Read();
}
catch (OperationCanceledException ex)
{
throw new Exception("My wrapped exception", ex);
}
}
}
public void MethodCatchNotWrappingAsyncCall()
{
SimpleFile.Read();
try
{
; //no async calls here
}
catch
{
}
}
}
} | using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using AsyncGenerator.TestCases;
namespace AsyncGenerator.Tests.ExceptionHandling.Input
{
public class DoNotPropagateOperationCanceledException
{
public void MethodThatCatchesTargetInvocationException()
{
try
{
SimpleFile.Read();
}
catch (TargetInvocationException ex)
{
throw new Exception("My wrapped exception", ex);
}
}
public void MethodThatCatchesOperationCanceledException()
{
try
{
SimpleFile.Read();
}
catch (OperationCanceledException ex)
{
throw new Exception("My wrapped exception", ex);
}
}
public void MethodWithoutCatch()
{
try
{
SimpleFile.Read();
}
finally
{
}
}
public void LocalFunctionThatCatchesOperationCanceledException()
{
Internal();
void Internal()
{
try
{
SimpleFile.Read();
}
catch (OperationCanceledException ex)
{
throw new Exception("My wrapped exception", ex);
}
}
}
public void MethodCatchNotWrappingAsyncCall()
{
SimpleFile.Read();
try
{
;
}
catch
{
}
}
}
} | mit | C# |
36600524b285d7d128d8e2ed4e4f5246f32202c2 | Revert code. | abock/roslyn,reaction1989/roslyn,mmitche/roslyn,DustinCampbell/roslyn,agocke/roslyn,DustinCampbell/roslyn,AmadeusW/roslyn,genlu/roslyn,tannergooding/roslyn,mattscheffer/roslyn,CyrusNajmabadi/roslyn,davkean/roslyn,jcouv/roslyn,DustinCampbell/roslyn,abock/roslyn,AlekseyTs/roslyn,tmat/roslyn,eriawan/roslyn,orthoxerox/roslyn,nguerrera/roslyn,jmarolf/roslyn,xasx/roslyn,brettfo/roslyn,Hosch250/roslyn,shyamnamboodiripad/roslyn,paulvanbrenk/roslyn,bartdesmet/roslyn,genlu/roslyn,mgoertz-msft/roslyn,physhi/roslyn,genlu/roslyn,robinsedlaczek/roslyn,ErikSchierboom/roslyn,CaptainHayashi/roslyn,pdelvo/roslyn,mgoertz-msft/roslyn,weltkante/roslyn,paulvanbrenk/roslyn,OmarTawfik/roslyn,srivatsn/roslyn,wvdd007/roslyn,stephentoub/roslyn,KevinRansom/roslyn,physhi/roslyn,khyperia/roslyn,sharwell/roslyn,heejaechang/roslyn,jamesqo/roslyn,KevinRansom/roslyn,aelij/roslyn,CaptainHayashi/roslyn,davkean/roslyn,KirillOsenkov/roslyn,davkean/roslyn,diryboy/roslyn,TyOverby/roslyn,VSadov/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,orthoxerox/roslyn,tmeschter/roslyn,reaction1989/roslyn,jamesqo/roslyn,mmitche/roslyn,swaroop-sridhar/roslyn,tvand7093/roslyn,ErikSchierboom/roslyn,lorcanmooney/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,swaroop-sridhar/roslyn,panopticoncentral/roslyn,MattWindsor91/roslyn,bartdesmet/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,CaptainHayashi/roslyn,dpoeschl/roslyn,srivatsn/roslyn,jmarolf/roslyn,reaction1989/roslyn,brettfo/roslyn,mavasani/roslyn,brettfo/roslyn,robinsedlaczek/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,MattWindsor91/roslyn,tannergooding/roslyn,nguerrera/roslyn,MattWindsor91/roslyn,sharwell/roslyn,abock/roslyn,mavasani/roslyn,AlekseyTs/roslyn,KirillOsenkov/roslyn,MichalStrehovsky/roslyn,agocke/roslyn,stephentoub/roslyn,OmarTawfik/roslyn,MichalStrehovsky/roslyn,AmadeusW/roslyn,MichalStrehovsky/roslyn,xasx/roslyn,jcouv/roslyn,AnthonyDGreen/roslyn,jasonmalinowski/roslyn,gafter/roslyn,panopticoncentral/roslyn,tmat/roslyn,AnthonyDGreen/roslyn,gafter/roslyn,bkoelman/roslyn,jkotas/roslyn,stephentoub/roslyn,shyamnamboodiripad/roslyn,khyperia/roslyn,Giftednewt/roslyn,srivatsn/roslyn,tmeschter/roslyn,nguerrera/roslyn,robinsedlaczek/roslyn,tmat/roslyn,khyperia/roslyn,diryboy/roslyn,mavasani/roslyn,AmadeusW/roslyn,tvand7093/roslyn,xasx/roslyn,wvdd007/roslyn,paulvanbrenk/roslyn,pdelvo/roslyn,wvdd007/roslyn,agocke/roslyn,TyOverby/roslyn,weltkante/roslyn,VSadov/roslyn,mattscheffer/roslyn,TyOverby/roslyn,cston/roslyn,dpoeschl/roslyn,dotnet/roslyn,physhi/roslyn,jmarolf/roslyn,jamesqo/roslyn,cston/roslyn,gafter/roslyn,bkoelman/roslyn,dotnet/roslyn,swaroop-sridhar/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,Giftednewt/roslyn,mmitche/roslyn,heejaechang/roslyn,AnthonyDGreen/roslyn,AlekseyTs/roslyn,cston/roslyn,jcouv/roslyn,tmeschter/roslyn,jkotas/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,KirillOsenkov/roslyn,sharwell/roslyn,Hosch250/roslyn,aelij/roslyn,jkotas/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Hosch250/roslyn,OmarTawfik/roslyn,diryboy/roslyn,eriawan/roslyn,orthoxerox/roslyn,pdelvo/roslyn,jasonmalinowski/roslyn,aelij/roslyn,eriawan/roslyn,tvand7093/roslyn,dotnet/roslyn,VSadov/roslyn,lorcanmooney/roslyn,bkoelman/roslyn,mattscheffer/roslyn,weltkante/roslyn,dpoeschl/roslyn,Giftednewt/roslyn,MattWindsor91/roslyn,lorcanmooney/roslyn,heejaechang/roslyn,panopticoncentral/roslyn | src/Features/Core/Portable/Completion/Providers/AbstractCrefCompletionProvider.cs | src/Features/Core/Portable/Completion/Providers/AbstractCrefCompletionProvider.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 Microsoft.CodeAnalysis.Options;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.Completion.Providers
{
abstract class AbstractCrefCompletionProvider : CommonCompletionProvider
{
protected const string HideAdvancedMembers = nameof(HideAdvancedMembers);
protected override async Task<CompletionDescription> GetDescriptionWorkerAsync(Document document, CompletionItem item, CancellationToken cancellationToken)
{
var position = SymbolCompletionItem.GetContextPosition(item);
// What EditorBrowsable settings were we previously passed in (if it mattered)?
bool hideAdvancedMembers = false;
if (item.Properties.TryGetValue(HideAdvancedMembers, out var hideAdvancedMembersString))
{
bool.TryParse(hideAdvancedMembersString, out hideAdvancedMembers);
}
var options = document.Project.Solution.Workspace.Options
.WithChangedOption(new OptionKey(CompletionOptions.HideAdvancedMembers, document.Project.Language), hideAdvancedMembers);
var (token, semanticModel, symbols) = await GetSymbolsAsync(document, position, options, cancellationToken).ConfigureAwait(false);
var name = SymbolCompletionItem.GetSymbolName(item);
var kind = SymbolCompletionItem.GetKind(item);
var bestSymbols = symbols.WhereAsArray(s => s.Kind == kind && s.Name == name);
return await SymbolCompletionItem.GetDescriptionAsync(item, bestSymbols, document, semanticModel, cancellationToken).ConfigureAwait(false);
}
protected abstract Task<(SyntaxToken, SemanticModel, ImmutableArray<ISymbol>)> GetSymbolsAsync(
Document document, int position, OptionSet options, CancellationToken cancellationToken);
}
}
| // 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 Microsoft.CodeAnalysis.Options;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.Completion.Providers
{
abstract class AbstractCrefCompletionProvider : CommonCompletionProvider
{
protected const string HideAdvancedMembers = nameof(HideAdvancedMembers);
protected override async Task<CompletionDescription> GetDescriptionWorkerAsync(
Document document, CompletionItem item, CancellationToken cancellationToken)
{
var position = SymbolCompletionItem.GetContextPosition(item);
// What EditorBrowsable settings were we previously passed in (if it mattered)?
bool hideAdvancedMembers = false;
if (item.Properties.TryGetValue(HideAdvancedMembers, out var hideAdvancedMembersString))
{
bool.TryParse(hideAdvancedMembersString, out hideAdvancedMembers);
}
var options = document.Project.Solution.Workspace.Options
.WithChangedOption(new OptionKey(CompletionOptions.HideAdvancedMembers, document.Project.Language), hideAdvancedMembers);
var (token, semanticModel, symbols) = await GetSymbolsAsync(document, position, options, cancellationToken).ConfigureAwait(false);
var name = SymbolCompletionItem.GetSymbolName(item);
var kind = SymbolCompletionItem.GetKind(item);
var bestSymbols = symbols.WhereAsArray(s => s.Kind == kind && s.Name == name);
return await SymbolCompletionItem.GetDescriptionAsync(item, bestSymbols, document, semanticModel, cancellationToken).ConfigureAwait(false);
}
protected abstract Task<(SyntaxToken, SemanticModel, ImmutableArray<ISymbol>)> GetSymbolsAsync(
Document document, int position, OptionSet options, CancellationToken cancellationToken);
}
}
| mit | C# |
5b8203f7f68e2d37f20c4162b8b2aec0e00386a7 | tweak Swagger info | collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists | src/FilterLists.Api/DependencyInjection/Extensions/ConfigureServicesCollection.cs | src/FilterLists.Api/DependencyInjection/Extensions/ConfigureServicesCollection.cs | using System.IO;
using Microsoft.ApplicationInsights.Extensibility.Implementation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.PlatformAbstractions;
using Swashbuckle.AspNetCore.Swagger;
namespace FilterLists.Api.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
public static void AddFilterListsApi(this IServiceCollection services)
{
services.AddMvc();
services.AddApiVersioning();
services.AddSwaggerGenCustom();
TelemetryDebugWriter.IsTracingDisabled = true;
}
private static void AddSwaggerGenCustom(this IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1",
new Info
{
Title = "FilterLists API",
Version = "v1",
Description =
"FilterLists is the independent and comprehensive directory of all public filter and hosts lists for advertisements, trackers, malware, and annoyances.",
Contact = new Contact {Url = "https://github.com/collinbarrett/FilterLists/issues"},
License = new License
{
Name = "Use under MIT License",
Url = "https://github.com/collinbarrett/FilterLists/blob/master/LICENSE"
}
});
c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath,
"FilterLists.Api.xml"));
});
}
}
} | using System.IO;
using Microsoft.ApplicationInsights.Extensibility.Implementation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.PlatformAbstractions;
using Swashbuckle.AspNetCore.Swagger;
namespace FilterLists.Api.DependencyInjection.Extensions
{
public static class ConfigureServicesCollection
{
public static void AddFilterListsApi(this IServiceCollection services)
{
services.AddMvc();
services.AddApiVersioning();
services.AddSwaggerGenCustom();
TelemetryDebugWriter.IsTracingDisabled = true;
}
private static void AddSwaggerGenCustom(this IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1",
new Info
{
Title = "FilterLists API",
Version = "v1",
Description =
"FilterLists is the independent and comprehensive directory of all public filter and hosts lists for advertisements, trackers, malware, and annoyances.",
Contact = new Contact {Url = "https://filterlists.com/contact/"},
License = new License
{
Name = "Use under GPL-3.0",
Url = "https://github.com/collinbarrett/FilterLists/blob/master/LICENSE"
}
});
c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath,
"FilterLists.Api.xml"));
});
}
}
} | mit | C# |
ca76af95c584797ede0930034c6892a6c252174d | Add back argument check for TypeForwardedFromAttribute (#16680) | ruben-ayrapetyan/coreclr,krk/coreclr,cshung/coreclr,wtgodbe/coreclr,ruben-ayrapetyan/coreclr,poizan42/coreclr,wtgodbe/coreclr,cshung/coreclr,mmitche/coreclr,mmitche/coreclr,wtgodbe/coreclr,ruben-ayrapetyan/coreclr,mmitche/coreclr,mmitche/coreclr,cshung/coreclr,wtgodbe/coreclr,ruben-ayrapetyan/coreclr,poizan42/coreclr,mmitche/coreclr,krk/coreclr,cshung/coreclr,poizan42/coreclr,wtgodbe/coreclr,cshung/coreclr,mmitche/coreclr,krk/coreclr,poizan42/coreclr,ruben-ayrapetyan/coreclr,wtgodbe/coreclr,ruben-ayrapetyan/coreclr,cshung/coreclr,krk/coreclr,krk/coreclr,poizan42/coreclr,poizan42/coreclr,krk/coreclr | src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs | src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
public sealed class TypeForwardedFromAttribute : Attribute
{
public TypeForwardedFromAttribute(string assemblyFullName)
{
if (string.IsNullOrEmpty(assemblyFullName))
throw new ArgumentNullException(nameof(assemblyFullName));
AssemblyFullName = assemblyFullName;
}
public string AssemblyFullName { get; }
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
public sealed class TypeForwardedFromAttribute : Attribute
{
public TypeForwardedFromAttribute(string assemblyFullName)
{
AssemblyFullName = assemblyFullName;
}
public string AssemblyFullName { get; }
}
}
| mit | C# |
160a8a04e74fd7ba6ba221eed8665e81aef3fd51 | Remove unnecessary external methods | OpenCGSS/DereTore,hozuki/DereTore,hozuki/DereTore,OpenCGSS/DereTore,hozuki/DereTore,OpenCGSS/DereTore | Interop/DereTore.Interop.OS/NativeMethods.cs | Interop/DereTore.Interop.OS/NativeMethods.cs | using System.Runtime.InteropServices;
namespace DereTore.Interop.OS {
public static class NativeMethods {
[DllImport("winmm.dll")]
public static extern uint timeBeginPeriod(uint uMilliseconds);
[DllImport("winmm.dll")]
public static extern uint timeEndPeriod(uint uMilliseconds);
[DllImport("winmm.dll")]
public static extern uint timeGetTime();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)]string lpszDeviceName, int iModeNum, out NativeStructures.DEVMODE lpDevMode);
}
}
| using System;
using System.Runtime.InteropServices;
namespace DereTore.Interop.OS {
public static class NativeMethods {
public const string DWMAPI_LIB = "dwmapi.dll";
public const string DwmGetColorizationParameters_FUNC = "#127";
public const int DwmGetColorizationParameters_ORD = 127;
// http://stackoverflow.com/questions/13660976/get-the-active-color-of-windows-8-automatic-color-theme
[DllImport(DWMAPI_LIB, EntryPoint = DwmGetColorizationParameters_FUNC)]
public static extern void DwmGetColorizationParameters(out NativeStructures.DWMCOLORIZATIONPARAMS colorParams);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)]
public static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FreeLibrary(IntPtr hModule);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern IntPtr GetProcAddress(IntPtr hModule, [MarshalAs(UnmanagedType.LPStr)] string lpProcName);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern IntPtr GetProcAddress(IntPtr hModule, IntPtr lpProcOrdinal);
[DllImport("winmm.dll")]
public static extern uint timeBeginPeriod(uint uMilliseconds);
[DllImport("winmm.dll")]
public static extern uint timeEndPeriod(uint uMilliseconds);
[DllImport("winmm.dll")]
public static extern uint timeGetTime();
[DllImport("user32.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)]string lpszDeviceName, int iModeNum, out NativeStructures.DEVMODE lpDevMode);
[DllImport("kernel32.dll")]
public static extern void RtlZeroMemory(IntPtr ptr, int length);
[DllImport("kernel32.dll")]
public static extern unsafe void RtlZeroMemory(void* ptr, int length);
}
}
| mit | C# |
42803e0b7ab927f1aad67c6e4e126be486c5ec54 | Remove parent param from obsoletes (#3848) | elastic/elasticsearch-net,elastic/elasticsearch-net | src/CodeGeneration/ApiGenerator/Configuration/Overrides/GlobalOverrides.cs | src/CodeGeneration/ApiGenerator/Configuration/Overrides/GlobalOverrides.cs | using System.Collections.Generic;
namespace ApiGenerator.Configuration.Overrides
{
public class GlobalOverrides : EndpointOverridesBase
{
public IDictionary<string, Dictionary<string, string>> ObsoleteEnumMembers { get; set; } = new Dictionary<string, Dictionary<string, string>>
{
{
"NodesStatsIndexMetric",
new Dictionary<string, string> { { "suggest", "As of 5.0 this option always returned an empty object in the response" } }
},
{
"IndicesStatsMetric",
new Dictionary<string, string> { { "suggest", "Suggest stats have folded under the search stats, this alias will be removed" } }
}
};
public override IDictionary<string, string> ObsoleteQueryStringParams { get; set; } = new Dictionary<string, string>
{
{ "copy_settings", "Elasticsearch 6.4 will throw an exception if this is turned off see elastic/elasticsearch#30404" }
};
public override IDictionary<string, string> RenameQueryStringParams { get; } = new Dictionary<string, string>
{
{ "_source", "source_enabled" },
{ "_source_includes", "source_includes" },
{ "_source_excludes", "source_excludes" },
{ "rest_total_hits_as_int", "total_hits_as_integer" },
{ "docvalue_fields", "doc_value_fields" },
{ "q", "query_on_query_string" },
//make cat parameters more descriptive
{ "h", "Headers" },
{ "s", "sort_by_columns" },
{ "v", "verbose" },
{ "ts", "include_timestamp" },
{ "if_seq_no", "if_sequence_number" },
{ "seq_no_primary_term", "sequence_number_primary_term" },
};
public override IEnumerable<string> RenderPartial => new[]
{
"stored_fields",
"docvalue_fields"
};
public override IEnumerable<string> SkipQueryStringParams { get; } = new[]
{
"parent", //can be removed once https://github.com/elastic/elasticsearch/pull/41098 is in
"copy_settings", //this still needs a PR?
"source", // allows the body to be specified as a request param, we do not want to advertise this with a strongly typed method
"timestamp",
"_source_include", "_source_exclude" // can be removed once https://github.com/elastic/elasticsearch/pull/41439 is in
};
}
}
| using System.Collections.Generic;
namespace ApiGenerator.Configuration.Overrides
{
public class GlobalOverrides : EndpointOverridesBase
{
public IDictionary<string, Dictionary<string, string>> ObsoleteEnumMembers { get; set; } = new Dictionary<string, Dictionary<string, string>>
{
{
"NodesStatsIndexMetric",
new Dictionary<string, string> { { "suggest", "As of 5.0 this option always returned an empty object in the response" } }
},
{
"IndicesStatsMetric",
new Dictionary<string, string> { { "suggest", "Suggest stats have folded under the search stats, this alias will be removed" } }
}
};
public override IDictionary<string, string> ObsoleteQueryStringParams { get; set; } = new Dictionary<string, string>
{
{ "parent", "the parent parameter has been deprecated from Elasticsearch, please use routing instead directly." },
{ "copy_settings", "Elasticsearch 6.4 will throw an exception if this is turned off see elastic/elasticsearch#30404" }
};
public override IDictionary<string, string> RenameQueryStringParams { get; } = new Dictionary<string, string>
{
{ "_source", "source_enabled" },
{ "_source_includes", "source_includes" },
{ "_source_excludes", "source_excludes" },
{ "rest_total_hits_as_int", "total_hits_as_integer" },
{ "docvalue_fields", "doc_value_fields" },
{ "q", "query_on_query_string" },
//make cat parameters more descriptive
{ "h", "Headers" },
{ "s", "sort_by_columns" },
{ "v", "verbose" },
{ "ts", "include_timestamp" },
{ "if_seq_no", "if_sequence_number" },
{ "seq_no_primary_term", "sequence_number_primary_term" },
};
public override IEnumerable<string> RenderPartial => new[]
{
"stored_fields",
"docvalue_fields"
};
public override IEnumerable<string> SkipQueryStringParams { get; } = new[]
{
"parent", //can be removed once https://github.com/elastic/elasticsearch/pull/41098 is in
"copy_settings", //this still needs a PR?
"source", // allows the body to be specified as a request param, we do not want to advertise this with a strongly typed method
"timestamp",
"_source_include", "_source_exclude" // can be removed once https://github.com/elastic/elasticsearch/pull/41439 is in
};
}
}
| apache-2.0 | C# |
24f4acf40d96e2dfd7193ed68e5077466f628e36 | Fix typos | macro187/produce | produce/Modules/NuGetModule.cs | produce/Modules/NuGetModule.cs | using System.Linq;
using MacroDiagnostics;
using MacroExceptions;
using MacroGuards;
namespace
produce
{
public class
NuGetModule : Module
{
public override void
Attach(ProduceRepository repository, Graph graph)
{
Guard.NotNull(repository, nameof(repository));
Guard.NotNull(graph, nameof(graph));
var slnFile = graph.FileSet("sln-file");
var restore = graph.Command("restore");
var update = graph.Command("update");
var nugetRestore = graph.Command("nuget-restore", _ =>
Restore(repository, slnFile.Files.SingleOrDefault()?.Path));
graph.Dependency(slnFile, nugetRestore);
graph.Dependency(nugetRestore, restore);
var nugetUpdate = graph.Command("nuget-update", _ =>
Update(repository, slnFile.Files.SingleOrDefault()?.Path));
graph.Dependency(slnFile, nugetUpdate);
graph.Dependency(nugetUpdate, update);
}
static void
Restore(ProduceRepository repository, string slnPath)
{
if (slnPath == null) return;
if (ProcessExtensions.Execute(true, true, repository.Path, "cmd", "/c", "nuget", "restore", slnPath) != 0)
throw new UserException("nuget failed");
}
static void
Update(ProduceRepository repository, string slnPath)
{
if (slnPath == null) return;
if (ProcessExtensions.Execute(true, true, repository.Path, "cmd", "/c", "nuget", "update", slnPath) != 0)
throw new UserException("nuget failed");
}
}
}
| using System.Linq;
using MacroDiagnostics;
using MacroExceptions;
using MacroGuards;
namespace
produce
{
public class
NuGetModule : Module
{
public override void
Attach(ProduceRepository repository, Graph graph)
{
Guard.NotNull(repository, nameof(repository));
Guard.NotNull(graph, nameof(graph));
var slnFile = graph.FileSet("sln-file");
var restore = graph.Command("restore");
var update = graph.Command("update");
var nugitRestore = graph.Command("nuget-restore", _ =>
Restore(repository, slnFile.Files.SingleOrDefault()?.Path));
graph.Dependency(slnFile, nugitRestore);
graph.Dependency(nugitRestore, restore);
var nugitUpdate = graph.Command("nuget-update", _ =>
Update(repository, slnFile.Files.SingleOrDefault()?.Path));
graph.Dependency(slnFile, nugitUpdate);
graph.Dependency(nugitUpdate, update);
}
static void
Restore(ProduceRepository repository, string slnPath)
{
if (slnPath == null) return;
if (ProcessExtensions.Execute(true, true, repository.Path, "cmd", "/c", "nuget", "restore", slnPath) != 0)
throw new UserException("nuget failed");
}
static void
Update(ProduceRepository repository, string slnPath)
{
if (slnPath == null) return;
if (ProcessExtensions.Execute(true, true, repository.Path, "cmd", "/c", "nuget", "update", slnPath) != 0)
throw new UserException("nuget failed");
}
}
}
| mit | C# |
15eb51623c368873d0be4a91afc7b7d725e9f305 | 添加20131029更新的高级接口:语音识别 | JeffreySu/WxOpen,JeffreySu/WeiXinMPSDK,down4u/WeiXinMPSDK,JeffreySu/WxOpen,JeffreySu/WeiXinMPSDK,wanddy/WeiXinMPSDK,lishewen/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,lishewen/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,wanddy/WeiXinMPSDK,mc7246/WeiXinMPSDK,wanddy/WeiXinMPSDK,lishewen/WeiXinMPSDK,mc7246/WeiXinMPSDK,down4u/WeiXinMPSDK,down4u/WeiXinMPSDK,mc7246/WeiXinMPSDK | Senparc.Weixin.MP/Senparc.Weixin.MP/Entities/Request/RequestMessageVoice.cs | Senparc.Weixin.MP/Senparc.Weixin.MP/Entities/Request/RequestMessageVoice.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Senparc.Weixin.MP.Entities
{
public class RequestMessageVoice : RequestMessageBase,IRequestMessageBase
{
public override RequestMsgType MsgType
{
get { return RequestMsgType.Voice; }
}
public string MediaId { get; set; }
/// <summary>
/// 语音格式:amr
/// </summary>
public string Format { get; set; }
/// <summary>
/// 语音识别结果,UTF8编码
/// 开通语音识别功能,用户每次发送语音给公众号时,微信会在推送的语音消息XML数据包中,增加一个Recongnition字段。
/// 注:由于客户端缓存,开发者开启或者关闭语音识别功能,对新关注者立刻生效,对已关注用户需要24小时生效。开发者可以重新关注此帐号进行测试。
/// </summary>
public string Recognition { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Senparc.Weixin.MP.Entities
{
public class RequestMessageVoice : RequestMessageBase,IRequestMessageBase
{
public override RequestMsgType MsgType
{
get { return RequestMsgType.Voice; }
}
public string MediaId { get; set; }
public string Format { get; set; }
}
}
| apache-2.0 | C# |
217199ad54d8a8000e0fecfdfb59f921be610d8f | remove redundant `this` qualifier. | alastairs/BobTheBuilder,fffej/BobTheBuilder | BobTheBuilder/Builder.cs | BobTheBuilder/Builder.cs | using System;
using System.Dynamic;
namespace BobTheBuilder
{
public class DynamicBuilder : DynamicObject
{
private readonly Type _destinationType;
private object property;
internal DynamicBuilder(Type destinationType)
{
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
_destinationType = destinationType;
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
property = args[0];
result = this;
return true;
}
public object Build()
{
object instance = Activator.CreateInstance(_destinationType);
instance.GetType().GetProperty("StringProperty").SetValue(instance, property);
return instance;
}
}
public class A
{
public static dynamic BuilderFor<T>() where T: class
{
return new DynamicBuilder(typeof(T));
}
}
} | using System;
using System.Dynamic;
namespace BobTheBuilder
{
public class DynamicBuilder : DynamicObject
{
private readonly Type _destinationType;
private object property;
internal DynamicBuilder(Type destinationType)
{
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
_destinationType = destinationType;
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
this.property = args[0];
result = this;
return true;
}
public object Build()
{
object instance = Activator.CreateInstance(_destinationType);
instance.GetType().GetProperty("StringProperty").SetValue(instance, property);
return instance;
}
}
public class A
{
public static dynamic BuilderFor<T>() where T: class
{
return new DynamicBuilder(typeof(T));
}
}
} | apache-2.0 | C# |
a4a850a1bfa70243e90a8beea4723020a666b40a | remove whitespace | IUMDPI/IUMediaHelperApps | Packager/Models/FileModels/ExcelFileModel.cs | Packager/Models/FileModels/ExcelFileModel.cs | using System.Linq;
namespace Packager.Models.FileModels
{
public class ExcelFileModel:AbstractFileModel
{
public ExcelFileModel()
{
}
public ExcelFileModel(string path) : base(path)
{
}
public override string ToFileName()
{
var parts = new[] { ProjectCode, BarCode};
var fileName = string.Join("_", parts.Where(p => !string.IsNullOrWhiteSpace(p)));
return string.Format("{0}{1}", fileName, Extension);
}
}
}
| using System.Linq;
namespace Packager.Models.FileModels
{
public class ExcelFileModel:AbstractFileModel
{
public ExcelFileModel()
{
}
public ExcelFileModel(string path) : base(path)
{
}
public override string ToFileName()
{
var parts = new[] { ProjectCode, BarCode};
var fileName = string.Join("_", parts.Where(p => !string.IsNullOrWhiteSpace(p)));
return string.Format("{0}{1}", fileName, Extension);
}
}
}
| apache-2.0 | C# |
65592d4ca5becb3e69479be6c4b0711d5ba6d819 | Add link to source | jeremycook/PickupMailViewer,jeremycook/PickupMailViewer | PickupMailViewer/Views/Shared/_Layout.cshtml | PickupMailViewer/Views/Shared/_Layout.cshtml | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/modernizr")
<meta name="description" content="Mail viewer" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Mail Viewer", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Albin Sunnanbo</p>
<p><a href="https://github.com/albinsunnanbo/PickupMailViewer">https://github.com/albinsunnanbo/PickupMailViewer</a></p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/app")
@RenderSection("scripts", required: false)
</body>
</html>
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/modernizr")
<meta name="description" content="Mail viewer" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("Mail Viewer", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Albin Sunnanbo</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/app")
@RenderSection("scripts", required: false)
</body>
</html>
| mit | C# |
0c30c80b826d85e13158c70cffe7b837b23d2feb | Fix for native extension method name (not Android!) | martijn00/MvvmCross-Plugins,MatthewSannes/MvvmCross-Plugins,Didux/MvvmCross-Plugins,lothrop/MvvmCross-Plugins | Cirrious/Color/Cirrious.MvvmCross.Plugins.Color.Touch/MvxColorExtensions.cs | Cirrious/Color/Cirrious.MvvmCross.Plugins.Color.Touch/MvxColorExtensions.cs | // MvxColorExtensions.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com
using Cirrious.CrossCore.UI;
using MonoTouch.UIKit;
namespace Cirrious.MvvmCross.Plugins.Color.Touch
{
public static class MvxColorExtensions
{
public static UIColor ToNativeColor(this MvxColor color)
{
return MvxTouchColor.ToUIColor(color);
}
}
} | // MvxColorExtensions.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com
using Cirrious.CrossCore.UI;
using MonoTouch.UIKit;
namespace Cirrious.MvvmCross.Plugins.Color.Touch
{
public static class MvxColorExtensions
{
public static UIColor ToAndroidColor(this MvxColor color)
{
return MvxTouchColor.ToUIColor(color);
}
}
} | mit | C# |
385b51ffe5aed0a634cddd812ade5281901efa8a | remove test code | ballance/Ballance.CryptoCurrency | CryptoConsole/Program.cs | CryptoConsole/Program.cs | using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CryptoConsole
{
class Program
{
static void Main(string[] args)
{
var bitThing = new Ballance.Crypto.Bitcoin();
var currentPriceRetrieved = bitThing.GetCurrentPrice();
var entered = string.Empty;
while (!entered.Equals("x", StringComparison.InvariantCultureIgnoreCase))
{
var livePrice = bitThing.GetLivePriceJSON("https://api.bitcoinaverage.com/ticker/USD/", "global-last");
Console.WriteLine("{0}", livePrice);
entered = Console.ReadKey().Key.ToString();
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CryptoConsole
{
class Program
{
static void Main(string[] args)
{
var bitThing = new Ballance.Crypto.Bitcoin();
var currentPriceRetrieved = bitThing.GetCurrentPrice();
//Console.WriteLine("Current Price: {0}", currentPriceRetrieved);
//var livePrice = bitThing.GetLivePrice("https://bitcoinaverage.com/#USD", "global-last");
//Console.WriteLine("Current Live Price: {0}", livePrice);
////Console.Write("Press any key to continue. 'q' to quit.");
var entered = string.Empty;
while (!entered.Equals("x", StringComparison.InvariantCultureIgnoreCase))
{
var livePrice = bitThing.GetLivePriceJSON("https://api.bitcoinaverage.com/ticker/USD/", "global-last");
Console.WriteLine("{0}", livePrice);
entered = Console.ReadKey().Key.ToString();
}
//Console.ReadKey();
}
}
}
| mit | C# |
625d2696844fdd3838a1528f70e6c0e2268088c1 | Update user info on opportunity. | Paymentsense/Dapper.SimpleSave | PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/OpportunityDto.cs | PS.Mothership.Core/PS.Mothership.Core.Common/Dto/Merchant/OpportunityDto.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
[DataContract]
public class OpportunityDto
{
[DataMember]
public Guid OpportunityGuid { get; set; }
[DataMember]
public string OpportunityLocatorId { get; set; }
[DataMember]
public Guid ProspectGuid { get; set; }
[DataMember]
public Guid CustomerGuid { get; set; }
[DataMember]
public Guid CurrentOfferGuid { get; set; }
[DataMember]
public Guid PartnerGuid { get; set; }
[DataMember]
public Guid CurrentStatusTrnGuid { get; set; }
[DataMember]
public OfferDto CurrentOffer { get; set; }
[DataMember]
public Guid UpdateUserGuid { get; set; }
[DataMember]
public string UpdateUsername { get; set; }
[DataMember]
public DateTimeOffset UpdateDate { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace PS.Mothership.Core.Common.Dto.Merchant
{
[DataContract]
public class OpportunityDto
{
[DataMember]
public Guid OpportunityGuid { get; set; }
[DataMember]
public string OpportunityLocatorId { get; set; }
[DataMember]
public Guid ProspectGuid { get; set; }
[DataMember]
public Guid CustomerGuid { get; set; }
[DataMember]
public Guid CurrentOfferGuid { get; set; }
[DataMember]
public Guid PartnerGuid { get; set; }
[DataMember]
public Guid CurrentStatusTrnGuid { get; set; }
[DataMember]
public OfferDto CurrentOffer { get; set; }
}
}
| mit | C# |
d32c698e03e3321ae9bd18d8e71b9cd0fe2f2f38 | Make Named Parameter PerMapConfigGeneratorSet public | yunseong/incubator-reef,dkm2110/Microsoft-cisl,swlsw/incubator-reef,motus/reef,zerg-junior/incubator-reef,zerg-junior/incubator-reef,anupam128/reef,dougmsft/reef,DifferentSC/incubator-reef,tcNickolas/incubator-reef,tcNickolas/reef,dongjoon-hyun/incubator-reef,shulmanb/reef,dkm2110/veyor,markusweimer/incubator-reef,dafrista/incubator-reef,jwang98052/incubator-reef,markusweimer/reef,jsjason/incubator-reef,dougmsft/reef,dongjoon-hyun/reef,anupam128/reef,dkm2110/veyor,yunseong/incubator-reef,anupam128/reef,jwang98052/reef,dkm2110/Microsoft-cisl,afchung/incubator-reef,zerg-junior/incubator-reef,gyeongin/reef,yingdachen/incubator-reef,markusweimer/incubator-reef,apache/incubator-reef,dougmsft/reef,tcNickolas/reef,apache/incubator-reef,markusweimer/reef,dongjoon-hyun/reef,tcNickolas/incubator-reef,tcNickolas/incubator-reef,shravanmn/reef,dongjoon-hyun/incubator-reef,jsjason/incubator-reef,yunseong/incubator-reef,shulmanb/reef,tcNickolas/incubator-reef,gyeongin/reef,zerg-junior/incubator-reef,dkm2110/veyor,afchung/reef,shulmanb/reef,nachocano/incubator-reef,jsjason/incubator-reef,markusweimer/incubator-reef,nachocano/incubator-reef,yunseong/incubator-reef,dongjoon-hyun/reef,zerg-junior/incubator-reef,afchung/incubator-reef,markusweimer/incubator-reef,afchung/incubator-reef,jwang98052/reef,apache/incubator-reef,dougmsft/reef,gyeongin/reef,dongjoon-hyun/reef,swlsw/incubator-reef,motus/reef,dongjoon-hyun/incubator-reef,gyeongin/reef,tcNickolas/incubator-reef,DifferentSC/incubator-reef,apache/reef,apache/reef,dkm2110/veyor,dafrista/incubator-reef,shulmanb/reef,dongjoon-hyun/incubator-reef,yingdachen/incubator-reef,DifferentSC/incubator-reef,anupam128/reef,jwang98052/incubator-reef,shravanmn/reef,tcNickolas/reef,jwang98052/incubator-reef,shravanmn/reef,markusweimer/incubator-reef,shravanmn/reef,motus/reef,afchung/incubator-reef,dougmsft/reef,singlis/reef,zerg-junior/incubator-reef,afchung/incubator-reef,yingdachen/incubator-reef,shravanmn/reef,singlis/reef,yunseong/incubator-reef,DifferentSC/incubator-reef,yunseong/reef,nachocano/incubator-reef,DifferentSC/incubator-reef,markusweimer/incubator-reef,jwang98052/incubator-reef,dongjoon-hyun/reef,dkm2110/Microsoft-cisl,yunseong/reef,markusweimer/reef,shulmanb/reef,apache/reef,anupam128/reef,DifferentSC/incubator-reef,shravanmn/reef,dongjoon-hyun/reef,apache/reef,zerg-junior/incubator-reef,jwang98052/reef,motus/reef,dkm2110/veyor,tcNickolas/reef,motus/reef,apache/reef,afchung/reef,tcNickolas/reef,nachocano/incubator-reef,tcNickolas/reef,dafrista/incubator-reef,singlis/reef,singlis/reef,gyeongin/reef,swlsw/incubator-reef,afchung/incubator-reef,yunseong/reef,jwang98052/reef,tcNickolas/incubator-reef,swlsw/incubator-reef,markusweimer/incubator-reef,afchung/incubator-reef,afchung/reef,jwang98052/reef,yingdachen/incubator-reef,apache/incubator-reef,markusweimer/reef,nachocano/incubator-reef,dkm2110/Microsoft-cisl,motus/reef,tcNickolas/reef,anupam128/reef,dongjoon-hyun/incubator-reef,anupam128/reef,DifferentSC/incubator-reef,yingdachen/incubator-reef,yunseong/reef,singlis/reef,motus/reef,apache/reef,jsjason/incubator-reef,dafrista/incubator-reef,jwang98052/incubator-reef,nachocano/incubator-reef,markusweimer/reef,afchung/reef,yunseong/reef,singlis/reef,dkm2110/veyor,yunseong/reef,apache/incubator-reef,dafrista/incubator-reef,apache/incubator-reef,nachocano/incubator-reef,yunseong/incubator-reef,jwang98052/reef,shravanmn/reef,gyeongin/reef,apache/reef,swlsw/incubator-reef,yunseong/incubator-reef,dkm2110/veyor,afchung/reef,yunseong/reef,dkm2110/Microsoft-cisl,jsjason/incubator-reef,afchung/reef,markusweimer/reef,swlsw/incubator-reef,yingdachen/incubator-reef,markusweimer/reef,jsjason/incubator-reef,dkm2110/Microsoft-cisl,dafrista/incubator-reef,gyeongin/reef,dougmsft/reef,yingdachen/incubator-reef,dongjoon-hyun/reef,jwang98052/incubator-reef,dongjoon-hyun/incubator-reef,dafrista/incubator-reef,jwang98052/incubator-reef,dkm2110/Microsoft-cisl,singlis/reef,dongjoon-hyun/incubator-reef,tcNickolas/incubator-reef,apache/incubator-reef,swlsw/incubator-reef,dougmsft/reef,afchung/reef,shulmanb/reef,shulmanb/reef,jwang98052/reef,jsjason/incubator-reef | lang/cs/Org.Apache.REEF.IMRU/API/PerMapConfigGeneratorSet.cs | lang/cs/Org.Apache.REEF.IMRU/API/PerMapConfigGeneratorSet.cs | #region LICENSE
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#endregion
using System.Collections.Generic;
using Org.Apache.REEF.Tang.Annotations;
namespace Org.Apache.REEF.IMRU.API
{
[NamedParameter("Set of mapper specfic configuration generators", "setofmapconfig")]
public sealed class PerMapConfigGeneratorSet : Name<ISet<IPerMapperConfigGenerator>>
{
}
} | #region LICENSE
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#endregion
using System.Collections.Generic;
using Org.Apache.REEF.Tang.Annotations;
namespace Org.Apache.REEF.IMRU.API
{
[NamedParameter("Set of mapper specfic configuration generators", "setofmapconfig")]
internal sealed class PerMapConfigGeneratorSet : Name<ISet<IPerMapperConfigGenerator>>
{
}
} | apache-2.0 | C# |
072b2931264ea73af9ee56dc97189d132a9c9c5e | Fix Build | dk307/HSPI_RemoteHelper | Devices/FeedbackValue.cs | Devices/FeedbackValue.cs | using NullGuard;
namespace Hspi.Devices
{
[NullGuard(ValidationFlags.Arguments | ValidationFlags.NonPublic)]
internal class FeedbackValue
{
public FeedbackValue(DeviceFeedback feedback, object value)
{
Value = value;
Feedback = feedback;
}
public DeviceFeedback Feedback { get; }
public object Value { get; }
}
} | using NullGuard;
namespace Hspi.Devices
{
[NullGuard(ValidationFlags.Arguments | ValidationFlags.NonPublic)]
internal struct FeedbackValue
{
public FeedbackValue(DeviceFeedback feedback, object value)
{
Value = value;
Feedback = feedback;
}
public DeviceFeedback Feedback { get; }
public object Value { get; }
}
} | mit | C# |
ab1a0575c7e92f94e15cbdf5c35aa41f5d5f70ae | Add IDocumentsManager interface | LightPaper/Infrastructure | Contracts/DocumentInterfaces.cs | Contracts/DocumentInterfaces.cs | #region Using
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading.Tasks;
#endregion
namespace LightPaper.Infrastructure.Contracts
{
public interface IDocumentUpdateListener
{
bool Listen(IDocument document, string sourceText = null);
}
public interface IDocument : INotifyPropertyChanged
{
#region Properties
string Title { get; }
bool IsDirty { get; }
bool IsTransient { get; set; }
string SourcePath { get; }
void Save(string filename);
#endregion
}
public interface IDocumentCloseConfirmer
{
Task<bool?> DocumentShouldCloseAsync(IDocument document);
Task<bool?> DocumentsShouldCloseAsync(IEnumerable<IDocument> documents);
}
public interface IDocumentsManager
{
ObservableCollection<IDocument> WorkingDocuments { get; }
IDocument CurrentDocument { get; }
bool Add(IDocument document, bool doSelect = false);
Task CloseCurrentAsync();
Task CloseAsync(IDocument document);
void SaveAllWorkingDocuments();
void PruneTransientDocuments();
}
} | #region usings
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
#endregion
namespace LightPaper.Infrastructure.Contracts
{
public interface IDocumentUpdateListener
{
bool Listen(IDocument document, string sourceText = null);
}
public interface IDocument : INotifyPropertyChanged
{
#region Properties
string Title { get; }
bool IsDirty { get; }
bool IsTransient { get; set; }
string SourcePath { get; }
void Save(string filename);
#endregion
}
public interface IDocumentCloseConfirmer
{
Task<bool?> DocumentShouldCloseAsync(IDocument document);
Task<bool?> DocumentsShouldCloseAsync(IEnumerable<IDocument> documents);
}
} | mit | C# |
28f37c6d5ad1306e35b1f0048df7e565e1dd713c | Add unit tests around the DlxLib events | taylorjg/DlxLib | DlxLibTests/DlxLibEventTests.cs | DlxLibTests/DlxLibEventTests.cs | using DlxLib;
using NUnit.Framework;
namespace DlxLibTests
{
[TestFixture]
internal class DlxLibEventTests
{
[Test]
public void StartedEventFires()
{
var matrix = new bool[0, 0];
var dlx = new Dlx();
var startedEventHasBeenRaised = false;
dlx.Started += (_, __) => startedEventHasBeenRaised = true;
dlx.Solve(matrix);
Assert.That(startedEventHasBeenRaised, Is.True, "Expected the Started event to have been raised");
}
[Test]
public void FinishedEventFires()
{
var matrix = new bool[0, 0];
var dlx = new Dlx();
var finishedEventHasBeenRaised = false;
dlx.Finished += (_, __) => finishedEventHasBeenRaised = true;
dlx.Solve(matrix);
Assert.That(finishedEventHasBeenRaised, Is.True, "Expected the Finished event to have been raised");
}
[Test]
public void CancelledEventFires()
{
var matrix = new bool[0, 0];
var dlx = new Dlx();
var cancelledEventHasBeenRaised = false;
dlx.Cancelled += (_, __) => cancelledEventHasBeenRaised = true;
dlx.Started += (sender, __) => ((Dlx)sender).Cancel();
var thread = new System.Threading.Thread(() => dlx.Solve(matrix));
thread.Start();
thread.Join();
Assert.That(cancelledEventHasBeenRaised, Is.True, "Expected the Cancelled event to have been raised");
}
[Test]
public void SearchStepEventFires()
{
var matrix = new[,]
{
{0, 0, 1, 0, 1, 1, 0},
{1, 0, 0, 1, 0, 0, 1},
{0, 1, 1, 0, 0, 1, 0},
{1, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 0, 1},
{0, 0, 0, 1, 1, 0, 1}
};
var dlx = new Dlx();
var searchStepEventHasBeenRaised = false;
dlx.SearchStep += (_, __) => searchStepEventHasBeenRaised = true;
dlx.Solve(matrix);
Assert.That(searchStepEventHasBeenRaised, Is.True, "Expected the SearchStep event to have been raised");
}
[Test]
public void SolutionFoundEventFires()
{
var matrix = new[,]
{
{0, 0, 1, 0, 1, 1, 0},
{1, 0, 0, 1, 0, 0, 1},
{0, 1, 1, 0, 0, 1, 0},
{1, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 0, 1},
{0, 0, 0, 1, 1, 0, 1}
};
var dlx = new Dlx();
var solutionFoundEventHasBeenRaised = false;
dlx.SolutionFound += (_, __) => solutionFoundEventHasBeenRaised = true;
dlx.Solve(matrix);
Assert.That(solutionFoundEventHasBeenRaised, Is.True, "Expected the SolutionFound event to have been raised");
}
}
}
| using NUnit.Framework;
namespace DlxLibTests
{
[TestFixture]
internal class DlxLibEventTests
{
[Test]
public void StartedEventFires()
{
}
[Test]
public void FinishedEventFires()
{
}
[Test]
public void CancelledEventFires()
{
}
[Test]
public void SearchStepEventFires()
{
}
[Test]
public void SolutionFoundEventFires()
{
}
}
}
| mit | C# |
0293f284a924566279200a35af98ad98518eb81c | Add CanPerformInPlayAction to IPersistentCard | StefanoFiumara/Harry-Potter-Unity | Assets/Scripts/HarryPotterUnity/Cards/Generic/Interfaces/IPersistentCard.cs | Assets/Scripts/HarryPotterUnity/Cards/Generic/Interfaces/IPersistentCard.cs | namespace HarryPotterUnity.Cards.Generic.Interfaces
{
public interface IPersistentCard {
void OnInPlayBeforeTurnAction();
void OnInPlayAfterTurnAction();
bool CanPerformInPlayAction();
void OnSelectedAction();
void OnEnterInPlayAction();
void OnExitInPlayAction();
}
}
| namespace HarryPotterUnity.Cards.Generic.Interfaces
{
public interface IPersistentCard {
void OnInPlayBeforeTurnAction();
void OnInPlayAfterTurnAction();
void OnSelectedAction(); //Might not need this
void OnEnterInPlayAction();
void OnExitInPlayAction();
}
}
| mit | C# |
34acc18ae420cc1839a778b27f76c8c6558cf642 | Change Assembly version | RaynaldM/asp.net-mvc-helpers | aspnet-mvc-helpers/Properties/AssemblyInfo.cs | aspnet-mvc-helpers/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("asp.net MVC helpers")]
[assembly: AssemblyDescription("Simple set of Helpers I use in my MVC app")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rayspiration")]
[assembly: AssemblyProduct("aspnet-mvc-helpers")]
[assembly: AssemblyCopyright("Copyright © 2014-2015")]
[assembly: AssemblyTrademark("Rayspiration")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("a74164f7-7523-4d5e-b4aa-6213215f2d72")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.4.*")]
[assembly: AssemblyFileVersion("0.1.4.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("asp.net MVC helpers")]
[assembly: AssemblyDescription("Simple set of Helpers I use in my MVC app")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rayspiration")]
[assembly: AssemblyProduct("aspnet-mvc-helpers")]
[assembly: AssemblyCopyright("Copyright © 2014-2015")]
[assembly: AssemblyTrademark("Rayspiration")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("a74164f7-7523-4d5e-b4aa-6213215f2d72")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.*")]
[assembly: AssemblyFileVersion("0.1.3.0")]
| mit | C# |
3a4da6b86795c22cabe94028a75f99875574d3a4 | use same code style | peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu | osu.Game/Localisation/NamedOverlayComponentStrings.cs | osu.Game/Localisation/NamedOverlayComponentStrings.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Localisation
{
public static class NamedOverlayComponentStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.NamedOverlayComponent";
/// <inheritdoc cref="PageTitleStrings.MainBeatmapsetsControllerIndex"/>
public static LocalisableString BeatmapListingTitle => PageTitleStrings.MainBeatmapsetsControllerIndex;
/// <summary>
/// "browse for new beatmaps"
/// </summary>
public static LocalisableString BeatmapListingDescription => new TranslatableString(getKey(@"beatmap_listing"), @"browse for new beatmaps");
/// <inheritdoc cref="PageTitleStrings.MainChangelogControllerDefault"/>
public static LocalisableString ChangelogTitle => PageTitleStrings.MainChangelogControllerDefault;
/// <summary>
/// "track recent dev updates in the osu! ecosystem"
/// </summary>
public static LocalisableString ChangelogDescription => new TranslatableString(getKey(@"changelog"), @"track recent dev updates in the osu! ecosystem");
/// <inheritdoc cref="PageTitleStrings.MainHomeControllerIndex"/>
public static LocalisableString DashboardTitle => PageTitleStrings.MainHomeControllerIndex;
/// <summary>
/// "view your friends and other information"
/// </summary>
public static LocalisableString DashboardDescription => new TranslatableString(getKey(@"dashboard"), @"view your friends and other information");
/// <inheritdoc cref="PageTitleStrings.MainRankingControllerDefault"/>
public static LocalisableString RankingsTitle => PageTitleStrings.MainRankingControllerDefault;
/// <summary>
/// "find out who's the best right now"
/// </summary>
public static LocalisableString RankingsDescription => new TranslatableString(getKey(@"rankings"), @"find out who's the best right now");
/// <inheritdoc cref="PageTitleStrings.MainNewsControllerDefault"/>
public static LocalisableString NewsTitle => PageTitleStrings.MainNewsControllerDefault;
/// <summary>
/// "get up-to-date on community happenings"
/// </summary>
public static LocalisableString NewsDescription => new TranslatableString(getKey(@"news"), @"get up-to-date on community happenings");
/// <inheritdoc cref="LayoutStrings.MenuHelpGetWiki"/>
public static LocalisableString WikiTitle => PageTitleStrings.MainWikiControllerDefault;
/// <summary>
/// "knowledge base"
/// </summary>
public static LocalisableString WikiDescription => new TranslatableString(getKey(@"wiki"), @"knowledge base");
private static string getKey(string key) => $"{prefix}:{key}";
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Localisation
{
public static class NamedOverlayComponentStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.NamedOverlayComponent";
/// <inheritdoc cref="PageTitleStrings.MainBeatmapsetsControllerIndex"/>
public static LocalisableString BeatmapListingTitle => PageTitleStrings.MainBeatmapsetsControllerIndex;
/// <summary>
/// "browse for new beatmaps"
/// </summary>
public static LocalisableString BeatmapListingDescription => new TranslatableString(getKey(@"beatmap_listing"), @"browse for new beatmaps");
/// <inheritdoc cref="PageTitleStrings.MainChangelogControllerDefault"/>
public static LocalisableString ChangelogTitle => PageTitleStrings.MainChangelogControllerDefault;
/// <summary>
/// "track recent dev updates in the osu! ecosystem"
/// </summary>
public static LocalisableString ChangelogDescription => new TranslatableString(getKey(@"changelog"), @"track recent dev updates in the osu! ecosystem");
/// <inheritdoc cref="PageTitleStrings.MainHomeControllerIndex"/>
public static LocalisableString DashboardTitle => PageTitleStrings.MainHomeControllerIndex;
/// <summary>
/// "view your friends and other information"
/// </summary>
public static LocalisableString DashboardDescription => new TranslatableString(getKey(@"dashboard"), @"view your friends and other information");
/// <inheritdoc cref="PageTitleStrings.MainRankingControllerDefault"/>
public static LocalisableString RankingsTitle => PageTitleStrings.MainRankingControllerDefault;
/// <summary>
/// "find out who's the best right now"
/// </summary>
public static LocalisableString RankingsDescription => new TranslatableString(getKey(@"rankings"), @"find out who's the best right now");
/// <inheritdoc cref="PageTitleStrings.MainNewsControllerDefault"/>
public static LocalisableString NewsTitle => PageTitleStrings.MainNewsControllerDefault;
/// <summary>
/// "get up-to-date on community happenings"
/// </summary>
public static LocalisableString NewsDescription => new TranslatableString(getKey(@"news"), @"get up-to-date on community happenings");
/// <inheritdoc cref="LayoutStrings.MenuHelpGetWiki"/>
public static LocalisableString WikiTitle => LayoutStrings.MenuHelpGetWiki;
/// <inheritdoc cref="PageTitleStrings.MainWikiControllerDefault"/>
public static LocalisableString WikiDescription => PageTitleStrings.MainWikiControllerDefault;
private static string getKey(string key) => $"{prefix}:{key}";
}
}
| mit | C# |
ecc2adc1ad450136cf8432f8a4f2ba3af13a522d | update for 0.7 of nuget package publish. | activescott/libmspack4n,activescott/libmspack4n,activescott/libmspack4n,activescott/libmspack4n,activescott/libmspack4n | libmspack4n/Properties/AssemblyInfo.cs | libmspack4n/Properties/AssemblyInfo.cs | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyTitle("libmspack4n")]
[assembly: System.Reflection.AssemblyDescription("A .NET version of the libmspack libmspack library that enables programatically re" +
"ading and extracting the content of Microsoft cab files.")]
[assembly: System.Reflection.AssemblyCompany("Scott Willeke")]
[assembly: System.Reflection.AssemblyVersion("0.7.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("0.7.0.0")]
[assembly: System.Reflection.AssemblyCopyright("Copyright Scott Willeke ©2013-2016")]
| //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Reflection.AssemblyTitle("libmspack4n")]
[assembly: System.Reflection.AssemblyDescription("A .NET version of the libmspack libmspack library that enables programatically re" +
"ading and extracting the content of Microsoft cab files.")]
[assembly: System.Reflection.AssemblyCompany("Scott Willeke")]
[assembly: System.Reflection.AssemblyVersion("0.6.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("0.6.0.0")]
[assembly: System.Reflection.AssemblyCopyright("Copyright Scott Willeke ©2013-2016")]
| lgpl-2.1 | C# |
5cd66fc02c125632878eaaab9113edaca963f90e | Change match syntax | DnDGen/RollGen,Lirusaito/RollGen,DnDGen/RollGen,Lirusaito/RollGen | Domain/RandomDice.cs | Domain/RandomDice.cs | using Albatross.Expression;
using System;
namespace RollGen.Domain
{
public class RandomDice : Dice
{
private readonly Random random;
public RandomDice(Random random)
{
this.random = random;
}
public override PartialRoll Roll(int quantity = 1)
{
return new RandomPartialRoll(quantity, random);
}
public override object Compute(string rolled)
{
var match = rollRegex.Match(rolled);
if (match.Success)
{
var message = string.Format("Cannot compute unrolled die roll {0}", match.Value);
throw new ArgumentException(message);
}
return Parser.GetParser().Compile(rolled).EvalValue(null);
}
}
}
| using Albatross.Expression;
using System;
namespace RollGen.Domain
{
public class RandomDice : Dice
{
private readonly Random random;
public RandomDice(Random random)
{
this.random = random;
}
public override PartialRoll Roll(int quantity = 1)
{
return new RandomPartialRoll(quantity, random);
}
public override object Compute(string rolled)
{
if (rollRegex.IsMatch(rolled))
{
var match = rollRegex.Match(rolled);
var message = string.Format("Cannot compute unrolled die roll {0}", match.Value);
throw new ArgumentException(message);
}
return Parser.GetParser().Compile(rolled).EvalValue(null);
}
}
}
| mit | C# |
548f3afbc48a99c89f6422eaeaf57685159453dd | fix netcore type resolution | Fody/Janitor | Janitor.Fody/ReferenceFinder.cs | Janitor.Fody/ReferenceFinder.cs | using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
public partial class ModuleWeaver
{
public void FindCoreReferences()
{
var types = new List<TypeDefinition>();
AddAssemblyIfExists("mscorlib", types);
AddAssemblyIfExists("System.Runtime", types);
AddAssemblyIfExists("System.Threading", types);
AddAssemblyIfExists("netstandard", types);
ObjectFinalizeReference = ModuleDefinition.ImportReference(ModuleDefinition.TypeSystem.Object.Resolve().Find("Finalize"));
var gcTypeDefinition = types.First(x => x.Name == "GC");
SuppressFinalizeMethodReference = ModuleDefinition.ImportReference(gcTypeDefinition.Find("SuppressFinalize", "Object"));
var iDisposableTypeDefinition = types.First(x => x.Name == "IDisposable");
DisposeMethodReference = ModuleDefinition.ImportReference(iDisposableTypeDefinition.Find("Dispose"));
var interlockedTypeDefinition = types.First(x => x.Name == "Interlocked");
ExchangeIntMethodReference = ModuleDefinition.ImportReference(interlockedTypeDefinition.Find("Exchange", "Int32&", "Int32"));
ExchangeTMethodReference = ModuleDefinition.ImportReference(interlockedTypeDefinition.Find("Exchange", "T&", "T"));
var exceptionTypeDefinition = types.First(x => x.Name == "ObjectDisposedException");
ExceptionConstructorReference = ModuleDefinition.ImportReference(exceptionTypeDefinition.Find(".ctor", "String"));
}
void AddAssemblyIfExists(string name, List<TypeDefinition> types)
{
try
{
var assembly = AssemblyResolver.Resolve(new AssemblyNameReference(name, null));
if (assembly != null)
{
var module = assembly.MainModule;
types.AddRange(module.Types.Where(x => x.IsPublic));
types.AddRange(module.ExportedTypes.Select(x => x.Resolve()).Where(x => x.IsPublic));
}
}
catch (AssemblyResolutionException)
{
LogInfo($"Failed to resolve '{name}'. So skipping its types.");
}
}
public MethodReference ExchangeIntMethodReference;
public MethodReference ExchangeTMethodReference;
public MethodReference SuppressFinalizeMethodReference;
public MethodReference ObjectFinalizeReference;
public MethodReference DisposeMethodReference;
public MethodReference ExceptionConstructorReference;
} | using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
public partial class ModuleWeaver
{
public void FindCoreReferences()
{
var types = new List<TypeDefinition>();
AddAssemblyIfExists("mscorlib", types);
AddAssemblyIfExists("System.Runtime", types);
AddAssemblyIfExists("System.Threading", types);
AddAssemblyIfExists("netstandard", types);
ObjectFinalizeReference = ModuleDefinition.ImportReference(ModuleDefinition.TypeSystem.Object.Resolve().Find("Finalize"));
var gcTypeDefinition = types.First(x => x.Name == "GC");
SuppressFinalizeMethodReference = ModuleDefinition.ImportReference(gcTypeDefinition.Find("SuppressFinalize", "Object"));
var iDisposableTypeDefinition = types.First(x => x.Name == "IDisposable");
DisposeMethodReference = ModuleDefinition.ImportReference(iDisposableTypeDefinition.Find("Dispose"));
var interlockedTypeDefinition = types.First(x => x.Name == "Interlocked");
ExchangeIntMethodReference = ModuleDefinition.ImportReference(interlockedTypeDefinition.Find("Exchange", "Int32&", "Int32"));
ExchangeTMethodReference = ModuleDefinition.ImportReference(interlockedTypeDefinition.Find("Exchange", "T&", "T"));
var exceptionTypeDefinition = types.First(x => x.Name == "ObjectDisposedException");
ExceptionConstructorReference = ModuleDefinition.ImportReference(exceptionTypeDefinition.Find(".ctor", "String"));
}
void AddAssemblyIfExists(string name, List<TypeDefinition> types)
{
try
{
var assembly = AssemblyResolver.Resolve(new AssemblyNameReference(name, null));
if (assembly != null)
{
types.AddRange(assembly.MainModule.Types);
}
}
catch (AssemblyResolutionException)
{
LogInfo($"Failed to resolve '{name}'. So skipping its types.");
}
}
public MethodReference ExchangeIntMethodReference;
public MethodReference ExchangeTMethodReference;
public MethodReference SuppressFinalizeMethodReference;
public MethodReference ObjectFinalizeReference;
public MethodReference DisposeMethodReference;
public MethodReference ExceptionConstructorReference;
} | mit | C# |
1164283bd2e36b9ca8086aa1388c277ec0ba5bb5 | Fix unit test | quartz-software/kephas,quartz-software/kephas | src/Tests/Kephas.Messaging.Tests/DefaultMessageHandlerRegistryTest.cs | src/Tests/Kephas.Messaging.Tests/DefaultMessageHandlerRegistryTest.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="DefaultMessageHandlerRegistryTest.cs" company="Kephas Software SRL">
// Copyright (c) Kephas Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Implements the default message handler registry test class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Messaging.Tests
{
using System;
using System.Collections.Generic;
using System.Linq;
using Kephas.Composition;
using Kephas.Composition.ExportFactories;
using Kephas.Messaging.Composition;
using Kephas.Messaging.HandlerSelectors;
using Kephas.Messaging.Messages;
using Kephas.Services.Composition;
using NSubstitute;
using NUnit.Framework;
[TestFixture]
public class DefaultMessageHandlerRegistryTest
{
[Test]
public void RegisterHandler()
{
var registry = new DefaultMessageHandlerRegistry(
new DefaultMessageMatchService(),
this.GetHandlerSelectorFactories().ToList(),
this.GetHandlerFactories().ToList());
var handler = Substitute.For<IMessageHandler>();
registry.RegisterHandler(handler, new MessageHandlerMetadata(typeof(string)));
var handlers = registry.ResolveMessageHandlers(new MessageAdapter { Message = "hello" });
Assert.AreSame(handler, handlers.Single());
}
private IEnumerable<IExportFactory<IMessageHandlerSelector, AppServiceMetadata>> GetHandlerSelectorFactories()
{
yield return (IExportFactory<IMessageHandlerSelector, AppServiceMetadata>)new ExportFactory<IMessageHandlerSelector, AppServiceMetadata>(
() => new DefaultMessageHandlerSelector(new DefaultMessageMatchService()),
new AppServiceMetadata());
}
private IEnumerable<IExportFactory<IMessageHandler, MessageHandlerMetadata>> GetHandlerFactories()
{
yield break;
}
}
}
| // --------------------------------------------------------------------------------------------------------------------
// <copyright file="DefaultMessageHandlerRegistryTest.cs" company="Kephas Software SRL">
// Copyright (c) Kephas Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Implements the default message handler registry test class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Messaging.Tests
{
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using Kephas.Composition;
using Kephas.Messaging.Composition;
using Kephas.Messaging.HandlerSelectors;
using Kephas.Messaging.Messages;
using Kephas.Services.Composition;
using NSubstitute;
using NUnit.Framework;
[TestFixture]
public class DefaultMessageHandlerRegistryTest
{
[Test]
public void RegisterHandler()
{
var registry = new DefaultMessageHandlerRegistry(
new DefaultMessageMatchService(),
this.GetHandlerSelectorFactories().ToList(),
this.GetHandlerFactories().ToList());
var handler = Substitute.For<IMessageHandler>();
registry.RegisterHandler(handler, new MessageHandlerMetadata(typeof(string)));
var handlers = registry.ResolveMessageHandlers(new MessageAdapter { Message = "hello" });
Assert.AreSame(handler, handlers.Single());
}
private IEnumerable<IExportFactory<IMessageHandlerSelector, AppServiceMetadata>> GetHandlerSelectorFactories()
{
yield return (IExportFactory<IMessageHandlerSelector, AppServiceMetadata>)new ExportFactory<IMessageHandlerSelector, AppServiceMetadata>(
() => Tuple.Create<IMessageHandlerSelector, Action>(new DefaultMessageHandlerSelector(new DefaultMessageMatchService()), () => { }),
new AppServiceMetadata());
}
private IEnumerable<IExportFactory<IMessageHandler, MessageHandlerMetadata>> GetHandlerFactories()
{
yield break;
}
}
}
| mit | C# |
4ccc2a0391c86618f784c2906a8cc07581a1dc35 | Add expected exception documentation | yonglehou/SDammann.WebApi.Versioning,lovewitty/SDammann.WebApi.Versioning,Sebazzz/SDammann.WebApi.Versioning,Sebazzz/SDammann.WebApi.Versioning,lovewitty/SDammann.WebApi.Versioning,Sebazzz/SDammann.WebApi.Versioning,lovewitty/SDammann.WebApi.Versioning,Sebazzz/SDammann.WebApi.Versioning,yonglehou/SDammann.WebApi.Versioning,yonglehou/SDammann.WebApi.Versioning | src/SDammann.WebApi.Versioning/Request/IRequestControllerIdentificationDetector.cs | src/SDammann.WebApi.Versioning/Request/IRequestControllerIdentificationDetector.cs | namespace SDammann.WebApi.Versioning.Request {
using System.Net.Http;
/// <summary>
/// Defines the interface for classes which detect controller name and version from requests
/// </summary>
public interface IRequestControllerIdentificationDetector
{
/// <summary>
/// Gets a name for the controller from the specified request message. Returns null if no controller identification could be detected.
/// </summary>
/// <param name="requestMessage"></param>
/// <returns></returns>
/// <exception cref="ApiVersionFormatException">Thrown when the API version cannot be parsed because of an invalid format</exception>
ControllerIdentification GetIdentification(HttpRequestMessage requestMessage);
}
} | namespace SDammann.WebApi.Versioning.Request {
using System.Net.Http;
/// <summary>
/// Defines the interface for classes which detect controller name and version from requests
/// </summary>
public interface IRequestControllerIdentificationDetector
{
/// <summary>
/// Gets a name for the controller from the specified request message. Returns null if no controller identification could be detected.
/// </summary>
/// <param name="requestMessage"></param>
/// <returns></returns>
ControllerIdentification GetIdentification(HttpRequestMessage requestMessage);
}
} | apache-2.0 | C# |
b1b6febbd65eca16c13eb053c7913d98f5045397 | Fix bitcoin bug | Aprogiena/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,quantumagi/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,fassadlr/StratisBitcoinFullNode,stratisproject/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,bokobza/StratisBitcoinFullNode,Aprogiena/StratisBitcoinFullNode,Neurosploit/StratisBitcoinFullNode,mikedennis/StratisBitcoinFullNode | src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/CheckDifficultyPowRule.cs | src/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/CheckDifficultyPowRule.cs | using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using NBitcoin;
using Stratis.Bitcoin.Consensus.Rules;
namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
{
/// <summary>
/// Calculate the difficulty for a POW network and check that it is correct.
/// </summary>
[HeaderValidationRule(CanSkipValidation = true)]
public class CheckDifficultyPowRule : ConsensusRule
{
/// <inheritdoc />
/// <exception cref="ConsensusErrors.HighHash"> Thrown if block doesn't have a valid PoS header.</exception>
public override void Run(RuleContext context)
{
if (!context.MinedBlock && !context.ValidationContext.ChainTipToExtand.Header.CheckProofOfWork())
ConsensusErrors.HighHash.Throw();
Target nextWorkRequired = context.ValidationContext.ChainTipToExtand.GetWorkRequired(this.Parent.Network.Consensus);
BlockHeader header = context.ValidationContext.ChainTipToExtand.Header;
// Check proof of work.
if (header.Bits != nextWorkRequired)
{
this.Logger.LogTrace("(-)[BAD_DIFF_BITS]");
ConsensusErrors.BadDiffBits.Throw();
}
}
}
} | using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using NBitcoin;
using Stratis.Bitcoin.Consensus.Rules;
namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
{
/// <summary>
/// Calculate the difficulty for a POW network and check that it is correct.
/// </summary>
[HeaderValidationRule(CanSkipValidation = true)]
public class CheckDifficultyPowRule : ConsensusRule
{
/// <inheritdoc />
/// <exception cref="ConsensusErrors.HighHash"> Thrown if block doesn't have a valid PoS header.</exception>
public override void Run(RuleContext context)
{
if (!context.MinedBlock && !context.ValidationContext.Block.Header.CheckProofOfWork())
ConsensusErrors.HighHash.Throw();
Target nextWorkRequired = context.ValidationContext.ChainTipToExtand.GetWorkRequired(this.Parent.Network.Consensus);
BlockHeader header = context.ValidationContext.Block.Header;
// Check proof of work.
if (header.Bits != nextWorkRequired)
{
this.Logger.LogTrace("(-)[BAD_DIFF_BITS]");
ConsensusErrors.BadDiffBits.Throw();
}
}
}
} | mit | C# |
88e2c1a99f0c38bc4115869e1ad6f4304aa2f1d1 | Add docs | dotnet/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,brettfo/roslyn,sharwell/roslyn,physhi/roslyn,bartdesmet/roslyn,gafter/roslyn,genlu/roslyn,wvdd007/roslyn,stephentoub/roslyn,jmarolf/roslyn,gafter/roslyn,CyrusNajmabadi/roslyn,heejaechang/roslyn,heejaechang/roslyn,weltkante/roslyn,genlu/roslyn,eriawan/roslyn,genlu/roslyn,AmadeusW/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,wvdd007/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,physhi/roslyn,jmarolf/roslyn,bartdesmet/roslyn,aelij/roslyn,panopticoncentral/roslyn,brettfo/roslyn,sharwell/roslyn,weltkante/roslyn,heejaechang/roslyn,mavasani/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,AlekseyTs/roslyn,shyamnamboodiripad/roslyn,stephentoub/roslyn,jasonmalinowski/roslyn,aelij/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,wvdd007/roslyn,diryboy/roslyn,ErikSchierboom/roslyn,aelij/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,tannergooding/roslyn,brettfo/roslyn,AlekseyTs/roslyn,shyamnamboodiripad/roslyn,panopticoncentral/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,mavasani/roslyn,panopticoncentral/roslyn,tmat/roslyn,tannergooding/roslyn,dotnet/roslyn,KevinRansom/roslyn,gafter/roslyn,dotnet/roslyn,tmat/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,ErikSchierboom/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,CyrusNajmabadi/roslyn,diryboy/roslyn,mavasani/roslyn,physhi/roslyn | src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.UnrootedSymbolSet.cs | src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.UnrootedSymbolSet.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
internal partial class SolutionState
{
/// <summary>
/// In IDE scenarios we have the need to map from an <see cref="ISymbol"/> to the <see cref="Project"/> that
/// contained a <see cref="Compilation"/> that could have produced that symbol. This is especially needed with
/// OOP scenarios where we have to communicate to OOP from VS (And vice versa) what symbol we are referring to.
/// To do this, we pass along a project where this symbol could be found, and enough information (a <see
/// cref="SymbolKey"/>) to resolve that symbol back in that that <see cref="Project"/>. This is challenging
/// however as symbols do not necessarily have back-pointers to <see cref="Compilation"/>s, and as such, we
/// can't just see which Project produced the <see cref="Compilation"/> that produced that <see
/// cref="ISymbol"/>. In other words, the <see cref="ISymbol"/> doesn't <c>root</c> the compilation. Because
/// of that we keep track of those symbols per project in a <c>weak</c> fashion. Then, we can later see if a
/// symbol came from a particular project by checking if it is one of those weak symbols. We use weakly held
/// symbols to that a <see cref="ProjectState"/> instance doesn't hold symbols alive. But, we know if we are
/// holding the symbol itself, then the weak-ref will stay alive such that we can do this containment check.
/// </summary>
private readonly struct UnrootedSymbolSet
{
/// <summary>
/// The <see cref="IAssemblySymbol"/> produced directly by <see cref="Compilation.Assembly"/>.
/// </summary>
public readonly WeakReference<IAssemblySymbol> PrimaryAssemblySymbol;
/// <summary>
/// The <see cref="IDynamicTypeSymbol"/> produced directly by <see cref="Compilation.DynamicType"/>. Only
/// valid for <see cref="LanguageNames.CSharp"/>.
/// </summary>
public readonly WeakReference<ITypeSymbol?> PrimaryDynamicSymbol;
/// <summary>
/// The <see cref="IAssemblySymbol"/>s or <see cref="IModuleSymbol"/>s produced through <see
/// cref="Compilation.GetAssemblyOrModuleSymbol(MetadataReference)"/> for all the references exposed by <see
/// cref="Compilation.References"/>/
/// </summary>
public readonly WeakSet<ISymbol> SecondaryReferencedSymbols;
public UnrootedSymbolSet(WeakReference<IAssemblySymbol> primaryAssemblySymbol, WeakReference<ITypeSymbol?> primaryDynamicSymbol, WeakSet<ISymbol> secondaryReferencedSymbols)
{
PrimaryAssemblySymbol = primaryAssemblySymbol;
PrimaryDynamicSymbol = primaryDynamicSymbol;
SecondaryReferencedSymbols = secondaryReferencedSymbols;
}
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
internal partial class SolutionState
{
private readonly struct UnrootedSymbolSet
{
public readonly WeakReference<IAssemblySymbol> PrimaryAssemblySymbol;
public readonly WeakReference<ITypeSymbol?> PrimaryDynamicSymbol;
public readonly WeakSet<ISymbol> SecondaryReferencedSymbols;
public UnrootedSymbolSet(WeakReference<IAssemblySymbol> primaryAssemblySymbol, WeakReference<ITypeSymbol?> primaryDynamicSymbol, WeakSet<ISymbol> secondaryReferencedSymbols)
{
PrimaryAssemblySymbol = primaryAssemblySymbol;
PrimaryDynamicSymbol = primaryDynamicSymbol;
SecondaryReferencedSymbols = secondaryReferencedSymbols;
}
}
}
}
| mit | C# |
3f2e52542e2cc904c8e7a0602aa3cdad1c6fd95f | Fix - Cancellazione Chiamate In Corso al logout | vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf,vvfosprojects/sovvf | src/backend/SO115App.Persistence.MongoDB/Marker/DeleteChiamataInCorsoByIdUtente.cs | src/backend/SO115App.Persistence.MongoDB/Marker/DeleteChiamataInCorsoByIdUtente.cs | using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.Models.Classi.Marker;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti;
using SO115App.Models.Servizi.Infrastruttura.Marker;
namespace SO115App.Persistence.MongoDB.Marker
{
public class DeleteChiamataInCorsoByIdUtente : IDeleteChiamataInCorsoByIdUtente
{
private readonly DbContext _dbContext;
private readonly IGetUtenteById _getUtente;
public DeleteChiamataInCorsoByIdUtente(DbContext dbContext, IGetUtenteById getUtente)
{
_dbContext = dbContext;
_getUtente = getUtente;
}
public void Delete(string idUtente)
{
var utente = _getUtente.GetUtenteByCodice(idUtente);
var nominativo = utente.Nome + " " + utente.Cognome;
_dbContext.ChiamateInCorsoCollection.DeleteMany(Builders<ChiamateInCorso>.Filter.Eq(x => x.DescrizioneOperatore, nominativo));
}
}
}
| using MongoDB.Driver;
using Persistence.MongoDB;
using SO115App.Models.Classi.Marker;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti;
using SO115App.Models.Servizi.Infrastruttura.Marker;
namespace SO115App.Persistence.MongoDB.Marker
{
public class DeleteChiamataInCorsoByIdUtente : IDeleteChiamataInCorsoByIdUtente
{
private readonly DbContext _dbContext;
private readonly IGetUtenteById _getUtente;
public DeleteChiamataInCorsoByIdUtente(DbContext dbContext, IGetUtenteById getUtente)
{
_dbContext = dbContext;
_getUtente = getUtente;
}
public void Delete(string idUtente)
{
var utente = _getUtente.GetUtenteByCodice(idUtente);
var nominativo = utente.Nome + " " + utente.Cognome;
_dbContext.ChiamateInCorsoCollection.DeleteOne(Builders<ChiamateInCorso>.Filter.Eq(x => x.DescrizioneOperatore, nominativo));
}
}
}
| agpl-3.0 | C# |
0db0c9eabab5101d9f4433e4f954ea669dab10f4 | Update CompositeAssemblyStringLocalizerTests.cs | tiksn/TIKSN-Framework | TIKSN.UnitTests.Shared/Localization/CompositeAssemblyStringLocalizerTests.cs | TIKSN.UnitTests.Shared/Localization/CompositeAssemblyStringLocalizerTests.cs | using System;
using System.Linq;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Serilog;
using TIKSN.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
namespace TIKSN.Localization.Tests
{
public class CompositeAssemblyStringLocalizerTests
{
private readonly IServiceProvider _serviceProvider;
public CompositeAssemblyStringLocalizerTests(ITestOutputHelper testOutputHelper)
{
var services = new ServiceCollection();
_ = services.AddFrameworkCore();
_ = services.AddLogging(builder =>
{
_ = builder.AddDebug();
var loggger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.TestOutput(testOutputHelper)
.CreateLogger();
_ = builder.AddSerilog(loggger);
});
this._serviceProvider = services.BuildServiceProvider();
}
[Fact]
public void KeyUniqueness()
{
var resourceNamesCache = new ResourceNamesCache();
var testStringLocalizer = new TestStringLocalizer(resourceNamesCache, this._serviceProvider.GetRequiredService<ILogger<TestStringLocalizer>>());
var duplicatesCount = testStringLocalizer.GetAllStrings().GroupBy(item => item.Name.ToLowerInvariant()).Count(item => item.Count() > 1);
_ = duplicatesCount.Should().Be(0);
}
}
}
| using System;
using System.Linq;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using TIKSN.DependencyInjection.Tests;
using Xunit;
using Xunit.Abstractions;
namespace TIKSN.Localization.Tests
{
public class CompositeAssemblyStringLocalizerTests
{
private readonly IServiceProvider _serviceProvider;
public CompositeAssemblyStringLocalizerTests(ITestOutputHelper testOutputHelper)
{
var compositionRoot = new TestCompositionRootSetup(testOutputHelper);
this._serviceProvider = compositionRoot.CreateServiceProvider();
}
[Fact]
public void KeyUniqueness()
{
var resourceNamesCache = new ResourceNamesCache();
var testStringLocalizer = new TestStringLocalizer(resourceNamesCache, this._serviceProvider.GetRequiredService<ILogger<TestStringLocalizer>>());
var duplicatesCount = testStringLocalizer.GetAllStrings().GroupBy(item => item.Name.ToLowerInvariant()).Count(item => item.Count() > 1);
_ = duplicatesCount.Should().Be(0);
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.