Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef45baecbd | ||
|
|
30e75b2100 | ||
|
|
563472b489 | ||
|
|
724a9adab8 | ||
|
|
9686c28f6a | ||
|
|
03d0aeb879 |
@@ -1,4 +1,6 @@
|
||||
|
||||
- The Japanese translation was updated. Thanks to the translators!
|
||||
|
||||
# v7.1.2.0 (2026-01-09)
|
||||
|
||||
- libmpv updated to v0.41 2026-01-09.
|
||||
|
||||
@@ -583,7 +583,7 @@ msgstr "再生履歴"
|
||||
#: D:\Projects\CS\mpv.net\src\MpvNet\InputHelp.cs:140
|
||||
#: D:\Projects\CS\mpv.net\src\MpvNet\InputHelp.cs:245
|
||||
msgid "Watch Later"
|
||||
msgstr "後で再生"
|
||||
msgstr "再生位置を保存"
|
||||
|
||||
#: D:\Projects\CS\mpv.net\src\MpvNet\InputHelp.cs:142
|
||||
msgid "Console"
|
||||
@@ -818,7 +818,7 @@ msgstr "ハードウェアデコードの切り替え"
|
||||
|
||||
#: D:\Projects\CS\mpv.net\src\MpvNet\InputHelp.cs:188
|
||||
msgid "Exit Watch Later"
|
||||
msgstr "後で再生を解除"
|
||||
msgstr "再生位置を保存して終了"
|
||||
|
||||
#: D:\Projects\CS\mpv.net\src\MpvNet\InputHelp.cs:190
|
||||
#: D:\Projects\CS\mpv.net\src\MpvNet.Windows\WinForms\MainForm.cs:477
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
|
||||
namespace MpvNet.Windows;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows;
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
using MpvNet.Windows.WinForms;
|
||||
using MpvNet.Windows.WPF.Views;
|
||||
using MpvNet.Windows.WPF;
|
||||
@@ -303,20 +303,20 @@ public class GuiCommand
|
||||
|
||||
if (File.Exists(path) && osd)
|
||||
{
|
||||
if (FileTypes.IsAudio(path.Ext()))
|
||||
if (FileTypes.IsAudio(path.Ext))
|
||||
{
|
||||
text = Player.GetPropertyOsdString("filtered-metadata");
|
||||
Player.CommandV("show-text", text, "5000");
|
||||
return;
|
||||
}
|
||||
else if (FileTypes.IsImage(path.Ext()))
|
||||
else if (FileTypes.IsImage(path.Ext))
|
||||
{
|
||||
fileSize = new FileInfo(path).Length;
|
||||
|
||||
text = "Width: " + Player.GetPropertyInt("width") + "\n" +
|
||||
"Height: " + Player.GetPropertyInt("height") + "\n" +
|
||||
"Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" +
|
||||
"Type: " + path.Ext().ToUpper();
|
||||
"Type: " + path.Ext.ToUpper();
|
||||
|
||||
Player.CommandV("show-text", text, "5000");
|
||||
return;
|
||||
@@ -332,7 +332,7 @@ public class GuiCommand
|
||||
int width = Player.GetPropertyInt("video-params/w");
|
||||
int height = Player.GetPropertyInt("video-params/h");
|
||||
TimeSpan len = TimeSpan.FromSeconds(Player.GetPropertyDouble("duration"));
|
||||
text = path.FileName() + "\n";
|
||||
text = path.FileName + "\n";
|
||||
text += FormatTime(len.TotalMinutes) + ":" + FormatTime(len.Seconds) + "\n";
|
||||
if (fileSize > 0)
|
||||
text += Convert.ToInt32(fileSize / 1024.0 / 1024.0) + " MB\n";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
|
||||
namespace MpvNet.Windows.UI;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Text.RegularExpressions;
|
||||
using MpvNet.Windows.WPF;
|
||||
using MpvNet.Windows.UI;
|
||||
using MpvNet.Help;
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
using MpvNet.MVVM;
|
||||
using MpvNet.Windows.WPF.MsgBox;
|
||||
|
||||
@@ -556,12 +556,12 @@ public partial class MainForm : Form
|
||||
if (App.AutofitImage > 1)
|
||||
App.AutofitImage = 1;
|
||||
|
||||
bool isAudio = FileTypes.IsAudio(Player.Path.Ext());
|
||||
bool isAudio = FileTypes.IsAudio(Player.Path.Ext);
|
||||
|
||||
if (isAudio)
|
||||
autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitAudio);
|
||||
|
||||
if (FileTypes.IsImage(Player.Path.Ext()))
|
||||
if (FileTypes.IsImage(Player.Path.Ext))
|
||||
autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitImage);
|
||||
|
||||
if (Player.VideoSize.Height == 0 || Player.VideoSize.Width == 0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
using MpvNet.Help;
|
||||
using MpvNet.MVVM;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
|
||||
namespace MpvNet;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
|
||||
namespace MpvNet;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ExtensionLoader
|
||||
{
|
||||
foreach (string dir in Directory.GetDirectories(path))
|
||||
{
|
||||
LoadDll(dir.AddSep() + Path.GetFileName(dir) + ".dll");
|
||||
LoadDll(dir.Separator + Path.GetFileName(dir) + ".dll");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
namespace MpvNet.ExtensionMethod;
|
||||
|
||||
public static class ObjectExtension
|
||||
{
|
||||
public static string ToStringEx(this object instance) => instance?.ToString() ?? "";
|
||||
}
|
||||
10
src/MpvNet/ExtensionMethod/ObjectExtensions.cs
Normal file
10
src/MpvNet/ExtensionMethod/ObjectExtensions.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace MpvNet.Extensions;
|
||||
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
extension(object instance)
|
||||
{
|
||||
public string ToStringEx() => instance?.ToString() ?? "";
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
namespace MpvNet.ExtensionMethod;
|
||||
|
||||
public static class PathStringExtension
|
||||
{
|
||||
public static string Ext(this string filepath) => filepath.Ext(false);
|
||||
|
||||
public static string Ext(this string filepath, bool includeDot)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
return "";
|
||||
|
||||
char[] chars = filepath.ToCharArray();
|
||||
|
||||
for (int x = filepath.Length - 1; x >= 0; x--)
|
||||
{
|
||||
if (chars[x] == Path.DirectorySeparatorChar)
|
||||
return "";
|
||||
|
||||
if (chars[x] == '.')
|
||||
return filepath.Substring(x + (includeDot ? 0 : 1)).ToLowerInvariant();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string FileName(this string instance)
|
||||
{
|
||||
if (string.IsNullOrEmpty(instance))
|
||||
return "";
|
||||
|
||||
int index = instance.LastIndexOf('\\');
|
||||
|
||||
if (index > -1)
|
||||
return instance[(index + 1)..];
|
||||
|
||||
index = instance.LastIndexOf('/');
|
||||
|
||||
if (index > -1)
|
||||
return instance[(index + 1)..];
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static string ShortPath(this string instance, int maxLength)
|
||||
{
|
||||
if (string.IsNullOrEmpty(instance))
|
||||
return "";
|
||||
|
||||
if (instance.Length > maxLength && instance.Substring(1, 2) == ":\\")
|
||||
instance = instance[..3] + "...\\" + instance.FileName();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
// Ensure trailing directory separator char
|
||||
public static string AddSep(this string instance)
|
||||
{
|
||||
if (string.IsNullOrEmpty(instance))
|
||||
return "";
|
||||
|
||||
if (!instance.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
instance = instance + Path.DirectorySeparatorChar;
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
77
src/MpvNet/ExtensionMethod/PathStringExtensions.cs
Normal file
77
src/MpvNet/ExtensionMethod/PathStringExtensions.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
namespace MpvNet.Extensions;
|
||||
|
||||
public static class PathStringExtensions
|
||||
{
|
||||
extension(string filepath)
|
||||
{
|
||||
public string Ext => GetExt(filepath, false);
|
||||
|
||||
static string GetExt(string path, bool includeDot)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return "";
|
||||
|
||||
char[] chars = path.ToCharArray();
|
||||
|
||||
for (int x = path.Length - 1; x >= 0; x--)
|
||||
{
|
||||
if (chars[x] == '/')
|
||||
return "";
|
||||
if (chars[x] == '\\')
|
||||
return "";
|
||||
if (chars[x] == '.')
|
||||
return path[(x + (includeDot ? 0 : 1))..].ToLowerInvariant();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
return "";
|
||||
|
||||
int index = filepath.LastIndexOf('\\');
|
||||
|
||||
if (index > -1)
|
||||
return filepath[(index + 1)..];
|
||||
|
||||
index = filepath.LastIndexOf('/');
|
||||
|
||||
if (index > -1)
|
||||
return filepath[(index + 1)..];
|
||||
|
||||
return filepath;
|
||||
}
|
||||
}
|
||||
|
||||
public string ShortPath(int maxLength)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
return "";
|
||||
|
||||
if (filepath.Length > maxLength && filepath.Substring(1, 2) == ":\\")
|
||||
filepath = $"{filepath[..3]}...\\{filepath.FileName}";
|
||||
|
||||
return filepath;
|
||||
}
|
||||
|
||||
// Ensure trailing directory separator char
|
||||
public string Separator
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
return "";
|
||||
|
||||
if (!filepath.EndsWith(Path.DirectorySeparatorChar.ToString()))
|
||||
filepath = filepath + Path.DirectorySeparatorChar;
|
||||
|
||||
return filepath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
|
||||
using System.Globalization;
|
||||
|
||||
namespace MpvNet.ExtensionMethod;
|
||||
namespace MpvNet.Extensions;
|
||||
|
||||
public static class StringExtension
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string ToUpperEx(this string instance) => (instance != null) ? instance.ToUpperInvariant() : "";
|
||||
public static string ToUpperEx(this string instance) => instance?.ToUpperInvariant() ?? "";
|
||||
|
||||
public static string ToLowerEx(this string instance) => (instance != null) ? instance.ToLowerInvariant() : "";
|
||||
public static string ToLowerEx(this string instance) => instance?.ToLowerInvariant() ?? "";
|
||||
|
||||
public static string TrimEx(this string? instance) => (instance == null) ? "" : instance.Trim();
|
||||
public static string TrimEx(this string? instance) => instance?.Trim() ?? "";
|
||||
|
||||
public static int ToInt(this string instance, int defaultValue = 0)
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
|
||||
namespace MpvNet;
|
||||
|
||||
@@ -49,5 +49,5 @@ public static class FileTypes
|
||||
IsVideo(exts, ext) || IsAudio(exts, ext) || IsImage(exts, ext);
|
||||
|
||||
public static IEnumerable<string> GetMediaFiles(string[] files) =>
|
||||
files.Where(i => IsMedia(files, i.Ext()));
|
||||
files.Where(i => IsMedia(files, i.Ext));
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
|
||||
namespace MpvNet;
|
||||
|
||||
public class Folder
|
||||
{
|
||||
public static string Startup { get; } = Path.GetDirectoryName(Environment.ProcessPath)!.AddSep();
|
||||
public static string AppData { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).AddSep();
|
||||
public static string Startup { get; } = Path.GetDirectoryName(Environment.ProcessPath)!.Separator;
|
||||
public static string AppData { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).Separator;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Extensions;
|
||||
using MpvNet.Help;
|
||||
using MpvNet.Native;
|
||||
|
||||
@@ -127,7 +127,7 @@ public class MainPlayer : MpvClient
|
||||
{
|
||||
string configDir = CommandLine.GetValue("config-dir");
|
||||
string fullPath = System.IO.Path.GetFullPath(configDir);
|
||||
App.InputConf.Path = fullPath.AddSep() + "input.conf";
|
||||
App.InputConf.Path = fullPath.Separator + "input.conf";
|
||||
string content = App.InputConf.GetContent();
|
||||
|
||||
if (!string.IsNullOrEmpty(content))
|
||||
@@ -250,7 +250,7 @@ public class MainPlayer : MpvClient
|
||||
string? mpvnet_home = Environment.GetEnvironmentVariable("MPVNET_HOME");
|
||||
|
||||
if (Directory.Exists(mpvnet_home))
|
||||
return _configFolder = mpvnet_home.AddSep();
|
||||
return _configFolder = mpvnet_home.Separator;
|
||||
|
||||
_configFolder = Folder.Startup + "portable_config";
|
||||
|
||||
@@ -260,7 +260,7 @@ public class MainPlayer : MpvClient
|
||||
if (!Directory.Exists(_configFolder))
|
||||
Directory.CreateDirectory(_configFolder);
|
||||
|
||||
_configFolder = _configFolder.AddSep();
|
||||
_configFolder = _configFolder.Separator;
|
||||
}
|
||||
|
||||
return _configFolder;
|
||||
@@ -441,7 +441,7 @@ public class MainPlayer : MpvClient
|
||||
|
||||
file = ConvertFilePath(file);
|
||||
|
||||
string ext = file.Ext();
|
||||
string ext = file.Ext;
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user