// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Drawing;
using System.IO;
using System.Reflection;
namespace Microsoft.PowerToys.PreviewHandler.Monaco
{
///
/// This class defines all the variables used for Monaco
///
public class Settings
{
///
/// Word warping. Set by PT settings.
///
private bool _wrap;
public bool Wrap
{
get => _wrap;
set
{
_wrap = value;
}
}
///
/// Max file size for displaying (in bytes).
///
private readonly long _maxFileSize = 50000;
public long MaxFileSize => _maxFileSize;
///
/// Gets the color of the window background.
///
public static Color BackgroundColor
{
get
{
if (GetTheme() == "dark")
{
return Color.DimGray;
}
else
{
return Color.White;
}
}
}
///
/// Gets the color of text labels.
///
public static Color TextColor
{
get
{
if (GetTheme() == "dark")
{
return Color.White;
}
else
{
return Color.Black;
}
}
}
///
/// Gets the path of the current assembly.
///
///
/// Source: https://stackoverflow.com/a/283917/14774889
///
public static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().Location;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}
///
/// Returns the theme.
///
/// Theme that should be used.
public static string GetTheme()
{
return Common.UI.ThemeManager.GetWindowsBaseColor().ToLowerInvariant();
}
}
}