mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-25 10:05:49 +08:00
fix path
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<AssemblyVersion>10.38.2</AssemblyVersion>
|
||||
<AssemblyVersion>10.38.3</AssemblyVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -23,18 +23,19 @@ public class FfmpegRecorder : IVideoRecorder
|
||||
|
||||
private readonly string _filePath;
|
||||
private string _startTime = string.Empty;
|
||||
|
||||
public string FileName { get; set; }
|
||||
|
||||
private readonly string _fileName;
|
||||
|
||||
public FfmpegRecorder(string fileName)
|
||||
{
|
||||
_fileName = fileName;
|
||||
FileName = fileName;
|
||||
if (!File.Exists(FfmpegPath))
|
||||
{
|
||||
throw new Exception("ffmpeg.exe不存在");
|
||||
}
|
||||
|
||||
var folderPath = Global.Absolute($@"User\KeyMouseScript\{fileName}\");
|
||||
var folderPath = Global.Absolute($@"User\KeyMouseScript\{FileName}\");
|
||||
Directory.CreateDirectory(folderPath);
|
||||
_filePath = Path.Combine(folderPath, "%Y_%m_%d_%H_%M_%S.mp4");
|
||||
var processInfo = new ProcessStartInfo
|
||||
@@ -117,7 +118,7 @@ public class FfmpegRecorder : IVideoRecorder
|
||||
// if (File.Exists(_filePath))
|
||||
// {
|
||||
// // 重命名文件
|
||||
// var newFilePath = Global.Absolute($@"User\KeyMouseScript\{_fileName}_{_startTime}.mp4");
|
||||
// var newFilePath = Global.Absolute($@"User\KeyMouseScript\{_FileName}_{_startTime}.mp4");
|
||||
// File.Move(_filePath, newFilePath);
|
||||
// TaskControl.Logger.LogInformation("ffmpeg录制: {Text}", $"录制完成");
|
||||
// }
|
||||
@@ -133,6 +134,7 @@ public class FfmpegRecorder : IVideoRecorder
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
|
||||
@@ -7,4 +7,6 @@ public interface IVideoRecorder : IDisposable
|
||||
public bool Start();
|
||||
|
||||
public void Stop();
|
||||
|
||||
string FileName { get; set; }
|
||||
}
|
||||
@@ -22,11 +22,11 @@ public class ObsRecorder : IVideoRecorder
|
||||
|
||||
private DateTime _lastRecordTime = DateTime.MinValue;
|
||||
|
||||
private readonly string _fileName;
|
||||
|
||||
public ObsRecorder(string fileName)
|
||||
public string FileName { get; set; }
|
||||
|
||||
public ObsRecorder()
|
||||
{
|
||||
_fileName = fileName;
|
||||
// 判断 OBS 是否已经启动
|
||||
if (Process.GetProcessesByName("obs64").Length == 0)
|
||||
{
|
||||
@@ -140,6 +140,7 @@ public class ObsRecorder : IVideoRecorder
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void MoveFile(string name)
|
||||
{
|
||||
Task.Run(() =>
|
||||
@@ -147,7 +148,7 @@ public class ObsRecorder : IVideoRecorder
|
||||
try
|
||||
{
|
||||
var videoPath = Global.Absolute($@"video\{name}");
|
||||
var folderPath = Global.Absolute($@"User\KeyMouseScript\{_fileName}\");
|
||||
var folderPath = Global.Absolute($@"User\KeyMouseScript\{FileName}\");
|
||||
if (File.Exists(videoPath))
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -14,13 +14,15 @@ public class VideoRecorderFactory
|
||||
switch (recorderType)
|
||||
{
|
||||
case "ffmpeg":
|
||||
return new FfmpegRecorder(fileName);
|
||||
var ffmpegRecorder = new FfmpegRecorder(fileName);
|
||||
return ffmpegRecorder;
|
||||
case "obs":
|
||||
if (_obsRecorder == null)
|
||||
{
|
||||
_obsRecorder = new ObsRecorder(fileName);
|
||||
_obsRecorder = new ObsRecorder();
|
||||
// TaskControl.Logger.LogInformation("当前选择使用OBS录制,OBS首次启动较慢,请耐心等待...");
|
||||
}
|
||||
_obsRecorder.FileName = fileName;
|
||||
return _obsRecorder;
|
||||
default:
|
||||
throw new ArgumentException("不支持的录制工具");
|
||||
|
||||
Reference in New Issue
Block a user