diff --git a/CSScriptAddon/CSScriptAddon.vb b/CSScriptAddon/CSScriptAddon.vb index 6747682..2be2355 100644 --- a/CSScriptAddon/CSScriptAddon.vb +++ b/CSScriptAddon/CSScriptAddon.vb @@ -11,7 +11,7 @@ Public Class CSScriptAddon Implements IAddon Sub New() - Dim scriptDir = mp.MpvConfFolderPath + "scripts" + Dim scriptDir = mp.MpvConfFolder + "scripts" If Not Directory.Exists(scriptDir) Then Return Dim csFiles = Directory.GetFiles(scriptDir, "*.cs").ToList csFiles.AddRange(Directory.GetFiles(Application.StartupPath + "\\Scripts", "*.cs")) diff --git a/README.md b/README.md index 5a307aa..9ca26d6 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ mpv.net shares the settings with mpv, settings can be edited in a settings dialo ``` C:\Users\user\AppData\Roaming\mpv\mpv.conf ``` +or alternativly at: +``` +\portable_config\mpv.conf +``` if it's missing mpv.net generates it with the following defaults: @@ -61,7 +65,19 @@ if it's missing mpv.net generates it with the following defaults: Scripting is supported via Python, C#, Lua, JavaScript and PowerShell -[Scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting-(CSharp,-Python,-JavaScript,-Lua,-PowerShell)) +[Scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting) + +### Add-ons + +Add-ons have to located at: + +C:\Users\\AppData\Roaming\mpv\Addons\*Addon.dll + +\Addons\*Addon.dll + +\portable_config\Addons\*Addon.dll + +The add-on filename must end with 'Addon.dll' ### Support @@ -73,6 +89,14 @@ Scripting is supported via Python, C#, Lua, JavaScript and PowerShell ### Changelog +### 3.1 (2019-04-23) + +- the Tracks and Chapters menu are now only added if default bindings exist and + it's now possible to move the chapters menu to the top level by editing input.conf +- mpvnet supports now like mpv a portable settings directory. If a directory named portable_config + next to the mpvnet.exe exists, all config will be loaded or written in this directory. +- there is now a portable download in 7zip format. + ### 3.0 (2019-04-20) - the history feature logs now only files that were opened longer than 90 seconds diff --git a/mpv.net/Addon.cs b/mpv.net/Addon.cs index e486cba..269be0c 100644 --- a/mpv.net/Addon.cs +++ b/mpv.net/Addon.cs @@ -28,7 +28,7 @@ namespace mpvnet foreach (string i in Directory.GetDirectories(dir)) catalog.Catalogs.Add(new DirectoryCatalog(i, "*Addon.dll")); - dir = mp.MpvConfFolderPath + "\\Addons"; + dir = mp.MpvConfFolder + "\\Addons"; if (Directory.Exists(dir)) foreach (string i in Directory.GetDirectories(dir)) diff --git a/mpv.net/Command.cs b/mpv.net/Command.cs index e2b5082..d809f0e 100644 --- a/mpv.net/Command.cs +++ b/mpv.net/Command.cs @@ -58,7 +58,7 @@ namespace mpvnet public static void open_conf_folder(string[] args) { - Process.Start(mp.MpvConfFolderPath); + Process.Start(mp.MpvConfFolder); } public static void show_input_editor(string[] args) @@ -73,7 +73,7 @@ namespace mpvnet public static void show_history(string[] args) { - var fp = mp.MpvConfFolderPath + "history.txt"; + var fp = mp.MpvConfFolder + "history.txt"; if (File.Exists(fp)) Process.Start(fp); diff --git a/mpv.net/MainForm.cs b/mpv.net/MainForm.cs index 9ea80b3..b7ea5fa 100644 --- a/mpv.net/MainForm.cs +++ b/mpv.net/MainForm.cs @@ -18,23 +18,20 @@ namespace mpvnet public static MainForm Instance { get; set; } public static IntPtr Hwnd { get; set; } - public new ContextMenuStripEx ContextMenu; - - MenuItemEx TracksMenu; - MenuItemEx ChaptersMenu; + public new ContextMenuStripEx ContextMenu { get; set; } Point LastCursorPosChanged; int LastCursorChangedTickCount; bool IgnoreDpiChanged = true; - float MpvAutofit = 0.50f; - bool MpvFullscreen; - int MpvScreen = -1; - string MpvNetDarkMode = "system"; - string MpvSid = ""; - string MpvAid = ""; - string MpvVid = ""; - int MpvEdition; + public string MpvNetDarkMode { get; set; } = "system"; + public bool MpvFullscreen { get; set; } + public float MpvAutofit { get; set; } = 0.50f; + public int MpvScreen { get; set; } = -1; + public string MpvSid { get; set; } = ""; + public string MpvAid { get; set; } = ""; + public string MpvVid { get; set; } = ""; + public int MpvEdition { get; set; } public MainForm() { @@ -74,73 +71,107 @@ namespace mpvnet { lock (mp.MediaTracks) { - if (TracksMenu != null) - TracksMenu.DropDownItems.Clear(); + MenuItem trackMenuItem = FindMenuItem("Track"); - MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray(); - MediaTrack[] subTracks = mp.MediaTracks.Where(track => track.Type == "s").ToArray(); - MediaTrack[] vidTracks = mp.MediaTracks.Where(track => track.Type == "v").ToArray(); - MediaTrack[] ediTracks = mp.MediaTracks.Where(track => track.Type == "e").ToArray(); - - foreach (MediaTrack track in vidTracks) + if (trackMenuItem != null) { - MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); - mi.Action = () => { mp.commandv("set", "vid", track.ID.ToString()); }; - mi.Checked = MpvVid == track.ID.ToString(); - } + trackMenuItem.DropDownItems.Clear(); - if (vidTracks.Length > 0) - ContextMenu.Add("Track > -"); + MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray(); + MediaTrack[] subTracks = mp.MediaTracks.Where(track => track.Type == "s").ToArray(); + MediaTrack[] vidTracks = mp.MediaTracks.Where(track => track.Type == "v").ToArray(); + MediaTrack[] ediTracks = mp.MediaTracks.Where(track => track.Type == "e").ToArray(); - foreach (MediaTrack track in audTracks) - { - MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); - mi.Action = () => { mp.commandv("set", "aid", track.ID.ToString()); }; - mi.Checked = MpvAid == track.ID.ToString(); - } + foreach (MediaTrack track in vidTracks) + { + MenuItem mi = new MenuItem(track.Text); + mi.Action = () => { mp.commandv("set", "vid", track.ID.ToString()); }; + mi.Checked = MpvVid == track.ID.ToString(); + trackMenuItem.DropDownItems.Add(mi); + } - if (subTracks.Length > 0) - ContextMenu.Add("Track > -"); + if (vidTracks.Length > 0) + trackMenuItem.DropDownItems.Add(new ToolStripSeparator()); - foreach (MediaTrack track in subTracks) - { - MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); - mi.Action = () => { mp.commandv("set", "sid", track.ID.ToString()); }; - mi.Checked = MpvSid == track.ID.ToString(); - } + foreach (MediaTrack track in audTracks) + { + MenuItem mi = new MenuItem(track.Text); + mi.Action = () => { mp.commandv("set", "aid", track.ID.ToString()); }; + mi.Checked = MpvAid == track.ID.ToString(); + trackMenuItem.DropDownItems.Add(mi); + } - if (subTracks.Length > 0) - { - MenuItemEx mi = ContextMenu.Add("Track > S: No subtitles"); - mi.Action = () => { mp.commandv("set", "sid", "no"); }; - mi.Checked = MpvSid == "no"; - } + if (subTracks.Length > 0) + trackMenuItem.DropDownItems.Add(new ToolStripSeparator()); - if (ediTracks.Length > 0) - ContextMenu.Add("Track > -"); + foreach (MediaTrack track in subTracks) + { + MenuItem mi = new MenuItem(track.Text); + mi.Action = () => { mp.commandv("set", "sid", track.ID.ToString()); }; + mi.Checked = MpvSid == track.ID.ToString(); + trackMenuItem.DropDownItems.Add(mi); + } - foreach (MediaTrack track in ediTracks) - { - MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); - mi.Action = () => { mp.commandv("set", "edition", track.ID.ToString()); }; - mi.Checked = MpvEdition == track.ID; + if (subTracks.Length > 0) + { + MenuItem mi = new MenuItem("S: No subtitles"); + mi.Action = () => { mp.commandv("set", "sid", "no"); }; + mi.Checked = MpvSid == "no"; + trackMenuItem.DropDownItems.Add(mi); + } + + if (ediTracks.Length > 0) + trackMenuItem.DropDownItems.Add(new ToolStripSeparator()); + + foreach (MediaTrack track in ediTracks) + { + MenuItem mi = new MenuItem(track.Text); + mi.Action = () => { mp.commandv("set", "edition", track.ID.ToString()); }; + mi.Checked = MpvEdition == track.ID; + trackMenuItem.DropDownItems.Add(mi); + } } } lock (mp.Chapters) { - if (ChaptersMenu != null) - ChaptersMenu.DropDownItems.Clear(); + MenuItem chaptersMenuItem = FindMenuItem("Chapters"); - foreach (var i in mp.Chapters) + if (chaptersMenuItem != null) { - MenuItemEx mi = ContextMenu.Add("Navigate > Chapters > " + i.Key); - mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(i.Value).ToString().Substring(0, 8) + " "; - mi.Action = () => { mp.commandv("seek", i.Value.ToString(CultureInfo.InvariantCulture), "absolute"); }; + chaptersMenuItem.DropDownItems.Clear(); + + foreach (var i in mp.Chapters) + { + MenuItem mi = new MenuItem(i.Key); + mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(i.Value).ToString().Substring(0, 8) + " "; + mi.Action = () => { mp.commandv("seek", i.Value.ToString(CultureInfo.InvariantCulture), "absolute"); }; + chaptersMenuItem.DropDownItems.Add(mi); + } } } } + public MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items); + + MenuItem FindMenuItem(string text, ToolStripItemCollection items) + { + foreach (var item in items) + { + if (item is MenuItem mi) + { + if (mi.Text.StartsWith(text) && mi.Text.Trim() == text) + return mi; + if (mi.DropDownItems.Count > 0) + { + MenuItem val = FindMenuItem(text, mi.DropDownItems); + if (val != null) return val; + } + } + } + return null; + } + protected void SetScreen(int targetIndex) { Screen[] screens = Screen.AllScreens; @@ -291,7 +322,7 @@ namespace mpvnet else input = ""; - MenuItemEx menuItem = ContextMenu.Add(path, () => { + MenuItem menuItem = ContextMenu.Add(path, () => { try { mp.command_string(command); } @@ -301,19 +332,7 @@ namespace mpvnet }); if (menuItem != null) - { - menuItem.ShortcutKeyDisplayString = input.Replace("_", "") + " "; - - if (TracksMenu == null && menuItem.Text.StartsWith("Track ") && - menuItem.Text.Trim() == "Track") - - TracksMenu = menuItem; - - if (ChaptersMenu == null && menuItem.Text.StartsWith("Chapters ") && - menuItem.Text.Trim() == "Chapters") - - ChaptersMenu = menuItem; - } + menuItem.ShortcutKeyDisplayString = input + " "; } } diff --git a/mpv.net/Menu.cs b/mpv.net/Menu.cs index b41439e..320eea1 100644 --- a/mpv.net/Menu.cs +++ b/mpv.net/Menu.cs @@ -23,33 +23,33 @@ public class ContextMenuStripEx : ContextMenuStrip Renderer = new ToolStripRendererEx(); } - public MenuItemEx Add(string path) + public MenuItem Add(string path) { return Add(path, null); } - public MenuItemEx Add(string path, Action action, bool enabled = true) + public MenuItem Add(string path, Action action, bool enabled = true) { - MenuItemEx ret = MenuItemEx.Add(Items, path, action); + MenuItem ret = MenuItem.Add(Items, path, action); if (ret == null) return null; ret.Enabled = enabled; return ret; } } -public class MenuItemEx : ToolStripMenuItem +public class MenuItem : ToolStripMenuItem { public Action Action { get; set; } - public MenuItemEx() + public MenuItem() { } - public MenuItemEx(string text) : base(text) + public MenuItem(string text) : base(text) { } - public MenuItemEx(string text, Action action) : base(text) + public MenuItem(string text, Action action) : base(text) { Action = action; } @@ -61,12 +61,12 @@ public class MenuItemEx : ToolStripMenuItem base.OnClick(e); } - public static MenuItemEx Add(ToolStripItemCollection items, string path, Action action, T value) + public static MenuItem Add(ToolStripItemCollection items, string path, Action action, T value) { return Add(items, path, () => action(value)); } - public static MenuItemEx Add(ToolStripItemCollection items, string path, Action action) + public static MenuItem Add(ToolStripItemCollection items, string path, Action action) { string[] a = path.Split(new[] { " > ", " | " }, StringSplitOptions.RemoveEmptyEntries); var itemsCollection = items; @@ -95,7 +95,7 @@ public class MenuItemEx : ToolStripMenuItem itemsCollection.Add(new ToolStripSeparator()); else { - MenuItemEx item = new MenuItemEx(a[x] + " ", action); + MenuItem item = new MenuItem(a[x] + " ", action); itemsCollection.Add(item); itemsCollection = item.DropDownItems; return item; @@ -103,7 +103,7 @@ public class MenuItemEx : ToolStripMenuItem } else { - MenuItemEx item = new MenuItemEx(); + MenuItem item = new MenuItem(); item.Text = a[x] + " "; itemsCollection.Add(item); itemsCollection = item.DropDownItems; @@ -266,10 +266,10 @@ public class ToolStripRendererEx : ToolStripSystemRenderer protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) { - if (e.Item.GetType() != typeof(MenuItemEx)) + if (e.Item.GetType() != typeof(MenuItem)) return; - MenuItemEx item = e.Item as MenuItemEx; + MenuItem item = e.Item as MenuItem; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; diff --git a/mpv.net/Properties/AssemblyInfo.cs b/mpv.net/Properties/AssemblyInfo.cs index 3f087c7..043ffe0 100644 --- a/mpv.net/Properties/AssemblyInfo.cs +++ b/mpv.net/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.1.0.0")] +[assembly: AssemblyFileVersion("3.1.0.0")] diff --git a/mpv.net/Resources/input.conf.txt b/mpv.net/Resources/input.conf.txt index 86fced7..f18df28 100644 --- a/mpv.net/Resources/input.conf.txt +++ b/mpv.net/Resources/input.conf.txt @@ -36,8 +36,8 @@ _ ignore #menu: - Enter cycle fullscreen #menu: Toggle Fullscreen - F11 playlist-prev #menu: Navigate > Previous - F12 playlist-next #menu: Navigate > Next + F11 playlist-prev #menu: Navigate > Previous File + F12 playlist-next #menu: Navigate > Next File _ ignore #menu: Navigate > - PGUP add chapter 1 #menu: Navigate > Next Chapter PGDWN add chapter -1 #menu: Navigate > Previous Chapter @@ -147,7 +147,7 @@ _ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Show mpv manual _ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > Show mpv default keys _ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt #menu: Help > Show mpv.net default keys - _ script-message mpv.net shell-execute https://github.com/stax76/mpvnet #menu: Help > Show mpv.net web site + _ script-message mpv.net shell-execute https://mpv-net.github.io/mpv.net-web-site/ #menu: Help > Show mpv.net web site _ ignore #menu: - Esc quit #menu: Exit diff --git a/mpv.net/mp.cs b/mpv.net/mp.cs index a13ee14..f5d30a1 100644 --- a/mpv.net/mp.cs +++ b/mpv.net/mp.cs @@ -60,15 +60,31 @@ namespace mpvnet public static List>> IntPropChangeActions { get; set; } = new List>>(); public static List>> StringPropChangeActions { get; set; } = new List>>(); public static Size VideoSize { get; set; } = new Size(1920, 1080); - public static string MpvConfFolderPath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\"; - public static string InputConfPath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\input.conf"; - public static string MpvConfPath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\mpv.conf"; - public static string MpvNetConfPath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\mpvnet.conf"; public static List PythonScripts { get; set; } = new List(); public static AutoResetEvent AutoResetEvent { get; set; } = new AutoResetEvent(false); public static List MediaTracks { get; set; } = new List(); public static List> Chapters { get; set; } = new List>(); + public static string InputConfPath { get; } = MpvConfFolder + "\\input.conf"; + public static string MpvConfPath { get; } = MpvConfFolder + "\\mpv.conf"; + public static string MpvNetConfPath { get; } = MpvConfFolder + "\\mpvnet.conf"; + + static string _MpvConfFolder; + + public static string MpvConfFolder { + get { + if (_MpvConfFolder == null) + { + if (Directory.Exists(Application.StartupPath + "\\portable_config")) + _MpvConfFolder = Application.StartupPath + "\\portable_config\\"; + else + _MpvConfFolder = Environment.GetFolderPath( + Environment.SpecialFolder.ApplicationData) + "\\mpv\\"; + } + return _MpvConfFolder; + } + } + static Dictionary _mpvConf; public static Dictionary mpvConf { @@ -105,8 +121,8 @@ namespace mpvnet public static void Init() { - if (!Directory.Exists(mp.MpvConfFolderPath)) - Directory.CreateDirectory(mp.MpvConfFolderPath); + if (!Directory.Exists(mp.MpvConfFolder)) + Directory.CreateDirectory(mp.MpvConfFolder); if (!File.Exists(mp.MpvConfPath)) File.WriteAllText(mp.MpvConfPath, Properties.Resources.mpv_conf); @@ -146,7 +162,7 @@ namespace mpvnet if (Path.GetExtension(scriptPath) == ".ps1") PowerShellScript.Init(scriptPath); - foreach (var scriptPath in Directory.GetFiles(mp.MpvConfFolderPath + "Scripts")) + foreach (var scriptPath in Directory.GetFiles(mp.MpvConfFolder + "Scripts")) if (Path.GetExtension(scriptPath) == ".py") PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath))); else if (Path.GetExtension(scriptPath) == ".ps1") @@ -611,7 +627,7 @@ namespace mpvnet if (File.Exists(LastHistoryPath) && totalMinutes > 1) { - string historyFilepath = mp.MpvConfFolderPath + "history.txt"; + string historyFilepath = mp.MpvConfFolder + "history.txt"; File.AppendAllText(historyFilepath, DateTime.Now.ToString().Substring(0, 16) + " " + totalMinutes.ToString().PadLeft(3) + " " + diff --git a/mpvConfEdit/MainWindow.xaml.cs b/mpvConfEdit/MainWindow.xaml.cs index 290a799..7b273bd 100644 --- a/mpvConfEdit/MainWindow.xaml.cs +++ b/mpvConfEdit/MainWindow.xaml.cs @@ -17,13 +17,14 @@ namespace mpvConfEdit { public partial class MainWindow : Window { - public string MpvConfPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\mpv.conf"; - public string MpvNetConfPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\mpvnet.conf"; private List MpvSettingsDefinitions = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\mpvConf.toml"); private List MpvNetSettingsDefinitions = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\mpvNetConf.toml"); - public ObservableCollection FilterStrings { get; } = new ObservableCollection(); private Dictionary> Comments = new Dictionary>(); + public ObservableCollection FilterStrings { get; } = new ObservableCollection(); + public string MpvConfPath { get; } = MpvConfFolder + "mpv.conf"; + public string MpvNetConfPath { get; } = MpvConfFolder + "mpvnet.conf"; + public MainWindow() { InitializeComponent(); @@ -36,6 +37,24 @@ namespace mpvConfEdit SetDarkTheme(); } + static string StartupFolder { get; } = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\"; + + static string _MpvConfFolder; + + public static string MpvConfFolder { + get { + if (_MpvConfFolder == null) + { + if (Directory.Exists(StartupFolder + "portable_config")) + _MpvConfFolder = StartupFolder + "portable_config\\"; + else + _MpvConfFolder = Environment.GetFolderPath( + Environment.SpecialFolder.ApplicationData) + "\\mpv\\"; + } + return _MpvConfFolder; + } + } + public Brush Foreground2 { get { return (Brush)GetValue(Foreground2Property); } set { SetValue(Foreground2Property, value); } diff --git a/mpvConfEdit/Properties/AssemblyInfo.cs b/mpvConfEdit/Properties/AssemblyInfo.cs index e2dff4f..a2aeba0 100644 --- a/mpvConfEdit/Properties/AssemblyInfo.cs +++ b/mpvConfEdit/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Windows; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("mpv(.net) conf edit")] -[assembly: AssemblyCopyright("Copyright © 2017-2019 stax76")] +[assembly: AssemblyCopyright("Copyright © 2017-2019 Frank Skare (stax76)")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -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("1.8.0.0")] -[assembly: AssemblyFileVersion("1.8.0.0")] +[assembly: AssemblyVersion("1.9.0.0")] +[assembly: AssemblyFileVersion("1.9.0.0")] diff --git a/mpvInputEdit/App.xaml.cs b/mpvInputEdit/App.xaml.cs index d223a18..71a8d91 100644 --- a/mpvInputEdit/App.xaml.cs +++ b/mpvInputEdit/App.xaml.cs @@ -7,7 +7,25 @@ namespace mpvInputEdit { public partial class App : Application { - public static string InputConfPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\input.conf"; + public static string InputConfPath { get; } = MpvConfFolder + "input.conf"; + + static string StartupFolder { get; } = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\"; + + static string _MpvConfFolder; + + public static string MpvConfFolder { + get { + if (_MpvConfFolder == null) + { + if (Directory.Exists(StartupFolder + "portable_config")) + _MpvConfFolder = StartupFolder + "portable_config\\"; + else + _MpvConfFolder = Environment.GetFolderPath( + Environment.SpecialFolder.ApplicationData) + "\\mpv\\"; + } + return _MpvConfFolder; + } + } private static ObservableCollection _InputItems; diff --git a/mpvInputEdit/Properties/AssemblyInfo.cs b/mpvInputEdit/Properties/AssemblyInfo.cs index 5979220..5640444 100644 --- a/mpvInputEdit/Properties/AssemblyInfo.cs +++ b/mpvInputEdit/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Windows; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("mpv(.net) input edit")] -[assembly: AssemblyCopyright("Copyright © 2017-2019 stax76")] +[assembly: AssemblyCopyright("Copyright © 2017-2019 Frank Skare (stax76)")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -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("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.7.0.0")] +[assembly: AssemblyFileVersion("1.7.0.0")] diff --git a/release.ps1 b/release.ps1 new file mode 100644 index 0000000..408df91 --- /dev/null +++ b/release.ps1 @@ -0,0 +1,8 @@ +$scriptDir = Split-Path -Path $PSCommandPath -Parent +$exePath = $scriptDir + "\mpv.net\bin\mpvnet.exe" +$version = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath).FileVersion +$desktopDir = [Environment]::GetFolderPath("Desktop") +$targetDir = $desktopDir + "\mpv.net-" + $version +Copy-Item $scriptDir\mpv.net\bin $targetDir -Recurse -Exclude System.Management.Automation.xml -Force +Copy-Item $scriptDir\README.md $targetDir\README.md -Force +& "C:\Program Files\7-Zip\7z.exe" a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*" \ No newline at end of file