This commit is contained in:
Frank Skare
2019-04-23 16:23:06 +02:00
parent 2415e2ed43
commit efd2ddf367
14 changed files with 218 additions and 114 deletions

View File

@@ -11,7 +11,7 @@ Public Class CSScriptAddon
Implements IAddon Implements IAddon
Sub New() Sub New()
Dim scriptDir = mp.MpvConfFolderPath + "scripts" Dim scriptDir = mp.MpvConfFolder + "scripts"
If Not Directory.Exists(scriptDir) Then Return If Not Directory.Exists(scriptDir) Then Return
Dim csFiles = Directory.GetFiles(scriptDir, "*.cs").ToList Dim csFiles = Directory.GetFiles(scriptDir, "*.cs").ToList
csFiles.AddRange(Directory.GetFiles(Application.StartupPath + "\\Scripts", "*.cs")) csFiles.AddRange(Directory.GetFiles(Application.StartupPath + "\\Scripts", "*.cs"))

View File

@@ -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 C:\Users\user\AppData\Roaming\mpv\mpv.conf
``` ```
or alternativly at:
```
<startup>\portable_config\mpv.conf
```
if it's missing mpv.net generates it with the following defaults: if it's missing mpv.net generates it with the following defaults:
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt> <https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt>
@@ -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 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\<user>\AppData\Roaming\mpv\Addons\*Addon.dll
<startup>\Addons\*Addon.dll
<startup>\portable_config\Addons\*Addon.dll
The add-on filename must end with 'Addon.dll'
### Support ### Support
@@ -73,6 +89,14 @@ Scripting is supported via Python, C#, Lua, JavaScript and PowerShell
### Changelog ### 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) ### 3.0 (2019-04-20)
- the history feature logs now only files that were opened longer than 90 seconds - the history feature logs now only files that were opened longer than 90 seconds

View File

@@ -28,7 +28,7 @@ namespace mpvnet
foreach (string i in Directory.GetDirectories(dir)) foreach (string i in Directory.GetDirectories(dir))
catalog.Catalogs.Add(new DirectoryCatalog(i, "*Addon.dll")); catalog.Catalogs.Add(new DirectoryCatalog(i, "*Addon.dll"));
dir = mp.MpvConfFolderPath + "\\Addons"; dir = mp.MpvConfFolder + "\\Addons";
if (Directory.Exists(dir)) if (Directory.Exists(dir))
foreach (string i in Directory.GetDirectories(dir)) foreach (string i in Directory.GetDirectories(dir))

View File

@@ -58,7 +58,7 @@ namespace mpvnet
public static void open_conf_folder(string[] args) public static void open_conf_folder(string[] args)
{ {
Process.Start(mp.MpvConfFolderPath); Process.Start(mp.MpvConfFolder);
} }
public static void show_input_editor(string[] args) public static void show_input_editor(string[] args)
@@ -73,7 +73,7 @@ namespace mpvnet
public static void show_history(string[] args) public static void show_history(string[] args)
{ {
var fp = mp.MpvConfFolderPath + "history.txt"; var fp = mp.MpvConfFolder + "history.txt";
if (File.Exists(fp)) if (File.Exists(fp))
Process.Start(fp); Process.Start(fp);

View File

@@ -18,23 +18,20 @@ namespace mpvnet
public static MainForm Instance { get; set; } public static MainForm Instance { get; set; }
public static IntPtr Hwnd { get; set; } public static IntPtr Hwnd { get; set; }
public new ContextMenuStripEx ContextMenu; public new ContextMenuStripEx ContextMenu { get; set; }
MenuItemEx TracksMenu;
MenuItemEx ChaptersMenu;
Point LastCursorPosChanged; Point LastCursorPosChanged;
int LastCursorChangedTickCount; int LastCursorChangedTickCount;
bool IgnoreDpiChanged = true; bool IgnoreDpiChanged = true;
float MpvAutofit = 0.50f; public string MpvNetDarkMode { get; set; } = "system";
bool MpvFullscreen; public bool MpvFullscreen { get; set; }
int MpvScreen = -1; public float MpvAutofit { get; set; } = 0.50f;
string MpvNetDarkMode = "system"; public int MpvScreen { get; set; } = -1;
string MpvSid = ""; public string MpvSid { get; set; } = "";
string MpvAid = ""; public string MpvAid { get; set; } = "";
string MpvVid = ""; public string MpvVid { get; set; } = "";
int MpvEdition; public int MpvEdition { get; set; }
public MainForm() public MainForm()
{ {
@@ -74,73 +71,107 @@ namespace mpvnet
{ {
lock (mp.MediaTracks) lock (mp.MediaTracks)
{ {
if (TracksMenu != null) MenuItem trackMenuItem = FindMenuItem("Track");
TracksMenu.DropDownItems.Clear();
MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray(); if (trackMenuItem != null)
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)
{ {
MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); trackMenuItem.DropDownItems.Clear();
mi.Action = () => { mp.commandv("set", "vid", track.ID.ToString()); };
mi.Checked = MpvVid == track.ID.ToString();
}
if (vidTracks.Length > 0) MediaTrack[] audTracks = mp.MediaTracks.Where(track => track.Type == "a").ToArray();
ContextMenu.Add("Track > -"); 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) foreach (MediaTrack track in vidTracks)
{ {
MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); MenuItem mi = new MenuItem(track.Text);
mi.Action = () => { mp.commandv("set", "aid", track.ID.ToString()); }; mi.Action = () => { mp.commandv("set", "vid", track.ID.ToString()); };
mi.Checked = MpvAid == track.ID.ToString(); mi.Checked = MpvVid == track.ID.ToString();
} trackMenuItem.DropDownItems.Add(mi);
}
if (subTracks.Length > 0) if (vidTracks.Length > 0)
ContextMenu.Add("Track > -"); trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
foreach (MediaTrack track in subTracks) foreach (MediaTrack track in audTracks)
{ {
MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); MenuItem mi = new MenuItem(track.Text);
mi.Action = () => { mp.commandv("set", "sid", track.ID.ToString()); }; mi.Action = () => { mp.commandv("set", "aid", track.ID.ToString()); };
mi.Checked = MpvSid == track.ID.ToString(); mi.Checked = MpvAid == track.ID.ToString();
} trackMenuItem.DropDownItems.Add(mi);
}
if (subTracks.Length > 0) if (subTracks.Length > 0)
{ trackMenuItem.DropDownItems.Add(new ToolStripSeparator());
MenuItemEx mi = ContextMenu.Add("Track > S: No subtitles");
mi.Action = () => { mp.commandv("set", "sid", "no"); };
mi.Checked = MpvSid == "no";
}
if (ediTracks.Length > 0) foreach (MediaTrack track in subTracks)
ContextMenu.Add("Track > -"); {
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) if (subTracks.Length > 0)
{ {
MenuItemEx mi = ContextMenu.Add("Track > " + track.Text); MenuItem mi = new MenuItem("S: No subtitles");
mi.Action = () => { mp.commandv("set", "edition", track.ID.ToString()); }; mi.Action = () => { mp.commandv("set", "sid", "no"); };
mi.Checked = MpvEdition == track.ID; 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) lock (mp.Chapters)
{ {
if (ChaptersMenu != null) MenuItem chaptersMenuItem = FindMenuItem("Chapters");
ChaptersMenu.DropDownItems.Clear();
foreach (var i in mp.Chapters) if (chaptersMenuItem != null)
{ {
MenuItemEx mi = ContextMenu.Add("Navigate > Chapters > " + i.Key); chaptersMenuItem.DropDownItems.Clear();
mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(i.Value).ToString().Substring(0, 8) + " ";
mi.Action = () => { mp.commandv("seek", i.Value.ToString(CultureInfo.InvariantCulture), "absolute"); }; 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) protected void SetScreen(int targetIndex)
{ {
Screen[] screens = Screen.AllScreens; Screen[] screens = Screen.AllScreens;
@@ -291,7 +322,7 @@ namespace mpvnet
else else
input = ""; input = "";
MenuItemEx menuItem = ContextMenu.Add(path, () => { MenuItem menuItem = ContextMenu.Add(path, () => {
try { try {
mp.command_string(command); mp.command_string(command);
} }
@@ -301,19 +332,7 @@ namespace mpvnet
}); });
if (menuItem != null) if (menuItem != null)
{ menuItem.ShortcutKeyDisplayString = input + " ";
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;
}
} }
} }

View File

@@ -23,33 +23,33 @@ public class ContextMenuStripEx : ContextMenuStrip
Renderer = new ToolStripRendererEx(); Renderer = new ToolStripRendererEx();
} }
public MenuItemEx Add(string path) public MenuItem Add(string path)
{ {
return Add(path, null); 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; if (ret == null) return null;
ret.Enabled = enabled; ret.Enabled = enabled;
return ret; return ret;
} }
} }
public class MenuItemEx : ToolStripMenuItem public class MenuItem : ToolStripMenuItem
{ {
public Action Action { get; set; } 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; Action = action;
} }
@@ -61,12 +61,12 @@ public class MenuItemEx : ToolStripMenuItem
base.OnClick(e); base.OnClick(e);
} }
public static MenuItemEx Add<T>(ToolStripItemCollection items, string path, Action<T> action, T value) public static MenuItem Add<T>(ToolStripItemCollection items, string path, Action<T> action, T value)
{ {
return Add(items, path, () => action(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); string[] a = path.Split(new[] { " > ", " | " }, StringSplitOptions.RemoveEmptyEntries);
var itemsCollection = items; var itemsCollection = items;
@@ -95,7 +95,7 @@ public class MenuItemEx : ToolStripMenuItem
itemsCollection.Add(new ToolStripSeparator()); itemsCollection.Add(new ToolStripSeparator());
else else
{ {
MenuItemEx item = new MenuItemEx(a[x] + " ", action); MenuItem item = new MenuItem(a[x] + " ", action);
itemsCollection.Add(item); itemsCollection.Add(item);
itemsCollection = item.DropDownItems; itemsCollection = item.DropDownItems;
return item; return item;
@@ -103,7 +103,7 @@ public class MenuItemEx : ToolStripMenuItem
} }
else else
{ {
MenuItemEx item = new MenuItemEx(); MenuItem item = new MenuItem();
item.Text = a[x] + " "; item.Text = a[x] + " ";
itemsCollection.Add(item); itemsCollection.Add(item);
itemsCollection = item.DropDownItems; itemsCollection = item.DropDownItems;
@@ -266,10 +266,10 @@ public class ToolStripRendererEx : ToolStripSystemRenderer
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{ {
if (e.Item.GetType() != typeof(MenuItemEx)) if (e.Item.GetType() != typeof(MenuItem))
return; return;
MenuItemEx item = e.Item as MenuItemEx; MenuItem item = e.Item as MenuItem;
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.1.0.0")]

View File

@@ -36,8 +36,8 @@
_ ignore #menu: - _ ignore #menu: -
Enter cycle fullscreen #menu: Toggle Fullscreen Enter cycle fullscreen #menu: Toggle Fullscreen
F11 playlist-prev #menu: Navigate > Previous F11 playlist-prev #menu: Navigate > Previous File
F12 playlist-next #menu: Navigate > Next F12 playlist-next #menu: Navigate > Next File
_ ignore #menu: Navigate > - _ ignore #menu: Navigate > -
PGUP add chapter 1 #menu: Navigate > Next Chapter PGUP add chapter 1 #menu: Navigate > Next Chapter
PGDWN add chapter -1 #menu: Navigate > Previous 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://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/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/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: - _ ignore #menu: -
Esc quit #menu: Exit Esc quit #menu: Exit

View File

@@ -60,15 +60,31 @@ namespace mpvnet
public static List<KeyValuePair<string, Action<int>>> IntPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<int>>>(); public static List<KeyValuePair<string, Action<int>>> IntPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<int>>>();
public static List<KeyValuePair<string, Action<string>>> StringPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<string>>>(); public static List<KeyValuePair<string, Action<string>>> StringPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<string>>>();
public static Size VideoSize { get; set; } = new Size(1920, 1080); 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<PythonScript> PythonScripts { get; set; } = new List<PythonScript>(); public static List<PythonScript> PythonScripts { get; set; } = new List<PythonScript>();
public static AutoResetEvent AutoResetEvent { get; set; } = new AutoResetEvent(false); public static AutoResetEvent AutoResetEvent { get; set; } = new AutoResetEvent(false);
public static List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>(); public static List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
public static List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>(); public static List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
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<string, string> _mpvConf; static Dictionary<string, string> _mpvConf;
public static Dictionary<string, string> mpvConf { public static Dictionary<string, string> mpvConf {
@@ -105,8 +121,8 @@ namespace mpvnet
public static void Init() public static void Init()
{ {
if (!Directory.Exists(mp.MpvConfFolderPath)) if (!Directory.Exists(mp.MpvConfFolder))
Directory.CreateDirectory(mp.MpvConfFolderPath); Directory.CreateDirectory(mp.MpvConfFolder);
if (!File.Exists(mp.MpvConfPath)) if (!File.Exists(mp.MpvConfPath))
File.WriteAllText(mp.MpvConfPath, Properties.Resources.mpv_conf); File.WriteAllText(mp.MpvConfPath, Properties.Resources.mpv_conf);
@@ -146,7 +162,7 @@ namespace mpvnet
if (Path.GetExtension(scriptPath) == ".ps1") if (Path.GetExtension(scriptPath) == ".ps1")
PowerShellScript.Init(scriptPath); 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") if (Path.GetExtension(scriptPath) == ".py")
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath))); PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
else if (Path.GetExtension(scriptPath) == ".ps1") else if (Path.GetExtension(scriptPath) == ".ps1")
@@ -611,7 +627,7 @@ namespace mpvnet
if (File.Exists(LastHistoryPath) && totalMinutes > 1) 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) + File.AppendAllText(historyFilepath, DateTime.Now.ToString().Substring(0, 16) +
" " + totalMinutes.ToString().PadLeft(3) + " " + " " + totalMinutes.ToString().PadLeft(3) + " " +

View File

@@ -17,13 +17,14 @@ namespace mpvConfEdit
{ {
public partial class MainWindow : Window 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<SettingBase> MpvSettingsDefinitions = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\mpvConf.toml"); private List<SettingBase> MpvSettingsDefinitions = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\mpvConf.toml");
private List<SettingBase> MpvNetSettingsDefinitions = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\mpvNetConf.toml"); private List<SettingBase> MpvNetSettingsDefinitions = Settings.LoadSettings(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\mpvNetConf.toml");
public ObservableCollection<string> FilterStrings { get; } = new ObservableCollection<string>();
private Dictionary<string, Dictionary<string, string>> Comments = new Dictionary<string, Dictionary<string, string>>(); private Dictionary<string, Dictionary<string, string>> Comments = new Dictionary<string, Dictionary<string, string>>();
public ObservableCollection<string> FilterStrings { get; } = new ObservableCollection<string>();
public string MpvConfPath { get; } = MpvConfFolder + "mpv.conf";
public string MpvNetConfPath { get; } = MpvConfFolder + "mpvnet.conf";
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
@@ -36,6 +37,24 @@ namespace mpvConfEdit
SetDarkTheme(); 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 { public Brush Foreground2 {
get { return (Brush)GetValue(Foreground2Property); } get { return (Brush)GetValue(Foreground2Property); }
set { SetValue(Foreground2Property, value); } set { SetValue(Foreground2Property, value); }

View File

@@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mpv(.net) conf edit")] [assembly: AssemblyProduct("mpv(.net) conf edit")]
[assembly: AssemblyCopyright("Copyright © 2017-2019 stax76")] [assembly: AssemblyCopyright("Copyright © 2017-2019 Frank Skare (stax76)")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.0.0")] [assembly: AssemblyVersion("1.9.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")] [assembly: AssemblyFileVersion("1.9.0.0")]

View File

@@ -7,7 +7,25 @@ namespace mpvInputEdit
{ {
public partial class App : Application 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<InputItem> _InputItems; private static ObservableCollection<InputItem> _InputItems;

View File

@@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mpv(.net) input edit")] [assembly: AssemblyProduct("mpv(.net) input edit")]
[assembly: AssemblyCopyright("Copyright © 2017-2019 stax76")] [assembly: AssemblyCopyright("Copyright © 2017-2019 Frank Skare (stax76)")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")] [assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyFileVersion("1.7.0.0")]

8
release.ps1 Normal file
View File

@@ -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\*"