From 757502e8bf9e5a8550e679142d5e571b396cf2d4 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Thu, 25 Apr 2019 10:13:48 +0200 Subject: [PATCH] - --- README.md | 15 ++++++++++++ mpv.net/Misc.cs | 31 +++++++++++++++++++++++++ mpv.net/Native.cs | 2 -- mpv.net/Resources/mpvConf.txt | 4 ++-- mpv.net/UI.cs | 36 ----------------------------- mpv.net/Windows/ConfWindow.xaml.cs | 2 +- mpv.net/Windows/InputWindow.xaml.cs | 12 +++++++--- mpv.net/mpv.net.csproj | 1 - 8 files changed, 58 insertions(+), 45 deletions(-) delete mode 100644 mpv.net/UI.cs diff --git a/README.md b/README.md index 5b14338..d3d2861 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ Table of contents - [Context Menu](#context-menu) - [Settings](#settings) - [Scripting](#scripting) +- [Add-ons](#add-ons) +- [Architecture](#architecture) - [Support](#support) - [Links](#links) - [Download](#download) @@ -111,6 +113,18 @@ Examples: [CSScriptAddon.vb](https://github.com/stax76/mpv.net/blob/master/CSScriptAddon/CSScriptAddon.vb) +### Architecture + +mpv.net is mostly written in C# 7.0 and runs on the .NET framework 4.7 or higher. +Few parts are written in VB.NET and Python. + +The Add-on implementation is based on the Managed Extensibility Framework, +the entire application code is accessible for add-ons and Python scripts. + +Python scripting is implemented with IronPython which uses Python 2.7. + +The main/video window is WinForms based, other windows are WPF based. + ### Support [Support thread in Doom9 forum](https://forum.doom9.org/showthread.php?t=174841) @@ -163,6 +177,7 @@ mpv.net bugs and requests: script descriptions were improved. [Scripting Page](https://github.com/stax76/mpv.net/wiki/Scripting). - greatly improved README.md file and github startpage - About dialog added +- the input editor shows only a closing message if actually a change was made ### 3.1 (2019-04-23) diff --git a/mpv.net/Misc.cs b/mpv.net/Misc.cs index d8bc03c..1ca748a 100644 --- a/mpv.net/Misc.cs +++ b/mpv.net/Misc.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Drawing; using System.IO; using System.Linq; using System.Runtime.CompilerServices; @@ -229,4 +230,34 @@ namespace mpvnet } } } + + public class CursorHelp + { + static bool IsVisible = true; + + public static void Show() + { + if (!IsVisible) + { + Cursor.Show(); + IsVisible = true; + } + } + + public static void Hide() + { + if (IsVisible) + { + Cursor.Hide(); + IsVisible = false; + } + } + + public static bool IsPosDifferent(Point screenPos) + { + return + Math.Abs(screenPos.X - Control.MousePosition.X) > 10 || + Math.Abs(screenPos.Y - Control.MousePosition.Y) > 10; + } + } } \ No newline at end of file diff --git a/mpv.net/Native.cs b/mpv.net/Native.cs index b22d24b..3f2703f 100644 --- a/mpv.net/Native.cs +++ b/mpv.net/Native.cs @@ -1,8 +1,6 @@ using System; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; -using System.Text; namespace mpvnet { diff --git a/mpv.net/Resources/mpvConf.txt b/mpv.net/Resources/mpvConf.txt index 8955c4d..25e416b 100644 --- a/mpv.net/Resources/mpvConf.txt +++ b/mpv.net/Resources/mpvConf.txt @@ -1,7 +1,7 @@  # mpv manual: https://mpv.io/manual/master/ -# mpv.net mpv.conf defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt +# mpv.net mpv.conf defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt input-ar-delay = 500 input-ar-rate = 20 @@ -11,4 +11,4 @@ keep-open = yes keep-open-pause = no osd-playing-msg = ${filename} screenshot-directory = ~~desktop/ -input-default-bindings = no \ No newline at end of file +input-default-bindings = no diff --git a/mpv.net/UI.cs b/mpv.net/UI.cs deleted file mode 100644 index c1de532..0000000 --- a/mpv.net/UI.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace mpvnet -{ - public class CursorHelp - { - static bool IsVisible = true; - - public static void Show() - { - if (!IsVisible) - { - Cursor.Show(); - IsVisible = true; - } - } - - public static void Hide() - { - if (IsVisible) - { - Cursor.Hide(); - IsVisible = false; - } - } - - public static bool IsPosDifferent(Point screenPos) - { - return - Math.Abs(screenPos.X - Control.MousePosition.X) > 10 || - Math.Abs(screenPos.Y - Control.MousePosition.Y) > 10; - } - } -} \ No newline at end of file diff --git a/mpv.net/Windows/ConfWindow.xaml.cs b/mpv.net/Windows/ConfWindow.xaml.cs index 00bf5ef..89223b9 100644 --- a/mpv.net/Windows/ConfWindow.xaml.cs +++ b/mpv.net/Windows/ConfWindow.xaml.cs @@ -164,7 +164,7 @@ namespace mpvnet WriteToDisk(mp.MpvConfPath, MpvConf, MpvSettingsDefinitions); WriteToDisk(mp.MpvNetConfPath, MpvNetConf, MpvNetSettingsDefinitions); - MessageBox.Show("Changes will be available on next startup of mpv.net.", + MessageBox.Show("Changes will be available on next mpv.net startup.", Title, MessageBoxButton.OK, MessageBoxImage.Information); } diff --git a/mpv.net/Windows/InputWindow.xaml.cs b/mpv.net/Windows/InputWindow.xaml.cs index a1cc7e8..d4182b4 100644 --- a/mpv.net/Windows/InputWindow.xaml.cs +++ b/mpv.net/Windows/InputWindow.xaml.cs @@ -12,10 +12,12 @@ namespace mpvnet public partial class InputWindow : Window { ICollectionView CollectionView; + string InitialInputConfContent; public InputWindow() { InitializeComponent(); + InitialInputConfContent = GetInputConfContent(); SearchControl.SearchTextBox.TextChanged += SearchTextBox_TextChanged; DataGrid.SelectionMode = DataGridSelectionMode.Single; CollectionViewSource collectionViewSource = new CollectionViewSource() { Source = InputItem.InputItems }; @@ -81,7 +83,7 @@ namespace mpvnet private void Window_Loaded(object sender, RoutedEventArgs e) => Keyboard.Focus(SearchControl.SearchTextBox); - private void Window_Closed(object sender, EventArgs e) + string GetInputConfContent() { string text = Properties.Resources.inputConfHeader + "\r\n"; @@ -99,9 +101,13 @@ namespace mpvnet text += line + "\r\n"; } + return text; + } - File.WriteAllText(mp.InputConfPath, text); - + private void Window_Closed(object sender, EventArgs e) + { + if (InitialInputConfContent == GetInputConfContent()) return; + File.WriteAllText(mp.InputConfPath, GetInputConfContent()); MessageBox.Show("Changes will be available on next mpv.net startup.", Title, MessageBoxButton.OK, MessageBoxImage.Information); } diff --git a/mpv.net/mpv.net.csproj b/mpv.net/mpv.net.csproj index 6a1d9ec..98f714e 100644 --- a/mpv.net/mpv.net.csproj +++ b/mpv.net/mpv.net.csproj @@ -198,7 +198,6 @@ InputWindow.xaml - MainForm.cs