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 |
|---|---|---|---|---|---|---|---|---|
996522fcca4717539b36ed7fd9cfdd942a3aefaa | 测试提交2 | Langbencom/rights,oceanho/rights,oceanho/rights,rucila/rights,Langbencom/rights,rucila/rights,rucila/rights,MetSystem/rights,Langbencom/rights,rucila/rights,MetSystem/rights,oceanho/rights,oceanho/rights,MetSystem/rights,Langbencom/rights,MetSystem/rights | Rights/App/Controllers/HomeController.cs | Rights/App/Controllers/HomeController.cs | using Common;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Langben.App.Controllers
{
public class HomeController : BaseController
{
//
// GET: /Home/
public ActionResult Index()
{
Account account = GetCurrentAccount();
if (account == null)
{
RedirectToAction("Index", "Account");
}
else
{
//IHomeBLL home = new HomeBLL();
//ViewData["Menu"] = home.GetMenuByAccount(ref account);// 获取菜单
}
return View();
}
}
}
| using Common;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Langben.App.Controllers
{
public class HomeController : BaseController
{
//
// GET: /Home/
public ActionResult Index()
{
Account account = GetCurrentAccount();
if (account == null)
{
RedirectToAction("Index", "Account");
}
else
{
//IHomeBLL home = new HomeBLL();
//ViewData["Menu"] = home.GetMenuByAccount(ref account);// 获取菜单
}
return View();
}
}
}
| apache-2.0 | C# |
7c2e149b4744c855f29cb19099d32fd712fda497 | bump build number | jjchiw/gelf4net,jjchiw/gelf4net | SharedAssemblyInfo.cs | SharedAssemblyInfo.cs | using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("gelf4net")]
[assembly: AssemblyFileVersion("2.0.3.1")]
[assembly: AssemblyVersion("2.0.3.1")]
[assembly: AssemblyCopyright("Copyright 2014")]
[assembly: ComVisible(false)]
| using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Runtime.CompilerServices;
[assembly: AssemblyCompany("gelf4net")]
[assembly: AssemblyFileVersion("2.0.3.0")]
[assembly: AssemblyVersion("2.0.3.0")]
[assembly: AssemblyCopyright("Copyright 2014")]
[assembly: ComVisible(false)]
| mit | C# |
30254132234e3d42c91ff85c0ba61f6d09d2c258 | Use AppModel APIs to get package version for accurate reporting | File-New-Project/EarTrumpet | EarTrumpet/ViewModels/SettingsViewModel.cs | EarTrumpet/ViewModels/SettingsViewModel.cs | using EarTrumpet.DataModel;
using EarTrumpet.Misc;
using EarTrumpet.Services;
using System;
using System.Diagnostics;
using System.Reflection;
using Windows.ApplicationModel;
namespace EarTrumpet.ViewModels
{
public class SettingsViewModel : BindableBase
{
SettingsService.HotkeyData _hotkey;
internal SettingsService.HotkeyData Hotkey
{
get => _hotkey;
set
{
_hotkey = value;
SettingsService.Hotkey = _hotkey;
RaisePropertyChanged(nameof(Hotkey));
RaisePropertyChanged(nameof(HotkeyText));
}
}
public string HotkeyText => _hotkey.ToString();
public RelayCommand OpenDiagnosticsCommand { get; }
public RelayCommand OpenAboutCommand { get; }
public RelayCommand OpenFeedbackCommand { get; }
public bool UseLegacyIcon
{
get => SettingsService.UseLegacyIcon;
set => SettingsService.UseLegacyIcon = value;
}
public string AboutText => $"EarTrumpet " +
$"{Package.Current.Id.Version.Major}." +
$"{Package.Current.Id.Version.Minor}." +
$"{Package.Current.Id.Version.Build}." +
$"{Package.Current.Id.Version.Revision}";
internal SettingsViewModel()
{
Hotkey = SettingsService.Hotkey;
OpenAboutCommand = new RelayCommand(OpenAbout);
OpenDiagnosticsCommand = new RelayCommand(OpenDiagnostics);
OpenFeedbackCommand = new RelayCommand(FeedbackService.OpenFeedbackHub);
}
private void OpenDiagnostics()
{
DiagnosticsService.DumpAndShowData();
}
private void OpenAbout()
{
Process.Start("http://github.com/File-New-Project/EarTrumpet");
}
}
}
| using EarTrumpet.DataModel;
using EarTrumpet.Misc;
using EarTrumpet.Services;
using System;
using System.Diagnostics;
using System.Reflection;
namespace EarTrumpet.ViewModels
{
public class SettingsViewModel : BindableBase
{
SettingsService.HotkeyData _hotkey;
internal SettingsService.HotkeyData Hotkey
{
get => _hotkey;
set
{
_hotkey = value;
SettingsService.Hotkey = _hotkey;
RaisePropertyChanged(nameof(Hotkey));
RaisePropertyChanged(nameof(HotkeyText));
}
}
public string HotkeyText => _hotkey.ToString();
public RelayCommand OpenDiagnosticsCommand { get; }
public RelayCommand OpenAboutCommand { get; }
public RelayCommand OpenFeedbackCommand { get; }
public bool UseLegacyIcon
{
get => SettingsService.UseLegacyIcon;
set => SettingsService.UseLegacyIcon = value;
}
public string AboutText => $"EarTrumpet {Assembly.GetEntryAssembly().GetName().Version}";
internal SettingsViewModel()
{
Hotkey = SettingsService.Hotkey;
OpenAboutCommand = new RelayCommand(OpenAbout);
OpenDiagnosticsCommand = new RelayCommand(OpenDiagnostics);
OpenFeedbackCommand = new RelayCommand(FeedbackService.OpenFeedbackHub);
}
private void OpenDiagnostics()
{
DiagnosticsService.DumpAndShowData();
}
private void OpenAbout()
{
Process.Start("http://github.com/File-New-Project/EarTrumpet");
}
}
}
| mit | C# |
6f444c279075585b71cafc49bfa54fc9f367e710 | Fix namespace in CharacterController | joinrpg/joinrpg-net,kirillkos/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,kirillkos/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net | Joinrpg/Controllers/CharacterController.cs | Joinrpg/Controllers/CharacterController.cs | using System.Web.Mvc;
using JoinRpg.Data.Interfaces;
using JoinRpg.Services.Interfaces;
namespace JoinRpg.Web.Controllers
{
public class CharacterController : Common.ControllerGameBase
{
// GET: Character
public CharacterController(ApplicationUserManager userManager, IProjectRepository projectRepository, IProjectService projectService) : base(userManager, projectRepository, projectService)
{
}
public ActionResult Details(int projectid, int characterid)
{
return WithCharacter(projectid, characterid, (project, character) => View(character));
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using JoinRpg.Data.Interfaces;
using JoinRpg.Services.Interfaces;
namespace JoinRpg.Web.Controllers
{
public class CharacterController : Common.ControllerGameBase
{
// GET: Character
public CharacterController(ApplicationUserManager userManager, IProjectRepository projectRepository, IProjectService projectService) : base(userManager, projectRepository, projectService)
{
}
public ActionResult Details(int projectid, int characterid)
{
return WithCharacter(projectid, characterid, (project, character) => View(character));
}
}
} | mit | C# |
cefd016fd15aed83fdb19b06ead75547cc6b649c | update LanguagesController.cs | mauroao/java-aspnet-interop,mauroao/java-aspnet-interop,mauroao/java-aspnet-interop | asp.net/MvcWebApi/Controllers/LanguagesController.cs | asp.net/MvcWebApi/Controllers/LanguagesController.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MvcWebApi.Repositories;
namespace MvcWebApi.Controllers
{
public class LanguagesController : ApiController
{
/// <summary>
/// Get all indexed languages. Verb = GET. Path = api/languages.
/// </summary>
/// <returns>List of languages</returns>
public IEnumerable<string> Get()
{
return LanguagesRepository.GetLanguages();
}
/// <summary>
/// Get language by its index. Verb = GET. Path = api/languages/5
/// </summary>
/// <param name="index">Index of language</param>
/// <returns>returns language name</returns>
public HttpResponseMessage Get(int index)
{
var languages = LanguagesRepository.GetLanguages();
if (index < 0 || index >= languages.Count || languages.Count == 0)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "language not found");
}
return Request.CreateResponse<string>(HttpStatusCode.OK, languages[index]);
}
/// <summary>
/// Inserts a new language. Verb = POST. Path = api/languages
/// </summary>
/// <param name="language">language object</param>
public HttpResponseMessage Post([FromBody]string languageName)
{
if (string.IsNullOrEmpty(languageName))
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "languageName can not be null/empty");
}
LanguagesRepository.GetLanguages().Add(languageName);
var resp = Request.CreateResponse(HttpStatusCode.Created);
resp.Headers.Location = new Uri(string.Concat(Request.RequestUri, LanguagesRepository.GetLanguages().Count - 1));
return resp;
}
/// <summary>
/// Get language by its index and changes its name. Verb = PUT. Path = api/language/5
/// </summary>
/// <param name="index">index of language</param>
/// <param name="languageName"></param>
public HttpResponseMessage Put(int index, [FromBody]string languageName)
{
var languages = LanguagesRepository.GetLanguages();
if (index < 0 || index >= languages.Count || languages.Count == 0)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "language not found");
}
if (string.IsNullOrEmpty(languageName))
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "languageName can not be null/empty");
}
languages[index] = languageName;
return Request.CreateResponse(HttpStatusCode.OK);
}
/// <summary>
/// Removes language by its index. Verb = DELETE. Path = api/languages/5
/// </summary>
/// <param name="index">index of language</param>
public HttpResponseMessage Delete(int index)
{
var languages = LanguagesRepository.GetLanguages();
if (index < 0 || index >= languages.Count || languages.Count == 0)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, "language not found");
}
languages.RemoveAt(index);
return Request.CreateResponse(HttpStatusCode.OK);
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MvcWebApi.Repositories;
namespace MvcWebApi.Controllers
{
public class LanguagesController : ApiController
{
/// <summary>
/// Get all indexed languages. Verb = GET. Path = api/languages.
/// </summary>
/// <returns>List of languages</returns>
public IEnumerable<string> Get()
{
return LanguagesRepository.GetLanguages();
}
/// <summary>
/// Get language by its index. Verb = GET. Path = api/languages/5
/// </summary>
/// <param name="index">Index of language</param>
/// <returns>returns language name</returns>
public string Get(int index)
{
var languages = LanguagesRepository.GetLanguages();
if (index < 0 || index >= languages.Count || languages.Count == 0)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
return languages[index];
}
/// <summary>
/// Inserts a new language. Verb = POST. Path = api/languages
/// </summary>
/// <param name="language">language object</param>
public void Post([FromBody]string languageName)
{
if (string.IsNullOrEmpty(languageName))
{
throw new HttpResponseException(HttpStatusCode.BadRequest);
}
LanguagesRepository.GetLanguages().Add(languageName);
}
/// <summary>
/// Removes language by its index. Verb = DELETE. Path = api/languages/5
/// </summary>
/// <param name="index">index of language</param>
public void Delete(int index)
{
var languages = LanguagesRepository.GetLanguages();
if (index < 0 || index >= languages.Count || languages.Count == 0)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
languages.RemoveAt(index);
}
}
} | unlicense | C# |
948f391514f341e3dfc6bfa100d11630292ae489 | Remove Task.Run() from SymbolFilterServer | MattKotsenas/SymbolFilterServer | SymbolFilterServer/SymbolFilterServer.cs | SymbolFilterServer/SymbolFilterServer.cs | using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace SymbolFilterServer
{
// ReSharper disable once ClassNeverInstantiated.Global -- Instantiated by middleware
public class SymbolFilterServer
{
private readonly RequestDelegate _next;
public SymbolFilterServer(RequestDelegate next)
{
_next = next;
}
// ReSharper disable once UnusedMember.Global -- Called by middleware
public async Task Invoke(HttpContext context, Arguments args, RedirectParser parser)
{
var symbolFilterList = args.Symbols;
if (context.Request.Method != "GET")
{
Respond404(context.Response);
}
// Avoid case sensitivity issues for matching the pattern
var path = context.Request.Path.ToString();
path = Uri.UnescapeDataString(path).ToLowerInvariant();
foreach (var symbol in symbolFilterList)
{
if (path.Contains(symbol))
{
Console.WriteLine("Matched pattern: {0}", symbol);
MaybeRedirect(context.Response, parser, path);
return;
}
}
Respond404(context.Response);
await _next(context);
}
private void Respond404(HttpResponse response)
{
response.StatusCode = 404;
}
private void Respond302(HttpResponse response, string url)
{
Console.WriteLine("302 Redirect {0}", url);
response.Redirect(url, false);
}
private void MaybeRedirect(HttpResponse response, RedirectParser parser, string req)
{
var result = parser.Parse(req);
if (result.IsValid)
{
Respond302(response, result.Redirect);
}
else
{
Respond404(response);
}
}
}
} | using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace SymbolFilterServer
{
// ReSharper disable once ClassNeverInstantiated.Global -- Instantiated by middleware
public class SymbolFilterServer
{
private readonly RequestDelegate _next;
public SymbolFilterServer(RequestDelegate next)
{
_next = next;
}
// ReSharper disable once UnusedMember.Global -- Called by middleware
public async Task Invoke(HttpContext context, Arguments args, RedirectParser parser)
{
var symbolFilterList = args.Symbols;
await Task.Run(() =>
{
if (context.Request.Method != "GET") { Respond404(context.Response); }
var path = context.Request.Path.ToString();
// Avoid case sensitivity issues for matching the pattern
path = Uri.UnescapeDataString(path).ToLowerInvariant();
foreach (var symbol in symbolFilterList)
{
if (path.Contains(symbol))
{
Console.WriteLine("Matched pattern: {0}", symbol);
MaybeRedirect(context.Response, parser, path);
return;
}
}
Respond404(context.Response);
});
await _next(context);
}
private void Respond404(HttpResponse response)
{
response.StatusCode = 404;
}
private void Respond302(HttpResponse response, string url)
{
Console.WriteLine("302 Redirect {0}", url);
response.Redirect(url, false);
}
private void MaybeRedirect(HttpResponse response, RedirectParser parser, string req)
{
var result = parser.Parse(req);
if (result.IsValid)
{
Respond302(response, result.Redirect);
}
else
{
Respond404(response);
}
}
}
} | mit | C# |
3ee84034a34439c805eafdf6462457ce614cbb0e | change creature base type (GameEntity is a concept, GameObject is a real instance) | Dergash/le | src/Models/Creature.cs | src/Models/Creature.cs | using System;
using System.IO;
namespace LE {
public class Creature : GameObject {
public String Name;
public Gender Gender;
}
} | using System;
using System.IO;
namespace LE {
public class Creature : GameEntity {
public String Name;
public Gender Gender;
}
} | mit | C# |
9f71d04a632cf2b09fe3eac3c97c2ef5ad91fd8a | add missing log | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/DetectedHardwareWalletViewModel.cs | WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/DetectedHardwareWalletViewModel.cs | using System;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Extensions;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Hwi.Models;
using WalletWasabi.Logging;
namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
{
public class DetectedHardwareWalletViewModel : RoutableViewModel
{
public DetectedHardwareWalletViewModel(HardwareWalletOperations hardwareWalletOperations, string walletName)
{
Title = "Hardware Wallet";
WalletName = walletName;
switch (hardwareWalletOperations.SelectedDevice!.Model)
{
case HardwareWalletModels.Coldcard:
case HardwareWalletModels.Coldcard_Simulator:
Type = WalletType.Coldcard;
break;
case HardwareWalletModels.Ledger_Nano_S:
Type = WalletType.Ledger;
break;
case HardwareWalletModels.Trezor_1:
case HardwareWalletModels.Trezor_1_Simulator:
case HardwareWalletModels.Trezor_T:
case HardwareWalletModels.Trezor_T_Simulator:
Type = WalletType.Trezor;
break;
default:
Type = WalletType.Hardware;
break;
}
TypeName = hardwareWalletOperations.SelectedDevice.Model.FriendlyName();
NextCommand = ReactiveCommand.CreateFromTask(async () =>
{
IsBusy = true;
try
{
await hardwareWalletOperations.GenerateWalletAsync(WalletName);
hardwareWalletOperations.Dispose();
Navigate().To(new AddedWalletPageViewModel(WalletName, Type));
}
catch(Exception ex)
{
Logger.LogError(ex);
await ShowErrorAsync(ex.Message, "Error occured during adding your wallet.");
Navigate().Back();
}
IsBusy = false;
});
NoCommand = ReactiveCommand.Create(() =>
{
Navigate().Back();
});
}
public string WalletName { get; }
public WalletType Type { get; }
public string TypeName { get; }
public ICommand NoCommand { get; }
}
}
| using System;
using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Extensions;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Hwi.Models;
namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
{
public class DetectedHardwareWalletViewModel : RoutableViewModel
{
public DetectedHardwareWalletViewModel(HardwareWalletOperations hardwareWalletOperations, string walletName)
{
Title = "Hardware Wallet";
WalletName = walletName;
switch (hardwareWalletOperations.SelectedDevice!.Model)
{
case HardwareWalletModels.Coldcard:
case HardwareWalletModels.Coldcard_Simulator:
Type = WalletType.Coldcard;
break;
case HardwareWalletModels.Ledger_Nano_S:
Type = WalletType.Ledger;
break;
case HardwareWalletModels.Trezor_1:
case HardwareWalletModels.Trezor_1_Simulator:
case HardwareWalletModels.Trezor_T:
case HardwareWalletModels.Trezor_T_Simulator:
Type = WalletType.Trezor;
break;
default:
Type = WalletType.Hardware;
break;
}
TypeName = hardwareWalletOperations.SelectedDevice.Model.FriendlyName();
NextCommand = ReactiveCommand.CreateFromTask(async () =>
{
IsBusy = true;
try
{
await hardwareWalletOperations.GenerateWalletAsync(WalletName);
hardwareWalletOperations.Dispose();
Navigate().To(new AddedWalletPageViewModel(WalletName, Type));
}
catch(Exception ex)
{
await ShowErrorAsync(ex.Message, "Error occured during adding your wallet.");
Navigate().Back();
}
IsBusy = false;
});
NoCommand = ReactiveCommand.Create(() =>
{
Navigate().Back();
});
}
public string WalletName { get; }
public WalletType Type { get; }
public string TypeName { get; }
public ICommand NoCommand { get; }
}
}
| mit | C# |
b329becda54800fbdbb7de002cf3f96d2386e033 | Add a string extension to validate Email | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Extensions/StringExtensions.cs | Anlab.Mvc/Extensions/StringExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace AnlabMvc.Extensions
{
public static class StringExtensions
{
const string emailRegex = @"^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$";
public static string PaymentMethodDescription(this string value)
{
if (string.Equals(value, "uc", StringComparison.OrdinalIgnoreCase))
{
return "UC Account";
}
if (string.Equals(value, "creditcard", StringComparison.OrdinalIgnoreCase))
{
return "Credit Card";
}
return "Other";
}
public static string MaxLength(this string value, int maxLength, bool ellipsis = true)
{
if (string.IsNullOrWhiteSpace(value))
{
return value;
}
if (value.Length > maxLength)
{
if (ellipsis)
{
return $"{value.Substring(0, maxLength - 3)}...";
}
return value.Substring(0, maxLength);
}
return value;
}
public static bool IsEmailValid(this string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return false;
}
return Regex.IsMatch(value.ToLower(), emailRegex);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AnlabMvc.Extensions
{
public static class StringExtensions
{
public static string PaymentMethodDescription(this string value)
{
if (string.Equals(value, "uc", StringComparison.OrdinalIgnoreCase))
{
return "UC Account";
}
if (string.Equals(value, "creditcard", StringComparison.OrdinalIgnoreCase))
{
return "Credit Card";
}
return "Other";
}
public static string MaxLength(this string value, int maxLength, bool ellipsis = true)
{
if (string.IsNullOrWhiteSpace(value))
{
return value;
}
if (value.Length > maxLength)
{
if (ellipsis)
{
return $"{value.Substring(0, maxLength - 3)}...";
}
return value.Substring(0, maxLength);
}
return value;
}
}
}
| mit | C# |
092978f55eefb75bda8b4a5934f6a15234f356de | fix for report cleanup in session end | Apex-net/WRP | src/WRP/Global.asax.cs | src/WRP/Global.asax.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace WebReportPreview
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
}
protected void Application_Error(Object sender, EventArgs e)
{
// cattura l'ultimo errore verificatosi nal server
Exception objErr = Server.GetLastError().GetBaseException();
System.Diagnostics.Debug.WriteLine("Error DEBUG WRP: " + objErr.Message);
}
protected void Session_End(Object sender, EventArgs e)
{
//[!] todo: test (no in windows 10 machine)
//
// Current verssion and Service Pack (SP 14) of SAP Crystal Reports, Developer Version for Visual Studio .NET do not support Windows 10
// Clean up report documents in sessione
//
try
{
// Test id sessione
string id = Session.SessionID.ToString();
// Cerco report documnent in session
string prefixIdReportDocument = (string)Session["PrefixIdReportDocument"];
string cleanUpRepDocEndSession = (string)Session["CleanUpRepDocEndSession"];
if (cleanUpRepDocEndSession == "1" && prefixIdReportDocument != "")
{
// se abiltato cleanup su sessione cerco i reportdocument validi e eseguo cleanup
for (int i = 0; i < Session.Contents.Count; i++)
{
string renamedItem;
renamedItem = Session.Keys[i];
int findPrefix = 0;
findPrefix = renamedItem.IndexOf(prefixIdReportDocument);
if (findPrefix == 0)
{
// Trovato
CrystalDecisions.CrystalReports.Engine.ReportDocument lReportDocument;
lReportDocument = (CrystalDecisions.CrystalReports.Engine.ReportDocument)Session[renamedItem];
if (lReportDocument != null)
{
// new:
WRP.Engine.CrystalReport.CloseReportDocument(lReportDocument);
}
}
}
}
}
catch (Exception ex)
{
string error = ex.Message;
System.Diagnostics.Debug.WriteLine("Error DEBUG WRP - Session_End: " + error);
}
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace WebReportPreview
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
}
protected void Application_Error(Object sender, EventArgs e)
{
// cattura l'ultimo errore verificatosi nal server
Exception objErr = Server.GetLastError().GetBaseException();
System.Diagnostics.Debug.WriteLine("Error DEBUG WRP: " + objErr.Message);
// [!] todo
// transfer control to error page
/*
if ((string)Session["HandleGlobalError"] == "1")
Server.Transfer("Errors.aspx");
*/
}
}
} | mit | C# |
5741c322e04618a2b99ce79e041a8c828283c224 | Update BuildTool Deploy | WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework,WorkplaceX/Framework | Framework.BuildTool/Command/Deploy.cs | Framework.BuildTool/Command/Deploy.cs | using System.IO;
namespace Framework.BuildTool
{
public class CommandDeploy : Command
{
public CommandDeploy()
: base("deploy", "Deploy to Azure git")
{
this.AzureGitUrl = ArgumentAdd("azureGitUrl", "Azure Git Url");
}
public readonly Argument AzureGitUrl;
public override void Run()
{
string azureGitUrl = AzureGitUrl.Value;
string folderPublish = UtilFramework.FolderName + "Server/bin/Debug/netcoreapp2.0/publish/";
//
UtilBuildTool.DirectoryDelete(folderPublish);
UtilFramework.Assert(!Directory.Exists(folderPublish), "Delete folder failed!");
UtilBuildTool.DotNetPublish(UtilFramework.FolderName + "Server/");
UtilFramework.Assert(Directory.Exists(folderPublish), "Publish failed!");
UtilBuildTool.Start(folderPublish, "git", "init");
UtilBuildTool.Start(folderPublish, "git", "remote add azure " + azureGitUrl);
UtilBuildTool.Start(folderPublish, "git", "fetch --all --progress");
UtilBuildTool.Start(folderPublish, "git", "add .");
UtilBuildTool.Start(folderPublish, "git", "commit -m Deploy");
UtilBuildTool.Start(folderPublish, "git", "push azure master -f --porcelain"); // Do not write to stderr. See also: https://git-scm.com/docs/git-push/2.10.0
}
}
}
| using System.IO;
namespace Framework.BuildTool
{
public class CommandDeploy : Command
{
public CommandDeploy()
: base("deploy", "Deploy to Azure git")
{
this.AzureGitUrl = ArgumentAdd("azureGitUrl", "Azure Git Url");
}
public readonly Argument AzureGitUrl;
public override void Run()
{
string azureGitUrl = AzureGitUrl.Value;
string folderPublish = UtilFramework.FolderName + "Server/bin/Debug/netcoreapp2.0/publish/";
//
UtilBuildTool.DirectoryDelete(folderPublish);
UtilFramework.Assert(!Directory.Exists(folderPublish), "Delete folder failed!");
UtilBuildTool.DotNetPublish(UtilFramework.FolderName + "Server/");
UtilFramework.Assert(Directory.Exists(folderPublish), "Publish failed!");
UtilBuildTool.Start(folderPublish, "git", "init");
UtilBuildTool.Start(folderPublish, "git", "remote add azure " + azureGitUrl);
UtilBuildTool.Start(folderPublish, "git", "fetch --all");
UtilBuildTool.Start(folderPublish, "git", "add .");
UtilBuildTool.Start(folderPublish, "git", "commit -m Deploy");
UtilBuildTool.Start(folderPublish, "git", "push azure master -f --porcelain"); // Do not write to stderr. See also: https://git-scm.com/docs/git-push/2.10.0
}
}
}
| mit | C# |
90aa156d6d38408d0b782d71295d639e22b08ba7 | Update version number for release | markashleybell/MAB.DotIgnore,markashleybell/MAB.DotIgnore | MAB.DotIgnore/Properties/AssemblyInfo.cs | MAB.DotIgnore/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("MAB.DotIgnore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MAB.DotIgnore")]
[assembly: AssemblyCopyright("Copyright © Mark Ashley Bell 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fed27394-3783-46a4-9449-8edf1ff197e4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
| 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("MAB.DotIgnore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MAB.DotIgnore")]
[assembly: AssemblyCopyright("Copyright © Mark Ashley Bell 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fed27394-3783-46a4-9449-8edf1ff197e4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
| mit | C# |
f6730b47ad844c22be105a668a6991db59ab4a5e | Update MailService.cs | TopSoftSolutions/CoreMailService | MailService.Core/Services/MailService.cs | MailService.Core/Services/MailService.cs | using MailService.Core.Configuration;
using MailService.Core.Models;
using MailService.Core.Response;
using System;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace MailService.Core.Services
{
public class MailService : IMailService
{
public async Task<MailSentResult> SendAsync(MailServiceOptions options, string profileName, Mail mail)
{
var profile = options.Profiles[profileName];
if (profile == null)
{
return await Task.FromResult(new MailSentResult
{
Succeeded = false,
Error = "Profile name not found"
});
}
SmtpClient client = new SmtpClient(profile.Host, profile.Port)
{
EnableSsl = profile.SSL,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(profile.UserName, profile.Password)
};
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress(profile.UserName);
foreach (var reciever in mail.To)
{
mailMessage.To.Add(reciever);
}
mailMessage.IsBodyHtml = mail.IsBodyHtml;
mailMessage.Body = mail.Body;
mailMessage.Subject = mail.Subject;
try
{
await client.SendMailAsync(mailMessage);
return await Task.FromResult(new MailSentResult
{
Succeeded = true
});
}
catch (Exception ex)
{
return await Task.FromResult(new MailSentResult
{
Succeeded = false,
Error = ex.Message
});
}
}
}
}
| using MailService.Core.Configuration;
using MailService.Core.Models;
using MailService.Core.Response;
using System;
using System.Net;
using System.Net.Mail;
using System.Threading.Tasks;
namespace MailService.Core.Services
{
public class MailService : IMailService
{
public async Task<MailSentResult> SendAsync(MailServiceOptions options, string profileName, Mail mail)
{
var profile = options.Profiles[profileName];
if (profile == null)
{
return await Task.FromResult(new MailSentResult
{
Succeeded = false,
Error = "Profile name not found"
});
}
SmtpClient client = new SmtpClient(profile.Host, profile.Port)
{
EnableSsl = profile.SSL,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(profile.UserName, profile.Password)
};
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress(profile.UserName);
foreach (var reciever in mail.To)
{
mailMessage.To.Add(reciever);
}
mailMessage.IsBodyHtml = mail.IsBodyHtml;
mailMessage.Body = mail.Body;
mailMessage.Subject = mail.Subject;
try
{
await client.SendMailAsync(mailMessage);
return await Task.FromResult(new MailSentResult
{
Succeeded = true
});
}
catch (Exception ex)
{
return await Task.FromResult(new MailSentResult
{
Succeeded = false,
Error = ex.Message
});
}
}
}
}
| mit | C# |
5b5e87ff3bc1d7045c6685a475ed8303a0564311 | Fix incorrect references. | dneelyep/MonoGameUtils | MonoGameUtils/Drawing/CubicBezierPath.cs | MonoGameUtils/Drawing/CubicBezierPath.cs | using System.Collections.Generic;
using System.Diagnostics;
namespace MonoGameUtils.Drawing
{
/// <summary>
/// Represents a collection of connected <see cref="CubicBezier"/> curves.
/// </summary>
public class CubicBezierPath
{
/// <summary>
/// The list of Bezier curves that belong to this path.
/// </summary>
public List<CubicBezier> Curves { get; set; }
/// <summary>
/// Creates a default, empty <see cref="CubicBezierPath"/>.
/// </summary>
public CubicBezierPath()
{
this.Curves = new List<CubicBezier>();
}
/// <summary>
/// Create a new bezier path, using the provided curve collection
/// to make up the path.
/// </summary>
/// <param name="curves">The curves that this path should be made of.</param>
public CubicBezierPath(List<CubicBezier> curves)
{
Debug.Assert(curves != null);
this.Curves = curves;
}
}
}
| using System;
using System.Collections;
using System.Collections.Generic;
namespace MonoGameUtils.Drawing
{
/// <summary>
/// Represents a collection of connected <see cref="CubicBezier"/> curves.
/// </summary>
public class CubicBezierPath
{
/// <summary>
/// The list of Bezier curves that belong to this path.
/// </summary>
public List<CubicBezier> Curves { get; set; }
/// <summary>
/// Creates a default, empty <see cref="CubicBezierPath"/>.
/// </summary>
public CubicBezierPath()
{
this.Curves = new List<CubicBezier>();
}
/// <summary>
/// Create a new bezier path, using the provided curve collection
/// to make up the path.
/// </summary>
/// <param name="curves">The curves that this path should be made of.</param>
public CubicBezierPath(List<CubicBezier> curves)
{
Debug.Assert(curves != null);
this.Curves = curves;
}
}
}
| mit | C# |
cb3512f84af32d1809c1e233e170a21499c0071c | Allow indices to be stored for .net assemblies. | sharwell/roslyn,VSadov/roslyn,zooba/roslyn,balajikris/roslyn,Maxwe11/roslyn,mattwar/roslyn,AlekseyTs/roslyn,robinsedlaczek/roslyn,sharadagrawal/Roslyn,jasonmalinowski/roslyn,khyperia/roslyn,lorcanmooney/roslyn,leppie/roslyn,mavasani/roslyn,leppie/roslyn,mmitche/roslyn,xoofx/roslyn,budcribar/roslyn,Pvlerick/roslyn,rgani/roslyn,xasx/roslyn,paulvanbrenk/roslyn,ljw1004/roslyn,ValentinRueda/roslyn,SeriaWei/roslyn,VSadov/roslyn,tmeschter/roslyn,nguerrera/roslyn,Maxwe11/roslyn,yeaicc/roslyn,TyOverby/roslyn,KevinRansom/roslyn,abock/roslyn,wvdd007/roslyn,jhendrixMSFT/roslyn,mattwar/roslyn,CaptainHayashi/roslyn,physhi/roslyn,thomaslevesque/roslyn,akrisiun/roslyn,AlekseyTs/roslyn,eriawan/roslyn,AArnott/roslyn,amcasey/roslyn,jaredpar/roslyn,panopticoncentral/roslyn,jasonmalinowski/roslyn,bkoelman/roslyn,natgla/roslyn,dpoeschl/roslyn,MattWindsor91/roslyn,mavasani/roslyn,davkean/roslyn,drognanar/roslyn,DustinCampbell/roslyn,ericfe-ms/roslyn,MatthieuMEZIL/roslyn,Giftednewt/roslyn,drognanar/roslyn,tvand7093/roslyn,kelltrick/roslyn,lorcanmooney/roslyn,bbarry/roslyn,KiloBravoLima/roslyn,MattWindsor91/roslyn,basoundr/roslyn,stephentoub/roslyn,orthoxerox/roslyn,mavasani/roslyn,AArnott/roslyn,CyrusNajmabadi/roslyn,xasx/roslyn,cston/roslyn,ErikSchierboom/roslyn,jamesqo/roslyn,jmarolf/roslyn,basoundr/roslyn,KiloBravoLima/roslyn,shyamnamboodiripad/roslyn,bbarry/roslyn,KevinRansom/roslyn,orthoxerox/roslyn,balajikris/roslyn,reaction1989/roslyn,bartdesmet/roslyn,heejaechang/roslyn,ericfe-ms/roslyn,rgani/roslyn,michalhosala/roslyn,jmarolf/roslyn,stephentoub/roslyn,gafter/roslyn,akrisiun/roslyn,TyOverby/roslyn,pdelvo/roslyn,ericfe-ms/roslyn,jhendrixMSFT/roslyn,kelltrick/roslyn,KevinH-MS/roslyn,tmat/roslyn,khyperia/roslyn,ljw1004/roslyn,Shiney/roslyn,weltkante/roslyn,jamesqo/roslyn,jeffanders/roslyn,Shiney/roslyn,KirillOsenkov/roslyn,vcsjones/roslyn,CaptainHayashi/roslyn,srivatsn/roslyn,natgla/roslyn,xoofx/roslyn,weltkante/roslyn,tmeschter/roslyn,antonssonj/roslyn,jkotas/roslyn,bbarry/roslyn,aelij/roslyn,swaroop-sridhar/roslyn,ValentinRueda/roslyn,AmadeusW/roslyn,natidea/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mmitche/roslyn,cston/roslyn,sharadagrawal/Roslyn,agocke/roslyn,xasx/roslyn,pdelvo/roslyn,Shiney/roslyn,swaroop-sridhar/roslyn,balajikris/roslyn,Pvlerick/roslyn,budcribar/roslyn,DustinCampbell/roslyn,aelij/roslyn,AArnott/roslyn,khellang/roslyn,MattWindsor91/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,leppie/roslyn,davkean/roslyn,gafter/roslyn,tannergooding/roslyn,brettfo/roslyn,paulvanbrenk/roslyn,wvdd007/roslyn,mgoertz-msft/roslyn,MatthieuMEZIL/roslyn,davkean/roslyn,jmarolf/roslyn,tmat/roslyn,rgani/roslyn,TyOverby/roslyn,khyperia/roslyn,jaredpar/roslyn,dotnet/roslyn,OmarTawfik/roslyn,sharwell/roslyn,abock/roslyn,shyamnamboodiripad/roslyn,VSadov/roslyn,mattscheffer/roslyn,dpoeschl/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,aelij/roslyn,tmeschter/roslyn,mmitche/roslyn,eriawan/roslyn,zooba/roslyn,pdelvo/roslyn,bkoelman/roslyn,wvdd007/roslyn,SeriaWei/roslyn,drognanar/roslyn,brettfo/roslyn,vslsnap/roslyn,jcouv/roslyn,CaptainHayashi/roslyn,jcouv/roslyn,sharadagrawal/Roslyn,kelltrick/roslyn,robinsedlaczek/roslyn,vslsnap/roslyn,a-ctor/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,OmarTawfik/roslyn,jhendrixMSFT/roslyn,KiloBravoLima/roslyn,genlu/roslyn,reaction1989/roslyn,tvand7093/roslyn,AmadeusW/roslyn,budcribar/roslyn,physhi/roslyn,bkoelman/roslyn,amcasey/roslyn,ljw1004/roslyn,MatthieuMEZIL/roslyn,jkotas/roslyn,vcsjones/roslyn,nguerrera/roslyn,natidea/roslyn,agocke/roslyn,AnthonyDGreen/roslyn,tmat/roslyn,KevinH-MS/roslyn,xoofx/roslyn,DustinCampbell/roslyn,vcsjones/roslyn,abock/roslyn,a-ctor/roslyn,diryboy/roslyn,Hosch250/roslyn,akrisiun/roslyn,Giftednewt/roslyn,khellang/roslyn,zooba/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,sharwell/roslyn,a-ctor/roslyn,ErikSchierboom/roslyn,thomaslevesque/roslyn,mgoertz-msft/roslyn,agocke/roslyn,jcouv/roslyn,Hosch250/roslyn,michalhosala/roslyn,nguerrera/roslyn,srivatsn/roslyn,stephentoub/roslyn,physhi/roslyn,khellang/roslyn,yeaicc/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,heejaechang/roslyn,dotnet/roslyn,MichalStrehovsky/roslyn,OmarTawfik/roslyn,mattscheffer/roslyn,CyrusNajmabadi/roslyn,Hosch250/roslyn,diryboy/roslyn,antonssonj/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,yeaicc/roslyn,jkotas/roslyn,brettfo/roslyn,ErikSchierboom/roslyn,tvand7093/roslyn,AnthonyDGreen/roslyn,paulvanbrenk/roslyn,AnthonyDGreen/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,orthoxerox/roslyn,genlu/roslyn,tannergooding/roslyn,cston/roslyn,genlu/roslyn,antonssonj/roslyn,weltkante/roslyn,jeffanders/roslyn,MattWindsor91/roslyn,heejaechang/roslyn,Pvlerick/roslyn,Maxwe11/roslyn,robinsedlaczek/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,ValentinRueda/roslyn,jaredpar/roslyn,mattwar/roslyn,mattscheffer/roslyn,jamesqo/roslyn,jeffanders/roslyn,KevinH-MS/roslyn,michalhosala/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,thomaslevesque/roslyn,KirillOsenkov/roslyn,basoundr/roslyn,lorcanmooney/roslyn,dpoeschl/roslyn,diryboy/roslyn,natgla/roslyn,Giftednewt/roslyn,SeriaWei/roslyn,natidea/roslyn,amcasey/roslyn,reaction1989/roslyn,swaroop-sridhar/roslyn,srivatsn/roslyn,MichalStrehovsky/roslyn,vslsnap/roslyn | src/VisualStudio/Core/Def/Implementation/Serialization/AssemblySerializationInfoService.cs | src/VisualStudio/Core/Def/Implementation/Serialization/AssemblySerializationInfoService.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.Composition;
using System.IO;
using Microsoft.CodeAnalysis.Host.Mef;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Serialization
{
[ExportWorkspaceService(typeof(IAssemblySerializationInfoService), ServiceLayer.Host)]
[Shared]
internal class AssemblySerializationInfoService : IAssemblySerializationInfoService
{
public bool Serializable(Solution solution, string assemblyFilePath)
{
if (assemblyFilePath == null || !File.Exists(assemblyFilePath))
{
return false;
}
// if solution is not from a disk, just create one.
if (solution.FilePath == null || !File.Exists(solution.FilePath))
{
return false;
}
return true;
}
public bool TryGetSerializationPrefixAndVersion(Solution solution, string assemblyFilePath, out string prefix, out VersionStamp version)
{
prefix = FilePathUtilities.GetRelativePath(solution.FilePath, assemblyFilePath);
version = VersionStamp.Create(File.GetLastWriteTimeUtc(assemblyFilePath));
return true;
}
}
}
| // 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.Composition;
using System.IO;
using Microsoft.CodeAnalysis.Host.Mef;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Serialization
{
[ExportWorkspaceService(typeof(IAssemblySerializationInfoService), ServiceLayer.Host)]
[Shared]
internal class AssemblySerializationInfoService : IAssemblySerializationInfoService
{
public bool Serializable(Solution solution, string assemblyFilePath)
{
if (assemblyFilePath == null || !File.Exists(assemblyFilePath) || !ReferencePathUtilities.PartOfFrameworkOrReferencePaths(assemblyFilePath))
{
return false;
}
// if solution is not from a disk, just create one.
if (solution.FilePath == null || !File.Exists(solution.FilePath))
{
return false;
}
return true;
}
public bool TryGetSerializationPrefixAndVersion(Solution solution, string assemblyFilePath, out string prefix, out VersionStamp version)
{
prefix = FilePathUtilities.GetRelativePath(solution.FilePath, assemblyFilePath);
version = VersionStamp.Create(File.GetLastWriteTimeUtc(assemblyFilePath));
return true;
}
}
}
| mit | C# |
078b1bf6661042d34353f107d00978037736817a | Add some symbol kinds | 0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced | Iced/Intel/FormatterOutputTextKind.cs | Iced/Intel/FormatterOutputTextKind.cs | /*
Copyright (C) 2018 de4dot@gmail.com
This file is part of Iced.
Iced 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 of the License, or
(at your option) any later version.
Iced 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 Iced. If not, see <https://www.gnu.org/licenses/>.
*/
#if (!NO_GAS_FORMATTER || !NO_INTEL_FORMATTER || !NO_MASM_FORMATTER || !NO_NASM_FORMATTER) && !NO_FORMATTER
namespace Iced.Intel {
/// <summary>
/// Formatter text kind
/// </summary>
public enum FormatterOutputTextKind {
/// <summary>
/// Normal text
/// </summary>
Text,
/// <summary>
/// Assembler directive
/// </summary>
Directive,
/// <summary>
/// Any prefix
/// </summary>
Prefix,
/// <summary>
/// Any mnemonic
/// </summary>
Mnemonic,
/// <summary>
/// Any keyword
/// </summary>
Keyword,
/// <summary>
/// Any operator
/// </summary>
Operator,
/// <summary>
/// Any punctuation
/// </summary>
Punctuation,
/// <summary>
/// Number
/// </summary>
Number,
/// <summary>
/// Any register
/// </summary>
Register,
/// <summary>
/// Selector value (eg. far jmp/call)
/// </summary>
SelectorValue,
/// <summary>
/// Label address (eg. JE XXXXXX)
/// </summary>
LabelAddress,
/// <summary>
/// Function address (eg. CALL XXXXX)
/// </summary>
FunctionAddress,
/// <summary>
/// Data symbol
/// </summary>
Data,
/// <summary>
/// Label symbol
/// </summary>
Label,
/// <summary>
/// Function symbol
/// </summary>
Function,
}
}
#endif
| /*
Copyright (C) 2018 de4dot@gmail.com
This file is part of Iced.
Iced 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 of the License, or
(at your option) any later version.
Iced 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 Iced. If not, see <https://www.gnu.org/licenses/>.
*/
#if (!NO_GAS_FORMATTER || !NO_INTEL_FORMATTER || !NO_MASM_FORMATTER || !NO_NASM_FORMATTER) && !NO_FORMATTER
namespace Iced.Intel {
/// <summary>
/// Formatter text kind
/// </summary>
public enum FormatterOutputTextKind {
/// <summary>
/// Normal text
/// </summary>
Text,
/// <summary>
/// Assembler directive
/// </summary>
Directive,
/// <summary>
/// Any prefix
/// </summary>
Prefix,
/// <summary>
/// Any mnemonic
/// </summary>
Mnemonic,
/// <summary>
/// Any keyword
/// </summary>
Keyword,
/// <summary>
/// Any operator
/// </summary>
Operator,
/// <summary>
/// Any punctuation
/// </summary>
Punctuation,
/// <summary>
/// Number
/// </summary>
Number,
/// <summary>
/// Any register
/// </summary>
Register,
/// <summary>
/// Selector value (eg. far jmp/call)
/// </summary>
SelectorValue,
/// <summary>
/// Label address (eg. JE XXXXXX)
/// </summary>
LabelAddress,
/// <summary>
/// Function address (eg. CALL XXXXX)
/// </summary>
FunctionAddress,
}
}
#endif
| mit | C# |
edba6c1018637a3b7d35ed33d629daa6de79b259 | Fix xmldoc typo | huoxudong125/NSubstitute,mrinaldi/NSubstitute,jannickj/NSubstitute,dnm240/NSubstitute,iamkoch/NSubstitute,mrinaldi/NSubstitute,jbialobr/NSubstitute,mrinaldi/NSubstitute,jannickj/NSubstitute,dnm240/NSubstitute,jbialobr/NSubstitute,jannickj/NSubstitute,dnm240/NSubstitute,iamkoch/NSubstitute,huoxudong125/NSubstitute,huoxudong125/NSubstitute,huoxudong125/NSubstitute,jbialobr/NSubstitute,iamkoch/NSubstitute,jbialobr/NSubstitute,dnm240/NSubstitute,jannickj/NSubstitute,jbialobr/NSubstitute,jannickj/NSubstitute,huoxudong125/NSubstitute,mrinaldi/NSubstitute,iamkoch/NSubstitute,dnm240/NSubstitute,iamkoch/NSubstitute,mrinaldi/NSubstitute | Source/NSubstitute/Core/WhenCalled.cs | Source/NSubstitute/Core/WhenCalled.cs | using System;
using NSubstitute.Routing;
namespace NSubstitute.Core
{
public class WhenCalled<T>
{
private readonly T _substitute;
private readonly Action<T> _call;
private readonly MatchArgs _matchArgs;
private readonly ICallRouter _callRouter;
private readonly IRouteFactory _routeFactory;
public WhenCalled(ISubstitutionContext context, T substitute, Action<T> call, MatchArgs matchArgs)
{
_substitute = substitute;
_call = call;
_matchArgs = matchArgs;
_callRouter = context.GetCallRouterFor(substitute);
_routeFactory = context.GetRouteFactory();
}
/// <summary>
/// Perform this action when called.
/// </summary>
/// <param name="callbackWithArguments"></param>
public void Do(Action<CallInfo> callbackWithArguments)
{
_callRouter.SetRoute(x => _routeFactory.DoWhenCalled(x, callbackWithArguments, _matchArgs));
_call(_substitute);
}
/// <summary>
/// Do not call the base implementation on future calls. For use with partial substitutes.
/// </summary>
public void DoNotCallBase()
{
_callRouter.SetRoute(x => _routeFactory.DoNotCallBase(x, _matchArgs));
_call(_substitute);
}
/// <summary>
/// Throw the specified exception when called.
/// </summary>
public void Throw(Exception exception)
{
Do(ci => { throw exception; });
}
/// <summary>
/// Throw an exception of the given type when called.
/// </summary>
public TException Throw<TException>() where TException : Exception, new()
{
var exception = new TException();
Do(ci =>
{
throw exception;
});
return exception;
}
/// <summary>
/// Throw an exception generated by the specified function when called.
/// </summary>
public void Throw(Func<CallInfo, Exception> createException)
{
Do(ci => { throw createException(ci); });
}
}
} | using System;
using NSubstitute.Routing;
namespace NSubstitute.Core
{
public class WhenCalled<T>
{
private readonly T _substitute;
private readonly Action<T> _call;
private readonly MatchArgs _matchArgs;
private readonly ICallRouter _callRouter;
private readonly IRouteFactory _routeFactory;
public WhenCalled(ISubstitutionContext context, T substitute, Action<T> call, MatchArgs matchArgs)
{
_substitute = substitute;
_call = call;
_matchArgs = matchArgs;
_callRouter = context.GetCallRouterFor(substitute);
_routeFactory = context.GetRouteFactory();
}
/// <summary>
/// Perform this action when called.
/// </summary>
/// <param name="callbackWithArguments"></param>
public void Do(Action<CallInfo> callbackWithArguments)
{
_callRouter.SetRoute(x => _routeFactory.DoWhenCalled(x, callbackWithArguments, _matchArgs));
_call(_substitute);
}
/// <summary>
/// Do not call the base implementation on future calls. For us with partial substitutes.
/// </summary>
public void DoNotCallBase()
{
_callRouter.SetRoute(x => _routeFactory.DoNotCallBase(x, _matchArgs));
_call(_substitute);
}
/// <summary>
/// Throw the specified exception when called.
/// </summary>
public void Throw(Exception exception)
{
Do(ci => { throw exception; });
}
/// <summary>
/// Throw an exception of the given type when called.
/// </summary>
public TException Throw<TException>() where TException : Exception, new()
{
TException exception = new TException();
Do(ci =>
{
throw exception;
});
return exception;
}
/// <summary>
/// Throw an exception generated by the specified function when called.
/// </summary>
public void Throw(Func<CallInfo, Exception> createException)
{
Do(ci => { throw createException(ci); });
}
}
} | bsd-3-clause | C# |
d4d66da121c9d7336e5073b91ad635e84bec31a7 | Fix merge mistake | yadyn/JabbR,yadyn/JabbR,yadyn/JabbR | JabbR/App_Start/Startup.Migrations.cs | JabbR/App_Start/Startup.Migrations.cs | using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using JabbR.Models;
using JabbR.Models.Migrations;
using JabbR.Services;
namespace JabbR
{
public partial class Startup
{
private const string SqlClient = "System.Data.SqlClient";
private static void DoMigrations(IJabbrConfiguration config)
{
if (String.IsNullOrEmpty(config.SqlConnectionString.ProviderName) ||
!config.SqlConnectionString.ProviderName.Equals(SqlClient, StringComparison.OrdinalIgnoreCase))
{
return;
}
Database.SetInitializer<JabbrContext>(null);
// Only run migrations for SQL server (Sql ce not supported as yet)
var settings = new MigrationsConfiguration();
var migrator = new DbMigrator(settings);
migrator.Update();
}
}
} | using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using JabbR.Models;
using JabbR.Models.Migrations;
using JabbR.Services;
namespace JabbR
{
public partial class Startup
{
private const string SqlClient = "System.Data.SqlClient";
private static void DoMigrations(IJabbrConfiguration config)
{
if (String.IsNullOrEmpty(config.SqlConnectionString.ProviderName) ||
!config.SqlConnectionString.ProviderName.Equals(SqlClient, StringComparison.OrdinalIgnoreCase))
String.IsNullOrEmpty(connectionString.ProviderName) ||
{
return;
}
Database.SetInitializer<JabbrContext>(null);
// Only run migrations for SQL server (Sql ce not supported as yet)
var settings = new MigrationsConfiguration();
var migrator = new DbMigrator(settings);
migrator.Update();
}
}
} | mit | C# |
d8f4b56f0046192dc8c861c278ef7bf5fa44e41f | Adjust pane when going to inline mode to close it | clarkezone/Kliva,AppCreativity/Kliva,timheuer/Kliva-1,JasterAtMicrosoft/Kliva | Kliva/ViewModels/SidePaneViewModel.cs | Kliva/ViewModels/SidePaneViewModel.cs | using Cimbalino.Toolkit.Services;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Kliva.Models;
using Kliva.Views;
using Windows.UI.Xaml.Controls;
namespace Kliva.ViewModels
{
public class SidePaneViewModel : KlivaBaseViewModel
{
private bool _isPaneOpen = false;
public bool IsPaneOpen
{
get { return _isPaneOpen; }
set { Set(() => IsPaneOpen, ref _isPaneOpen, value); }
}
private SplitViewDisplayMode _displayMode = SplitViewDisplayMode.CompactOverlay;
public SplitViewDisplayMode DisplayMode
{
get { return _displayMode; }
set { Set(() => DisplayMode, ref _displayMode, value); }
}
private RelayCommand _hamburgerCommand;
public RelayCommand HamburgerCommand => _hamburgerCommand ?? (_hamburgerCommand = new RelayCommand(() => this.IsPaneOpen = !this.IsPaneOpen));
private RelayCommand _settingsCommand;
public RelayCommand SettingsCommand => _settingsCommand ?? (_settingsCommand = new RelayCommand(() => _navigationService.Navigate<SettingsPage>()));
public SidePaneViewModel(INavigationService navigationService) : base(navigationService)
{
}
internal void ShowHide(bool show)
{
if (show)
this.DisplayMode = SplitViewDisplayMode.CompactOverlay;
else
{
this.DisplayMode = SplitViewDisplayMode.Inline;
this.IsPaneOpen = false;
}
}
}
}
| using Cimbalino.Toolkit.Services;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Kliva.Models;
using Kliva.Views;
using Windows.UI.Xaml.Controls;
namespace Kliva.ViewModels
{
public class SidePaneViewModel : KlivaBaseViewModel
{
private bool _isPaneOpen = true;
public bool IsPaneOpen
{
get { return _isPaneOpen; }
set { Set(() => IsPaneOpen, ref _isPaneOpen, value); }
}
private bool _isPaneVisible = true;
public bool IsPaneVisible
{
get { return _isPaneVisible; }
set { Set(() => IsPaneVisible, ref _isPaneVisible, value); }
}
private SplitViewDisplayMode _displayMode = SplitViewDisplayMode.CompactOverlay;
public SplitViewDisplayMode DisplayMode
{
get { return _displayMode; }
set { Set(() => DisplayMode, ref _displayMode, value); }
}
private RelayCommand _hamburgerCommand;
public RelayCommand HamburgerCommand => _hamburgerCommand ?? (_hamburgerCommand = new RelayCommand(() => this.IsPaneOpen = !this.IsPaneOpen));
private RelayCommand _settingsCommand;
public RelayCommand SettingsCommand => _settingsCommand ?? (_settingsCommand = new RelayCommand(() => _navigationService.Navigate<SettingsPage>()));
public SidePaneViewModel(INavigationService navigationService) : base(navigationService)
{
}
internal void ShowHide(bool show)
{
if (show)
this.DisplayMode = SplitViewDisplayMode.CompactOverlay;
else
this.DisplayMode = SplitViewDisplayMode.Inline;
this.IsPaneVisible = show;
}
}
}
| mit | C# |
2eb5e302a1d81cff6d4886fc3e5f342f18211704 | Fix broken test | cityindex-attic/CIAPI.CS,cityindex-attic/CIAPI.CS,cityindex-attic/CIAPI.CS | src/CIAPI.Tests/PrettyPrinterExtensionsFixture.cs | src/CIAPI.Tests/PrettyPrinterExtensionsFixture.cs | using System;
using System.Threading;
using CIAPI.DTO;
using CIAPI.Streaming;
using NUnit.Framework;
namespace CIAPI.Tests
{
[TestFixture]
public class PrettyPrinterExtensionsFixture
{
[Test]
public void CreateStringWithValuesOfEachPublicProperty()
{
var dto = new TheDto
{
AnInt = 12,
AString = "No place like 127.0.0.1",
ADate = new DateTime(2011, 02, 03, 13, 24, 45, 111),
ABool = false
};
Assert.AreEqual("TheDto: \n\tAnInt=12\tAString=No place like 127.0.0.1\tADate=2011-02-03 13:24:45Z\tABool=False\n", dto.ToStringWithValues());
}
private class TheDto
{
public int AnInt { get; set; }
public string AString { get; set; }
public DateTime ADate { get; set; }
public bool ABool { get; set; }
private int _secret = 42;
}
}
}
| using System;
using System.Threading;
using CIAPI.DTO;
using CIAPI.Streaming;
using NUnit.Framework;
namespace CIAPI.Tests
{
[TestFixture]
public class PrettyPrinterExtensionsFixture
{
[Test]
public void CreateStringWithValuesOfEachPublicProperty()
{
var dto = new TheDto
{
AnInt = 12,
AString = "No place like 127.0.0.1",
ADate = new DateTime(2011, 02, 03, 13, 24, 45, 111),
ABool = false
};
Assert.AreEqual("TheDto: \n\tAnInt=12\tAString=No place like 127.0.0.1\tADate=2011-02-03 13:24:45Z\tABool=False", dto.ToStringWithValues());
}
private class TheDto
{
public int AnInt { get; set; }
public string AString { get; set; }
public DateTime ADate { get; set; }
public bool ABool { get; set; }
private int _secret = 42;
}
}
}
| apache-2.0 | C# |
4fb584ee77c76898a3875ad066fed969cb8a6f5b | Add some tests for CassetteApplication.OnPostMapRequestHandler. | BluewireTechnologies/cassette,andrewdavey/cassette,honestegg/cassette,damiensawyer/cassette,damiensawyer/cassette,honestegg/cassette,BluewireTechnologies/cassette,andrewdavey/cassette,honestegg/cassette,andrewdavey/cassette,damiensawyer/cassette | src/Cassette.UnitTests/Web/CassetteApplication.cs | src/Cassette.UnitTests/Web/CassetteApplication.cs | #region License
/*
Copyright 2011 Andrew Davey
This file is part of Cassette.
Cassette is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Cassette is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
Cassette. If not, see http://www.gnu.org/licenses/.
*/
#endregion
using System.Collections.Generic;
using System.Web;
using System.Web.Routing;
using Cassette.HtmlTemplates;
using Cassette.IO;
using Cassette.Scripts;
using Cassette.Stylesheets;
using Cassette.UI;
using Moq;
using Should;
using Xunit;
namespace Cassette.Web
{
public class CassetteApplication_OnPostMapRequestHandler_Tests
{
[Fact]
public void GivenHtmlRewritingEnabled_WhenOnPostMapRequestHandler_ThenPlaceholderTrackerAddedToContextItems()
{
var application = StubApplication();
application.HtmlRewritingEnabled = true;
var context = new Mock<HttpContextBase>();
var items = new Dictionary<string, object>();
context.SetupGet(c => c.Items).Returns(items);
application.OnPostMapRequestHandler(context.Object);
items[typeof(IPlaceholderTracker).FullName].ShouldBeType<PlaceholderTracker>();
}
[Fact]
public void GivenHtmlRewritingDisabled_WhenOnPostMapRequestHandler_ThenNullPlaceholderTrackerAddedToContextItems()
{
var application = StubApplication();
application.HtmlRewritingEnabled = false;
var context = new Mock<HttpContextBase>();
var items = new Dictionary<string, object>();
context.SetupGet(c => c.Items).Returns(items);
application.OnPostMapRequestHandler(context.Object);
items[typeof(IPlaceholderTracker).FullName].ShouldBeType<NullPlaceholderTracker>();
}
static CassetteApplication StubApplication()
{
return new CassetteApplication(
new[] { new StubConfig() },
Mock.Of<IDirectory>(),
Mock.Of<IDirectory>(),
false,
"",
new UrlGenerator(""),
new RouteCollection(),
() => null
);
}
class StubConfig : ICassetteConfiguration
{
public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
{
moduleConfiguration.Add(Mock.Of<IModuleSource<ScriptModule>>());
moduleConfiguration.Add(Mock.Of<IModuleSource<StylesheetModule>>());
moduleConfiguration.Add(Mock.Of<IModuleSource<HtmlTemplateModule>>());
}
}
}
}
| #region License
/*
Copyright 2011 Andrew Davey
This file is part of Cassette.
Cassette is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
Cassette is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
Cassette. If not, see http://www.gnu.org/licenses/.
*/
#endregion
namespace Cassette.Web
{
// TODO: Add tests for CassetteApplication
}
| mit | C# |
3a5155066012e818f964236a36c927ca7aa3e450 | Use the parameterless contructor from Obselete Portal Helper | robsiera/Dnn.Platform,valadas/Dnn.Platform,EPTamminga/Dnn.Platform,valadas/Dnn.Platform,RichardHowells/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,robsiera/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,EPTamminga/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,RichardHowells/Dnn.Platform,RichardHowells/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,mitchelsellers/Dnn.Platform,RichardHowells/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,EPTamminga/Dnn.Platform,bdukes/Dnn.Platform | src/Dnn.PersonaBar.Library/Helper/PortalHelper.cs | src/Dnn.PersonaBar.Library/Helper/PortalHelper.cs | using DotNetNuke.Entities.Portals;
using System;
namespace Dnn.PersonaBar.Library.Helper
{
public class PortalHelper
{
private static readonly IContentVerifier _contentVerifier = new ContentVerifier();
[Obsolete("Deprecated in 9.2.1. Use IContentVerifier.IsContentExistsForRequestedPortal")]
public static bool IsContentExistsForRequestedPortal(int contentPortalId, PortalSettings portalSettings, bool checkForSiteGroup = false)
{
return _contentVerifier.IsContentExistsForRequestedPortal(contentPortalId, portalSettings, checkForSiteGroup);
}
}
}
| using DotNetNuke.Entities.Portals;
using System;
using System.Linq;
namespace Dnn.PersonaBar.Library.Helper
{
public class PortalHelper
{
private static readonly IContentVerifier _contentVerifier = new ContentVerifier(PortalController.Instance, PortalGroupController.Instance);
[Obsolete("Deprecated in 9.2.1. Use IContentVerifier.IsContentExistsForRequestedPortal")]
public static bool IsContentExistsForRequestedPortal(int contentPortalId, PortalSettings portalSettings, bool checkForSiteGroup = false)
{
return _contentVerifier.IsContentExistsForRequestedPortal(contentPortalId, portalSettings, checkForSiteGroup);
}
}
}
| mit | C# |
4124bc7fe28d6c51b72158b7d20f471a1308c110 | Increase timeout to prevent cibuild failures | bkoelman/TestableFileSystem | src/Fakes.Tests/Specs/FakeWatcher/WatcherSpecs.cs | src/Fakes.Tests/Specs/FakeWatcher/WatcherSpecs.cs | namespace TestableFileSystem.Fakes.Tests.Specs.FakeWatcher
{
public abstract class WatcherSpecs
{
protected const int NotifyWaitTimeoutMilliseconds = 1000;
protected const int SleepTimeToEnsureOperationHasArrivedAtWatcherConsumerLoop = 250;
// TODO: Add specs for File.Encrypt/Decrypt, File.Lock/Unlock, File.Replace, Begin+EndRead/Write
// TODO: Add specs for Directory.GetLogicalDrives
}
}
| namespace TestableFileSystem.Fakes.Tests.Specs.FakeWatcher
{
public abstract class WatcherSpecs
{
protected const int NotifyWaitTimeoutMilliseconds = 500;
protected const int SleepTimeToEnsureOperationHasArrivedAtWatcherConsumerLoop = 250;
// TODO: Add specs for File.Encrypt/Decrypt, File.Lock/Unlock, File.Replace, Begin+EndRead/Write
// TODO: Add specs for Directory.GetLogicalDrives
}
}
| apache-2.0 | C# |
3949d46383b6adece23f0e43445ee92b3ff31585 | Add test fix to other test | UselessToucan/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,ppy/osu,johnneijzen/osu,NeoAdonis/osu,smoogipoo/osu,2yangk23/osu,EVAST9919/osu,ZLima12/osu,peppy/osu,peppy/osu,peppy/osu-new,ppy/osu,smoogipoo/osu,johnneijzen/osu,ZLima12/osu,EVAST9919/osu,NeoAdonis/osu,NeoAdonis/osu,2yangk23/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu | osu.Game.Tests/Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs | osu.Game.Tests/Visual/UserInterface/TestSceneHoldToConfirmOverlay.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneHoldToConfirmOverlay : OsuTestScene
{
protected override double TimePerAction => 100; // required for the early exit test, since hold-to-confirm delay is 200ms
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ExitConfirmOverlay),
typeof(HoldToConfirmContainer),
};
public TestSceneHoldToConfirmOverlay()
{
bool fired = false;
var firedText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Fired!",
Font = OsuFont.GetFont(size: 50),
Alpha = 0,
};
var overlay = new TestHoldToConfirmOverlay
{
Action = () =>
{
fired = true;
firedText.FadeTo(1).Then().FadeOut(1000);
}
};
Children = new Drawable[]
{
overlay,
firedText
};
AddStep("start confirming", () => overlay.Begin());
AddStep("abort confirming", () => overlay.Abort());
AddAssert("ensure aborted", () => !fired);
AddStep("start confirming", () => overlay.Begin());
AddUntilStep("wait until confirmed", () => fired);
}
private class TestHoldToConfirmOverlay : ExitConfirmOverlay
{
protected override bool AllowMultipleFires => true;
public void Begin() => BeginConfirm();
public void Abort() => AbortConfirm();
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneHoldToConfirmOverlay : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ExitConfirmOverlay),
typeof(HoldToConfirmContainer),
};
public TestSceneHoldToConfirmOverlay()
{
bool fired = false;
var firedText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Fired!",
Font = OsuFont.GetFont(size: 50),
Alpha = 0,
};
var overlay = new TestHoldToConfirmOverlay
{
Action = () =>
{
fired = true;
firedText.FadeTo(1).Then().FadeOut(1000);
}
};
Children = new Drawable[]
{
overlay,
firedText
};
AddStep("start confirming", () => overlay.Begin());
AddStep("abort confirming", () => overlay.Abort());
AddAssert("ensure aborted", () => !fired);
AddStep("start confirming", () => overlay.Begin());
AddUntilStep("wait until confirmed", () => fired);
}
private class TestHoldToConfirmOverlay : ExitConfirmOverlay
{
protected override bool AllowMultipleFires => true;
public void Begin() => BeginConfirm();
public void Abort() => AbortConfirm();
}
}
}
| mit | C# |
6f6ff7c57b03dc69e294be83ccabe7f8f054be3f | Switch to cake-contrib | Redth/Cake.Json,Redth/Cake.Json | setup.cake | setup.cake | #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Json",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Json",
appVeyorAccountName: "cakecontrib",
shouldRunDotNetCorePack: true,
shouldRunDupFinder: false,
shouldRunInspectCode: false);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/Cake.Json.Tests/*.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[FakeItEasy]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore();
| #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Json",
repositoryOwner: "redth",
repositoryName: "Cake.Json",
appVeyorAccountName: "redth",
shouldRunDotNetCorePack: true,
shouldRunDupFinder: false,
shouldRunInspectCode: false);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/Cake.Json.Tests/*.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[FakeItEasy]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore();
| apache-2.0 | C# |
8afb33ff0df96906801aa57a43c9a193880d48ec | Move to cake-contrib | Redth/Cake.SemVer | setup.cake | setup.cake | #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.SemVer",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.SemVer",
appVeyorAccountName: "cakecontrib",
shouldRunDotNetCorePack: true,
shouldRunDupFinder: false,
shouldRunInspectCode: false);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/Cake.SemVer.Tests/*.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[FakeItEasy]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore();
| #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.SemVer",
repositoryOwner: "redth",
repositoryName: "Cake.SemVer",
appVeyorAccountName: "redth",
shouldRunDotNetCorePack: true,
shouldRunDupFinder: false,
shouldRunInspectCode: false);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
BuildParameters.RootDirectoryPath + "/Cake.SemVer.Tests/*.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[FakeItEasy]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore();
| mit | C# |
976fc17a4d5002d7933ba81eda8558d25deb0633 | Change property "Value" | KonH/UnityCache | Assets/UnityCache/Scripts/Cached.cs | Assets/UnityCache/Scripts/Cached.cs | using UnityEngine;
namespace UnityCache {
/// <summary>
/// Experimental feature:
/// You can make instance of this component in our script and use it for lazy initialization
/// Pro:
/// - You can cache external dependencies by passing its GameObject to constructor
/// Contra:
/// - You want to explicit create all instances (definition and initialization)
/// </summary>
/// <typeparam name="T">Any component</typeparam>
public class Cached<T> where T : Component {
GameObject _target = null;
bool _isCached = false;
T _component = null;
public Cached(GameObject target) {
_target = target;
}
public T Value {
get {
if ( !_isCached ) {
_component = _target.GetComponent<T>();
_isCached = true;
}
return _component;
}
}
public T SafeValue {
get {
if ( _target ) {
if ( !_component ) {
_component = _target.GetComponent<T>();
}
return _component;
}
return null;
}
}
}
}
| using UnityEngine;
namespace UnityCache {
/// <summary>
/// Experimental feature:
/// You can make instance of this component in our script and use it for lazy initialization
/// Pro:
/// - You can cache external dependencies by passing its GameObject to constructor
/// Contra:
/// - You want to explicit create all instances (definition and initialization)
/// </summary>
/// <typeparam name="T">Any component</typeparam>
public class Cached<T> where T : Component {
GameObject _target = null;
bool _isCached = false;
T _component = null;
public Cached(GameObject target) {
_target = target;
}
public T Value {
get {
if ( !_isCached ) {
_component = _target.GetComponent<T>();
_isCached = false;
}
return _component;
}
}
public T SafeValue {
get {
if ( _target ) {
if ( !_component ) {
_component = _target.GetComponent<T>();
}
return _component;
}
return null;
}
}
}
}
| mit | C# |
66103e17de24dcbcb0c81ee02f125fe94c8b5583 | Exit VR with tilt | aornelas/Tiny-Planets,aornelas/Tiny-Planets | Assets/_Scripts/PlanetController.cs | Assets/_Scripts/PlanetController.cs | using UnityEngine;
using System.Collections;
public class PlanetController : MonoBehaviour {
public Transform referencePoint;
public GameObject nextPlanet;
void Start () {
Debug.Log("Started " + this.name);
}
void OnEnable() {
Debug.Log("Enabled " + this.name);
OrientTowardsReference();
}
void Update () {
OrientTowardsReference();
if (GvrViewer.Instance.Tilted) {
GvrViewer.Instance.VRModeEnabled = false;
}
if (GvrViewer.Instance.Triggered) {
Debug.Log("Triggered " + this.name);
this.gameObject.SetActive(false);
nextPlanet.SetActive(true);
}
}
/**
* Rotate the planet to face the reference point, which makes the planet rotate relative to the camera
*/
private void OrientTowardsReference() {
this.transform.LookAt(referencePoint);
}
}
| using UnityEngine;
using System.Collections;
public class PlanetController : MonoBehaviour {
public Transform referencePoint;
public GameObject nextPlanet;
void Start () {
Debug.Log("Started " + this.name);
OrientTowardsReference();
}
void Update () {
OrientTowardsReference();
if (GvrViewer.Instance.Triggered) {
Debug.Log("Triggered " + this.name);
this.gameObject.SetActive(false);
nextPlanet.SetActive(true);
}
}
/**
* Rotate the planet to face the reference point, which makes the planet rotate relative to the camera
*/
public void OrientTowardsReference() {
this.transform.LookAt(referencePoint);
}
}
| mit | C# |
6aa2ffc4f7fc9578d351d6926f407f70c54dc968 | Change signatures | sakapon/Blaze | Blaze/Blaze/Propositions/Formula.cs | Blaze/Blaze/Propositions/Formula.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace Blaze.Propositions
{
public abstract class Formula
{
public abstract Formula[] Children { get; }
public abstract bool? IsTrue { get; }
internal static Formula[] EmptyFormulas { get; } = new Formula[0];
public static Formula True { get; } = new ConstantFormula(true);
public static Formula False { get; } = new ConstantFormula(false);
public static VariableFormula<TStatement> Variable<TStatement>(TStatement statement) => new VariableFormula<TStatement>(statement);
public static Formula Imply(Formula v1, Formula v2) => new ImplicationFormula(v1, v2);
public static Formula Equivalent(Formula v1, Formula v2) => new EquivalenceFormula(v1, v2);
public static Formula And(IEnumerable<Formula> formulas) => formulas.Aggregate((v1, v2) => v1 & v2);
public static Formula Or(IEnumerable<Formula> formulas) => formulas.Aggregate((v1, v2) => v1 | v2);
public static Formula Xor(IEnumerable<Formula> formulas) => formulas.Aggregate((v1, v2) => v1 ^ v2);
public static Formula operator !(Formula v) => new NegationFormula(v);
public static Formula operator &(Formula v1, Formula v2) => new AndFormula(v1, v2);
public static Formula operator |(Formula v1, Formula v2) => new OrFormula(v1, v2);
public static Formula operator ^(Formula v1, Formula v2) => new XorFormula(v1, v2);
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace Blaze.Propositions
{
public abstract class Formula
{
public abstract Formula[] Children { get; }
public abstract bool? IsTrue { get; }
internal static Formula[] EmptyFormulas { get; } = new Formula[0];
public static Formula True { get; } = new ConstantFormula(true);
public static Formula False { get; } = new ConstantFormula(false);
public static Formula Variable<TStatement>(TStatement statement) => new VariableFormula<TStatement>(statement);
public static Formula Imply(Formula v1, Formula v2) => new ImplicationFormula(v1, v2);
public static Formula Equivalent(Formula v1, Formula v2) => new EquivalenceFormula(v1, v2);
public static Formula And(IEnumerable<Formula> formulas) => formulas.Aggregate((v1, v2) => v1 & v2);
public static Formula Or(IEnumerable<Formula> formulas) => formulas.Aggregate((v1, v2) => v1 | v2);
public static Formula Xor(IEnumerable<Formula> formulas) => formulas.Aggregate((v1, v2) => v1 ^ v2);
public static Formula operator !(Formula v) => new NegationFormula(v);
public static Formula operator &(Formula v1, Formula v2) => new AndFormula(v1, v2);
public static Formula operator |(Formula v1, Formula v2) => new OrFormula(v1, v2);
public static Formula operator ^(Formula v1, Formula v2) => new XorFormula(v1, v2);
}
}
| mit | C# |
535637d3ba3300f414e13a57ba8ea0fc2a91bb6a | Fix bug with date from CKAN API not being converted from UTC to local | DenverDev/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API,DenverDev/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API,opencolorado/.NET-Wrapper-for-CKAN-API | CkanDotNet.Api/Helper/DateHelper.cs | CkanDotNet.Api/Helper/DateHelper.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace CkanDotNet.Api.Helper
{
public static class DateHelper
{
/// <summary>
/// Parse a date/time string.
/// </summary>
/// <param name="dateString"></param>
/// <returns></returns>
public static DateTime Parse(string dateString)
{
// Remove any line breaks
dateString = dateString.Replace("\n", "");
dateString = dateString.Replace("\r", "");
// Remove any surrounding quotes
if (dateString.StartsWith("\"") && dateString.EndsWith("\""))
{
dateString = dateString.Substring(1, dateString.Length - 2);
}
var formats = new[] {
"u",
"s",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'",
"yyyy-MM-ddTHH:mm:ssZ",
"yyyy-MM-dd HH:mm:ssZ",
"yyyy-MM-ddTHH:mm:ss",
"yyyy-MM-ddTHH:mm:sszzzzzz",
"yyyy-MM-ddTHH:mm:ss.ffffff",
"yyyy-MM-dd HH:mm:ss.ffffff",
"M/d/yyyy h:mm:ss tt" // default format for invariant culture
};
DateTime date;
if (DateTime.TryParseExact(dateString, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
{
date = TimeZoneInfo.ConvertTimeFromUtc(date,TimeZoneInfo.Local);
return date;
}
return DateTime.MinValue;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace CkanDotNet.Api.Helper
{
public static class DateHelper
{
/// <summary>
/// Parse a date/time string.
/// </summary>
/// <param name="dateString"></param>
/// <returns></returns>
public static DateTime Parse(string dateString)
{
// Remove any line breaks
dateString = dateString.Replace("\n", "");
dateString = dateString.Replace("\r", "");
// Remove any surrounding quotes
if (dateString.StartsWith("\"") && dateString.EndsWith("\""))
{
dateString = dateString.Substring(1, dateString.Length - 2);
}
var formats = new[] {
"u",
"s",
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'",
"yyyy-MM-ddTHH:mm:ssZ",
"yyyy-MM-dd HH:mm:ssZ",
"yyyy-MM-ddTHH:mm:ss",
"yyyy-MM-ddTHH:mm:sszzzzzz",
"yyyy-MM-ddTHH:mm:ss.ffffff",
"yyyy-MM-dd HH:mm:ss.ffffff",
"M/d/yyyy h:mm:ss tt" // default format for invariant culture
};
DateTime date;
if (DateTime.TryParseExact(dateString, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
{
return date;
}
return DateTime.MinValue;
}
}
}
| apache-2.0 | C# |
2179f6085409b6eb52ab30724a3ed3a80fdc468f | Update the appveyor account | jeyjeyemem/Xer.Cqrs | setup.cake | setup.cake | #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./Src",
title: "Xer.Cqrs",
solutionFilePath: "./Xer.Cqrs.sln",
repositoryOwner: "XerProjects",
repositoryName: "Xer.Cqrs",
appVeyorAccountName: "xerprojects-bot",
testFilePattern: "/**/*Tests.csproj",
testDirectoryPath: "./Tests",
shouldRunDupFinder: false,
shouldRunDotNetCorePack: true);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore();
| #load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
Environment.SetVariableNames();
BuildParameters.SetParameters(context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./Src",
title: "Xer.Cqrs",
solutionFilePath: "./Xer.Cqrs.sln",
repositoryOwner: "XerProjects",
repositoryName: "Xer.Cqrs",
appVeyorAccountName: "mvput",
testFilePattern: "/**/*Tests.csproj",
testDirectoryPath: "./Tests",
shouldRunDupFinder: false,
shouldRunDotNetCorePack: true);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context,
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Build.RunDotNetCore(); | mit | C# |
bc2adc55fcbe0e6dc8345ced5e4f1ab1c5a851b1 | Update MatthewSoucoup.cs | MabroukENG/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,stvansolano/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin | src/Firehose.Web/Authors/MatthewSoucoup.cs | src/Firehose.Web/Authors/MatthewSoucoup.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MatthewSoucoup : IAmAMicrosoftMVP, IAmAXamarinMVP
{
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://codemilltech.com/feed/"); }
}
public string FirstName => "Matthew";
public string LastName => "Soucoup";
public string StateOrRegion => "Madison, WI";
public string EmailAddress => "msoucoup@codemilltech.com";
public string ShortBioOrTagLine => "";
public Uri WebSite => new Uri("https://codemilltech.com");
public string TwitterHandle => "codemillmatt";
public string GravatarHash => "df69069a0bffd2dae5a8700a1bef7bfd";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(43.0730520, -89.4012300);
}
}
| using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class MatthewSoucoup : IAmAMicrosoftMVP, IAmAXamarinMVP
{
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://codemilltech.com/feed/"); }
}
public string FirstName => "Matthew";
public string LastName => "Soucoup";
public string StateOrRegion => "Madison, WI";
public string EmailAddress => "msoucoup@codemilltech.com";
public string ShortBioOrTagLine => "Principal";
public Uri WebSite => new Uri("https://codemilltech.com");
public string TwitterHandle => "codemillmatt";
public string GravatarHash => "df69069a0bffd2dae5a8700a1bef7bfd";
public string GitHubHandle => string.Empty;
public GeoPosition Position => new GeoPosition(43.0730520, -89.4012300);
}
} | mit | C# |
476265018699af7fc746f5268b55f77883af4158 | 修改 Index view. | NemoChenTW/MvcMovie,NemoChenTW/MvcMovie,NemoChenTW/MvcMovie | src/MvcMovie/Views/HelloWorld/Index.cshtml | src/MvcMovie/Views/HelloWorld/Index.cshtml | @{
ViewData["Title"] = "Index";
}
<h2>Index</h2>
<p>Hello from our View Template!</p> | @*
For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
| apache-2.0 | C# |
20b51398f2e5e2b616a23f9581003a919bf33824 | Bump the build version. | exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml,exKAZUu/Code2Xml | Code2Xml.Core/Properties/AssemblyInfo.cs | Code2Xml.Core/Properties/AssemblyInfo.cs | #region License
// Copyright (C) 2011-2012 Kazunori Sakamoto
//
// 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.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("Code2Xml.Core")]
[assembly:
AssemblyDescription(
"Code2Xml is a parser library that interconverts source code and xml files supporting multiple programming languages."
)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kazunori Sakamoto")]
[assembly: AssemblyProduct("Code2Xml.Core")]
[assembly: AssemblyCopyright("Copyright © Kazunori Sakamoto 2011-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e289e42c-2fe6-45d5-842f-406c7f691cad")]
// 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.10")]
[assembly: AssemblyFileVersion("1.0.0.10")] | #region License
// Copyright (C) 2011-2012 Kazunori Sakamoto
//
// 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.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("Code2Xml")]
[assembly:
AssemblyDescription(
"Code2Xml is a parser library that interconverts source code and xml files supporting multiple programming languages."
)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Kazunori Sakamoto")]
[assembly: AssemblyProduct("Code2Xml")]
[assembly: AssemblyCopyright("Copyright © Kazunori Sakamoto 2011-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e289e42c-2fe6-45d5-842f-406c7f691cad")]
// 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.10")]
[assembly: AssemblyFileVersion("1.0.0.10")] | apache-2.0 | C# |
f8bde743dcf8a3180b45df7239d5a7de314de1cc | Change the wait example to a mock login page. | matthewrwilton/SeleniumExamples,matthewrwilton/SeleniumExamples | ExampleWebApp/Views/Examples/Wait.cshtml | ExampleWebApp/Views/Examples/Wait.cshtml | @{
ViewBag.Title = "ComboLoad";
}
<div class="row">
<div class="col-md-12">
<h2>Example page for testing waits</h2>
<p class="alert alert-danger" id="message" style="display:none"></p>
<div>
<div class="form-group">
<label for="username">Username</label>
<input type="email" class="form-control" id="username" placeholder="Username">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password">
</div>
<button type="button" class="btn btn-default" id="login">Log in</button>
</div>
</div>
</div>
@section scripts {
<script>
$(document).ready(function () {
var loginButton = $("#login");
loginButton.on("click", function () {
var usernameTxt = $("#username"),
username = usernameTxt[0].value
passwordTxt = $("#password"),
password = passwordTxt[0].value;
// Timeout to simulate making login request.
setTimeout(function () {
if (username === "user" && password === "password") {
window.location = "/";
}
else {
var messageContainer = $("#message");
messageContainer.text("Invalid username and password.")
messageContainer.css("display", "");
}
},
2 * 1000);
});
});
</script>
}
| @{
ViewBag.Title = "ComboLoad";
}
<div class="row">
<div class="col-md-12">
<h2>Example page for testing waits</h2>
<p>The following combo starts with a placeholder option and after 3 seconds updates with a new item.</p>
<select id="combo" >
<option>Placeholder</option>
</select>
</div>
</div>
@section scripts {
<script>
$(document).ready(function () {
var combo = $("#combo");
// Simulate loading the combo items from another source.
// Wait 3 seconds then update the combo.
setTimeout(function () {
combo.empty();
combo.append(
$("<option id=\"loaded\"></option>").text("Loaded")
);
},
3 * 1000);
});
</script>
}
| mit | C# |
3e60bac49043c2b0324b1a8a3a979b431ac34a04 | return to nice situation | IlyasGaripov/Math-Shapes | MathShapesProject/Assets/Scripts/Game.cs | MathShapesProject/Assets/Scripts/Game.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Game : MonoBehaviour {
private int coins;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Game : MonoBehaviour {
private int VeryBadSituation;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
| mit | C# |
05459ec5d94a983eef0c3358afa3c5db4a5ebf3b | Update QrCodeScanningService.cs | rhinorust/MoMa | Moma/Moma.Droid/QrCodeScanningService.cs | Moma/Moma.Droid/QrCodeScanningService.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using ZXing.Mobile;
using System.Threading.Tasks;
using Moma.Droid;
[assembly: Dependency(typeof(QrCodeScanningService))]
namespace Moma.Droid
{
class QrCodeScanningService: IQrCodeScanningService
{
IJavascriptInterface js;
public async Task<string> ScanAsync()
{
var scanner = new MobileBarcodeScanner();
var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.QR_CODE
};
var scanResults = await scanner.Scan(options);
//js.CallJs("showQRText(" + scanResults.Text + ");");
if (scanResults != null) {
return scanResults.Text;
}
else
{
return "";
}
return scanResults.Text;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using ZXing.Mobile;
using System.Threading.Tasks;
using Moma.Droid;
[assembly: Dependency(typeof(QrCodeScanningService))]
namespace Moma.Droid
{
class QrCodeScanningService: IQrCodeScanningService
{
IJavascriptInterface js;
public async Task<string> ScanAsync()
{
var scanner = new MobileBarcodeScanner();
var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.QR_CODE
};
var scanResults = await scanner.Scan(options);
//js.CallJs("showQRText(" + scanResults.Text + ");");
return scanResults.Text;
}
}
} | mit | C# |
be760faa935f2f56797497155c6653f110cb6006 | Fix Read-Palettes not counting tile number. | Prof9/PixelPet | PixelPet/CLI/Commands/ReadPalettesCmd.cs | PixelPet/CLI/Commands/ReadPalettesCmd.cs | using LibPixelPet;
using System;
using System.Linq;
namespace PixelPet.CLI.Commands {
internal class ReadPalettesCmd : CliCommand {
public ReadPalettesCmd()
: base("Read-Palettes",
new Parameter("format", "f", false, new ParameterValue("name", nameof(ColorFormat.BGRA8888))),
new Parameter("palette-number", "pn", false, new ParameterValue("number", "-1")),
new Parameter("palette-size", "ps", false, new ParameterValue("count", "" + int.MaxValue))
) { }
public override void Run(Workbench workbench, ILogger logger) {
string fmtName = FindNamedParameter("--format").Values[0].ToString();
int palNum = FindNamedParameter("--palette-number").Values[0].ToInt32();
int palSize = FindNamedParameter("--palette-size").Values[0].ToInt32();
if (palNum < -1) {
logger?.Log("Invalid palette number.", LogLevel.Error);
return;
}
if (palSize < 1) {
logger?.Log("Invalid palette size.", LogLevel.Error);
return;
}
if (!(ColorFormat.GetFormat(fmtName) is ColorFormat fmt)) {
logger?.Log("Unknown color format \"" + fmtName + "\".", LogLevel.Error);
return;
}
TileCutter cutter = new TileCutter(8, 8);
int ti = 0;
int addedColors = 0;
int addedPalettes = 0;
Palette pal = null;
foreach (Tile tile in cutter.CutTiles(workbench.Bitmap)) {
// Grab color from tile.
int color = tile[0, 0];
foreach (int otherColor in tile.EnumerateTile().Skip(1)) {
if (otherColor != color) {
logger?.Log("Palette tile " + ti + " is not a single color.", LogLevel.Error);
return;
}
}
// Create new palette if needed.
if (pal == null) {
pal = new Palette(fmt, palSize);
}
// Add finished palette to palette set.
pal.Add(color, ColorFormat.BGRA8888);
addedColors++;
// Add finished palette to palette set.
if (pal.Count >= palSize) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
addedPalettes++;
pal = null;
}
ti++;
}
if (pal != null) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
}
logger?.Log("Read " + addedPalettes + " palettes with " + addedColors + " colors total.");
}
}
}
| using LibPixelPet;
using System;
using System.Linq;
namespace PixelPet.CLI.Commands {
internal class ReadPalettesCmd : CliCommand {
public ReadPalettesCmd()
: base("Read-Palettes",
new Parameter("format", "f", false, new ParameterValue("name", nameof(ColorFormat.BGRA8888))),
new Parameter("palette-number", "pn", false, new ParameterValue("number", "-1")),
new Parameter("palette-size", "ps", false, new ParameterValue("count", "" + int.MaxValue))
) { }
public override void Run(Workbench workbench, ILogger logger) {
string fmtName = FindNamedParameter("--format").Values[0].ToString();
int palNum = FindNamedParameter("--palette-number").Values[0].ToInt32();
int palSize = FindNamedParameter("--palette-size").Values[0].ToInt32();
if (palNum < -1) {
logger?.Log("Invalid palette number.", LogLevel.Error);
return;
}
if (palSize < 1) {
logger?.Log("Invalid palette size.", LogLevel.Error);
return;
}
if (!(ColorFormat.GetFormat(fmtName) is ColorFormat fmt)) {
logger?.Log("Unknown color format \"" + fmtName + "\".", LogLevel.Error);
return;
}
TileCutter cutter = new TileCutter(8, 8);
int ti = 0;
int addedColors = 0;
int addedPalettes = 0;
Palette pal = null;
foreach (Tile tile in cutter.CutTiles(workbench.Bitmap)) {
// Grab color from tile.
int color = tile[0, 0];
foreach (int otherColor in tile.EnumerateTile().Skip(1)) {
if (otherColor != color) {
logger?.Log("Palette tile " + ti + " is not a single color.", LogLevel.Error);
return;
}
}
// Create new palette if needed.
if (pal == null) {
pal = new Palette(fmt, palSize);
}
// Add finished palette to palette set.
pal.Add(color, ColorFormat.BGRA8888);
addedColors++;
// Add finished palette to palette set.
if (pal.Count >= palSize) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
addedPalettes++;
pal = null;
}
}
if (pal != null) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
}
logger?.Log("Read " + addedPalettes + " palettes with " + addedColors + " colors total.");
}
}
}
| mit | C# |
f4f8917315bde244820b1d0d4fea6dc25fa26f83 | add custom presenter to setup | dkataskin/bstrkr | bstrkr.mobile/bstrkr.android/Setup.cs | bstrkr.mobile/bstrkr.android/Setup.cs | using Android.Content;
using Cirrious.CrossCore;
using Cirrious.CrossCore.Platform;
using Cirrious.MvvmCross.Binding.Bindings.Target.Construction;
using Cirrious.MvvmCross.Droid.Platform;
using Cirrious.MvvmCross.ViewModels;
using bstrkr.core.android.config;
using bstrkr.core.android.services;
using bstrkr.core.android.services.location;
using bstrkr.core.android.services.resources;
using bstrkr.core.config;
using bstrkr.core.services.location;
using bstrkr.core.services.resources;
using bstrkr.mvvm;
using bstrkr.mvvm.views;
using bstrkr.android.views;
using Xamarin;
using Cirrious.MvvmCross.Droid.Views;
using bstrkr.core.android.presenters;
namespace bstrkr.android
{
public class Setup : MvxAndroidSetup
{
public Setup(Context applicationContext) : base(applicationContext)
{
Insights.Initialize("<your_key_here>", applicationContext);
}
protected override void InitializeFirstChance()
{
Mvx.LazyConstructAndRegisterSingleton<IConfigManager, ConfigManager>();
Mvx.LazyConstructAndRegisterSingleton<ILocationService, SuperLocationService>();
Mvx.LazyConstructAndRegisterSingleton<IResourceManager, ResourceManager>();
Mvx.RegisterSingleton<ICustomPresenter>(new CustomPresenter());
base.InitializeFirstChance();
}
protected override IMvxApplication CreateApp()
{
return new BusTrackerApp();
}
protected override IMvxTrace CreateDebugTrace()
{
return new DebugTrace();
}
protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
{
registry.RegisterCustomBindingFactory<MonoDroidGoogleMapsView>(
"Zoom",
mapView => new MapViewZoomTargetBinding(mapView));
base.FillTargetFactories(registry);
}
protected override IMvxAndroidViewPresenter CreateViewPresenter()
{
return Mvx.Resolve<ICustomPresenter>();
}
}
} | using Android.Content;
using Cirrious.CrossCore;
using Cirrious.CrossCore.Platform;
using Cirrious.MvvmCross.Binding.Bindings.Target.Construction;
using Cirrious.MvvmCross.Droid.Platform;
using Cirrious.MvvmCross.ViewModels;
using bstrkr.core.android.config;
using bstrkr.core.android.services;
using bstrkr.core.android.services.location;
using bstrkr.core.android.services.resources;
using bstrkr.core.config;
using bstrkr.core.services.location;
using bstrkr.core.services.resources;
using bstrkr.mvvm;
using bstrkr.mvvm.views;
using bstrkr.android.views;
using Xamarin;
namespace bstrkr.android
{
public class Setup : MvxAndroidSetup
{
public Setup(Context applicationContext) : base(applicationContext)
{
Insights.Initialize("<your_key_here>", applicationContext);
}
protected override void InitializeFirstChance()
{
Mvx.LazyConstructAndRegisterSingleton<IConfigManager, ConfigManager>();
Mvx.LazyConstructAndRegisterSingleton<ILocationService, SuperLocationService>();
Mvx.LazyConstructAndRegisterSingleton<IResourceManager, ResourceManager>();
base.InitializeFirstChance();
}
protected override IMvxApplication CreateApp()
{
return new BusTrackerApp();
}
protected override IMvxTrace CreateDebugTrace()
{
return new DebugTrace();
}
protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
{
registry.RegisterCustomBindingFactory<MonoDroidGoogleMapsView>(
"Zoom",
mapView => new MapViewZoomTargetBinding(mapView));
base.FillTargetFactories(registry);
}
}
} | bsd-2-clause | C# |
55e84fc04900eea3257dccc8eebb588eb8391c28 | update to the version number | UweKeim/aspnetserve,UweKeim/aspnetserve,UweKeim/aspnetserve,UweKeim/aspnetserve | CommonAssemblyInfo.cs | CommonAssemblyInfo.cs | using System.Reflection;
[assembly: AssemblyCompany("Jason Whitehorn")]
[assembly: AssemblyCopyright("Copyright © 2006-2008 Jason Whitehorn")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")] | using System.Reflection;
[assembly: AssemblyCompany("Jason Whitehorn")]
[assembly: AssemblyCopyright("Copyright © 2006-2008 Jason Whitehorn")]
[assembly: AssemblyVersion("1.3.0.99")]
[assembly: AssemblyFileVersion("1.3.0.99")] | bsd-3-clause | C# |
50d3b2494f1f1ba752f92bdf67279f02580924f0 | add Icon support to AlertDialogBckend | directhex/xwt,iainx/xwt,mono/xwt,mminns/xwt,lytico/xwt,hamekoz/xwt,mminns/xwt,antmicro/xwt,residuum/xwt,cra0zy/xwt,hwthomas/xwt,akrisiun/xwt,steffenWi/xwt,TheBrainTech/xwt | Xwt.Mac/Xwt.Mac/AlertDialogBackend.cs | Xwt.Mac/Xwt.Mac/AlertDialogBackend.cs | //
// AlertDialogBackend.cs
//
// Author:
// Thomas Ziegler <ziegler.thomas@web.de>
//
// Copyright (c) 2012 Thomas Ziegler
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using MonoMac.AppKit;
using MonoMac.Foundation;
using Xwt.Backends;
using Xwt.Drawing;
namespace Xwt.Mac
{
public class AlertDialogBackend : NSAlert, IAlertDialogBackend
{
ApplicationContext Context;
public AlertDialogBackend ()
{
}
public AlertDialogBackend (System.IntPtr intptr)
{
}
public void Initialize (ApplicationContext actx)
{
Context = actx;
}
#region IAlertDialogBackend implementation
public Command Run (WindowFrame transientFor, MessageDescription message)
{
this.MessageText = (message.Text != null) ? message.Text : String.Empty;
this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty;
if (message.Icon != null)
Icon = message.Icon.ToImageDescription (Context).ToNSImage ();
var sortedButtons = new Command [message.Buttons.Count];
var j = 0;
if (message.DefaultButton >= 0) {
sortedButtons [0] = message.Buttons [message.DefaultButton];
this.AddButton (message.Buttons [message.DefaultButton].Label);
j = 1;
}
for (var i = 0; i < message.Buttons.Count; i++) {
if (i == message.DefaultButton)
continue;
sortedButtons [j++] = message.Buttons [i];
this.AddButton (message.Buttons [i].Label);
}
return sortedButtons [this.RunModal () - 1000];
}
public bool ApplyToAll { get; set; }
#endregion
}
}
| //
// AlertDialogBackend.cs
//
// Author:
// Thomas Ziegler <ziegler.thomas@web.de>
//
// Copyright (c) 2012 Thomas Ziegler
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using MonoMac.AppKit;
using MonoMac.Foundation;
using Xwt.Backends;
using Xwt.Drawing;
namespace Xwt.Mac
{
public class AlertDialogBackend : NSAlert, IAlertDialogBackend
{
public AlertDialogBackend ()
{
}
public AlertDialogBackend (System.IntPtr intptr)
{
}
public void Initialize (ApplicationContext actx)
{
}
#region IAlertDialogBackend implementation
public Command Run (WindowFrame transientFor, MessageDescription message)
{
this.MessageText = (message.Text != null) ? message.Text : String.Empty;
this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty;
//TODO Set Icon
var sortedButtons = new Command [message.Buttons.Count];
var j = 0;
if (message.DefaultButton >= 0) {
sortedButtons [0] = message.Buttons [message.DefaultButton];
this.AddButton (message.Buttons [message.DefaultButton].Label);
j = 1;
}
for (var i = 0; i < message.Buttons.Count; i++) {
if (i == message.DefaultButton)
continue;
sortedButtons [j++] = message.Buttons [i];
this.AddButton (message.Buttons [i].Label);
}
return sortedButtons [this.RunModal () - 1000];
}
public bool ApplyToAll { get; set; }
#endregion
}
}
| mit | C# |
a091a2f905a8ada6d47f44ff865dc82f3374e8fe | use random int to place checkbox | peterhumbert/YARTE | YARTE/YARTE/Buttons/CheckboxButton.cs | YARTE/YARTE/Buttons/CheckboxButton.cs | using System.Drawing;
using YARTE.Properties;
using System;
namespace YARTE.UI.Buttons
{
public class CheckboxButton : IHTMLEditorButton
{
public void IconClicked(ButtonArgs args)
{
Random t = new Random();
string valueToReplace = t.Next().ToString();
args.Editor.InsertTextAtCursor(valueToReplace); // place random int in checkbox's position
string html = args.Editor.Html;
html = html.Replace(valueToReplace, "<input type=\"checkbox\">"); // place checkbox
args.Editor.Html = html; // reload
}
public Image IconImage
{
get
{
return Resources.insertcheckbox;
}
}
public string IconName
{
get { return "Insert Checkbox"; }
}
public string IconTooltip
{
get { return "Insert Checkbox"; }
}
public string CommandIdentifier
{
get { return ""; }
}
}
}
| using System.Drawing;
using YARTE.Properties;
using System;
namespace YARTE.UI.Buttons
{
public class CheckboxButton : IHTMLEditorButton
{
public void IconClicked(ButtonArgs args)
{
args.Editor.InsertTextAtCursor("123456789");
string html = args.Editor.Html;
html = html.Replace("123456789", "<input type=\"checkbox\">");
Console.WriteLine(html.ToCharArray()[html.ToCharArray().Length-3]);
args.Editor.Html = "";
args.Editor.Html = html;
}
public Image IconImage
{
get
{
return Resources.insertcheckbox;
}
}
public string IconName
{
get { return "Insert Checkbox"; }
}
public string IconTooltip
{
get { return "Insert Checkbox"; }
}
public string CommandIdentifier
{
get { return "Bold"; }
}
}
}
| apache-2.0 | C# |
d3be7180fe2bdffe1be6f1034bdfa771ad1a34a7 | Fix bug where repo name was used instead of organization in the links. | rprouse/GetChanges | GetChanges/Program.cs | GetChanges/Program.cs | using Nito.AsyncEx;
using Octokit;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Alteridem.GetChanges
{
class Program
{
static int Main(string[] args)
{
var options = new Options();
if (!CommandLine.Parser.Default.ParseArguments(args, options))
{
return -1;
}
AsyncContext.Run(() => MainAsync(options));
//Console.WriteLine("*** Press ENTER to Exit ***");
//Console.ReadLine();
return 0;
}
static async void MainAsync(Options options)
{
var github = new GitHubApi(options.Organization, options.Repository);
var milestones = await github.GetOpenMilestones();
foreach (var milestone in milestones.Where(m => m.DueOn != null && m.DueOn.Value.Subtract(DateTimeOffset.Now).TotalDays < 30))
{
var milestoneIssues = await github.GetClosedIssuesForMilestone(milestone);
DisplayIssuesForMilestone(options, milestone.Title, milestoneIssues);
}
}
static void DisplayIssuesForMilestone(Options options, string milestone, IEnumerable<Issue> issues)
{
Console.WriteLine("## {0}", milestone);
Console.WriteLine();
foreach (var issue in issues)
{
if(options.LinkIssues)
Console.WriteLine($" * [{issue.Number:####}](https://github.com/{options.Organization}/{options.Repository}/issues/{issue.Number}) {issue.Title}");
else
Console.WriteLine($" * {issue.Number:####} {issue.Title}");
}
Console.WriteLine();
}
}
}
| using Nito.AsyncEx;
using Octokit;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Alteridem.GetChanges
{
class Program
{
static int Main(string[] args)
{
var options = new Options();
if (!CommandLine.Parser.Default.ParseArguments(args, options))
{
return -1;
}
AsyncContext.Run(() => MainAsync(options));
//Console.WriteLine("*** Press ENTER to Exit ***");
//Console.ReadLine();
return 0;
}
static async void MainAsync(Options options)
{
var github = new GitHubApi(options.Organization, options.Repository);
var milestones = await github.GetOpenMilestones();
foreach (var milestone in milestones.Where(m => m.DueOn != null && m.DueOn.Value.Subtract(DateTimeOffset.Now).TotalDays < 30))
{
var milestoneIssues = await github.GetClosedIssuesForMilestone(milestone);
DisplayIssuesForMilestone(options, milestone.Title, milestoneIssues);
}
}
static void DisplayIssuesForMilestone(Options options, string milestone, IEnumerable<Issue> issues)
{
Console.WriteLine("## {0}", milestone);
Console.WriteLine();
foreach (var issue in issues)
{
if(options.LinkIssues)
Console.WriteLine($" * [{issue.Number:####}](https://github.com/{options.Repository}/{options.Repository}/issues/{issue.Number}) {issue.Title}");
else
Console.WriteLine($" * {issue.Number:####} {issue.Title}");
}
Console.WriteLine();
}
}
}
| mit | C# |
8bfed285fae886f766e2df57134bccb590c7e4bd | Update version to 2.7.0 | TheOtherTimDuncan/TOTD | SharedAssemblyInfo.cs | SharedAssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.7.0.0")]
[assembly: AssemblyFileVersion("2.7.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.0.0")]
[assembly: AssemblyFileVersion("2.6.0.0")]
| mit | C# |
3a576d2a4b863c4b7984e3e854316519f253e5a5 | Increment minor -> 0.10.0 | awseward/Bugsnag.NET,awseward/Bugsnag.NET | SharedAssemblyInfo.cs | SharedAssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.10.0.0")]
[assembly: AssemblyFileVersion("0.10.0.0")]
[assembly: AssemblyInformationalVersion("0.10.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.9.1.0")]
[assembly: AssemblyFileVersion("0.9.1.0")]
[assembly: AssemblyInformationalVersion("0.9.1")]
| mit | C# |
569cb0743f9b4274843e965a5618d3efdd38a411 | Update version to 1.6.0 | TheOtherTimDuncan/TOTD-Mailer | SharedAssemblyInfo.cs | SharedAssemblyInfo.cs | using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyProduct("TOTD Mailer")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
| using System.Reflection;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Other Tim Duncan")]
[assembly: AssemblyProduct("TOTD Mailer")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
| mit | C# |
822b6cd015f5c5ebe13bb3b8ea281c0ab68d7199 | Add note about what your dod is | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Models/RequestAccessModel.cs | Battery-Commander.Web/Models/RequestAccessModel.cs | using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Web.Models
{
public class RequestAccessModel
{
public String Name { get; set; }
public String Email { get; set; }
[Display(Name = "DOD ID (10 Digits, On Your CAC)")]
public String DoDId { get; set; }
public int Unit { get; set; }
public IEnumerable<SelectListItem> Units { get; set; }
}
} | using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace BatteryCommander.Web.Models
{
public class RequestAccessModel
{
public String Name { get; set; }
public String Email { get; set; }
[Display(Name = "DOD ID")]
public String DoDId { get; set; }
public int Unit { get; set; }
public IEnumerable<SelectListItem> Units { get; set; }
}
} | mit | C# |
8dbc0d6d85f08560399ceccc501a1b711cac3438 | Convert Web Api project to C# 5 | DimitarDKirov/RealEstateSystem,DimitarDKirov/RealEstateSystem,DimitarDKirov/RealEstateSystem | RealEstateWebApi/Tests/Teleimot.Web.Api.Tests/Setups/Services.cs | RealEstateWebApi/Tests/Teleimot.Web.Api.Tests/Setups/Services.cs | namespace Teleimot.Web.Api.Tests.Setups
{
using Teleimot.Services.Data;
using Teleimot.Services.Data.Contracts;
public static class Services
{
public static ICommentsService CommentsService
{
get
{
return new CommentsService(Repositories.CommentsRepository, Repositories.RealEstatessRepository);
}
}
}
}
| namespace Teleimot.Web.Api.Tests.Setups
{
using Teleimot.Services.Data;
using Teleimot.Services.Data.Contracts;
public static class Services
{
public static ICommentsService CommentsService => new CommentsService(Repositories.CommentsRepository, Repositories.RealEstatessRepository);
}
}
| mit | C# |
0764372723ff48994acea1797186c16225b34f55 | Fix button Id | hishamco/WebForms,hishamco/WebForms | samples/WebFormsSample/Pages/Calculator.htm.designer.cs | samples/WebFormsSample/Pages/Calculator.htm.designer.cs | namespace WebFormsSample.Pages
{
public partial class Calculator
{
private global::My.AspNetCore.WebForms.Controls.TextBox txtNumber1;
private global::My.AspNetCore.WebForms.Controls.TextBox txtNumber2;
private global::My.AspNetCore.WebForms.Controls.Button btnAdd;
private global::My.AspNetCore.WebForms.Controls.Literal litResult;
#region Web Form Designer generated code
private void InitializeComponent()
{
txtNumber1 = new global::My.AspNetCore.WebForms.Controls.TextBox();
txtNumber2 = new global::My.AspNetCore.WebForms.Controls.TextBox();
btnAdd = new global::My.AspNetCore.WebForms.Controls.Button();
litResult = new global::My.AspNetCore.WebForms.Controls.Literal();
//
// txtNumber1
//
this.txtNumber1.Name = "txtNumber1";
//
// txtNumber2
//
this.txtNumber2.Name = "txtNumber2";
//
// btnAdd
//
this.btnAdd.Name = "btnAdd";
this.btnAdd.Text = "Add";
this.btnAdd.Click += btnAdd_Click;
//
// litResult
//
this.litResult.Name = "litResult";
this.Controls.Add(txtNumber1);
this.Controls.Add(txtNumber2);
this.Controls.Add(btnAdd);
this.Controls.Add(litResult);
}
#endregion
}
}
| namespace WebFormsSample.Pages
{
public partial class Calculator
{
private global::My.AspNetCore.WebForms.Controls.TextBox txtNumber1;
private global::My.AspNetCore.WebForms.Controls.TextBox txtNumber2;
private global::My.AspNetCore.WebForms.Controls.Button bntAdd;
private global::My.AspNetCore.WebForms.Controls.Literal litResult;
#region Web Form Designer generated code
private void InitializeComponent()
{
txtNumber1 = new global::My.AspNetCore.WebForms.Controls.TextBox();
txtNumber2 = new global::My.AspNetCore.WebForms.Controls.TextBox();
bntAdd = new global::My.AspNetCore.WebForms.Controls.Button();
litResult = new global::My.AspNetCore.WebForms.Controls.Literal();
//
// txtNumber1
//
this.txtNumber1.Name = "txtNumber1";
//
// txtNumber2
//
this.txtNumber2.Name = "txtNumber2";
//
// btnAdd
//
this.bntAdd.Name = "btnAdd";
this.bntAdd.Text = "Add";
this.bntAdd.Click += btnAdd_Click;
//
// litResult
//
this.litResult.Name = "litResult";
this.Controls.Add(txtNumber1);
this.Controls.Add(txtNumber2);
this.Controls.Add(bntAdd);
this.Controls.Add(litResult);
}
#endregion
}
}
| mit | C# |
133553bfb13c3fc45a8f94fd6c2c5ad7e40f8309 | Test was missed. | RadioSystems/Cake.ActiveDirectory | src/Cake.ActiveDirectory.Tests/UserFindTests.cs | src/Cake.ActiveDirectory.Tests/UserFindTests.cs | using NSubstitute;
using System;
using Cake.ActiveDirectory.Tests.Fixture;
using Landpy.ActiveDirectory.Core;
using Should;
using Should.Core.Assertions;
namespace Cake.ActiveDirectory.Tests {
public sealed class UserFindTests {
public void Should_Throw_If_ProxyAddress_Is_Null() {
// Given
var adOperator = Substitute.For<IADOperator>();
var fixture = new UserFindFixture(adOperator);
fixture.ProxyAddress = null;
// When
var result = Record.Exception(() => fixture.FindUserByProxyAddress());
// Then
result.ShouldBeType<ArgumentNullException>().ParamName.ShouldEqual("proxyAddress");
}
}
}
| using NSubstitute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cake.ActiveDirectory.Tests.Fixture;
using Landpy.ActiveDirectory.Core;
using Should;
using Should.Core.Assertions;
namespace Cake.ActiveDirectory.Tests {
public sealed class UserFindTests {
public void Should_Throw_If_ProxyAddress_Is_Null() {
// Given
var adOperator = Substitute.For<IADOperator>();
var fixture = new UserFindFixture(adOperator);
fixture.ProxyAddress = null;
// When
var result = Record.Exception(() => fixture.FindUserByProxyAddress());
// Then
result.ShouldBeType<ArgumentNullException>().ParamName.ShouldEqual("proxyAddress");
}
}
}
| apache-2.0 | C# |
0cd6e0a02f6781e5b85169cd25225e1141296537 | Make DesktopElement not sealed so that clients can extend it with properties that find windows. | toroso/ruibarbo | ruibarbo.core/DesktopElement.cs | ruibarbo.core/DesktopElement.cs | using System.Collections.Generic;
using ruibarbo.core.ElementFactory;
namespace ruibarbo.core
{
public class DesktopElement : ISearchSourceElement
{
internal DesktopElement()
{
}
public string Name
{
get { return "Desktop"; }
}
public string Class
{
get { return "Desktop"; }
}
public IEnumerable<object> NativeChildren
{
get { return ElementFactory.ElementFactory.GetRootElements(); }
}
public object NativeParent
{
get { return null; }
}
public string FoundBy
{
get { return string.Empty; }
}
public ISearchSourceElement SearchParent
{
get { return null; }
}
public int InstanceId
{
get { return GetHashCode(); }
}
public bool IsVisible
{
get { return true; }
}
public bool IsEnabled
{
get { return true; }
}
public void Click()
{
}
public void DoubleClick()
{
}
}
} | using System.Collections.Generic;
using ruibarbo.core.ElementFactory;
namespace ruibarbo.core
{
public sealed class DesktopElement : ISearchSourceElement
{
internal DesktopElement()
{
}
public string Name
{
get { return "Desktop"; }
}
public string Class
{
get { return "Desktop"; }
}
public IEnumerable<object> NativeChildren
{
get { return ElementFactory.ElementFactory.GetRootElements(); }
}
public object NativeParent
{
get { return null; }
}
public string FoundBy
{
get { return string.Empty; }
}
public ISearchSourceElement SearchParent
{
get { return null; }
}
public int InstanceId
{
get { return GetHashCode(); }
}
public bool IsVisible
{
get { return true; }
}
public bool IsEnabled
{
get { return true; }
}
public void Click()
{
}
public void DoubleClick()
{
}
}
} | apache-2.0 | C# |
0a4757db24e7f3e4e35bc6e4a6707db3fa1bf982 | Write out raw HTML if SubMessage contains any | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EAS.Web/Views/Shared/_SuccessMessage.cshtml | src/SFA.DAS.EAS.Web/Views/Shared/_SuccessMessage.cshtml | @using SFA.DAS.EAS.Web
@using SFA.DAS.EAS.Web.Models
@model dynamic
@{
var viewModel = Model as OrchestratorResponse;
}
@if (!string.IsNullOrEmpty(viewModel?.FlashMessage?.Message) || !string.IsNullOrEmpty(viewModel?.FlashMessage?.SubMessage))
{
<div class="grid-row">
<div class="column-full">
<div class="@viewModel.FlashMessage.SeverityCssClass">
@if (!string.IsNullOrWhiteSpace(viewModel.FlashMessage.Headline))
{
<h1 class="@(viewModel.FlashMessage.Severity == FlashMessageSeverityLevel.Error ? "bold-medium" : "bold-large")">@viewModel.FlashMessage.Headline</h1>
}
@if (!string.IsNullOrEmpty(viewModel.FlashMessage.Message))
{
<p>@Html.Raw(viewModel.FlashMessage.Message)</p>
}
@if (!string.IsNullOrEmpty(viewModel.FlashMessage.SubMessage))
{
<p>@Html.Raw(viewModel.FlashMessage.SubMessage)</p>
}
@if (viewModel.FlashMessage.ErrorMessages.Any())
{
<ul class="error-summary-list">
@foreach (var errorMessage in viewModel.FlashMessage.ErrorMessages)
{
<li>
<a class="danger" href="#@errorMessage.Key">@errorMessage.Value</a>
</li>
}
</ul>
}
</div>
</div>
</div>
} | @using SFA.DAS.EAS.Web
@using SFA.DAS.EAS.Web.Models
@model dynamic
@{
var viewModel = Model as OrchestratorResponse;
}
@if (!string.IsNullOrEmpty(viewModel?.FlashMessage?.Message) || !string.IsNullOrEmpty(viewModel?.FlashMessage?.SubMessage))
{
<div class="grid-row">
<div class="column-full">
<div class="@viewModel.FlashMessage.SeverityCssClass">
@if (!string.IsNullOrWhiteSpace(viewModel.FlashMessage.Headline))
{
<h1 class="@(viewModel.FlashMessage.Severity == FlashMessageSeverityLevel.Error ? "bold-medium" : "bold-large")">@viewModel.FlashMessage.Headline</h1>
}
@if (!string.IsNullOrEmpty(viewModel.FlashMessage.Message))
{
<p>@Html.Raw(viewModel.FlashMessage.Message)</p>
}
@if (!string.IsNullOrEmpty(viewModel.FlashMessage.SubMessage))
{
<p>@viewModel.FlashMessage.SubMessage</p>
}
@if (viewModel.FlashMessage.ErrorMessages.Any())
{
<ul class="error-summary-list">
@foreach (var errorMessage in viewModel.FlashMessage.ErrorMessages)
{
<li>
<a class="danger" href="#@errorMessage.Key">@errorMessage.Value</a>
</li>
}
</ul>
}
</div>
</div>
</div>
} | mit | C# |
e559fddfb1fbb6a73e9e834b2f4014bf63c2bd74 | Fix exit codes, reset console colors after changing them | oledid-dotnet/xslt-cli | CLI/Program.cs | CLI/Program.cs | using System;
using System.IO;
namespace CLI
{
internal class Program
{
private enum ExitCodes
{
Success = 0,
Error = 1
}
internal static int Main(string[] args)
{
var parsedArgs = new ArgsParser(args);
if (parsedArgs.IsValid(File.Exists))
{
return (int)Execute(parsedArgs.Source, parsedArgs.Transform, parsedArgs.OutFile);
}
Console.WriteLine(parsedArgs.ErrorMessage);
return (int)ExitCodes.Error;
}
private static ExitCodes Execute(string source, string transform, string outFile)
{
Exception writeException = null;
var outFileInfo = new FileInfo(outFile);
var output = XslTransformer.Transform(new FileInfo(source), new FileInfo(transform));
if (output.IsSuccessful && TryWriteFile(output.Result, outFileInfo, out writeException))
{
Console.WriteLine($"Output written to: {outFileInfo.FullName}");
Console.WriteLine($"Took {output.Duration:ss} seconds {output.Duration:fff} milliseconds.");
return ExitCodes.Success;
}
Console.WriteLine("An error occurred:");
Console.ForegroundColor = ConsoleColor.Red;
Console.BackgroundColor = ConsoleColor.Black;
Console.WriteLine(output.Exception?.ToString() ?? writeException?.ToString() ?? "Please create an issue at https://github.com/oledid/dotnet-xslt-cli/issues");
Console.ResetColor();
return ExitCodes.Error;
}
private static bool TryWriteFile(string outputResult, FileInfo outFileInfo, out Exception writeException)
{
try
{
File.WriteAllText(outFileInfo.FullName, outputResult, UTF8withoutBOM.Lazy.Value);
writeException = null;
return true;
}
catch (Exception exception)
{
writeException = exception;
return false;
}
}
}
}
| using System;
using System.IO;
namespace CLI
{
class Program
{
static void Main(string[] args)
{
var parsedArgs = new ArgsParser(args);
if (parsedArgs.IsValid(File.Exists))
{
Execute(parsedArgs.Source, parsedArgs.Transform, parsedArgs.OutFile);
}
else
{
Console.WriteLine(parsedArgs.ErrorMessage);
}
}
private static void Execute(string source, string transform, string outFile)
{
Exception writeException = null;
var outFileInfo = new FileInfo(outFile);
var output = XslTransformer.Transform(new FileInfo(source), new FileInfo(transform));
if (output.IsSuccessful && TryWriteFile(output.Result, outFileInfo, out writeException))
{
Console.WriteLine($"Output written to: {outFileInfo.FullName}");
Console.WriteLine($"Took {output.Duration:ss} seconds {output.Duration:fff} milliseconds.");
return;
}
Console.WriteLine("An error occurred:");
Console.ForegroundColor = ConsoleColor.Red;
Console.BackgroundColor = ConsoleColor.Black;
Console.WriteLine(output.Exception?.ToString() ?? writeException?.ToString() ?? "Please create an issue at https://github.com/oledid/dotnet-xslt-cli/issues");
}
private static bool TryWriteFile(string outputResult, FileInfo outFileInfo, out Exception writeException)
{
try
{
File.WriteAllText(outFileInfo.FullName, outputResult, UTF8withoutBOM.Lazy.Value);
writeException = null;
return true;
}
catch (Exception exception)
{
writeException = exception;
return false;
}
}
}
}
| mit | C# |
cf7b326c4b56959d275835bd9fe1a995c2e7766e | change namespace for extension methods | albx/CorePatterns | src/CorePatterns.AspNetCore/Extensions/ServiceCollectionExtensions.cs | src/CorePatterns.AspNetCore/Extensions/ServiceCollectionExtensions.cs | using CorePatterns.AspNetCore.Commands;
using CorePatterns.AspNetCore.Events;
using CorePatterns.Commands;
using CorePatterns.Events;
using Microsoft.Extensions.DependencyInjection;
namespace CorePatterns.AspNetCore
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddCommandBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
services.AddSingleton<ICommandBus>(new CommandBus(serviceProvider));
return services;
}
public static ICommandBus CommandBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
return serviceProvider.GetService<ICommandBus>();
}
public static IServiceCollection AddEventBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
services.AddSingleton<IEventBus>(new EventBus(serviceProvider, serviceProvider.GetService<IEventStore>()));
return services;
}
public static IEventBus EventBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
return serviceProvider.GetService<IEventBus>();
}
}
}
| using CorePatterns.AspNetCore.Commands;
using CorePatterns.AspNetCore.Events;
using CorePatterns.Commands;
using CorePatterns.Events;
using Microsoft.Extensions.DependencyInjection;
namespace CorePatterns.AspNetCore.Extensions
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddCommandBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
services.AddSingleton<ICommandBus>(new CommandBus(serviceProvider));
return services;
}
public static ICommandBus CommandBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
return serviceProvider.GetService<ICommandBus>();
}
public static IServiceCollection AddEventBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
services.AddSingleton<IEventBus>(new EventBus(serviceProvider, serviceProvider.GetService<IEventStore>()));
return services;
}
public static IEventBus EventBus(this IServiceCollection services)
{
var serviceProvider = services.BuildServiceProvider();
return serviceProvider.GetService<IEventBus>();
}
}
}
| mit | C# |
af620db2da7a00d1d82046c0aab52d2f9d6adca3 | Add WriteJson to MixedDateTimeConverter | timheuer/alexa-skills-dotnet,stoiveyp/alexa-skills-dotnet | Alexa.NET/Helpers/MixedDateTimeConverter.cs | Alexa.NET/Helpers/MixedDateTimeConverter.cs | using System;
using Newtonsoft.Json;
namespace Alexa.NET.Helpers
{
public class MixedDateTimeConverter : Newtonsoft.Json.Converters.DateTimeConverterBase
{
static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteValue(value);
}
public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.ValueType == typeof(DateTime))
{
return reader.Value;
}
if(reader.ValueType == typeof(long))
{
return UtcFromEpoch((long)reader.Value);
}
if (reader.ValueType == typeof(String))
{
return DateTime.Parse(reader.Value.ToString());
}
return UtcFromEpoch(((long)reader.Value));
}
private DateTime UtcFromEpoch(long epochTime)
{
return UnixEpoch.AddMilliseconds(epochTime);
}
}
}
| using System;
using Newtonsoft.Json;
namespace Alexa.NET.Helpers
{
public class MixedDateTimeConverter : Newtonsoft.Json.Converters.DateTimeConverterBase
{
static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
// TODO: We may need to future add something here. Right now this is only used in Request reader
}
public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer)
{
if(reader.ValueType == typeof(DateTime))
{
return reader.Value;
}
if(reader.ValueType == typeof(long))
{
return UtcFromEpoch((long)reader.Value);
}
if (reader.ValueType == typeof(String))
{
return DateTime.Parse(reader.Value.ToString());
}
return UtcFromEpoch(((long)reader.Value));
}
private DateTime UtcFromEpoch(long epochTime)
{
return UnixEpoch.AddMilliseconds(epochTime);
}
}
}
| mit | C# |
067e37081738b7261967160a5257c7c78da85f34 | Update version | batstyx/Shamanic | Shamanic/Properties/AssemblyInfo.cs | Shamanic/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("Shamanic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Shamanic")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("06753ba1-7691-4266-9dfb-b2bc5d6116a2")]
// 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.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Shamanic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Shamanic")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("06753ba1-7691-4266-9dfb-b2bc5d6116a2")]
// 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.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
| mit | C# |
3c73f35481e5d1c144787f55548c575e5a9cefb9 | Update CombatUse.cs (#3285) | LtRipley36706/ACE,LtRipley36706/ACE,ACEmulator/ACE,ACEmulator/ACE,LtRipley36706/ACE,ACEmulator/ACE | Source/ACE.Entity/Enum/CombatUse.cs | Source/ACE.Entity/Enum/CombatUse.cs | namespace ACE.Entity.Enum
{
public enum CombatUse : byte
{
None = 0x00,
Melee = 0x01,
Missile = 0x02,
Ammo = 0x03,
Shield = 0x04,
TwoHanded = 0x05
}
}
| namespace ACE.Entity.Enum
{
public enum CombatUse : byte
{
None = 0x00,
Melee = 0x01,
Missle = 0x02,
Ammo = 0x03,
Shield = 0x04,
TwoHanded = 0x05
}
}
| agpl-3.0 | C# |
689a29b08c19019947be033eb77464ab4db391b1 | Build revision update. | jduv/AppDomainToolkit | AppDomainToolkit/Properties/AssemblyInfo.cs | AppDomainToolkit/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("AppDomain Toolkit")]
[assembly: AssemblyDescription("A small toolkit for manipulating .NET application domains.")]
[assembly: AssemblyProduct("AppDomainToolkit")]
[assembly: AssemblyCopyright("Copyright © Jeremy Duvall, 2012")]
// 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("8220c5ce-9cb4-485f-ae78-f2a9f2cbd754")]
// Versioning
[assembly: AssemblyVersion("1.0.1.3")]
// Unit tests.
[assembly: InternalsVisibleTo("AppDomainToolkit.UnitTests")] | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AppDomain Toolkit")]
[assembly: AssemblyDescription("A small toolkit for manipulating .NET application domains.")]
[assembly: AssemblyProduct("AppDomainToolkit")]
[assembly: AssemblyCopyright("Copyright © Jeremy Duvall, 2012")]
// 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("8220c5ce-9cb4-485f-ae78-f2a9f2cbd754")]
// Versioning
[assembly: AssemblyVersion("1.0.1.2")]
// Unit tests.
[assembly: InternalsVisibleTo("AppDomainToolkit.UnitTests")] | mit | C# |
21871a800707b6f5dbf8cbd5b21b1501e8457d4f | Fix line above home paragraph | travistme/PersonalSite | TElkins.Web/Views/Home/Index.cshtml | TElkins.Web/Views/Home/Index.cshtml |
@{
ViewBag.Title = "Travis Elkins";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
</head>
<body>
<div class="jumbotron">
<div class="container">
<div class="col-lg-12">
<h1> Travis Elkins </h1>
<br><br>
<div class="col-lg-4 col-lg-offset-3 col-md-3 col-md-offset-4 col-sm-3 col-sm-offset-3">
<a class="btn btn-link btn-lrg" href="/about" role="button" id="buttonAboutMe"><strong>About Me</strong></a>
</div>
<div class="col-lg-3 xs-col-3">
<a class="btn btn-link btn-lrg" href="/contact" role="button" id="buttonContact"><strong>Contact</strong></a>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="center-block">
<h2 id="intro"> A Brief Introduction </h2>
<div id="home-info">
<p> _________________________________________</p>
<p> I am 24 years of age</p>
<p> I am happily married</p>
<p> Currently studying Computer Science at Indiana University Southeast</p>
<p> I have a passion for learning, I feel it is essential to living</p>
<p> I am not afraid to try new things</p>
</div>
</div>
</div>
</body>
</html>
|
@{
ViewBag.Title = "Travis Elkins";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
</head>
<body>
<div class="jumbotron">
<div class="container">
<div class="col-lg-12">
<h1> Travis Elkins </h1>
<br><br>
<div class="col-lg-4 col-lg-offset-3 col-md-3 col-md-offset-4 col-sm-3 col-sm-offset-3">
<a class="btn btn-link btn-lrg" href="/about" role="button" id="buttonAboutMe"><strong>About Me</strong></a>
</div>
<div class="col-lg-3 xs-col-3">
<a class="btn btn-link btn-lrg" href="/contact" role="button" id="buttonContact"><strong>Contact</strong></a>
</div>
</div>
</div>
</div>
<div class="col-md-12>
<div class="center-block">
<h2 id="intro"> A Brief Introduction </h2>
<p> _________________________________________</p>
<div id="home-info">
<p> I am 24 years of age</p>
<p> I am happily married</p>
<p> Currently studying Computer Science at Indiana University Southeast</p>
<p> I have a passion for learning, I feel it is essential to living</p>
<p> I am not afraid to try new things</p>
</div>
</div>
</div>
</body>
</html>
| mit | C# |
0813538e0ac48b65ba7a0fc4078783c1a3be099c | modify ForTestController | mc7246/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,mc7246/WeiXinMPSDK,lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,lishewen/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,JeffreySu/WeiXinMPSDK,jiehanlin/WeiXinMPSDK,mc7246/WeiXinMPSDK | Samples/Senparc.Weixin.MP.Sample.vs2017/Senparc.Weixin.MP.CoreSample/Controllers/ForTestController.cs | Samples/Senparc.Weixin.MP.Sample.vs2017/Senparc.Weixin.MP.CoreSample/Controllers/ForTestController.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Senparc.Weixin.HttpUtility;
namespace Senparc.Weixin.MP.CoreSample.Controllers
{
/// <summary>
/// 提供给 Senparc.WeixinTests/Utilities/HttpUtility/PostTests.cs使用
/// </summary>
public class ForTestController : Controller
{
[HttpPost]
public ActionResult PostTest()
{
string data;
using (var sr = new StreamReader(Request.GetRequestMemoryStream()))
{
data = sr.ReadToEnd();
}
var isAjax = Request.IsAjaxRequest();
Response.Cookies.Append("TestCookie", DateTime.Now.ToString());
return Content(data + " Ajax:" + isAjax + " Server Time:" + DateTime.Now);
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNetCore.Mvc;
namespace Senparc.Weixin.MP.CoreSample.Controllers
{
/// <summary>
/// 提供给 Senparc.WeixinTests/Utilities/HttpUtility/PostTests.cs使用
/// </summary>
public class ForTestController : Controller
{
[HttpPost]
public ActionResult PostTest()
{
string data;
using (var sr = new StreamReader(Request.InputStream))
{
data = sr.ReadToEnd();
}
var isAjax = Request.IsAjaxRequest();
Response.SetCookie(new HttpCookie("TestCookie", DateTime.Now.ToString()));
return Content(data + " Ajax:" + isAjax + " Server Time:" + DateTime.Now);
}
}
}
| apache-2.0 | C# |
94ff6f668abc60b5137c6598e96dfe6235d8a69d | Update AssemblyInfo.cs | hyonholee/azure-sdk-for-net,atpham256/azure-sdk-for-net,pankajsn/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,smithab/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,atpham256/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,AzCiS/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,samtoubia/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,smithab/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,pilor/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,jamestao/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,smithab/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,markcowl/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,mihymel/azure-sdk-for-net,samtoubia/azure-sdk-for-net,atpham256/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,djyou/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,hyonholee/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,MichaelCommo/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,shutchings/azure-sdk-for-net,samtoubia/azure-sdk-for-net,olydis/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,hyonholee/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,nathannfan/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,nathannfan/azure-sdk-for-net,jamestao/azure-sdk-for-net,btasdoven/azure-sdk-for-net,r22016/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,stankovski/azure-sdk-for-net,AzCiS/azure-sdk-for-net,pilor/azure-sdk-for-net,SiddharthChatrolaMs/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jhendrixMSFT/azure-sdk-for-net,stankovski/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,nathannfan/azure-sdk-for-net,btasdoven/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,olydis/azure-sdk-for-net,begoldsm/azure-sdk-for-net,AzCiS/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,olydis/azure-sdk-for-net,jamestao/azure-sdk-for-net,pankajsn/azure-sdk-for-net,jamestao/azure-sdk-for-net,shutchings/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,shutchings/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,djyou/azure-sdk-for-net,JasonYang-MSFT/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,hyonholee/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,begoldsm/azure-sdk-for-net,btasdoven/azure-sdk-for-net,yoavrubin/azure-sdk-for-net,mihymel/azure-sdk-for-net,ScottHolden/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,ahosnyms/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,djyou/azure-sdk-for-net,pilor/azure-sdk-for-net,peshen/azure-sdk-for-net,r22016/azure-sdk-for-net,peshen/azure-sdk-for-net,mihymel/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,pankajsn/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AzureAutomationTeam/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,peshen/azure-sdk-for-net,r22016/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,samtoubia/azure-sdk-for-net,Yahnoosh/azure-sdk-for-net,begoldsm/azure-sdk-for-net | src/ResourceManagement/Resource/Microsoft.Azure.Management.ResourceManager/Properties/AssemblyInfo.cs | src/ResourceManagement/Resource/Microsoft.Azure.Management.ResourceManager/Properties/AssemblyInfo.cs | //
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System.Reflection;
using System.Resources;
[assembly: AssemblyTitle("Microsoft Azure Resource Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure resource management operations including Resource Groups.")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
| //
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System.Reflection;
using System.Resources;
[assembly: AssemblyTitle("Microsoft Azure Resource Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure resource management operations including Resource Groups.")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
| mit | C# |
df63bd73f5a4b1be0f7809bfd9c2560e96ac2531 | Make the 'throw' test more realistic | jonathanvdc/flame-llvm,jonathanvdc/flame-llvm,jonathanvdc/flame-llvm | tests/throw/throw.cs | tests/throw/throw.cs | using System;
public static class Program
{
public static void Main()
{
try
{
ThrowAndFinally();
}
catch (Exception o)
{
Console.Write("are ");
}
finally
{
Console.WriteLine("ya");
}
}
private static void ThrowAndFinally()
{
try
{
Throw();
}
finally
{
Console.Write("how ");
}
}
private static void Throw()
{
throw new InvalidOperationException();
}
} | using System;
public static class Program
{
public static void Main()
{
try
{
ThrowAndFinally();
}
catch (Object o)
{
Console.Write("are ");
}
finally
{
Console.WriteLine("ya");
}
}
private static void ThrowAndFinally()
{
try
{
Throw();
}
finally
{
Console.Write("how ");
}
}
private static void Throw()
{
throw new Object();
}
} | mit | C# |
36d5e00b1466319ba02616b2a23c8a443a8ef13c | Set current category to the first one we add | simontaylor81/Syrup,simontaylor81/Syrup | ShaderEditorApp/ViewModel/OutputWindowViewModel.cs | ShaderEditorApp/ViewModel/OutputWindowViewModel.cs | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading.Tasks;
using ReactiveUI;
using SRPCommon.Logging;
namespace ShaderEditorApp.ViewModel
{
public class OutputWindowViewModel : ReactiveObject, ILoggerFactory
{
public ReactiveList<OutputWindowCategoryViewModel> Categories { get; } = new ReactiveList<OutputWindowCategoryViewModel>();
private OutputWindowCategoryViewModel _currentCategory;
public OutputWindowCategoryViewModel CurrentCategory
{
get { return _currentCategory; }
set { this.RaiseAndSetIfChanged(ref _currentCategory, value); }
}
// Existing loggers for the different categories. Can be accessed on multiple threads so must be concurrent.
private ConcurrentDictionary<string, ILogger> _loggers = new ConcurrentDictionary<string, ILogger>();
private Subject<OutputWindowCategoryViewModel> _newCategories = new Subject<OutputWindowCategoryViewModel>();
public OutputWindowViewModel()
{
// Add category when adding a new logger.
_newCategories.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(category =>
{
Categories.Add(category);
// Set current category if we don't have one.
if (CurrentCategory == null)
{
CurrentCategory = category;
}
});
// Update visibilities when the current category changes.
// We keep all the text boxes around so things like caret position aren't lost when switching.
this.WhenAnyValue(x => x.CurrentCategory).Subscribe(current =>
{
foreach (var category in Categories)
{
category.IsVisible = category == current;
}
});
}
// ILoggerFactory interface
public ILogger CreateLogger(string category)
{
return _loggers.GetOrAdd(category, key =>
{
var categoryVM = new OutputWindowCategoryViewModel(key);
// Fire new categories observable.
_newCategories.OnNext(categoryVM);
return categoryVM;
});
}
}
}
| using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading.Tasks;
using ReactiveUI;
using SRPCommon.Logging;
namespace ShaderEditorApp.ViewModel
{
public class OutputWindowViewModel : ReactiveObject, ILoggerFactory
{
public ReactiveList<OutputWindowCategoryViewModel> Categories { get; } = new ReactiveList<OutputWindowCategoryViewModel>();
private OutputWindowCategoryViewModel _currentCategory;
public OutputWindowCategoryViewModel CurrentCategory
{
get { return _currentCategory; }
set { this.RaiseAndSetIfChanged(ref _currentCategory, value); }
}
// Existing loggers for the different categories. Can be accessed on multiple threads so must be concurrent.
private ConcurrentDictionary<string, ILogger> _loggers = new ConcurrentDictionary<string, ILogger>();
private Subject<OutputWindowCategoryViewModel> _newCategories = new Subject<OutputWindowCategoryViewModel>();
public OutputWindowViewModel()
{
// Add category when adding a new logger.
_newCategories.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(category =>
{
Categories.Add(category);
});
// Update visibilities when the current category changes.
// We keep all the text boxes around so things like caret position aren't lost when switching.
this.WhenAnyValue(x => x.CurrentCategory).Subscribe(current =>
{
foreach (var category in Categories)
{
category.IsVisible = category == current;
}
});
}
// ILoggerFactory interface
public ILogger CreateLogger(string category)
{
return _loggers.GetOrAdd(category, key =>
{
var categoryVM = new OutputWindowCategoryViewModel(key);
// Fire new categories observable.
_newCategories.OnNext(categoryVM);
return categoryVM;
});
}
}
}
| mit | C# |
eb6acab2d46fa4832769bc3597ff729222cb0445 | Bump version to 0.6 | mganss/XmlSchemaClassGenerator,mganss/XmlSchemaClassGenerator | XmlSchemaClassGenerator/Properties/AssemblyInfo.cs | XmlSchemaClassGenerator/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("XmlSchemaClassGenerator")]
[assembly: AssemblyDescription("A console program and library to generate XmlSerializer compatible C# classes from XML Schema files.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Ganss")]
[assembly: AssemblyProduct("XmlSchemaClassGenerator")]
[assembly: AssemblyCopyright("Copyright © 2013-2015 Michael Ganss")]
[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("de5a48df-c5c0-4efc-9516-264d4e76d2a9")]
// 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.6.*")]
| 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("XmlSchemaClassGenerator")]
[assembly: AssemblyDescription("A console program and library to generate XmlSerializer compatible C# classes from XML Schema files.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Ganss")]
[assembly: AssemblyProduct("XmlSchemaClassGenerator")]
[assembly: AssemblyCopyright("Copyright © 2013-2015 Michael Ganss")]
[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("de5a48df-c5c0-4efc-9516-264d4e76d2a9")]
// 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.5.*")]
| apache-2.0 | C# |
51c43c55a9fb479d07a7deb786049a2f693386c0 | Formate code | edwardinubuntu/Roguelike2D | Assets/Scripts/Enemy.cs | Assets/Scripts/Enemy.cs | using UnityEngine;
using System.Collections;
public class Enemy : MovingObject
{
public int playerDamage;
private Animator animator;
private Transform target;
private bool skipMove;
protected override void Start ()
{
animator = GetComponent < Animator> ();
target = GameObject.FindGameObjectsWithTag ("Player").transform;
base.Start ();
}
protected override void AttemptMove <T> (int xDir, int yDir)
{
if (skipMove) {
skipMove = false;
return;
}
base.AttemptMove<T> (xDir, yDir);
skipMove = true;
}
public void MoveEnemy ()
{
int xdir = 0;
int ydir = 0;
if (Mathf.Abs (target.position.x - transform.position.x) < float .Epsilon) {
ydir = target.position.y > transform.position.y ? 1 : -1;
} else {
xdir = target.position.x > transform.position.x ? 1 : -1;
}
AttemptMove<Player> (xdir, ydir);
}
protected override void OnCantMove <T> (T component)
{
Player hitPlayer = component as Player;
hitPlayer.LoseFood (playerDamage);
}
}
| using UnityEngine;
using System.Collections;
public class Enemy : MovingObject {
public int playerDamage;
private Animator animator;
private Transform target;
private bool skipMove;
protected override void Start () {
animator = GetComponent < Animator> ();
target = GameObject.FindGameObjectsWithTag ("Player").transform;
base.Start ();
}
protected override void AttemptMove <T> (int xDir,int yDir)
{
if (skipMove) {
skipMove = false;
return;
}
base.AttemptMove<T> (xDir, yDir);
skipMove = true;
}
public void MoveEnemy()
{
int xdir = 0;
int ydir = 0;
if (Mathf.Abs (target.position.x - transform.position.x) < float .Epsilon) {
ydir = target.position.y > transform.position.y ? 1 : -1;
} else {
xdir = target.position.x> transform.position.x? 1:-1;
}
AttemptMove<Player> (xdir, ydir);
}
protected override void OnCantMove <T> (T component) {
Player hitPlayer = component as Player;
hitPlayer.LoseFood (playerDamage);
}
}
| mit | C# |
98c13dca25adc8cd15bc3cc0a41645f1594734dc | Add missing Decimal translation | another-guy/CSharpToTypeScript,another-guy/CSharpToTypeScript | Core/DotNetToTypeScriptType.cs | Core/DotNetToTypeScriptType.cs | using System;
using System.Collections.Generic;
namespace TsModelGen.Core
{
public static class DotNetToTypeScriptType
{
public static Dictionary<string, string> Mapping => MappingLazy.Value;
private static readonly Lazy<Dictionary<string, string>> MappingLazy =
new Lazy<Dictionary<string, string>>(
// Simple cases:
// * object -> any
// * primitive types to their TS direct translations
() => new Dictionary<string, string>
{
{typeof(object).FullName, "any"},
{typeof(short).FullName, "number"},
{typeof(int).FullName, "number"},
{typeof(long).FullName, "number"},
{typeof(ushort).FullName, "number"},
{typeof(uint).FullName, "number"},
{typeof(ulong).FullName, "number"},
{typeof(byte).FullName, "number"},
{typeof(sbyte).FullName, "number"},
{typeof(float).FullName, "number"},
{typeof(double).FullName, "number"},
{typeof(decimal).FullName, "number"},
{typeof(bool).FullName, "boolean"},
{typeof(string).FullName, "string"},
{typeof(DateTime).FullName, "boolean"}
// { typeof(char).FullName, "any" },
// { typeof(TimeSpan).FullName, "boolean" },
});
}
} | using System;
using System.Collections.Generic;
namespace TsModelGen.Core
{
public static class DotNetToTypeScriptType
{
public static Dictionary<string, string> Mapping => MappingLazy.Value;
private static readonly Lazy<Dictionary<string, string>> MappingLazy =
new Lazy<Dictionary<string, string>>(
// Simple cases:
// * object -> any
// * primitive types to their TS direct translations
() => new Dictionary<string, string>
{
{typeof(object).FullName, "any"},
{typeof(short).FullName, "number"},
{typeof(int).FullName, "number"},
{typeof(long).FullName, "number"},
{typeof(ushort).FullName, "number"},
{typeof(uint).FullName, "number"},
{typeof(ulong).FullName, "number"},
{typeof(byte).FullName, "number"},
{typeof(sbyte).FullName, "number"},
{typeof(float).FullName, "number"},
{typeof(double).FullName, "number"},
{typeof(bool).FullName, "boolean"},
{typeof(string).FullName, "string"},
{typeof(DateTime).FullName, "boolean"}
// { typeof(char).FullName, "any" },
// { typeof(TimeSpan).FullName, "boolean" },
});
}
} | mit | C# |
c08faedc2a66b65afdf5070a1d2d54f5ccbb8879 | Update FiverTests.cs | willrawls/xlg,willrawls/xlg | MetX/MetX.Console.Tests/Fiver/FiverTests.cs | MetX/MetX.Console.Tests/Fiver/FiverTests.cs | using System.IO;
using MetX.Five;
using MetX.Standard.Primary.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MetX.Console.Tests.Fiver;
[TestClass]
public class FiverTests
{
[TestMethod]
public void SettingsFile_RoundTrip()
{
var expected = "Fred";
var settingsFilePath = "SettingsFile_RoundTrip.txt";
FileSystem.SafelyDeleteFile(settingsFilePath);
Assert.IsFalse(File.Exists(settingsFilePath));
Shared.InitializeDirs(settingsFilePath, true);
Shared.Dirs.ToSettingsFile("George", expected);
Assert.IsTrue(File.Exists(settingsFilePath));
var actual = Shared.Dirs.FromSettingsFile("George");
Shared.Dirs.ResetSettingsFile();
Assert.IsFalse(File.Exists(settingsFilePath));
Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void SettingsFile_RoundTripTwice()
{
var expected = "Fred";
// Trip 1
const string filePath = "SettingsFile_RoundTripTwice.txt";
Shared.Dirs.SettingsFilePath = filePath;
Shared.Dirs.ResetSettingsFile();
Assert.IsFalse(File.Exists(filePath));
Shared.Dirs.ToSettingsFile("George", expected);
Assert.IsTrue(File.Exists(filePath));
var actual = Shared.Dirs.FromSettingsFile("George");
Shared.Dirs.ResetSettingsFile();
Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual);
// Trip 2
Shared.Dirs.SettingsFilePath = filePath;
Shared.Dirs.ResetSettingsFile();
Assert.IsFalse(File.Exists(filePath));
Shared.Dirs.ToSettingsFile("George", expected);
Assert.IsTrue(File.Exists(filePath));
actual = Shared.Dirs.FromSettingsFile("George");
Shared.Dirs.ResetSettingsFile();
Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual);
}
} | using System.IO;
using MetX.Five;
using MetX.Standard.Primary.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MetX.Console.Tests.Fiver;
[TestClass]
public class FiverTests
{
[TestMethod]
public void SettingsFile_RoundTrip()
{
var expected = "Fred";
var settingsFilePath = "SettingsFile_RoundTrip.txt";
FileSystem.SafelyDeleteFile(settingsFilePath);
Assert.IsFalse(File.Exists(settingsFilePath));
Shared.InitializeDirs(settingsFilePath, true);
Shared.Dirs.ToSettingsFile("George", expected);
Assert.IsTrue(File.Exists(settingsFilePath));
var actual = Shared.Dirs.FromSettingsFile("George");
Shared.Dirs.ResetSettingsFile();
Assert.IsFalse(File.Exists(settingsFilePath));
Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual);
}
[TestMethod]
public void SettingsFile_RoundTripTwice()
{
var expected = "Fred";
// Trip 1
const string filePath = "SettingsFile_RoundTripTwice.txt";
Shared.Dirs.SettingsFilePath = filePath;
Shared.Dirs.ResetSettingsFile();
Assert.IsFalse(File.Exists(filePath));
Shared.Dirs.ToSettingsFile("George", expected);
Assert.IsTrue(File.Exists(filePath));
var actual = Shared.Dirs.FromSettingsFile("George");
Shared.Dirs.ResetSettingsFile();
Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual);
// Trip 2
Shared.Dirs.SettingsFilePath = filePath;
Shared.Dirs.ResetSettingsFile();
Assert.IsFalse(File.Exists(filePath));
Shared.Dirs.ToSettingsFile("George", expected);
Assert.IsTrue(File.Exists(filePath));
actual = Shared.Dirs.FromSettingsFile("George");
Shared.Dirs.ResetSettingsFile();
Assert.IsNotNull(actual);
Assert.AreEqual(expected, actual);
}
} | mit | C# |
4321e8b194518b30a203f024a6b3fccf09faa508 | fix OperationException | gomafutofu/BtrieveWrapper,yezorat/BtrieveWrapper,yezorat/BtrieveWrapper,gomafutofu/BtrieveWrapper | BtrieveWrapper/OperationException.cs | BtrieveWrapper/OperationException.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;
using System.Xml.Serialization;
namespace BtrieveWrapper
{
[Serializable]
public class OperationException : Exception
{
static readonly string _statusDefinitionPath = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".StatusCollection.xml";
static readonly Dictionary<short, string> _dictionary = new Dictionary<short, string>();
static string GetMessage(Operation operationType, short statusCode){
var result = new StringBuilder("Status code ");
result.Append(statusCode);
result.Append(" (");
result.Append(operationType);
result.Append(") : ");
if (_dictionary.ContainsKey(statusCode)) {
result.Append(_dictionary[statusCode]);
} else {
result.Append("This code is undefined.");
}
return result.ToString();
}
static OperationException() {
try {
StatusDefinition statusDefinition;
using (var stream = new FileStream(_statusDefinitionPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
var serializer = new XmlSerializer(typeof(StatusDefinition));
statusDefinition = (StatusDefinition)serializer.Deserialize(stream);
}
foreach (var status in statusDefinition.StatusCollection) {
_dictionary[status.Code] = status.Message;
}
} catch { }
}
string _message = null;
internal OperationException(Operation operation, short statusCode, Exception innerException = null)
: base(null, innerException) {
this.Operation = operation;
this.StatusCode = statusCode;
}
public Operation Operation { get; private set; }
public short StatusCode { get; private set; }
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
}
public override string Message {
get {
return _message ?? (_message = GetMessage(this.Operation, this.StatusCode));
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;
using System.Xml.Serialization;
namespace BtrieveWrapper
{
[Serializable]
public class OperationException : Exception
{
static readonly string _statusDefinitionPath = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".StatusCollection.xml";
static readonly Dictionary<short, string> _dictionary = new Dictionary<short, string>();
static string GetMessage(Operation operationType, short statusCode){
var result = new StringBuilder("Status code ");
result.Append(statusCode);
result.Append(" (");
result.Append(operationType);
result.Append(") : ");
if (_dictionary.ContainsKey(statusCode)) {
result.Append(_dictionary[statusCode]);
} else {
result.Append("This code is undefined.");
}
return result.ToString();
}
static OperationException() {
try {
StatusDefinition statusDefinition;
using (var stream = new FileStream(_statusDefinitionPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
var serializer = new XmlSerializer(typeof(StatusDefinition));
statusDefinition = (StatusDefinition)serializer.Deserialize(stream);
}
foreach (var status in statusDefinition.StatusCollection) {
_dictionary[status.Code] = status.Message;
}
} catch { }
}
internal OperationException(Operation operation, short statusCode, Exception innerException = null)
: base(null, innerException) {
this.Operation = operation;
this.StatusCode = statusCode;
}
public Operation Operation { get; private set; }
public short StatusCode { get; private set; }
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
}
public override string Message {
get {
return GetMessage(
}
}
}
}
| mit | C# |
b3c6bd9b75eb527f435f5326a5718b1e0afcac97 | Update SwedenProvider.cs | tinohager/Nager.Date,tinohager/Nager.Date,tinohager/Nager.Date | Nager.Date/PublicHolidays/SwedenProvider.cs | Nager.Date/PublicHolidays/SwedenProvider.cs | using Nager.Date.Contract;
using Nager.Date.Model;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nager.Date.PublicHolidays
{
public class SwedenProvider : IPublicHolidayProvider
{
public IEnumerable<PublicHoliday> Get(DateTime easterSunday, int year)
{
//Sweden
//https://en.wikipedia.org/wiki/Public_holidays_in_Sweden
var countryCode = CountryCode.SE;
var midsummerDay = DateSystem.FindDay(year, 6, 20, DayOfWeek.Saturday);
var allSaintsDay = DateSystem.FindDay(year, 10, 31, DayOfWeek.Saturday);
var items = new List<PublicHoliday>();
items.Add(new PublicHoliday(year, 1, 1, "nyårsdagen", "New Year's Day", countryCode));
items.Add(new PublicHoliday(year, 1, 6, "trettondedag jul", "Epiphany", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(-2), "långfredagen", "Good Friday", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(1), "annandag påsk", "Easter Monday", countryCode));
items.Add(new PublicHoliday(year, 5, 1, "Första maj", "International Workers' Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(39), "Kristi himmelsfärds dag", "Ascension Day", countryCode));
items.Add(new PublicHoliday(year, 6, 6, "Sveriges nationaldag", "National Day of Sweden", countryCode));
items.Add(new PublicHoliday(midsummerDay.AddDays(-1), "midsommarafton", "Midsummer Eve", countryCode));
items.Add(new PublicHoliday(midsummerDay, "midsommardagen", "Midsummer Day", countryCode));
items.Add(new PublicHoliday(allSaintsDay, "alla helgons dag", "All Saints' Day", countryCode));
items.Add(new PublicHoliday(year, 12, 24, "julafton", "Christmas Eve", countryCode));
items.Add(new PublicHoliday(year, 12, 25, "juldagen", "Christmas Day", countryCode));
items.Add(new PublicHoliday(year, 12, 26, "annandag jul", "St. Stephen's Day", countryCode));
items.Add(new PublicHoliday(year, 12, 31, "nyårsafton", "New Year's Eve", countryCode));
return items.OrderBy(o => o.Date);
}
}
}
| using Nager.Date.Contract;
using Nager.Date.Model;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Nager.Date.PublicHolidays
{
public class SwedenProvider : IPublicHolidayProvider
{
public IEnumerable<PublicHoliday> Get(DateTime easterSunday, int year)
{
//Sweden
//https://en.wikipedia.org/wiki/Public_holidays_in_Sweden
var countryCode = CountryCode.SE;
var midsummerDay = DateSystem.FindDay(year, 6, 20, DayOfWeek.Saturday);
var allSaintsDay = DateSystem.FindDay(year, 10, 31, DayOfWeek.Saturday);
var items = new List<PublicHoliday>();
items.Add(new PublicHoliday(year, 1, 1, "nyårsdagen", "New Year's Day", countryCode));
items.Add(new PublicHoliday(year, 1, 6, "trettondedag jul", "Epiphany", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(-2), "långfredagen", "Good Friday", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(1), "annandag påsk", "Easter Monday", countryCode));
items.Add(new PublicHoliday(year, 5, 1, "Första maj", "International Workers' Day", countryCode));
items.Add(new PublicHoliday(easterSunday.AddDays(39), "Kristi himmelsfärds dag", "Ascension Day", countryCode));
items.Add(new PublicHoliday(year, 6, 6, "Sveriges nationaldag", "National Day of Sweden", countryCode));
items.Add(new PublicHoliday(midsummerDay, "midsommardagen", "Midsummer Day", countryCode));
items.Add(new PublicHoliday(allSaintsDay, "alla helgons dag", "All Saints' Day", countryCode));
items.Add(new PublicHoliday(year, 12, 25, "juldagen", "Christmas Day", countryCode));
items.Add(new PublicHoliday(year, 12, 26, "annandag jul", "St. Stephen's Day", countryCode));
return items.OrderBy(o => o.Date);
}
}
}
| mit | C# |
7ff43e637209492e35618264fc39a61d7d2fb0f1 | Remove useless func | DragonEyes7/ConcoursUBI17,DragonEyes7/ConcoursUBI17 | Proto/Assets/Scripts/Helpers/FileManager.cs | Proto/Assets/Scripts/Helpers/FileManager.cs | using System.IO;
public class FileManager
{
private readonly string _file;
public FileManager(string filePath)
{
_file = filePath;
}
public void Write(string text)
{
File.WriteAllText(_file, text);
}
public string Read()
{
return File.Exists(_file) ? File.ReadAllText(_file) : "";
}
} | using System.IO;
public class FileManager
{
private readonly string _file;
public FileManager(string filePath)
{
_file = filePath;
}
public void Append(string text)
{
var writer = File.AppendText(_file);
writer.Write(text);
writer.Flush();
}
public void Write(string text)
{
File.WriteAllText(_file, text);
}
public string Read()
{
return File.Exists(_file) ? File.ReadAllText(_file) : "";
}
} | mit | C# |
1156fe16a7adc186ad652aba5292e75e1e235d59 | Check 3 | tamaraAbramov/FinalProject,tamaraAbramov/FinalProject,tamaraAbramov/FinalProject | FinalProject/Models/Article.cs | FinalProject/Models/Article.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace FinalProject.Models
{
public class Article
{
public int ID { get; set; }
[Display(Name = "Article Title")]
public string Title { get; set; }
//Check
public virtual User Author { get; set; }
public DateTime PublishDate { get; set; }
public string Text { get; set; }
public string Image { get; set; }
public string Video { get; set; }
public virtual ICollection<Comment> Comments { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace FinalProject.Models
{
public class Article
{
public int ID { get; set; }
[Display(Name = "Article Title")]
public string Title { get; set; }
public virtual User Author { get; set; }
public DateTime PublishDate { get; set; }
public string Text { get; set; }
public string Image { get; set; }
public string Video { get; set; }
public virtual ICollection<Comment> Comments { get; set; }
}
} | mit | C# |
d05f11c2fcf6f9e98edc6eaed9262531cce03a97 | Improve the comparable implementation | DHancock/Countdown | Countdown/ViewModels/EquationItem.cs | Countdown/ViewModels/EquationItem.cs | using System;
namespace Countdown.ViewModels
{
/// <summary>
/// Used to display solver results in the ui and tracks
/// the selection of the items
/// </summary>
internal sealed class EquationItem : ItemBase, IComparable
{
public EquationItem() : this(string.Empty)
{
}
public EquationItem(string equation) : base(equation)
{
}
public int CompareTo(object obj)
{
string other = ((EquationItem)obj).Content;
int lengthCompare = Content.Length - other.Length;
return lengthCompare == 0 ? string.Compare(Content, other) : lengthCompare;
}
}
}
| using System;
namespace Countdown.ViewModels
{
/// <summary>
/// Used to display solver results in the ui and tracks
/// the selection of the items
/// </summary>
internal sealed class EquationItem : ItemBase, IComparable
{
public EquationItem() : this(string.Empty)
{
}
public EquationItem(string equation) : base(equation)
{
}
public int CompareTo(object obj)
{
string other = ((EquationItem)obj).Content;
return Content.Length == other.Length ? string.Compare(Content, other) : Content.Length - other.Length;
}
}
}
| unlicense | C# |
1249cc577067d0a2318eadbe598e3e6774478838 | Update IndexModule.cs | LeedsSharp/AppVeyorDemo | src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs | src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs | namespace AppVeyorDemo.Modules
{
using System.Configuration;
using AppVeyorDemo.Models;
using Nancy;
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = parameters =>
{
var model = new IndexViewModel
{
HelloName = "Leeds#",
ServerName = ConfigurationManager.AppSettings["Server_Name"]
};
return View["index", model];
};
}
}
}
| namespace AppVeyorDemo.Modules
{
using System.Configuration;
using AppVeyorDemo.Models;
using Nancy;
public class IndexModule : NancyModule
{
public IndexModule()
{
Get["/"] = parameters =>
{
var model = new IndexViewModel
{
HelloName = "AppVeyor",
ServerName = ConfigurationManager.AppSettings["Server_Name"]
};
return View["index", model];
};
}
}
}
| apache-2.0 | C# |
30db186ebc157153787691d624c7451efe5dc583 | Make a final sound after all the other sounds | gadauto/OCDEscape | Assets/OCDRoomEscape/Scripts/Interaction/PuzzleMaster.cs | Assets/OCDRoomEscape/Scripts/Interaction/PuzzleMaster.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PuzzleMaster : MonoBehaviour
{
public float timeBetweenSounds = 15f;
public WallManager wallMgr;
public List<Puzzle> puzzles;
public AudioSource puzzleWinSound;
public AudioSource endGameWinSound;
float increment;
float weightedIncrementTotal;
bool isGameOver = false;
// Use this for initialization
void Awake ()
{
foreach (var puzzle in puzzles) {
Debug.Log("Puzzle added: "+puzzle);
}
}
void Start()
{
puzzleWinSound = GetComponent<AudioSource>();
// We'll consider the puzzle's weight when determining how much it affects the room movement
foreach (var puzzle in puzzles) {
weightedIncrementTotal += puzzle.puzzleWeight;
}
}
public void PuzzleCompleted(Puzzle puzzle)
{
if (isGameOver) {
Debug.Log("GAME OVER!!! Let the player know!!");
return;
}
var growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal;
// Notify room of growth increment
wallMgr.Resize(wallMgr.transformRoom + growthIncrement);
KickOffSoundForPuzzle(puzzle);
if (puzzle.IsResetable() && puzzles.Contains(puzzle)) {
Debug.Log("Puzzle marked for reset");
puzzle.MarkForReset();
}
// Remove the puzzle, but also allow it to remain in the list multiple times
puzzles.Remove(puzzle);
Debug.Log("Finished puzzle: "+puzzle+", "+puzzles.Count+" left, room growing to: "+(wallMgr.transformRoom + growthIncrement));
if (wallMgr.transformRoom >= 1f) {
StopAllCoroutines(); // Turn off sounds
if (puzzleWinSound) {
puzzleWinSound.Stop();
}
isGameOver = true;
Debug.Log("GAME OVER!!!");
AudioSource finalSource = GetComponentInParent<AudioSource>();
if (finalSource) {
finalSource.Play();
}
}
}
private void KickOffSoundForPuzzle(Puzzle puzzle)
{
StopAllCoroutines();
// Now kick off the discordant sound
AudioSource source = puzzle.SoundForPuzzle();
if (!source) {
Debug.Log(puzzle+" does not have an associated AudioSource");
}
StartCoroutine(PlaySound(source));
}
private IEnumerator PlaySound(AudioSource source)
{
// Play a win sound
if (puzzleWinSound) {
puzzleWinSound.Play();
yield return new WaitForSeconds(7f);
}
while (source) {
source.Play();
yield return new WaitForSeconds(timeBetweenSounds);
}
}
}
| using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PuzzleMaster : MonoBehaviour
{
public float timeBetweenSounds = 15f;
public WallManager wallMgr;
public List<Puzzle> puzzles;
public AudioSource puzzleWinSound;
float increment;
float weightedIncrementTotal;
bool isGameOver = false;
// Use this for initialization
void Awake ()
{
foreach (var puzzle in puzzles) {
Debug.Log("Puzzle added: "+puzzle);
}
}
void Start()
{
puzzleWinSound = GetComponent<AudioSource>();
// We'll consider the puzzle's weight when determining how much it affects the room movement
foreach (var puzzle in puzzles) {
weightedIncrementTotal += puzzle.puzzleWeight;
}
}
public void PuzzleCompleted(Puzzle puzzle)
{
if (isGameOver) {
Debug.Log("GAME OVER!!! Let the player know!!");
return;
}
var growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal;
// Notify room of growth increment
wallMgr.Resize(wallMgr.transformRoom + growthIncrement);
KickOffSoundForPuzzle(puzzle);
if (puzzle.IsResetable() && puzzles.Contains(puzzle)) {
Debug.Log("Puzzle marked for reset");
puzzle.MarkForReset();
}
// Remove the puzzle, but also allow it to remain in the list multiple times
puzzles.Remove(puzzle);
Debug.Log("Finished puzzle: "+puzzle+", "+puzzles.Count+" left, room growing to: "+(wallMgr.transformRoom + growthIncrement));
if (wallMgr.transformRoom >= 1f) {
StopAllCoroutines(); // Turn off sounds
isGameOver = true;
Debug.Log("GAME OVER!!!");
}
}
private void KickOffSoundForPuzzle(Puzzle puzzle)
{
StopAllCoroutines();
// Now kick off the discordant sound
AudioSource source = puzzle.SoundForPuzzle();
if (!source) {
Debug.Log(puzzle+" does not have an associated AudioSource");
}
StartCoroutine(PlaySound(source));
}
private IEnumerator PlaySound(AudioSource source)
{
// Play a win sound
if (puzzleWinSound) {
puzzleWinSound.Play();
yield return new WaitForSeconds(7f);
}
while (source) {
source.Play();
yield return new WaitForSeconds(timeBetweenSounds);
}
}
}
| apache-2.0 | C# |
8e4e0504032a068b8b903554114266e60d4262a5 | bump version | sevoku/MonoDevelop.Xwt | Properties/AddinInfo.cs | Properties/AddinInfo.cs | using Mono.Addins;
[assembly:Addin (
"Xwt",
Namespace = "MonoDevelop",
Version = "1.0.1"
)]
[assembly:AddinName ("Xwt Project Support")]
[assembly:AddinCategory ("IDE extensions")]
[assembly:AddinDescription (
"Adds Xwt cross-platform UI project and file templates, " +
"including executable projects for supported Xwt backends and " +
"automatic platform detection.")]
[assembly:AddinAuthor ("Vsevolod Kukol")]
[assembly:AddinUrl ("https://github.com/sevoku/MonoDevelop.Xwt.git")]
| using Mono.Addins;
[assembly:Addin (
"Xwt",
Namespace = "MonoDevelop",
Version = "1.0"
)]
[assembly:AddinName ("Xwt Project Support")]
[assembly:AddinCategory ("IDE extensions")]
[assembly:AddinDescription (
"Adds Xwt cross-platform UI project and file templates, " +
"including executable projects for supported Xwt backends and " +
"automatic platform detection.")]
[assembly:AddinAuthor ("Vsevolod Kukol")]
[assembly:AddinUrl ("https://github.com/sevoku/MonoDevelop.Xwt.git")]
| mit | C# |
3eb5bd9ba7aa2ec13c6fdf9b55c70fd4d6fbecbb | fix typo | splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net | IPTables.Net/Iptables/DataTypes/ConnectionStateHelper.cs | IPTables.Net/Iptables/DataTypes/ConnectionStateHelper.cs | using System;
using IPTables.Net.Exceptions;
namespace IPTables.Net.Iptables.DataTypes
{
public class ConnectionStateHelper
{
public static String GetString(ConnectionState state)
{
switch (state)
{
case ConnectionState.Established:
return "ESTABLISHED";
case ConnectionState.Invalid:
return "INVALID";
case ConnectionState.New:
return "NEW";
case ConnectionState.Related:
return "RELATED";
case ConnectionState.Untracked:
return "UNTRACKED";
}
throw new IpTablesNetException("Unknown connection state");
}
public static ConnectionState FromString(String state)
{
switch (state)
{
case "ESTABLISHED":
return ConnectionState.Established;
case "INVALID":
return ConnectionState.Invalid;
case "NEW":
return ConnectionState.New;
case "RELATED":
return ConnectionState.Related;
case "UNTRACKED":
return ConnectionState.Untracked;
}
throw new IpTablesNetException("Unknown connection state: " + state);
}
}
} | using System;
using IPTables.Net.Exceptions;
namespace IPTables.Net.Iptables.DataTypes
{
public class ConnectionStateHelper
{
public static String GetString(ConnectionState state)
{
switch (state)
{
case ConnectionState.Established:
return "ESTABLISHED";
case ConnectionState.Invalid:
return "INVALID";
case ConnectionState.New:
return "NEW";
case ConnectionState.Related:
return "RELATED";
case ConnectionState.Untracked:
return "UNTRACKED";
}
throw new IpTablesNetException("Unknown connection state");
}
public static ConnectionState FromString(String state)
{
switch (state)
{
case "ESTABLISHED":
return ConnectionState.Established;
case "INVALID":
return ConnectionState.Invalid;
case "NEW":
return ConnectionState.New;
case "RELATED":
return ConnectionState.Related;
case "UNTRACKED":
return ConnectionState.Untracked;
}
throw new IpTablesNetException("Unknown connection stat: " + state);
}
}
} | apache-2.0 | C# |
3a27a8f29d9bc36e484e12bc2c043eaecfc2f178 | Update CacheDecoratorBase.cs | tiksn/TIKSN-Framework | TIKSN.Core/Data/Cache/CacheDecoratorBase.cs | TIKSN.Core/Data/Cache/CacheDecoratorBase.cs | using System;
namespace TIKSN.Data.Cache
{
public abstract class CacheDecoratorBase<T>
{
protected static readonly Type entityType = typeof(T);
}
}
| using System;
namespace TIKSN.Data.Cache
{
public abstract class CacheDecoratorBase<T>
{
protected static readonly Type entityType = typeof(T);
}
} | mit | C# |
83cc5f97bb1ea67b05e73f1f0e147ff5140e616f | Update AssemblyInfo.cs | faniereynders/WebApiProxy,lust4life/WebApiProxy | WebApiProxy.Core/Properties/AssemblyInfo.cs | WebApiProxy.Core/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebApiWebApiWebApiProxy.Core.Models.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebApiWebApiWebApiProxy.Core.Models.Core")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("763affa5-736f-41fe-91d5-3fb209acc9a4")]
// 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.*")]
[assembly: AssemblyFileVersion("1.0.*")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebApiWebApiWebApiProxy.Core.Models.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebApiWebApiWebApiProxy.Core.Models.Core")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("763affa5-736f-41fe-91d5-3fb209acc9a4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
bebba5a324bc1027284d3373b18f241edfb3f3e4 | fix format index in FinalLogData.ToString | mperdeck/jsnlog | jsnlog/PublicFacing/Configuration/FinalLogData.cs | jsnlog/PublicFacing/Configuration/FinalLogData.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JSNLog
{
public class FinalLogData
{
public ILogRequest LogRequest { get; private set; }
public string FinalLogger { get; set; }
public Level FinalLevel { get; set; }
public string FinalMessage { get; set; }
public string ServerSideMessageFormat { get; internal set; }
public FinalLogData(ILogRequest logRequest)
{
LogRequest = logRequest;
}
public override string ToString()
{
return string.Format(
"FinalLogger: {0}, FinalLevel: {1}, FinalMessage: {2}, ServerSideMessageFormat: {3}, LogRequest: {{{4}}}",
FinalLogger, FinalLevel, FinalMessage, ServerSideMessageFormat, LogRequest);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JSNLog
{
public class FinalLogData
{
public ILogRequest LogRequest { get; private set; }
public string FinalLogger { get; set; }
public Level FinalLevel { get; set; }
public string FinalMessage { get; set; }
public string ServerSideMessageFormat { get; internal set; }
public FinalLogData(ILogRequest logRequest)
{
LogRequest = logRequest;
}
public override string ToString()
{
return string.Format(
"FinalLogger: {0}, FinalLevel: {1}, FinalMessage: {2}, ServerSideMessageFormat: {3}, LogRequest: {{{5}}}",
FinalLogger, FinalLevel, FinalMessage, ServerSideMessageFormat, LogRequest);
}
}
}
| mit | C# |
6fe49a26b0599a82287a08775b9c6f178ccc68e0 | use async / await for http client call | andrew0928/WebServerClock | WebServerClock/Form1.cs | WebServerClock/Form1.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebServerClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.labClock.Text = (DateTime.Now + this.Offset).ToString("HH:mm:ss.f");
}
private TimeSpan Offset = TimeSpan.Zero;
private async void button1_Click(object sender, EventArgs e)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(this.textWebSiteURL.Text);
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Head, "/");
DateTime t0 = DateTime.Now;
HttpResponseMessage rsp = await client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead);
DateTime t3 = DateTime.Now;
TimeSpan duration = t3 - t0;
DateTime t1p = DateTime.Parse(rsp.Headers.GetValues("Date").First());
this.Offset = t1p - t0.AddMilliseconds(duration.TotalMilliseconds / 2);
this.labelOffset.Text = string.Format(
@"時間差: {0} msec, 最大誤差值: {1} msec",
this.Offset.TotalMilliseconds,
duration.TotalMilliseconds / 2);
}
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WebServerClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.labClock.Text = (DateTime.Now + this.Offset).ToString("HH:mm:ss.f");
}
private TimeSpan Offset = TimeSpan.Zero;
private void button1_Click(object sender, EventArgs e)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(this.textWebSiteURL.Text);
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Head, "/");
DateTime t0 = DateTime.Now;
HttpResponseMessage rsp = client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead).Result;
DateTime t3 = DateTime.Now;
TimeSpan duration = t3 - t0;
DateTime t1p = DateTime.Parse(rsp.Headers.GetValues("Date").First());
this.Offset = t1p - t0.AddMilliseconds(duration.TotalMilliseconds / 2);
this.labelOffset.Text = string.Format(
@"時間差: {0} msec, 最大誤差值: {1} msec",
this.Offset.TotalMilliseconds,
duration.TotalMilliseconds / 2);
}
}
}
| mit | C# |
f1969c253948220dacb29444c2191df7a3bcc598 | Fix SignalR Streaming example (#42281) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/SignalR/samples/SignalRSamples/Hubs/Streaming.cs | src/SignalR/samples/SignalRSamples/Hubs/Streaming.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.Reactive.Linq;
using System.Threading.Channels;
using Microsoft.AspNetCore.SignalR;
namespace SignalRSamples.Hubs;
public class Streaming : Hub
{
public async IAsyncEnumerable<int> AsyncEnumerableCounter(int count, double delay)
{
for (var i = 0; i < count; i++)
{
yield return i;
await Task.Delay(TimeSpan.FromMilliseconds(delay));
}
}
public ChannelReader<int> ObservableCounter(int count, double delay)
{
var observable = Observable.Interval(TimeSpan.FromMilliseconds(delay))
.Select((_, index) => index)
.Take(count);
return observable.AsChannelReader(Context.ConnectionAborted);
}
public ChannelReader<int> ChannelCounter(int count, double delay)
{
var channel = Channel.CreateUnbounded<int>();
Task.Run(async () =>
{
for (var i = 0; i < count; i++)
{
await channel.Writer.WriteAsync(i);
await Task.Delay(TimeSpan.FromMilliseconds(delay));
}
channel.Writer.TryComplete();
});
return channel.Reader;
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Reactive.Linq;
using System.Threading.Channels;
using Microsoft.AspNetCore.SignalR;
namespace SignalRSamples.Hubs;
public class Streaming : Hub
{
public async IAsyncEnumerable<int> AsyncEnumerableCounter(int count, double delay)
{
for (var i = 0; i < count; i++)
{
yield return i;
await Task.Delay((int)delay);
}
}
public ChannelReader<int> ObservableCounter(int count, double delay)
{
var observable = Observable.Interval(TimeSpan.FromMilliseconds(delay))
.Select((_, index) => index)
.Take(count);
return observable.AsChannelReader(Context.ConnectionAborted);
}
public ChannelReader<int> ChannelCounter(int count, int delay)
{
var channel = Channel.CreateUnbounded<int>();
Task.Run(async () =>
{
for (var i = 0; i < count; i++)
{
await channel.Writer.WriteAsync(i);
await Task.Delay(delay);
}
channel.Writer.TryComplete();
});
return channel.Reader;
}
}
| apache-2.0 | C# |
0161d607e6bb4944c991f39a2e405706efd0ae8d | Fix handling of deletion of settings file; | SnpM/Lockstep-Framework | Settings/LSFSettingsManager.cs | Settings/LSFSettingsManager.cs | using UnityEngine;
using System.Collections; using FastCollections;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Lockstep
{
public static class LSFSettingsManager
{
public const string DEFAULT_SETTINGS_NAME = "DefaultLockstepFrameworkSettings";
public const string SETTINGS_NAME = "LockstepFrameworkSettings";
static LSFSettings MainSettings;
static LSFSettingsManager () {
Initialize ();
}
static void Initialize()
{
LSFSettings settings = Resources.Load<LSFSettings>(SETTINGS_NAME);
#if UNITY_EDITOR
if (settings == null)
{
if (Application.isPlaying == false)
{
settings = ScriptableObject.CreateInstance <LSFSettings>();
if (!System.IO.Directory.Exists(Application.dataPath + "/Resources"))
AssetDatabase.CreateFolder("Assets", "Resources");
AssetDatabase.CreateAsset(settings, "Assets/Resources/" + SETTINGS_NAME + ".asset");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("Successfuly created new settings file.");
} else
{
}
}
#endif
MainSettings = settings;
if (MainSettings == null)
{
settings = Resources.Load<LSFSettings>(DEFAULT_SETTINGS_NAME);
Debug.Log("No settings found. Loading default settings.");
}
}
public static LSFSettings GetSettings()
{
if (MainSettings == null)
Initialize ();
return MainSettings;
}
}
} | using UnityEngine;
using System.Collections; using FastCollections;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace Lockstep
{
public static class LSFSettingsManager
{
public const string DEFAULT_SETTINGS_NAME = "DefaultLockstepFrameworkSettings";
public const string SETTINGS_NAME = "LockstepFrameworkSettings";
static LSFSettings MainSettings;
static LSFSettingsManager()
{
LSFSettings settings = Resources.Load<LSFSettings>(SETTINGS_NAME);
#if UNITY_EDITOR
if (settings == null)
{
if (Application.isPlaying == false)
{
settings = ScriptableObject.CreateInstance <LSFSettings>();
if (!System.IO.Directory.Exists(Application.dataPath + "/Resources"))
AssetDatabase.CreateFolder("Assets", "Resources");
AssetDatabase.CreateAsset(settings, "Assets/Resources/" + SETTINGS_NAME + ".asset");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
} else
{
}
}
#endif
MainSettings = settings;
if (MainSettings == null)
{
settings = Resources.Load<LSFSettings>(DEFAULT_SETTINGS_NAME);
Debug.Log("No settings found. Loading default settings.");
}
}
public static LSFSettings GetSettings()
{
return MainSettings;
}
}
} | mit | C# |
0b82182ed246157d8922ff6e909ce8603b13e1fc | refactor database seed | StefanBertels/language-ext,StanJav/language-ext,louthy/language-ext | Samples/Contoso/Contoso.Web/Extensions/HostExtensions.cs | Samples/Contoso/Contoso.Web/Extensions/HostExtensions.cs | using System;
using Contoso.Infrastructure.Data;
using LanguageExt;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using static LanguageExt.Prelude;
namespace Contoso.Web.Extensions
{
public static class HostExtensions
{
public static IHost SeedDatabase(this IHost host)
{
var test = use(() => host.Services.CreateScope(), Seed);
return host;
}
private static Unit Seed(IServiceScope scope) =>
Try(() => scope.ServiceProvider)
.Bind(services => Try(GetDbContext(services)))
.Bind(ctx => Try(Migrate(ctx)))
.Bind(ctx => Try(InitializeDb(ctx)))
.IfFail(ex => LogException(ex, scope.ServiceProvider));
private static ContosoDbContext GetDbContext(IServiceProvider provider) =>
provider.GetRequiredService<ContosoDbContext>();
private static ContosoDbContext Migrate(ContosoDbContext context)
{
context.Database.Migrate();
return context;
}
private static Unit InitializeDb(ContosoDbContext context) =>
DbInitializer.Initialize(context);
private static Unit LogException(Exception ex, IServiceProvider provider)
{
provider.GetRequiredService<ILogger<Program>>()
.LogError(ex, "Error occurred while seeding database");
return Unit.Default;
}
}
}
| using System;
using Contoso.Infrastructure.Data;
using LanguageExt;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using static LanguageExt.Prelude;
namespace Contoso.Web.Extensions
{
public static class HostExtensions
{
public static IHost SeedDatabase(this IHost host)
{
var test = use(() => host.Services.CreateScope(), Seed);
return host;
}
static Func<IServiceScope, Unit> Seed = (scope) =>
{
var services = scope.ServiceProvider;
Try(GetDbContext(services)).Bind(ctx => Try(InitializeDb(ctx)))
.Match(
Succ: a => { },
Fail: ex => LogException(ex, services));
return Unit.Default;
};
static Func<IServiceProvider, ContosoDbContext> GetDbContext = (provider) =>
provider.GetRequiredService<ContosoDbContext>();
static Func<ContosoDbContext, Unit> InitializeDb = (context) =>
DbInitializer.Initialize(context);
private static void LogException(Exception ex, IServiceProvider provider) =>
provider.GetRequiredService<ILogger<Program>>()
.LogError(ex, "Error occurred while seeding database");
}
}
| mit | C# |
38f22d121f17994e78fbdb6f4b5d1ad9bd489c57 | Fix $ning output | graymalkin/gwen | ThreadedIRCBot/Modules/Ning.cs | ThreadedIRCBot/Modules/Ning.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ThreadedIRCBot
{
class Ning : Module
{
public Ning(IRC ircNet) : base(ircNet) { }
public override void Start()
{
throw new NotImplementedException();
}
public override void Stop()
{
throw new NotImplementedException();
}
public override void Save()
{
throw new NotImplementedException();
}
public override void InterpretCommand(string[] command, Events.MessageReceivedEventArgs e)
{
if(DateTime.Now.Hour => 12 && DateTime.Now.Hour <= 17)
{
irc.Send(new IRCMessage("PRIVMSG", e.Message.MessageTarget, "Afternooning."));
return;
}
if(DateTime.Now.Hour > 17)
irc.Send(new IRCMessage("PRIVMSG", e.Message.MessageTarget, "Evening."));
else
irc.Send(new IRCMessage("PRIVMSG", e.Message.MessageTarget, "Morning."));
}
public override string Help()
{
return "Sends the current <?>ning";
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ThreadedIRCBot
{
class Ning : Module
{
public Ning(IRC ircNet) : base(ircNet) { }
public override void Start()
{
throw new NotImplementedException();
}
public override void Stop()
{
throw new NotImplementedException();
}
public override void Save()
{
throw new NotImplementedException();
}
public override void InterpretCommand(string[] command, Events.MessageReceivedEventArgs e)
{
if(DateTime.Now.Hour < 4 || DateTime.Now.Hour > 12)
irc.Send(new IRCMessage("PRIVMSG", e.Message.MessageTarget, "Evening."));
else
irc.Send(new IRCMessage("PRIVMSG", e.Message.MessageTarget, "Morning."));
}
public override string Help()
{
return "Sends the current <?>ning";
}
}
}
| mit | C# |
a0eebac196aa19dd6d913df6fb681effc21b7652 | Remove Mono specific using | sant0ro/Yupi,sant0ro/Yupi,sant0ro/Yupi,TheDoct0r11/Yupi,TheDoct0r11/Yupi,TheDoct0r11/Yupi,TheDoct0r11/Yupi,sant0ro/Yupi,sant0ro/Yupi | Yupi.Model/MonoSQLiteDriver.cs | Yupi.Model/MonoSQLiteDriver.cs | using System;
namespace Yupi.Model
{
public class MonoSQLiteDriver : NHibernate.Driver.ReflectionBasedDriver
{
public MonoSQLiteDriver()
: base(
"Mono.Data.Sqlite",
"Mono.Data.Sqlite",
"Mono.Data.Sqlite.SqliteConnection",
"Mono.Data.Sqlite.SqliteCommand")
{
}
public override bool UseNamedPrefixInParameter {
get {
return true;
}
}
public override bool UseNamedPrefixInSql {
get {
return true;
}
}
public override string NamedPrefix {
get {
return "@";
}
}
public override bool SupportsMultipleOpenReaders {
get {
return false;
}
}
}
}
| using System;
using Mono.Data.Sqlite;
namespace Yupi.Model
{
public class MonoSQLiteDriver : NHibernate.Driver.ReflectionBasedDriver
{
public MonoSQLiteDriver()
: base(
"Mono.Data.Sqlite",
"Mono.Data.Sqlite",
"Mono.Data.Sqlite.SqliteConnection",
"Mono.Data.Sqlite.SqliteCommand")
{
}
public override bool UseNamedPrefixInParameter {
get {
return true;
}
}
public override bool UseNamedPrefixInSql {
get {
return true;
}
}
public override string NamedPrefix {
get {
return "@";
}
}
public override bool SupportsMultipleOpenReaders {
get {
return false;
}
}
}
}
| mit | C# |
e538ccca779e170f30c027b8d623a22bb4664bdd | Update PlatformIdentifier unit test | tgstation/tgstation-server-tools,Cyberboss/tgstation-server,tgstation/tgstation-server,Cyberboss/tgstation-server,tgstation/tgstation-server | tests/Tgstation.Server.Host.Tests/Core/TestPlatformIdentifier.cs | tests/Tgstation.Server.Host.Tests/Core/TestPlatformIdentifier.cs | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Runtime.InteropServices;
namespace Tgstation.Server.Host.Core.Tests
{
[TestClass]
public sealed class TestPlatformIdentifier
{
[TestMethod]
public void TestCorrectPlatform()
{
var identifier = new PlatformIdentifier();
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
const string WindowsScriptExtension = "bat";
const string PosixScriptExtension = "sh";
Assert.AreEqual(isWindows, identifier.IsWindows);
Assert.AreEqual(isWindows ? WindowsScriptExtension : PosixScriptExtension, identifier.ScriptFileExtension);
}
}
}
| using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Runtime.InteropServices;
namespace Tgstation.Server.Host.Core.Tests
{
[TestClass]
public sealed class TestPlatformIdentifier
{
[TestMethod]
public void TestCorrectPlatform()
{
var identifier = new PlatformIdentifier();
Assert.AreEqual(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), identifier.IsWindows);
}
}
}
| agpl-3.0 | C# |
403690881f1161dc24a7795f19378e314ddffb85 | Fix incomplete zlib compression (#102) | hybrasyl/server,baughj/hybrasylserver,baughj/hybrasylserver,hybrasyl/server,baughj/hybrasylserver,hybrasyl/server | hybrasyl/Compression.cs | hybrasyl/Compression.cs | using System.IO;
using System.IO.Compression;
namespace Hybrasyl
{
public static class ZlibCompression
{
public static void Compress(Stream originalStream, Stream compressedStream)
{
uint checksum = 0;
using (var checksumStream = new MemoryStream())
{
var position = originalStream.Position;
originalStream.CopyTo(checksumStream);
originalStream.Seek(position, SeekOrigin.Begin);
var buffer = checksumStream.ToArray();
checksum = Adler32.ComputeHash(buffer);
}
compressedStream.Write(new byte[] { 0x78, 0x9C }, 0, 2);
using (var compressionStream = new DeflateStream(compressedStream, CompressionMode.Compress, true))
{
originalStream.Seek(0, SeekOrigin.Begin);
originalStream.CopyTo(compressionStream);
}
compressedStream.Write(new byte[]
{
(byte)(checksum >> 24),
(byte)(checksum >> 16),
(byte)(checksum >> 8),
(byte)checksum
}, 0, 4);
}
public static void Decompress(Stream originalStream, Stream decompressedStream)
{
originalStream.Seek(2, SeekOrigin.Begin);
using (var decompressionStream = new DeflateStream(originalStream, CompressionMode.Decompress, true))
{
decompressionStream.CopyTo(decompressedStream);
}
originalStream.Seek(4, SeekOrigin.Current);
}
}
public static class Adler32
{
public static uint ComputeHash(byte[] buffer) =>
ComputeHash(buffer, 0, buffer.Length);
public static uint ComputeHash(byte[] buffer, int offset, int count)
{
uint checksum = 1;
int n;
uint s1 = checksum & 0xFFFF;
uint s2 = checksum >> 16;
while (count > 0)
{
n = (3800 > count) ? count : 3800;
count -= n;
while (--n >= 0)
{
s1 = s1 + (uint)(buffer[offset++] & 0xFF);
s2 = s2 + s1;
}
s1 %= 65521;
s2 %= 65521;
}
checksum = (s2 << 16) | s1;
return checksum;
}
}
}
| using System.IO;
using System.IO.Compression;
namespace Hybrasyl
{
public static class ZlibCompression
{
public static void Compress(Stream originalStream, Stream compressedStream)
{
compressedStream.Write(new byte[] { 0x78, 0x9C }, 0, 2);
using (var compressionStream = new DeflateStream(compressedStream, CompressionMode.Compress, true))
{
originalStream.Seek(0, SeekOrigin.Begin);
originalStream.CopyTo(compressionStream);
}
}
public static void Decompress(Stream originalStream, Stream decompressedStream)
{
originalStream.Seek(2, SeekOrigin.Begin);
using (var decompressionStream = new DeflateStream(originalStream, CompressionMode.Decompress, true))
{
decompressionStream.CopyTo(decompressedStream);
}
}
}
}
| agpl-3.0 | C# |
b83ea0dea2c4b71407f136178dfb496e8040354f | Fix incorrect field name retrieval | jgoode/EDDiscovery,jgoode/EDDiscovery,mwerle/EDDiscovery,mwerle/EDDiscovery,jthorpe4/EDDiscovery | EDDiscovery/EliteDangerous/JournalEvents/JournalEndCrewSession.cs | EDDiscovery/EliteDangerous/JournalEvents/JournalEndCrewSession.cs | /*
* Copyright © 2017 EDDiscovery development team
*
* 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.
*
* EDDiscovery is not affiliated with Frontier Developments plc.
*/
using Newtonsoft.Json.Linq;
using System.Linq;
namespace EDDiscovery.EliteDangerous.JournalEvents
{
// When written: when the captain in multicrew disbands the crew
//Parameters:
// OnCrime: (bool) true if crew disbanded as a result of a crime in a lawful session
// { "timestamp":"2017-04-12T11:32:30Z", "event":"EndCrewSession", "OnCrime":false }
[JournalEntryType(JournalTypeEnum.EndCrewSession)]
public class JournalEndCrewSession : JournalEntry
{
public JournalEndCrewSession(JObject evt) : base(evt, JournalTypeEnum.EndCrewSession)
{
OnCrime = evt["OnCrime"].Bool();
}
public bool OnCrime { get; set; }
public override System.Drawing.Bitmap Icon { get { return EDDiscovery.Properties.Resources.crewmemberquits; } }
public override void FillInformation(out string summary, out string info, out string detailed) //V
{
summary = EventTypeStr.SplitCapsWord();
info = Tools.FieldBuilder("; Crime", OnCrime);
detailed = "";
}
}
}
| /*
* Copyright © 2017 EDDiscovery development team
*
* 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.
*
* EDDiscovery is not affiliated with Frontier Developments plc.
*/
using Newtonsoft.Json.Linq;
using System.Linq;
namespace EDDiscovery.EliteDangerous.JournalEvents
{
// When written: when the captain in multicrew disbands the crew
//Parameters:
// OnCrime: (bool) true if crew disbanded as a result of a crime in a lawful session
// { "timestamp":"2017-04-12T11:32:30Z", "event":"EndCrewSession", "OnCrime":false }
[JournalEntryType(JournalTypeEnum.EndCrewSession)]
public class JournalEndCrewSession : JournalEntry
{
public JournalEndCrewSession(JObject evt) : base(evt, JournalTypeEnum.EndCrewSession)
{
OnCrime = evt["Name"].Bool();
}
public bool OnCrime { get; set; }
public override System.Drawing.Bitmap Icon { get { return EDDiscovery.Properties.Resources.crewmemberquits; } }
public override void FillInformation(out string summary, out string info, out string detailed) //V
{
summary = EventTypeStr.SplitCapsWord();
info = Tools.FieldBuilder("; Crime", OnCrime);
detailed = "";
}
}
}
| apache-2.0 | C# |
67ac57f5060232f992d85724e060fdc4e5122755 | Rename types in test code. | JohanLarsson/Gu.Roslyn.Asserts | Gu.Roslyn.Asserts.Tests.Net472WithAttributes/RoslynAssertTests.cs | Gu.Roslyn.Asserts.Tests.Net472WithAttributes/RoslynAssertTests.cs | namespace Gu.Roslyn.Asserts.Tests.Net472WithAttributes
{
using Gu.Roslyn.Asserts.Tests.Net472WithAttributes.AnalyzersAndFixes;
using NUnit.Framework;
public partial class RoslynAssertTests
{
[Test]
public void ResetMetadataReferences()
{
CollectionAssert.IsNotEmpty(RoslynAssert.MetadataReferences);
RoslynAssert.MetadataReferences.Clear();
CollectionAssert.IsEmpty(RoslynAssert.MetadataReferences);
RoslynAssert.ResetMetadataReferences();
CollectionAssert.IsNotEmpty(RoslynAssert.MetadataReferences);
}
[Test]
public void CodeFixSingleClassOneErrorCorrectFix()
{
var before = @"
namespace RoslynSandbox
{
class C
{
private readonly int ↓_value;
}
}";
var after = @"
namespace RoslynSandbox
{
class C
{
private readonly int value;
}
}";
var analyzer = new FieldNameMustNotBeginWithUnderscore();
var fix = new DontUseUnderscoreCodeFixProvider();
RoslynAssert.CodeFix(analyzer, fix, before, after);
}
}
}
| namespace Gu.Roslyn.Asserts.Tests.Net472WithAttributes
{
using Gu.Roslyn.Asserts.Tests.Net472WithAttributes.AnalyzersAndFixes;
using NUnit.Framework;
public partial class RoslynAssertTests
{
[Test]
public void ResetMetadataReferences()
{
CollectionAssert.IsNotEmpty(RoslynAssert.MetadataReferences);
RoslynAssert.MetadataReferences.Clear();
CollectionAssert.IsEmpty(RoslynAssert.MetadataReferences);
RoslynAssert.ResetMetadataReferences();
CollectionAssert.IsNotEmpty(RoslynAssert.MetadataReferences);
}
[Test]
public void CodeFixSingleClassOneErrorCorrectFix()
{
var before = @"
namespace RoslynSandbox
{
class Foo
{
private readonly int ↓_value;
}
}";
var after = @"
namespace RoslynSandbox
{
class Foo
{
private readonly int value;
}
}";
var analyzer = new FieldNameMustNotBeginWithUnderscore();
var fix = new DontUseUnderscoreCodeFixProvider();
RoslynAssert.CodeFix(analyzer, fix, before, after);
}
}
}
| mit | C# |
3d3c7f1dcc984018ce9abd42dad01cd806fba324 | Add test methods 'StringUtilsTest#GetPositionByIndexError' | lury-lang/compiler-base | UnitTest/StringUtilsTest.cs | UnitTest/StringUtilsTest.cs | using System;
using Lury.Compiling.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class StringUtilsTest
{
[TestMethod]
public void GetNumberOfLineTest()
{
Assert.AreEqual(0, StringUtils.GetNumberOfLine(null));
Assert.AreEqual(1, String.Empty.GetNumberOfLine());
Assert.AreEqual(1, "\0".GetNumberOfLine());
Assert.AreEqual(1, "abc123".GetNumberOfLine());
Assert.AreEqual(2, "\r".GetNumberOfLine());
Assert.AreEqual(2, "\n".GetNumberOfLine());
Assert.AreEqual(2, "\r\n".GetNumberOfLine());
Assert.AreEqual(2, "\u2028".GetNumberOfLine());
Assert.AreEqual(2, "\u2029".GetNumberOfLine());
Assert.AreEqual(3, "\n\r".GetNumberOfLine());
}
[TestMethod]
public void GetPositionByIndexTest()
{
Assert.AreEqual(CharPosition.BasePosition, String.Empty.GetPositionByIndex(0));
Assert.AreEqual(CharPosition.BasePosition, "abc123".GetPositionByIndex(0));
Assert.AreEqual(new CharPosition(1, 4), "abc123".GetPositionByIndex(3));
Assert.AreEqual(new CharPosition(2, 1), "ab\nc123".GetPositionByIndex(3));
Assert.AreEqual(new CharPosition(2, 1), "ab\r\nc123".GetPositionByIndex(3));
Assert.AreEqual(new CharPosition(1, 7), "abc123".GetPositionByIndex(6));
Assert.AreEqual(new CharPosition(2, 3), "abc\n123".GetPositionByIndex(6));
Assert.AreEqual(new CharPosition(2, 4), "abc\n123".GetPositionByIndex(7));
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void GetPositionByIndexError1()
{
StringUtils.GetPositionByIndex(null, 0);
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void GetPositionByIndexError2()
{
"text".GetPositionByIndex(-1);
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
public void GetPositionByIndexError3()
{
"text".GetPositionByIndex(6);
}
}
}
| using System;
using Lury.Compiling.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTest
{
[TestClass]
public class StringUtilsTest
{
[TestMethod]
public void GetNumberOfLineTest()
{
Assert.AreEqual(0, StringUtils.GetNumberOfLine(null));
Assert.AreEqual(1, String.Empty.GetNumberOfLine());
Assert.AreEqual(1, "\0".GetNumberOfLine());
Assert.AreEqual(1, "abc123".GetNumberOfLine());
Assert.AreEqual(2, "\r".GetNumberOfLine());
Assert.AreEqual(2, "\n".GetNumberOfLine());
Assert.AreEqual(2, "\r\n".GetNumberOfLine());
Assert.AreEqual(2, "\u2028".GetNumberOfLine());
Assert.AreEqual(2, "\u2029".GetNumberOfLine());
Assert.AreEqual(3, "\n\r".GetNumberOfLine());
}
[TestMethod]
public void GetPositionByIndexTest()
{
Assert.AreEqual(CharPosition.BasePosition, String.Empty.GetPositionByIndex(0));
Assert.AreEqual(CharPosition.BasePosition, "abc123".GetPositionByIndex(0));
Assert.AreEqual(new CharPosition(1, 4), "abc123".GetPositionByIndex(3));
Assert.AreEqual(new CharPosition(2, 1), "ab\nc123".GetPositionByIndex(3));
Assert.AreEqual(new CharPosition(2, 1), "ab\r\nc123".GetPositionByIndex(3));
Assert.AreEqual(new CharPosition(1, 7), "abc123".GetPositionByIndex(6));
Assert.AreEqual(new CharPosition(2, 3), "abc\n123".GetPositionByIndex(6));
Assert.AreEqual(new CharPosition(2, 4), "abc\n123".GetPositionByIndex(7));
}
}
}
| mit | C# |
d997684c25c1eef1ab2734a6c705f8ee39ec3459 | Add more unit tests for EntityController | jbe2277/waf | src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Applications.Test/Controllers/EntityControllerTest.cs | src/System.Waf/Samples/BookLibrary/BookLibrary.Library.Applications.Test/Controllers/EntityControllerTest.cs | using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;
using System.Waf.UnitTesting;
using System.Waf.UnitTesting.Mocks;
using Waf.BookLibrary.Library.Applications.Controllers;
using Waf.BookLibrary.Library.Applications.Services;
using Waf.BookLibrary.Library.Applications.ViewModels;
using Waf.BookLibrary.Library.Domain;
namespace Test.BookLibrary.Library.Applications.Controllers
{
[TestClass]
public class EntityControllerTest : TestClassBase
{
[TestMethod]
public void ValidateBeforeSave()
{
var controller = (EntityController)Get<IEntityController>();
controller.Initialize();
Assert.IsFalse(controller.HasChanges());
var entityService = Get<EntityService>();
entityService.Persons.Add(new Person() { Firstname = "Harry", Lastname = "Potter" });
entityService.Persons.Last().Validate();
Assert.IsTrue(controller.HasChanges());
Assert.IsTrue(controller.CanSave());
controller.Save();
Assert.IsFalse(controller.HasChanges());
var messageService = Get<MockMessageService>();
Assert.AreEqual(MessageType.None, messageService.MessageType);
entityService.Persons.Add(new Person());
entityService.Persons.Last().Validate();
Assert.IsTrue(controller.HasChanges());
var shellViewModel = Get<ShellViewModel>();
shellViewModel.SaveCommand.Execute(null);
Assert.AreEqual(MessageType.Error, messageService.MessageType);
Assert.IsTrue(controller.HasChanges());
controller.Shutdown();
}
[TestMethod]
public void DisableSaveWhenShellIsInvalid()
{
var controller = (EntityController)Get<IEntityController>();
controller.Initialize();
var shellViewModel = Get<ShellViewModel>();
Assert.IsTrue(shellViewModel.SaveCommand.CanExecute(null));
AssertHelper.CanExecuteChangedEvent(shellViewModel.SaveCommand, () => shellViewModel.IsValid = false);
Assert.IsFalse(shellViewModel.SaveCommand.CanExecute(null));
controller.Shutdown();
}
[TestMethod]
public void EntityToStringTest()
{
var entity = new Entity() { ToStringValue = "Test1" };
Assert.AreEqual("Test1", EntityController.EntityToString(entity));
var entity2 = new FormattableEntity() { ToStringValue = "Test2" };
Assert.AreEqual("Test2", EntityController.EntityToString(entity2));
}
private class Entity
{
public string ToStringValue;
public override string ToString() { return ToStringValue; }
}
private class FormattableEntity : IFormattable
{
public string ToStringValue;
public string ToString(string format, IFormatProvider formatProvider)
{
return ToStringValue;
}
}
}
}
| using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Waf.BookLibrary.Library.Applications.Controllers;
namespace Test.BookLibrary.Library.Applications.Controllers
{
[TestClass]
public class EntityControllerTest : TestClassBase
{
[TestMethod]
public void EntityToStringTest()
{
var entity = new Entity() { ToStringValue = "Test1" };
Assert.AreEqual("Test1", EntityController.EntityToString(entity));
var entity2 = new FormattableEntity() { ToStringValue = "Test2" };
Assert.AreEqual("Test2", EntityController.EntityToString(entity2));
}
private class Entity
{
public string ToStringValue;
public override string ToString() { return ToStringValue; }
}
private class FormattableEntity : IFormattable
{
public string ToStringValue;
public string ToString(string format, IFormatProvider formatProvider)
{
return ToStringValue;
}
}
}
}
| mit | C# |
9d814715639a7d4e2e7101ae407e13ab0a36be50 | Bump version. | kyourek/Pagination,kyourek/Pagination,kyourek/Pagination | sln/AssemblyVersion.cs | sln/AssemblyVersion.cs | using System.Reflection;
[assembly: AssemblyVersion("2.1.1")]
| using System.Reflection;
[assembly: AssemblyVersion("2.1.0.2")]
| mit | C# |
18b14716081cc6c7f4377196db030a862e292d6e | fix review | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/resharper-unity/src/CSharp/Feature/Services/Refactorings/Rename/UnityRenameUtil.cs | resharper/resharper-unity/src/CSharp/Feature/Services/Refactorings/Rename/UnityRenameUtil.cs | using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.ProjectModel;
using JetBrains.ReSharper.Psi;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.Refactorings.Rename
{
public static class UnityRenameUtil
{
public static bool IsRenameShouldBeSilent(IDeclaredElement declaredElement)
{
var project = declaredElement.GetSourceFiles().FirstOrDefault()?.GetProject();
if (project == null)
return false;
if (project.IsPlayerProject())
return true;
if (project.IsMiscProjectItem())
return true;
return false;
}
}
} | using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi;
namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.Refactorings.Rename
{
public static class UnityRenameUtil
{
public static bool IsRenameShouldBeSilent(IDeclaredElement declaredElement)
{
var project = declaredElement.GetSourceFiles().FirstOrDefault()?.GetProject();
if (project == null)
return false;
if (project.Name.EndsWith(".Player"))
return true;
if (project.IsMiscProjectItem())
return true;
return false;
}
}
} | apache-2.0 | C# |
f6cf8d71a4f93f12fa66fa5f1e31d819a657b0cf | Make the chat input only update when enter is not pressed | gavazquez/LunaMultiPlayer,DaggerES/LunaMultiPlayer,gavazquez/LunaMultiPlayer,gavazquez/LunaMultiPlayer | LmpClient/Windows/Chat/ChatDrawer.cs | LmpClient/Windows/Chat/ChatDrawer.cs | using LmpClient.Localization;
using LmpClient.Systems.Chat;
using UnityEngine;
namespace LmpClient.Windows.Chat
{
public partial class ChatWindow
{
private static string _chatInputText = string.Empty;
protected override void DrawWindowContent(int windowId)
{
var pressedEnter = Event.current.type == EventType.KeyDown && !Event.current.shift && Event.current.character == '\n';
GUILayout.BeginVertical();
GUI.DragWindow(MoveRect);
DrawChatMessageBox();
DrawTextInput(pressedEnter);
GUILayout.Space(5);
GUILayout.EndVertical();
}
private static void DrawChatMessageBox()
{
GUILayout.BeginHorizontal();
_chatScrollPos = GUILayout.BeginScrollView(_chatScrollPos);
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
foreach (var channelMessage in ChatSystem.Singleton.ChatMessages)
GUILayout.Label(channelMessage);
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndHorizontal();
}
private static void DrawTextInput(bool pressedEnter)
{
GUILayout.BeginHorizontal();
if (pressedEnter || GUILayout.Button(LocalizationContainer.ChatWindowText.Send, GUILayout.Width(WindowWidth * .25f)))
{
if (!string.IsNullOrEmpty(_chatInputText))
{
ChatSystem.Singleton.MessageSender.SendChatMsg(_chatInputText.Trim('\n'));
}
_chatInputText = string.Empty;
}
else
{
_chatInputText = GUILayout.TextArea(_chatInputText);
}
GUILayout.EndHorizontal();
}
}
} | using LmpClient.Localization;
using LmpClient.Systems.Chat;
using UnityEngine;
namespace LmpClient.Windows.Chat
{
public partial class ChatWindow
{
private static string _chatInputText = string.Empty;
protected override void DrawWindowContent(int windowId)
{
var pressedEnter = Event.current.type == EventType.KeyDown && !Event.current.shift && Event.current.character == '\n';
GUILayout.BeginVertical();
GUI.DragWindow(MoveRect);
DrawChatMessageBox();
DrawTextInput(pressedEnter);
GUILayout.Space(5);
GUILayout.EndVertical();
}
private static void DrawChatMessageBox()
{
GUILayout.BeginHorizontal();
_chatScrollPos = GUILayout.BeginScrollView(_chatScrollPos);
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
foreach (var channelMessage in ChatSystem.Singleton.ChatMessages)
GUILayout.Label(channelMessage);
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndHorizontal();
}
private static void DrawTextInput(bool pressedEnter)
{
GUILayout.BeginHorizontal();
_chatInputText = GUILayout.TextArea(_chatInputText);
if (pressedEnter || GUILayout.Button(LocalizationContainer.ChatWindowText.Send, GUILayout.Width(WindowWidth * .25f)))
{
if (!string.IsNullOrEmpty(_chatInputText))
{
ChatSystem.Singleton.MessageSender.SendChatMsg(_chatInputText.Trim('\n'));
}
_chatInputText = string.Empty;
}
GUILayout.EndHorizontal();
}
}
} | mit | C# |
9c28835f7384532e5fd2754289dde16a382f3561 | change text on index | NJWolf/professionalsite,NJWolf/professionalsite | NickWolf.Web/Views/Home/Index.cshtml | NickWolf.Web/Views/Home/Index.cshtml | @{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body id="page-top" class="index">
<header>
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">
Welcome To Nick Wolf's site!
</div>
<div class="intro-heading">Thanks for visiting</div>
<a href="#about" class="page-scroll btn btn-xl">About Me</a>
</div>
</div>
</header>
@Html.Partial("_About")
@Html.Partial("_Resume")
@Html.Partial("_Contact")
</body>
</html>
| @{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body id="page-top" class="index">
<header>
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">
Welcome To Nick Wolf site!
</div>
<div class="intro-heading">It's Nice To Meet You</div>
<a href="#about" class="page-scroll btn btn-xl">About Me</a>
</div>
</div>
</header>
@Html.Partial("_About")
@Html.Partial("_Resume")
@Html.Partial("_Contact")
</body>
</html>
| mit | C# |
32aac83e5fa7ec7df8935cbd2498cd13bdb88554 | Add tooltips and extract inspector classes | bartlomiejwolk/DisableAfterTime | Editor/DisableAfterTimeEditor.cs | Editor/DisableAfterTimeEditor.cs | using UnityEngine;
using System.Collections;
using UnityEditor;
using OneDayGame;
namespace DisableAfterTimeEx {
[CustomEditor(typeof (DisableAfterTime))]
public class DisableAfterTimeEditor : Editor {
private SerializedProperty targetGO;
private SerializedProperty delay;
private void OnEnable() {
targetGO = serializedObject.FindProperty("targetGO");
delay = serializedObject.FindProperty("delay");
}
public override void OnInspectorGUI() {
serializedObject.Update();
DrawTargetGOField();
DrawDelayField();
serializedObject.ApplyModifiedProperties();
}
private void DrawDelayField() {
EditorGUILayout.PropertyField(
delay,
new GUIContent(
"Delay",
"Delay before disabling target game object."));
}
private void DrawTargetGOField() {
EditorGUILayout.PropertyField(
targetGO,
new GUIContent(
"Target",
"Game object to be disabled."));
}
}
}
| using UnityEngine;
using System.Collections;
using UnityEditor;
using OneDayGame;
namespace DisableAfterTimeEx {
[CustomEditor(typeof (DisableAfterTime))]
public class DisableAfterTimeEditor : Editor {
private SerializedProperty targetGO;
private SerializedProperty delay;
private void OnEnable() {
targetGO = serializedObject.FindProperty("targetGO");
delay = serializedObject.FindProperty("delay");
}
public override void OnInspectorGUI() {
serializedObject.Update();
EditorGUILayout.PropertyField(targetGO);
EditorGUILayout.PropertyField(delay);
serializedObject.ApplyModifiedProperties();
}
}
}
| mit | C# |
0ac9a707358967b4c4249b74e16ab52708a10de4 | Update ApplicationDbContextFactory | mlorbetske/templating,mlorbetske/templating,seancpeters/templating,seancpeters/templating,seancpeters/templating,seancpeters/templating | template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/ApplicationDbContextFactory.cs | template_feed/Microsoft.DotNet.Web.ProjectTemplates.2.0/content/StarterWeb-CSharp/Data/ApplicationDbContextFactory.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace Company.WebApplication1.Data
{
public class ApplicationDbContextFactory : IDbContextFactory<ApplicationDbContext>
{
public ApplicationDbContext Create(string[] args) =>
Program.BuildWebHost(args).Services.GetRequiredService<ApplicationDbContext>();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace Company.WebApplication1.Data
{
public class ApplicationDbContextFactory : IDbContextFactory<ApplicationDbContext>
{
public ApplicationDbContext Create(DbContextFactoryOptions options) =>
Program.BuildWebHost(Array.Empty<string>()).Services.GetRequiredService<ApplicationDbContext>();
}
}
| mit | C# |
b773fc792d4cf1ea386c18a45ecd44eb5344a0ef | use HashSet instead of List for speed of lookups | jmkelly/elephanet,YoloDev/elephanet,jmkelly/elephanet,YoloDev/elephanet | Elephanet/IStoreInfo.cs | Elephanet/IStoreInfo.cs | using System;
using System.Collections.Generic;
namespace Elephanet
{
public interface IStoreInfo
{
string Name { get; }
HashSet<string> Tables { get; }
void Add(string tableName);
}
}
| using System;
using System.Collections.Generic;
namespace Elephanet
{
public interface IStoreInfo
{
string Name { get; }
List<string> Tables { get; }
void Add(string tableName);
}
}
| mit | C# |
c5ddcaedf1819ad29efd160e732856c570be175d | Make Assign internal for safety | EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework | osu.Framework/Graphics/Pooling/PoolableDrawable.cs | osu.Framework/Graphics/Pooling/PoolableDrawable.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Layout;
namespace osu.Framework.Graphics.Pooling
{
public class PoolableDrawable : CompositeDrawable
{
public override bool DisposeOnDeathRemoval => pool == null;
/// <summary>
/// Whether this pooled drawable is currently in use.
/// </summary>
public bool IsInUse { get; private set; }
/// <summary>
/// Whether this drawable is currently managed by a pool.
/// </summary>
public bool IsInPool => pool != null;
private IDrawablePool pool;
public void SetPool(IDrawablePool pool)
{
this.pool = pool;
}
internal void Assign()
{
if (IsInUse)
throw new InvalidOperationException($"This {nameof(PoolableDrawable)} is already in use");
Debug.Assert(pool != null);
IsInUse = true;
LifetimeStart = double.MinValue;
LifetimeEnd = double.MaxValue;
Schedule(PrepareForUse);
}
/// <summary>
/// Perform any initialisation on new usage of this drawable.
/// </summary>
protected virtual void PrepareForUse()
{
}
/// <summary>
/// Perform any clean-up required before returning this drawable to a pool.
/// </summary>
protected virtual void FreeAfterUse()
{
}
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
{
if (invalidation.HasFlag(Invalidation.Parent))
{
if (IsInUse && Parent == null)
{
FreeAfterUse();
pool?.Return(this);
IsInUse = false;
}
}
return base.OnInvalidate(invalidation, source);
}
}
}
| // 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.Diagnostics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Layout;
namespace osu.Framework.Graphics.Pooling
{
public class PoolableDrawable : CompositeDrawable
{
public override bool DisposeOnDeathRemoval => pool == null;
/// <summary>
/// Whether this pooled drawable is currently in use.
/// </summary>
public bool IsInUse { get; private set; }
/// <summary>
/// Whether this drawable is currently managed by a pool.
/// </summary>
public bool IsInPool => pool != null;
private IDrawablePool pool;
public void SetPool(IDrawablePool pool)
{
this.pool = pool;
}
public void Assign()
{
Debug.Assert(pool != null);
Debug.Assert(!IsInUse);
IsInUse = true;
LifetimeStart = double.MinValue;
LifetimeEnd = double.MaxValue;
if (IsLoaded)
PrepareForUse();
else
Schedule(PrepareForUse);
}
/// <summary>
/// Perform any initialisation on new usage of this drawable.
/// </summary>
protected virtual void PrepareForUse()
{
}
/// <summary>
/// Perform any clean-up required before returning this drawable to a pool.
/// </summary>
protected virtual void FreeAfterUse()
{
}
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
{
if (invalidation.HasFlag(Invalidation.Parent))
{
if (IsInUse && Parent == null)
{
FreeAfterUse();
pool?.Return(this);
IsInUse = false;
}
}
return base.OnInvalidate(invalidation, source);
}
}
}
| mit | C# |
1b567d31f5490c63d02c876a147d093ea3403e41 | Add copyright and nullability to AnalyzerConfigOptionSet | AmadeusW/roslyn,heejaechang/roslyn,genlu/roslyn,CyrusNajmabadi/roslyn,brettfo/roslyn,KevinRansom/roslyn,agocke/roslyn,sharwell/roslyn,reaction1989/roslyn,jmarolf/roslyn,mgoertz-msft/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,eriawan/roslyn,aelij/roslyn,mgoertz-msft/roslyn,physhi/roslyn,panopticoncentral/roslyn,weltkante/roslyn,davkean/roslyn,wvdd007/roslyn,dotnet/roslyn,heejaechang/roslyn,aelij/roslyn,gafter/roslyn,physhi/roslyn,weltkante/roslyn,eriawan/roslyn,ErikSchierboom/roslyn,gafter/roslyn,AlekseyTs/roslyn,stephentoub/roslyn,brettfo/roslyn,tannergooding/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,tmat/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,AlekseyTs/roslyn,genlu/roslyn,AmadeusW/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,eriawan/roslyn,KevinRansom/roslyn,mavasani/roslyn,genlu/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,agocke/roslyn,dotnet/roslyn,sharwell/roslyn,diryboy/roslyn,KirillOsenkov/roslyn,KirillOsenkov/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,brettfo/roslyn,panopticoncentral/roslyn,KirillOsenkov/roslyn,AmadeusW/roslyn,physhi/roslyn,diryboy/roslyn,reaction1989/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,tannergooding/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,aelij/roslyn,davkean/roslyn,reaction1989/roslyn,wvdd007/roslyn,davkean/roslyn,KevinRansom/roslyn,tannergooding/roslyn,bartdesmet/roslyn,mavasani/roslyn,agocke/roslyn,tmat/roslyn,diryboy/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,tmat/roslyn | src/Features/Core/Portable/Diagnostics/AnalyzerConfigOptionSet.cs | src/Features/Core/Portable/Diagnostics/AnalyzerConfigOptionSet.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.
#nullable enable
using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal class AnalyzerConfigOptionSet : OptionSet
{
private readonly AnalyzerConfigOptions _analyzerConfigOptions;
private readonly OptionSet? _optionSet;
public AnalyzerConfigOptionSet(AnalyzerConfigOptions analyzerConfigOptions, OptionSet? optionSet)
{
_analyzerConfigOptions = analyzerConfigOptions;
_optionSet = optionSet;
}
public override object GetOption(OptionKey optionKey)
{
// First try to find the option from the .editorconfig options parsed by the compiler.
if (_analyzerConfigOptions.TryGetOption(optionKey, out var value))
{
return value;
}
// Fallback to looking for option from the document's optionset if unsuccessful.
return _optionSet?.GetOption(optionKey) ?? optionKey.Option.DefaultValue;
}
public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object value)
{
throw new NotImplementedException();
}
internal override IEnumerable<OptionKey> GetChangedOptions(OptionSet optionSet)
{
throw new NotImplementedException();
}
}
}
| using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal class AnalyzerConfigOptionSet : OptionSet
{
private readonly AnalyzerConfigOptions _analyzerConfigOptions;
private readonly OptionSet _optionSet;
public AnalyzerConfigOptionSet(AnalyzerConfigOptions analyzerConfigOptions, OptionSet optionSet)
{
_analyzerConfigOptions = analyzerConfigOptions;
_optionSet = optionSet;
}
public override object GetOption(OptionKey optionKey)
{
// First try to find the option from the .editorconfig options parsed by the compiler.
if (_analyzerConfigOptions.TryGetOption(optionKey, out var value))
{
return value;
}
// Fallback to looking for option from the document's optionset if unsuccessful.
return _optionSet?.GetOption(optionKey) ?? optionKey.Option.DefaultValue;
}
public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object value)
{
throw new NotImplementedException();
}
internal override IEnumerable<OptionKey> GetChangedOptions(OptionSet optionSet)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.