text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>windowService);
windowService.SetMainWindow(_window);
((FileStorage)_fileStorage).MainWindow = _window;
((FontProvider)_fontProvider).MainWindow = _window;
// Navigate to our Blazor webpage.
_blazorGtkWebView.RootComponents.Add(new RootComponent { Selector = "#app"... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>namespace DevToys.Linux;
internal partial class Program
{
private static LinuxProgram? linuxProgram;
private <|fim_suffix|>in(string[] args)
{
linuxProgram = new LinuxProgram();
linuxProgram.Application.Run(0, null);
return 0;
}
}
<|fim_middle|>static int Ma<|end... | fim | DevToys-app/DevToys | csharp |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//-----------------------------------------... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>ce.
_windowService = new WindowService();
LogInitialization((DateTime.Now - startTime).TotalMilliseconds);
LogAppStarting();
// Set the user-defined language.
string languageIdentifier
= MefComposer.Provider.Import<ISettingsProvider>().GetSetting(Prede... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using DevToys.MacOS.Core.Helpers;
using Microsoft.AspNetCore.Components;
namespace DevToys.MacOS.Controls;
internal sealed c<|fim_suffix|>ult>> workItem)
{
return ThreadHelper.RunOnUIThreadAsync(workItem);
}
}
<|fim_middle|>lass AppKitDispatcher : Dispatcher
{
public override bool Ch... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>utableDictionary<NSString, NSString>())
{
dic.Add(
(NSString)"Content-Length",
(NSString)responseBytes.Length.ToString(CultureInfo.InvariantCulture));
dic.Add(
(NSString)"Content-Type",
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>igation)
{
// TODO: Determine whether this is needed
//_webView.HandleNavigationStarting(_currentUri);
}
}
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
{
if (_currentUri != ... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>iewManagerAsync(WebViewManager webviewManager)
{
if (string.IsNullOrWhiteSpace(Selector))
{
throw new InvalidOperationException( $"{nameof(RootComponent)} requires a value for its {nameof(Selector)} property, but no value was set.");
}
return webviewManager... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Colle<|fim_suffix|>>
internal sealed class RootComponentsCollection : ObservableCollection<RootComponent>, IJSComponentConfiguration
{
/// <inheritdoc />
public JSComponentConfigurationStore JSComponents { get; } = new();
}
<|fim_middle|>ctions.ObjectModel;
using Microsoft.AspNetCore.... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>
if (string.Equals(".css", Path.GetExtension(relativePath), StringComparison.Ordinal))
{
// We could try to supply the URL of the modified file, so the JS-side logic could only update the affected
// stylesheet. This would reduce flic... | fim | DevToys-app/DevToys | csharp |
namespace DevToys.MacOS.Controls.BlazorWebView;
/// <summary>
/// Used to provide information about a link (<![CDATA[<a>]]>) clicked within a Blazor WebView.
/// <para>
/// Anchor tags with target="_blank" will always open in the default
/// browser and the UrlLoading event won't be called.
/// </para>
/// </summary>
... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>namespace DevToys.MacOS.Controls.BlazorWebView;
/// <summary>
/// URL loading strategy for anchor tags <![CDATA[<a>]]> within a Blazor WebView.
///
/// Anchor tags with target="_blank" will always open in the default
/// browser and the UrlLoading event won't be called.
/// </summary>
internal enum UrlL... | fim | DevToys-app/DevToys | csharp |
using DevToys.Api;
using Microsoft.Extensions.Logging;
using ObjCRuntime;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats.Png;
using DevToys.MacOS.Core.Helpers;
namespace DevToys.MacOS.Core;
[Export(typeof(IClipboard))]
inter... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>rectory.LibraryDirectory);
private static string GetDirectory(NSSearchPathDirectory directory)
{
string[]? dirs = NSSearchPath.GetDirectories(directory, NSSearchPathDomain.User);
Guard.IsNotNull(dirs);
Guard.IsGreaterThan(dirs.Length, 0);
return dirs[0];
}
... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Runtime.Versioning;
using DevToys.Api;
using DevToys.Core;
using DevToys.MacOS.Core.Helpers;
using UniformTypeIdentifiers;
namespace DevToys.MacOS.Core;
[Export(typeof(IFileStorage))]
internal sealed class FileStorage : IFileStorage
{
public string AppCacheDirectory => Constants.AppCach... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using DevToys.Api;
using Microsoft.Extensions.Logging;
namespace DevToys.MacOS.Core;
[Export(typeof(IFontProvider))]
internal sealed partial class FontProvider : IFontProvider
{
private readonly ILogger _logger;
[ImportingConstructor]
public FontProvider()
{
_logger = thi<|fim_s... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>namespace DevToys.MacOS.Core.Helpers;
internal static class ThreadHelper
{
internal static void ThrowIfNotOnUIThread()
{
if (!IsOnUIThread())
{
throw new Exception("The UI thread is expected, but the current call stack is running on another thread.");
}
}
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>rDefaults;
string? valueString = value?.ToString();
if (value == null)
{
if (userDefaults[settingName] != null)
{
userDefaults.RemoveObject(settingName);
}
return;
}
... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using DevToys.Api;
using DevToys.Blazor.Components;
using DevToys.Core.Settings;
using DevToys.MacOS.Core.Helpers;
using DevToys.MacOS.Views;
namespace DevToys.MacOS.Core;
[Export(typeof(IThemeListener))]
internal sealed class ThemeListener : IThemeListener, IDisposable
{
private readonly ISettingsP... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>ndowState.MaxWidth, _nonCompactOverlayModeWindowState.MaxHeight);
CGRect newFrame = MainWindow.Instance.Frame;
newFrame.Width = _nonCompactOverlayModeWindowState.Width;
newFrame.Height = _nonCompactOverlayModeWindowState.Height;
newFrame.X = _nonCompactOverl... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> MinHeight,
double MinWidth)
{
}
<|fim_prefix|>namespace DevToys.MacOS.Core;
internal record WindowStateBackup(
bool IsZoomed,
nfloat Height,
nfloat Width,
nfloat X,
nfloat Y,
double <|fim_middle|>MaxHeight,
double MaxWidth,
double<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>pplication.Main(args);
<|fim_prefix|>using DevToys.Mac<|fim_middle|>OS;
NSApplication.Init();
NSApplication.SharedApplication.Delegate = new AppDelegate();
NSA<|endoftext|> | fim | DevToys-app/DevToys | csharp |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//-----------------------------------------... | fim | DevToys-app/DevToys | csharp |
using DevToys.Api;
namespace DevToys.MacOS.Views;
internal sealed class AppMenuBar : NSMenu
{
private readonly NSMenuItem _devToysMenu = new();
private readonly NSMenu _devToysSubmenu = new();
private readonly NSMenuItem _editMenu = new();
private readonly NSMenu _editSubmenu;
private readonly NSM... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>MainWindowMaximized, IsZoomed);
}
}
private void OnBlazorWebViewInitialized(object? sender, EventArgs e)
{
InitializeLowPriorityServices();
}
private void TitleBarInfoProvider_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using Application = System.Windows.Application;
<|fim_suffix|>r App.xaml
/// </summary>
public partial class App : Application
{
}
<|fim_middle|>
namespace DevToys.Windows;
/// <summary>
/// Interaction logic fo<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>ldOf(_childHandle, new HWND(windowHandleParent.Handle));
handleRef = new HandleRef(this, _childHandle);
}
return handleRef;
}
protected override void DestroyWindowCore(HandleRef hwnd)
{
}
}
<|fim_prefix|>using System.Runtime.InteropServices;
using System.Wind... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Shell;
using DevToys.Api;
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>erlayWindow = new OverlayWindow
{
Content = content,
WndProcHandler = WndProcHandler
};
_overlayWindow.Show();
var windowHandle = new HWND(new WindowInteropHelper(_overlayWindow).Handle);
_host = new HwndHostEx(windowHandle);
Conten... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>}
protected override void OnSourceInitialized(EventArgs e)
{
nint windowHandle = new WindowInteropHelper(this).Handle;
var hwndSource = HwndSource.FromHwnd(windowHandle);
hwndSource.AddHook(new HwndSourceHook(WndProc));
// Hide window from Alt+Tab.
NativeM... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using DevToys.Blazor.Core;
using Microsoft.AspNetCore.Components.WebView.Wpf;
using Microsoft.Extensions.FileProviders;
namespace D<|fim_suffix|>ew
{
public override IFileProvider CreateFileProvider(string contentRootDir)
{
var embeddedProvider = new DevToysBlazorEmbeddedFileProvider();
... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Collections.Specialized;
using System.IO;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using DevToys.Api;
using DevToys.Windows.Core.Helpers;
using DevToys.Windows.Helpers;
using Microsoft.Extensions.Logging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Pixel... | fim | DevToys-app/DevToys | csharp |
using System.IO;
using DevToys.Core;
namespace DevToys.Windows.Core;
internal static class Constants
{
internal static readonly string AppCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppHelper.IsPreviewVersion.Value ? "DevToys-preview" : "DevToys");
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> ProcessPriorityClass.High => PROCESS_CREATION_FLAGS.HIGH_PRIORITY_CLASS,
ProcessPriorityClass.RealTime => PROCESS_CREATION_FLAGS.REALTIME_PRIORITY_CLASS,
_ => throw new NotImplementedException(),
};
_ = PInvoke.SetPriorityClass(hProcess: PInvoke.GetCurr... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.IO;
using System.Text;
using DevToys.Api;
using DevToys.Core;
using DevToys.Windows.Helpers;
using DevToys.Windows.Strings.Other;
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
using SaveFileDialog = Microsoft.Win32.SaveFileDialog;
namespace DevToys.Windows.Core;
[Export(typeof(IFi... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Windows.Media;
usin<|fim_suffix|> private readonly Lazy<string[]> _fontFamilies
= new(() => Fonts.SystemFontFamilies.SelectMany(f => f.FamilyNames.Values).Order().ToArray());
private readonly ILogger _logger;
[ImportingConstructor]
public FontProvider()
{
_l... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Gdi;
namespace DevToys.Windows.Core.Helpers;
/// <summary>
/// An helper class to help with DPI.
/// </summary>
internal sealed class DpiHelp... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>Stream, width, height);
// BITMAPINFOHEADER struct for DIB.
int hdrSize = 0x28;
byte[] fullImage = new byte[hdrSize + 12 + bm32bData.Length];
//Int32 biSize;
WriteIntToByteArray(fullImage, 0x00, 4, true, (uint)hdrSize);
//Int32 biWidth;
WriteIntTo... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Windows.Threading;
using DevToys.Api;
using Application = System.Windows.Application;
namespace DevToys.Windows.Helpers;
public static class ThreadHelper
{
private static readonly Dispatcher dispatcher = Application.Current.Dispatcher;
public static void ThrowIfNotOnUIThread()
... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Runtime.Versioning;
namespace DevToys.Windows.Core;
/// <summary>
/// The system maintains multiple QoS levels, each with differentiated performance and power efficiency. <br/>
/// Windows provides standard default settings for scheduling and processor power management for each QoS level.... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> return false;
}
public void WriteSetting(string settingName, object? value)
{
_settings.Value[settingName] = value?.ToString() ?? string.Empty;
SaveAllSettingsAsync().Forget();
}
private ConcurrentDictionary<string, string> LoadAllSettings()
{
var result... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Windows.Shell;
using CommunityToolkit.Mvvm.ComponentModel;
using DevToys.Api;
using DevToys.Business.Services;
using DevToys.Core.Tools;
using DevToys.Windows.Helpers;
using DevToys.Windows.Strings.TaskBar;
namespace DevToys.Windows.Core;
[Export(typeof(TaskbarJumpListService))]
internal c... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Windows;
using DevToys.Api;
using DevToys.Blazor.Components;
using Dev<|fim_suffix|> theme = CurrentSystemTheme;
}
// Set theme for window root.
if (theme == AvailableApplicationTheme.Dark)
{
ActualAppTheme = ApplicationTheme.Dark;
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> _window.ActualWidth,
_window.Top,
_window.Left,
_window.MaxHeight,
_window.MaxWidth,
_window.MinHeight,
_window.MinWidth,
_window.WindowState);
// Re... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Windows;
namespace DevToys.Windows.Core;
internal record WindowStateBackup(
bool Topmost,
double H<|fim_suffix|> double MaxWidth,
double MinHeight,
double MinWidth,
WindowState State)
{
}
<|fim_middle|>eight,
double Width,
double Top,
double Left,
doub... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.IO;
using System.Windows.Interop;
using DevToys.Api;
using DevToys.Blazor.BuiltInTools;
using DevToys.Blazor.BuiltInTools.ExtensionsManager;
using DevToys.Blazor.Core.Languages;
using DevToys.Blazor.Core.Services;
using DevToys.Business.Services;
using DevToys.Business.ViewModels;
using DevT... | fim | DevToys-app/DevToys | csharp |
namespace DevToys.Windows.Native;
[Flags]
internal enum AccentEdges
{
Left = 0x20,
Top = 0x40,
Right = 0x80,
Bottom = 0x100
}
<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>CENT_ENABLE_BORDER_TOP | ACCENT_ENABLE_BORDER_RIGHT | ACCENT_ENABLE_BORDER_BOTTOM
}
<|fim_prefix|>namespace DevToys.Windows.Native;
[Flags]
internal enum AccentFlag
{
ACCENT_NONE,
ACCENT_ENABLE_MODERN_ACRYLIC_RECIPE = 1 << 1, // Windows 11 22H2+
ACCENT_ENABLE_GRADIENT_COLOR = 1 << 1, // AC... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Runtime.InteropServices;
namespace DevToys.Windows.Native;
[Str<|fim_suffix|> int AnimationId;
}
<|fim_middle|>uctLayout(LayoutKind.Sequential)]
internal struct AccentPolicy
{
public AccentState AccentState;
public AccentFlag AccentFlags;
public uint GradientColor;
public<|... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>namespace DevToys.Windows.Native;
internal enum AccentState
{
ACCENT_DISABLED = 0,
ACCENT_ENABLE_GRADIENT = 1,
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
ACCENT_ENABLE_BLURBEHIND = 3,
ACCENT_ENABLE_ACRYLICBLURBEHIND = 4,
<|fim_suffix|>CCENT_INVALID_STATE = 5
}
<|fim_middle|> A<|endoft... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>namespace DevToys.Windows.Native<|fim_suffix|>CT = 1029
}
<|fim_middle|>;
[Flags]
public enum DWMWINDOWATTRIBUTE_EXTENDED
{
DWMWA_MICA_EFFE<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>_CORNER_PREFERENCE
{
DWMWCP_DEFAULT = 0,
DWMWCP_DONOTROUND = 1,
DWMWCP_ROUND = 2,
DWMWCP_ROUNDSMALL = 3
}
<|fim_prefix|>namespace DevToys.Windows.Native;
public enum DWM_WINDO<|fim_middle|>W<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>onst int
True = 0x01,
False = 0x00;
}
<|fim_prefix|>namespace Dev<|fim_middle|>Toys.Windows.Native;
internal static class DwmValues
{
internal c<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>namespace DevToys.Windows.Nativ<|fim_suffix|>;
}
<|fim_middle|>e;
internal static class HwndButtons
{
public const int WS_SYSMENU = 0x80000<|endoftext|> | fim | DevToys-app/DevToys | csharp |
namespace DevToys.Windows.Native;
internal static class HwndSourceMessages
{
internal const int WS_CHILD = 0x40000000;
internal const int WS_EX_TOOLWINDOW = 0x00000080;
}
<|endoftext|> | fim | DevToys-app/DevToys | csharp |
using System.Runtime.InteropServices;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Dwm;
using Windows.Win32.UI.Controls;
using Windows.Win32.UI.WindowsAndMessaging;
namespace DevToys.Windows.Native;
internal static partial class NativeMethods
{
#pragma warning disable CA1416 // V... | fim | DevToys-app/DevToys | csharp |
using Microsoft.Win32;
namespace DevToys.Windows.Native;
internal static class SnapLayoutHelper
{
private const string RegistryKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
private const string RegistryValueName = "EnableSnapAssistFlyout";
internal static bool IsSnapLayoutEna... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>indowCompositionAttribute
{
WCA_ACCENT_POLICY = 19
}
<|fim_prefix|>names<|fim_middle|>pace DevToys.Windows.Native;
internal enum W<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Runtime.InteropServices;
namespace Dev<|fim_suffix|> public IntPtr Data;
public int SizeOfData;
}
<|fim_middle|>Toys.Windows.Native;
[StructLayout(LayoutKind.Sequential)]
internal struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>rtedOSPlatform("windows")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevToys.Windows.Strings.Other.Other", typeof(Other).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/... | fim | DevToys-app/DevToys | csharp |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//--... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>")]
#endif
<|fim_prefix|>global using CommunityToolkit.Diagnostics;
global using System;
global using System.Collections.Generic;
global using System.ComponentModel;
global using System.ComponentModel.Composition;
global using System.Diagn<|fim_middle|>ostics;
global using System.Linq;
global using Syst... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>h the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("DevToys")]
[assembly: AssemblyProduct("DevToys")]
[assembly: AssemblyCopyrigh... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//---------------------------... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>ableHashSet<string> { "Palmer", "Carmack" };
int countChanging = 0;
int countChanged = 0;
int collectionChanged = 0;
int currentCount = 2;
int countChange = 2;
string[] adding = ["Brendan", "Nate"];
hashSet.PropertyChanging += (s, a) => AssertCountC... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Threading.Tasks;
namespace DevToys.UnitTests.Api.Core.Threading;
public class AsyncLazyTests
{
[Fact]
public async Task AccurateResultAsync()
{
var expected = new TestClass(5);
var lazy = new AsyncLazy<TestClass>(async () =>
{
await Task.Yiel... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Threading;
using System.Threading.Tasks;
namespace DevToys.UnitTests.Api.Core.Threading;
public class DisposableSemaphoreTests
{
[Fact]
public async Task DisposingTest()
{
var semaphore = new DisposableSemaphore(1);
using (await semaphore.WaitAsync(Cancellation... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>u<|fim_suffix|>InDataTypeDetectors;
public class Base64TextDataTypeDetectorTests
{
[Theory]
[InlineData(null, false)]
[InlineData("", false)]
[InlineData(" ", false)]
[InlineData("aGVsbG8gd29ybGQ=", true)]
[InlineData("aGVsbG8gd2f9ybGQ=", false)]
[InlineData("SGVsbG8gV29y", t... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>oggerFactory ??= LoggerFactory.Create(builder => { });
DataDetectionResult dataDetectionResult = new(false, input);
GZipTextDataTypeDetector sut = new();
DataDetectionResult result = await sut.TryDetectDataAsync(
input,
dataDetectionResult,
defa... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Threading.Tasks;
using DevToys.Blazor.BuiltInDataTypeDetectors;
using Microsoft.Extensions.Logging;
namespac<|fim_suffix|>taDetectionResult result = await sut.TryDetectDataAsync(
input,
dataDetectionResult,
default);
result.Success.Should().Be(ex... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Threading.Tasks;
using DevToys.Blazor.BuiltInDataTypeDetectors;
using Microsoft.Exte<|fim_suffix|>peDetectors;
public class JsonDataTypeDetectorTests
{
[Theory]
[InlineData("\"foo\"", true)]
[InlineData("123", false)]
[InlineData(" { } ", true)]
[InlineData(" [ ] ... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Threading.Tasks;
using DevToys.Blazor.BuiltInDataTypeDetectors;
using Mic<|fim_suffix|>erFactory.Create(builder => { });
DataDetectionResult dataDetectionResult = new(false, input);
XmlDataTypeDetector sut = new();
DataDetectionResult result = await sut.TryDetectData... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using DevToys.Blazor.BuiltInTools.ExtensionsManager;
using Microsoft.Extensions.Logging;
namespace DevToys.UnitTests.Blazor.BuiltInTools;
public class ExtensionInstallationManagerTests
{
private static readonly As... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>aking the window wider will turn the nav bar into expanded mode.")]
public void FromCollapsedToExpanded()
{
_state.WidthUpdated(NavBarWidthSidebarCollapseThreshold - 1, NavBarWidthSidebarHiddenThreshold, NavBarWidthSidebarCollapseThreshold);
_onStateChangedInvokeCount.Should().Be(1... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> new List<object[]>
{
#if DEBUG
#else
new object[] { new JSException("only testing") },
#endif
new object[] { new TaskCanceledException() },
new object[] { new JSDisconnectedException("only testing") },
};
//[Theory]
//[MemberData(na... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using DevToys.Blazor.Core.Helpers;
namespace DevToys.UnitTests.Blazor.Core.Helpers;
public class CssBuilderTests
{
[Fact]
public void ShouldConstructWithDefaultValue()
{
//arrange
string classToRender = CssBuilder.Default("item-one").Build();
//assert
classT... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>{
string styleToRender = StyleBuilder.Empty()
.AddStyle("text-decoration", v => v
.AddValue("underline", true)
.AddValue("overline", false)
.AddValue("line-through", true),
when: true)
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>se();
}
}
<|fim_prefix|>using System.IO;
namespace DevToys.UnitTests;
internal sealed class ConsoleOutputMonitor : IDisposable
{
private readonly StringWriter _outputWriter = new();
private readonly StringWriter _errorWriter = new();
private readonly TextWriter _originalOutp<|fim_middle... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>d().BeFalse();
}
}
<|fim_prefix|>using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using DevToys.Core;
using DevToys.Core.Models;
using DevToys.Core.Version;
using DevToys.Core.Web;
namespace DevToys.UnitTests.Core;
public class AppHelperTests
{
[Theory]
[InlineD... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>row<ArgumentException>();
}
[Fact]
public void OrderTest()
{
TestLazy[] extensions = new[] {
Create("Foo").After("Baz").After("Bar"),
Create("Bar").After("Baz").Before("Foo"),
Create("Baz").Before("Bar").Before("Foo")
};... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> DummyParse);
object result = OneOfParser.ParseOneOf(option, "1.5");
result.Should().BeOfType<OneOf<string, float>>();
result.Should().Be((OneOf<string, float>)1.5f);
result = OneOfParser.ParseOneOf(option, "5");
result.Should().BeOfType<OneOf<string, floa... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Collections.ObjectModel;
using System.ComponentModel;
using DevToys.Core.Tools;
using DevToys.Core.Tools.ViewItems;
namespace DevToys.UnitTests.Core.Tools;
public class GuiToolProviderTests : MefBasedTest
{
[Fact]
public void TitleResourceResolution()
{
GuiToolProvider ... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Threading;
using System.Threading.Tasks;
using DevToys.Core.Tools;
namespace DevToys.UnitTests.Core.Tools;
pu<|fim_suffix|>lInstance.InternalComponentName.Should().Be(toolNames[i]);
}
}
}
<|fim_middle|>blic class SmartDetectionServiceTests : MefBasedTest
{
[Theory]
[Inl... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.Globalization;
using System.<|fim_suffix|>ICulture = new CultureInfo("en-US");
}
}
<|fim_middle|>Reflection;
using DevToys.Core.Mef;
using Microsoft.Extensions.Logging;
namespace DevToys.UnitTests;
public abstract class MefBasedTest
{
private readonly MefComposer _mefComposer;
... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>nalize(this);
}
~MockIDisposable()
{
Dispose(false);
}
}
<|fim_prefix|>namespace DevToys.UnitTests.Mocks;
internal class MockIDisposable : IDisposable
{
<|fim_middle|>private bool _disposed = false;
protected virtual void Dispose(bool disposing)
{
if (!_disp... | fim | DevToys-app/DevToys | csharp |
using System.ComponentModel.Composition;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using DevToys.Core;
namespace DevToys.UnitTests.Mocks;
[Export(typeof(IFileStorage))]
internal class MockIFileStorage : IFileStorage
{
public bool FileExistsResult { get; set; } = true;
public st... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using Microsoft.Extensions.Log<|fim_suffix|>}
<|fim_middle|>ging;
namespace DevToys.UnitTests.Mocks;
internal class MockILogger : ILogger
{
public IDisposable BeginScope<TState>(TState state) where TState : notnull
{
return new MockIDisposable();
}
public bool IsEnabled(LogLevel... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>ring, object> _settings = new();
public void ResetSetting(string settingName)
{
throw new NotImplementedException();
}
public bool TryReadSetting(string settingName, out object value)
{
return _settings.TryGetValue(settingName, out value);
}
public void Write... | fim | DevToys-app/DevToys | csharp |
using System.ComponentModel.Composition;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace DevToys.UnitTests.Mocks.Tools;
[Export(typeof(IDataTypeDetector))]
[DataTypeName("JSON", baseName: "text")]
... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.ComponentModel.Composition;
namespace DevToys.UnitTests.Mocks.Tools;
[Export(typeof(GuiToolGroup))]
[Name("Moc<|fim_suffix|> MockGuiToolGroup : GuiToolGroup
{
[ImportingConstructor]
internal MockGuiToolGroup()
{
IconFontName = "FluentSystemIcons";
IconGlyph = '\... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|> void OnDataReceived(string dataTypeName, object parsedData) { }
}
[Export(typeof(IGuiTool))]
[Name("MockTool4-XMLValidator")]
[ToolDisplayInformation(
IconFontName = "FluentSystemIcons",
IconGlyph = '\u0108',
GroupName = "MockGroup",
ResourceManagerAssemblyIdentifier = nameof(MockResourc... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>lic ValueTask<FontDefinition[]> GetFontDefinitionsAsync()
{
throw new NotImplementedException();
}
}
<|fim_prefix|>using System.ComponentModel.Composition;
using System.Threading.Tasks;
namespace DevToys.UnitTests.Mocks.Tools;
[Export(typeof(IResourceAssemblyIdentifier))]
[Name(nameof(M... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-g... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>llelization = true)]
public class TestParallelizationDisabled
{
}
<|fim_prefix|>namespace DevToys.UnitTests;
[CollectionDefinition(nameof<|fim_middle|>(TestParallelizationDisabled), DisablePara<|endoftext|> | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>ultipleChildrenWithSameId()
{
var child1 = new Mock<IUIElement>();
child1.Setup(c => c.Id).Returns("child");
var child2 = new Mock<IUIElement>();
child2.Setup(c => c.Id).Returns("child");
var element = new TestUIElement(
"parent",
new L... | fim | DevToys-app/DevToys | csharp |
<|fim_suffix|>s.Api;
global using FluentAssertions;
global using Moq;
global using Xunit;
<|fim_prefix|>global using System;
global usi<|fim_middle|>ng System.Collections.Generic;
global using System.Linq;
global using DevToy<|endoftext|> | fim | DevToys-app/DevToys | csharp |
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
namespace ResxHelperGenerator;
[Generator]
#pragma warning disable RS1036 // Specify analyzer banned... | fim | DevToys-app/DevToys | csharp |
<|fim_prefix|>using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
namespace ExternalLibraries.Clipboard
{
public static class WindowsClipboard
{
private const uint cfUnicodeText = 13;
public static string? GetText()
{
if (!IsClipboardFormat... | fim | Devolutions/UniGetUI | csharp |
<|fim_prefix|>using System.Runtime.InteropServices;
using ExternalLibraries.Pickers.Guids;
namespace ExternalLibraries.Pickers.Classes;
// --------<|fim_suffix|>ting runtime callable wrappers
[
ComImport,
ClassInterface(ClassInterfaceType.None),
TypeLibType(TypeLibTypeFlags.FCanCreate),
Guid(CLSIDGuid... | fim | Devolutions/UniGetUI | csharp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.