-
This commit is contained in:
@@ -23,7 +23,7 @@ Public Class CSScriptAddon
|
||||
Try
|
||||
CSScriptLibrary.CSScript.Evaluator.LoadCode(File.ReadAllText(i))
|
||||
Catch ex As Exception
|
||||
MsgError(ex.ToString)
|
||||
MainForm.Instance.ShowMsgBox(ex.ToString(), MessageBoxIcon.Error)
|
||||
End Try
|
||||
Next
|
||||
End Sub
|
||||
|
||||
@@ -132,6 +132,10 @@ Please note that PowerShell don't allow assigning to events and mpv.net uses as
|
||||
|
||||
### Changelog
|
||||
|
||||
### soon
|
||||
|
||||
- all info and error messages are shown now on the main window thread having the main window as parent
|
||||
|
||||
### 1.8
|
||||
|
||||
- new config editor added
|
||||
|
||||
@@ -5,8 +5,6 @@ using System.ComponentModel.Composition.Hosting;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using static mpvnet.StaticUsing;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
public class Addon
|
||||
@@ -42,7 +40,7 @@ namespace mpvnet
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MsgError(e.ToString());
|
||||
MainForm.Instance.ShowMsgBox(e.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using static mpvnet.StaticUsing;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
public class Command
|
||||
@@ -72,12 +70,7 @@ namespace mpvnet
|
||||
|
||||
public static void show_conf_editor(string[] args)
|
||||
{
|
||||
using (var p = new Process())
|
||||
{
|
||||
p.StartInfo.FileName = Application.StartupPath + "\\mpvSettingsEditor.exe";
|
||||
p.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
p.Start();
|
||||
}
|
||||
Process.Start(Application.StartupPath + "\\mpvSettingsEditor.exe");
|
||||
}
|
||||
|
||||
public static void history(string[] args)
|
||||
@@ -87,7 +80,7 @@ namespace mpvnet
|
||||
if (File.Exists(fp))
|
||||
Process.Start(fp);
|
||||
else
|
||||
if (MsgQuestion("Create history.txt file in config folder?\n\nmpv.net will write the date, time and filename of opened files to it.") == DialogResult.OK)
|
||||
if (MainForm.Instance.ShowMsgBox("Create history.txt file in config folder?\n\nmpv.net will write the date, time and filename of opened files to it.", MessageBoxIcon.Question) == DialogResult.OK)
|
||||
File.WriteAllText(fp, "");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using static mpvnet.StaticUsing;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
@@ -46,7 +43,7 @@ namespace mpvnet
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MsgError(e.ToString());
|
||||
MainForm.Instance.ShowMsgBox(e.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,20 +136,15 @@ namespace mpvnet
|
||||
|
||||
public void BuildMenu()
|
||||
{
|
||||
foreach (var i in File.ReadAllText(mp.InputConfPath).SplitLinesNoEmpty())
|
||||
foreach (var i in File.ReadAllText(mp.InputConfPath).Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (!i.Contains("#menu:"))
|
||||
continue;
|
||||
|
||||
var left = i.Left("#menu:").Trim();
|
||||
|
||||
if (left.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
var cmd = left.Right(" ").Trim();
|
||||
var menu = i.Right("#menu:").Trim();
|
||||
var key = menu.Left(";").Trim();
|
||||
var path = menu.Right(";").Trim();
|
||||
if (!i.Contains("#menu:")) continue;
|
||||
var left = i.Substring(0, i.IndexOf("#menu:")).Trim();
|
||||
if (left.StartsWith("#")) continue;
|
||||
var cmd = left.Substring(left.IndexOf(" ") + 1).Trim();
|
||||
var menu = i.Substring(i.IndexOf("#menu:") + "#menu:".Length).Trim();
|
||||
var key = menu.Substring(0, menu.IndexOf(";")).Trim();
|
||||
var path = menu.Substring(menu.IndexOf(";") + 1).Trim();
|
||||
|
||||
if (path == "" || cmd == "")
|
||||
continue;
|
||||
@@ -164,7 +156,7 @@ namespace mpvnet
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MsgError(e.ToString());
|
||||
MainForm.Instance.ShowMsgBox(e.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -206,7 +198,7 @@ namespace mpvnet
|
||||
|
||||
private void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
MsgError(e.Exception.ToString());
|
||||
ShowMsgBox(e.Exception.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private void mp_VideoSizeChanged()
|
||||
|
||||
@@ -27,24 +27,6 @@ namespace mpvnet
|
||||
int IComparer<string>.Compare(string x, string y) => IComparerOfString_Compare(x, y);
|
||||
}
|
||||
|
||||
public class StaticUsing
|
||||
{
|
||||
public static void MsgInfo(string message)
|
||||
{
|
||||
MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
public static void MsgError(string message)
|
||||
{
|
||||
MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
public static DialogResult MsgQuestion(string message)
|
||||
{
|
||||
return MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
}
|
||||
}
|
||||
|
||||
//public class OSVersion
|
||||
//{
|
||||
// public static float Windows7 { get; set; } = 6.1f;
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Management.Automation.Runspaces;
|
||||
|
||||
using static mpvnet.StaticUsing;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
@@ -50,10 +49,10 @@ Using namespace System;
|
||||
}
|
||||
catch
|
||||
{
|
||||
MsgError("PowerShell Setup Problem\r\n\r\nEnsure you have at least PowerShell 5.1 installed.");
|
||||
MainForm.Instance.ShowMsgBox("PowerShell Setup Problem\n\nEnsure you have at least PowerShell 5.1 installed.", MessageBoxIcon.Error);
|
||||
return null;
|
||||
}
|
||||
MsgError(ex.ToString());
|
||||
MainForm.Instance.ShowMsgBox(ex.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
|
||||
using static mpvnet.StaticUsing;
|
||||
using PyRT = IronPython.Runtime;
|
||||
|
||||
namespace mpvnet
|
||||
@@ -27,7 +27,7 @@ namespace mpvnet
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MsgError(ex.ToString());
|
||||
MainForm.Instance.ShowMsgBox(ex.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string ExtFull(this string filepath)
|
||||
{
|
||||
return Ext(filepath, true);
|
||||
}
|
||||
|
||||
public static string Ext(this string filepath)
|
||||
{
|
||||
return Ext(filepath, false);
|
||||
}
|
||||
|
||||
public static string Ext(this string filepath, bool dot)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
return "";
|
||||
|
||||
var chars = filepath.ToCharArray();
|
||||
|
||||
for (var x = filepath.Length - 1; x >= 0; x += -1)
|
||||
{
|
||||
if (chars[x] == Path.DirectorySeparatorChar)
|
||||
return "";
|
||||
|
||||
if (chars[x] == '.')
|
||||
return filepath.Substring(x + (dot ? 0 : 1)).ToLower();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string Left(this string value, int index)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value) || index < 0)
|
||||
return "";
|
||||
|
||||
if (index > value.Length)
|
||||
return value;
|
||||
|
||||
return value.Substring(0, index);
|
||||
}
|
||||
|
||||
public static string Left(this string value, string start)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(start))
|
||||
return "";
|
||||
|
||||
if (!value.Contains(start))
|
||||
return "";
|
||||
|
||||
return value.Substring(0, value.IndexOf(start));
|
||||
}
|
||||
|
||||
public static string LeftLast(this string value, string start)
|
||||
{
|
||||
if (!value.Contains(start))
|
||||
return "";
|
||||
|
||||
return value.Substring(0, value.LastIndexOf(start));
|
||||
}
|
||||
|
||||
public static string Right(this string value, string start)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(start))
|
||||
return "";
|
||||
|
||||
if (!value.Contains(start))
|
||||
return "";
|
||||
|
||||
return value.Substring(value.IndexOf(start) + start.Length);
|
||||
}
|
||||
|
||||
public static string RightLast(this string value, string start)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(start))
|
||||
return "";
|
||||
|
||||
if (!value.Contains(start))
|
||||
return "";
|
||||
|
||||
return value.Substring(value.LastIndexOf(start) + start.Length);
|
||||
}
|
||||
|
||||
public static string[] SplitNoEmpty(this string value, params string[] delimiters)
|
||||
{
|
||||
return value.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public static string[] SplitKeepEmpty(this string value, params string[] delimiters)
|
||||
{
|
||||
return value.Split(delimiters, StringSplitOptions.None);
|
||||
}
|
||||
|
||||
public static string[] SplitNoEmptyAndWhiteSpace(this string value, params string[] delimiters)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return null;
|
||||
|
||||
var a = SplitNoEmpty(value, delimiters);
|
||||
|
||||
for (var i = 0; i <= a.Length - 1; i++)
|
||||
a[i] = a[i].Trim();
|
||||
|
||||
var l = a.ToList();
|
||||
|
||||
while (l.Contains(""))
|
||||
l.Remove("");
|
||||
|
||||
return l.ToArray();
|
||||
}
|
||||
|
||||
public static string[] SplitLinesNoEmpty(this string value)
|
||||
{
|
||||
return SplitNoEmpty(value, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ using System.Windows.Forms;
|
||||
|
||||
using static mpvnet.libmpv;
|
||||
using static mpvnet.Native;
|
||||
using static mpvnet.StaticUsing;
|
||||
|
||||
using PyRT = IronPython.Runtime;
|
||||
|
||||
@@ -75,7 +74,7 @@ namespace mpvnet
|
||||
if (File.Exists(mpvConfPath))
|
||||
foreach (var i in File.ReadAllLines(mpvConfPath))
|
||||
if (i.Contains("=") && ! i.StartsWith("#"))
|
||||
_mpvConf[i.Left("=").Trim()] = i.Right("=").Trim();
|
||||
_mpvConf[i.Substring(0, i.IndexOf("=")).Trim()] = i.Substring(i.IndexOf("=") + 1).Trim();
|
||||
}
|
||||
return _mpvConf;
|
||||
}
|
||||
@@ -208,7 +207,7 @@ namespace mpvnet
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MsgError(ex.GetType().Name + "\r\n\r\n" + ex.ToString());
|
||||
MainForm.Instance.ShowMsgBox(ex.GetType().Name + "\n\n" + ex.ToString(), MessageBoxIcon.Error);
|
||||
}
|
||||
ClientMessage?.Invoke(args);
|
||||
}
|
||||
@@ -465,7 +464,7 @@ namespace mpvnet
|
||||
string[] types = "264 265 3gp aac ac3 avc avi avs bmp divx dts dtshd dtshr dtsma eac3 evo flac flv h264 h265 hevc hvc jpg jpeg m2t m2ts m2v m4a m4v mka mkv mlp mov mp2 mp3 mp4 mpa mpeg mpg mpv mts ogg ogm opus pcm png pva raw rmvb thd thd+ac3 true-hd truehd ts vdr vob vpy w64 wav webm wmv y4m".Split(' ');
|
||||
string path = get_property_string("path");
|
||||
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
||||
files = files.Where((file) => types.Contains(file.Ext())).ToList();
|
||||
files = files.Where((file) => types.Contains(Path.GetExtension(file).TrimStart(".".ToCharArray()).ToLower())).ToList();
|
||||
files.Sort(new StringLogicalComparer());
|
||||
int index = files.IndexOf(path);
|
||||
files.Remove(path);
|
||||
|
||||
@@ -143,7 +143,6 @@
|
||||
</Compile>
|
||||
<Compile Include="PowerShellScript.cs" />
|
||||
<Compile Include="PythonScript.cs" />
|
||||
<Compile Include="StringExtensions.cs" />
|
||||
<Compile Include="libmpv.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
xmlns:local="clr-namespace:DynamicGUI"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
<!--<Style x:Key="UrlTextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Foreground" Value="Blue"/>
|
||||
</Style>-->
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
</Application>
|
||||
@@ -12,8 +12,8 @@ help = "screen=<default|0-32> In multi-monitor configurations (i.e. a single des
|
||||
name = "osd-playing-msg"
|
||||
default = ""
|
||||
width = 300
|
||||
help = "osd-playing-msg=<value> Show a message on OSD when playback starts. The string is expanded for properties, e.g. --osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename."
|
||||
helpurl = "https://mpv.io/manual/master/#property-expansion"
|
||||
help = "osd-playing-msg=<value> Show a message on OSD when playback starts. The string is expanded for properties, e.g. --osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename."
|
||||
|
||||
[[settings]]
|
||||
name = "fullscreen"
|
||||
@@ -47,8 +47,8 @@ name = "vo"
|
||||
default = "gpu"
|
||||
helpurl = "https://mpv.io/manual/master/#video-output-drivers-vo"
|
||||
help = "gpu=<mode> Video output drivers to be used. Default = gpu."
|
||||
options = [{ name = "direct3d", help = "Video output driver that uses the Direct3D interface" },
|
||||
{ name = "gpu", text = "gpu (Default)", help = "General purpose, customizable, GPU-accelerated video output driver. It supports extended scaling methods, dithering, color management, custom shaders, HDR, and more. (Default)" }]
|
||||
options = [{ name = "gpu", text = "gpu (Default)", help = "General purpose, customizable, GPU-accelerated video output driver. It supports extended scaling methods, dithering, color management, custom shaders, HDR, and more. (Default)" },
|
||||
{ name = "direct3d", help = "Video output driver that uses the Direct3D interface" }]
|
||||
|
||||
[[settings]]
|
||||
name = "keep-open-pause"
|
||||
@@ -60,8 +60,8 @@ options = [{ name = "yes", text = "yes (Default)" }, { name = "no" }]
|
||||
name = "keep-open"
|
||||
default = "no"
|
||||
help = "keep-open=<yes|no|always> Do not terminate when playing or seeking beyond the end of the file, and there is not next file to be played (and --loop is not used). Instead, pause the player. When trying to seek beyond end of the file, the player will attempt to seek to the last frame.\n\nNormally, this will act like set pause yes on EOF, unless the --keep-open-pause=no option is set."
|
||||
options = [{ name = "no", text = "no (Default)", help = "If the current file ends, go to the next file or terminate. (Default.)" },
|
||||
{ name = "yes", help = "Don't terminate if the current file is the last playlist entry. Equivalent to --keep-open without arguments."},
|
||||
options = [{ name = "yes", help = "Don't terminate if the current file is the last playlist entry. Equivalent to --keep-open without arguments."},
|
||||
{ name = "no", text = "no (Default)", help = "If the current file ends, go to the next file or terminate. (Default.)" },
|
||||
{ name = "always", help = "Like yes, but also applies to files before the last playlist entry. This means playback will never automatically advance to the next file."}]
|
||||
|
||||
[[settings]]
|
||||
@@ -70,6 +70,12 @@ alias = "loop"
|
||||
default = ""
|
||||
help = "loop-file=<N|inf|no>, loop=<N|inf|no> Loop a single file N times. inf means forever, no means normal playback. For compatibility, --loop-file and --loop-file=yes are also accepted, and are the same as --loop-file=inf.\n\nThe difference to --loop-playlist is that this doesn't loop the playlist, just the file itself. If the playlist contains only a single file, the difference between the two option is that this option performs a seek on loop, instead of reloading the file.\n\n--loop is an alias for this option."
|
||||
|
||||
[[settings]]
|
||||
name = "save-position-on-quit"
|
||||
default = "no"
|
||||
help = "Always save the current playback position on quit. When this file is played again later, the player will seek to the old playback position on start. This does not happen if playback of a file is stopped in any other way than quitting. For example, going to the next file in the playlist will not save the position, and start playback at beginning the next time the file is played.\n\nThis behavior is disabled by default, but is always available when quitting the player with Shift+Q."
|
||||
options = [{ name = "yes" }, { name = "no", text = "no (Default)" }]
|
||||
|
||||
[[settings]]
|
||||
name = "screenshot-directory"
|
||||
default = ""
|
||||
@@ -85,4 +91,23 @@ help = "input-ar-delay=<integer> Delay in milliseconds before we start to autore
|
||||
[[settings]]
|
||||
name = "input-ar-rate"
|
||||
default = ""
|
||||
help = "input-ar-rate=<integer> Number of key presses to generate per second on autorepeat."
|
||||
help = "input-ar-rate=<integer> Number of key presses to generate per second on autorepeat."
|
||||
|
||||
[[settings]]
|
||||
name = "alang"
|
||||
default = ""
|
||||
help = "alang=<languagecode[,languagecode,...]> Specify a priority list of audio languages to use. Different container formats employ different language codes. DVDs use ISO 639-1 two-letter language codes, Matroska, MPEG-TS and NUT use ISO 639-2 three-letter language codes, while OGM uses a free-form identifier. See also --aid.\n\nExamples\n\nmpv dvd://1 --alang=hu,en chooses the Hungarian language track on a DVD and falls back on English if Hungarian is not available.\n\nmpv --alang=jpn example.mkv plays a Matroska file with Japanese audio."
|
||||
|
||||
[[settings]]
|
||||
name = "slang"
|
||||
default = ""
|
||||
help = "--slang=<languagecode[,languagecode,...]> Specify a priority list of subtitle languages to use. Different container formats employ different language codes. DVDs use ISO 639-1 two letter language codes, Matroska uses ISO 639-2 three letter language codes while OGM uses a free-form identifier. See also --sid."
|
||||
|
||||
[[settings]]
|
||||
name = "hr-seek"
|
||||
default = "absolute"
|
||||
help = "hr-seek=<no|absolute|yes> Select when to use precise seeks that are not limited to keyframes. Such seeks require decoding video from the previous keyframe up to the target position and so can take some time depending on decoding performance. For some video formats, precise seeks are disabled. This option selects the default choice to use for seeks; it is possible to explicitly override that default in the definition of key bindings and in input commands."
|
||||
options = [{ name = "yes", help = "Use precise seeks whenever possible." },
|
||||
{ name = "no", help = "Never use precise seeks." },
|
||||
{ name = "absolute", text = "absolute (Default)", help = "Use precise seeks if the seek is to an absolute position in the file, such as a chapter seek, but not for relative seeks like the default behavior of arrow keys (default)." },
|
||||
{ name = "always", help = "Same as yes (for compatibility)." }]
|
||||
24
mpvSettingsEditor/DynamicGUI/Controls.cs
Normal file
24
mpvSettingsEditor/DynamicGUI/Controls.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace DynamicGUI
|
||||
{
|
||||
public class HyperlinkEx : Hyperlink
|
||||
{
|
||||
private void HyperLinkEx_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(e.Uri.AbsoluteUri);
|
||||
}
|
||||
|
||||
public void SetURL(string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return;
|
||||
NavigateUri = new Uri(url);
|
||||
RequestNavigate += HyperLinkEx_RequestNavigate;
|
||||
Inlines.Clear();
|
||||
Inlines.Add(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@ namespace DynamicGUI
|
||||
|
||||
baseSetting.Name = setting["name"];
|
||||
if (setting.HasKey("help")) baseSetting.Help = setting["help"];
|
||||
if (setting.HasKey("helpurl")) baseSetting.HelpURL = setting["helpurl"];
|
||||
if (setting.HasKey("alias")) baseSetting.Alias = setting["alias"];
|
||||
if (setting.HasKey("width")) baseSetting.Width = setting["width"];
|
||||
settingsList.Add(baseSetting);
|
||||
@@ -93,8 +94,6 @@ namespace DynamicGUI
|
||||
set => _Text = value;
|
||||
}
|
||||
|
||||
//private bool _IsChecked;
|
||||
|
||||
public bool IsChecked
|
||||
{
|
||||
get => OptionSetting.Value == Name ;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid Margin="20,0">
|
||||
<WrapPanel Orientation="Vertical">
|
||||
<TextBox x:Name="TitleTextBox" FontSize="20" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
|
||||
<TextBox x:Name="TitleTextBox" FontSize="24" Margin="0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
|
||||
<ItemsControl x:Name="ItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -19,7 +19,10 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBox x:Name="HelpTextBox" TextWrapping="WrapWithOverflow" Margin="0,10" BorderThickness="0" IsReadOnly="True" Padding="0"></TextBox>
|
||||
<TextBox x:Name="HelpTextBox" TextWrapping="WrapWithOverflow" BorderThickness="0" IsReadOnly="True" Margin="0,10,0,0"></TextBox>
|
||||
<TextBlock Margin="0,10,0,0">
|
||||
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
|
||||
</TextBlock>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,5 +1,4 @@
|
||||
using DynamicGUI;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace DynamicGUI
|
||||
{
|
||||
@@ -14,6 +13,7 @@ namespace DynamicGUI
|
||||
TitleTextBox.Text = optionSetting.Name;
|
||||
HelpTextBox.Text = optionSetting.Help;
|
||||
ItemsControl.ItemsSource = optionSetting.Options;
|
||||
Link.SetURL(optionSetting.HelpURL);
|
||||
}
|
||||
|
||||
private string _SearchableText;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
d:DesignWidth="800" >
|
||||
<Grid Margin="20,0">
|
||||
<WrapPanel Orientation="Vertical">
|
||||
<TextBox x:Name="TitleTextBox" FontSize="20" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
|
||||
<TextBox x:Name="TitleTextBox" FontSize="24" Margin="0,0,0,10" BorderThickness="0" IsReadOnly="True"></TextBox>
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<Window xmlns:DynamicGUI="clr-namespace:DynamicGUI" x:Name="MainWindow1" x:Class="DynamicGUI.MainWindow"
|
||||
<Window xmlns:DynamicGUI="clr-namespace:mpvSettingsEditor" x:Name="MainWindow1" x:Class="mpvSettingsEditor.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:DynamicGUI"
|
||||
xmlns:local="clr-namespace:mpvSettingsEditor"
|
||||
mc:Ignorable="d"
|
||||
Height="500" Width="800">
|
||||
Height="500" Width="800" Loaded="MainWindow1_Loaded">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Background="White" Width="300" Margin="0,0,0,10">
|
||||
<Grid x:Name="SearchGrid" Background="White" Width="300" Margin="0,0,0,10">
|
||||
<TextBlock Margin="5,2" MinWidth="50" Text="Search..." Foreground="LightSteelBlue" IsHitTestVisible="False" />
|
||||
<TextBox MinWidth="50" Name="SearchTextBox" Background="Transparent" TextChanged="SearchTextBox_TextChanged" />
|
||||
</Grid>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DynamicGUI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -6,20 +7,20 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using DynamicGUI;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace DynamicGUI
|
||||
namespace mpvSettingsEditor
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public string mpvConfPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\mpv.conf";
|
||||
private List<SettingBase> mpvSettings = Settings.LoadSettings("Definitions.toml");
|
||||
private List<SettingBase> mpvSettings = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\Definitions.toml");
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = (Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0] as AssemblyProductAttribute).Product + " " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
|
||||
|
||||
foreach (var setting in mpvSettings)
|
||||
{
|
||||
foreach (var pair in mpvConf)
|
||||
@@ -153,5 +154,10 @@ namespace DynamicGUI
|
||||
MainWrapPanel.Children[i].Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private void MainWindow1_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FocusManager.SetFocusedElement(SearchGrid, SearchTextBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,5 +51,5 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
[assembly: AssemblyVersion("0.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.0.0")]
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="DynamicGUI\Controls.cs" />
|
||||
<Compile Include="DynamicGUI\DynamicGUI.cs" />
|
||||
<Compile Include="DynamicGUI\OptionSettingControl.xaml.cs">
|
||||
<DependentUpon>OptionSettingControl.xaml</DependentUpon>
|
||||
|
||||
Reference in New Issue
Block a user