├── StarTools
├── StarTools
│ ├── StarTools.ico
│ ├── StarTools.nsi
│ ├── App.config
│ ├── About.cs
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── AssemblyInfo.cs
│ │ ├── Settings.Designer.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Program.cs
│ ├── rip_cmd.cs
│ ├── run_rip.cs
│ ├── Page.cs
│ ├── run_rip.Designer.cs
│ ├── StarTools.Designer.cs
│ ├── rip_cmd.Designer.cs
│ ├── FileDo.cs
│ ├── About.Designer.cs
│ ├── CmdUtils.cs
│ ├── StarTools.cs
│ ├── ffmpeg_demux.cs
│ ├── ffmpeg_Live.cs
│ ├── .gitignore
│ ├── EncoderBox.cs
│ ├── needed.cs
│ ├── Encode.cs
│ ├── Mux.cs
│ ├── StarTools.csproj
│ ├── About.resx
│ ├── Mux.resx
│ ├── Encode.resx
│ ├── EncoderBox.resx
│ ├── StarTools.resx
│ ├── needed.resx
│ ├── rip_cmd.resx
│ ├── run_rip.resx
│ └── ffmpeg_Live.resx
├── StarTools.sln
└── .gitignore
├── README_CN.md
└── README.md
/StarTools/StarTools/StarTools.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hoshinohikari/StarTools/HEAD/StarTools/StarTools/StarTools.ico
--------------------------------------------------------------------------------
/StarTools/StarTools/StarTools.nsi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hoshinohikari/StarTools/HEAD/StarTools/StarTools/StarTools.nsi
--------------------------------------------------------------------------------
/StarTools/StarTools/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/StarTools/StarTools/About.cs:
--------------------------------------------------------------------------------
1 | using Sunny.UI;
2 |
3 | namespace StarTools
4 | {
5 | public partial class About : UITitlePage
6 | {
7 | public About()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | # StarTools
2 |
3 | ****
4 | |Author|HoshinoKun|
5 | |---|---
6 | |E-mail|hoshinokun@346pro.club
7 | ****
8 |
9 | ### 这是什么
10 | 这是一个基于FFmpeg、NVEnc等命令行工具的常用命令的GUI小工具,里面包含了一些在rip制作以及日常使用中常用的一些小命令,如果你有想添加的功能,请提issue或者pr
11 |
12 | ### 如何使用
13 | 请在[releases](https://github.com/hoshinohikari/StarTools/releases)中下载最新的安装包并按照自己所使用的平台选择需要的编码器,即可开始使用
14 |
--------------------------------------------------------------------------------
/StarTools/StarTools/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace StarTools
5 | {
6 | internal static class Program
7 | {
8 | ///
9 | /// 应用程序的主入口点。
10 | ///
11 | [STAThread]
12 | private static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new StarTools());
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # StarTools
2 |
3 | ****
4 | |Author|HoshinoKun|
5 | |---|---
6 | |E-mail|hoshinokun@346pro.club
7 | ****
8 |
9 | [中文简介](/README_CN.md)
10 | ## What's this?
11 | This is a GUI gadget based on FFmpeg, NVEnc, and other command line tools. It contains some commands that are commonly used in rip creation and daily use. If you have a feature you would like to add, please create issue or pull requests.
12 |
13 | ### How to use
14 | Please download the latest installation package at [releases](https://github.com/hoshinohikari/StarTools/releases) and select the required encoder according to the chipset you are using. Then you can start using this.
--------------------------------------------------------------------------------
/StarTools/StarTools/rip_cmd.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Sunny.UI;
3 |
4 | namespace StarTools
5 | {
6 | public partial class RipCmd : UITitlePage
7 | {
8 | private static Thread _thread;
9 | private static readonly CmdUtils Cmd = new CmdUtils();
10 | private readonly string _arg;
11 | private readonly string _line;
12 |
13 | public RipCmd(string cmdLine, string argLine)
14 | {
15 | InitializeComponent();
16 | _line = cmdLine;
17 | _arg = argLine;
18 | _thread = new Thread(Init_cmd) {IsBackground = true};
19 | _thread.Start();
20 | }
21 |
22 | public static void StopCmd()
23 | {
24 | Cmd.CloseCmd();
25 | _thread.Abort();
26 | }
27 |
28 | private void Init_cmd()
29 | {
30 | Cmd.SendCmd(this, _line, _arg);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // 有关程序集的一般信息由以下
5 | // 控制。更改这些特性值可修改
6 | // 与程序集关联的信息。
7 | [assembly: AssemblyTitle("StarTools")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("StarTools")]
12 | [assembly: AssemblyCopyright("Copyright © 2020")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // 将 ComVisible 设置为 false 会使此程序集中的类型
17 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
18 | //请将此类型的 ComVisible 特性设置为 true。
19 | [assembly: ComVisible(false)]
20 |
21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
22 | [assembly: Guid("53841ee9-2aea-4111-b28c-ceab47fadd53")]
23 |
24 | // 程序集的版本信息由下列四个值组成:
25 | //
26 | // 主版本
27 | // 次版本
28 | // 生成号
29 | // 修订号
30 | //
31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
32 | //通过使用 "*",如下所示:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/StarTools/StarTools/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace StarTools.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/StarTools/StarTools/run_rip.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using Sunny.UI;
3 |
4 | namespace StarTools
5 | {
6 | public partial class RunRip : UIHeaderMainFrame
7 | {
8 | public RunRip(string cmdLine, string argLine)
9 | {
10 | InitializeComponent();
11 |
12 | //设置关联
13 | Header.TabControl = MainTabControl;
14 |
15 | //增加页面到Main
16 | AddPage(new RipCmd(cmdLine, argLine), 1001);
17 |
18 | //设置Header节点索引
19 | Header.SetNodePageIndex(Header.Nodes[0], 1001);
20 |
21 | //显示默认界面
22 | Header.SelectedIndex = 0;
23 | }
24 |
25 | private void run_rip_FormClosing(object sender, FormClosingEventArgs e)
26 | {
27 | if (MainTabControl.TabPages[0].Controls[0] is RipCmd r && r.uiProcessBar1.Value != 100)
28 | {
29 | if (ShowAskDialog("转换未完成,确认要退出吗"))
30 | RipCmd.StopCmd();
31 | else
32 | e.Cancel = true;
33 | }
34 | else
35 | {
36 | RipCmd.StopCmd();
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/StarTools/StarTools.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30225.117
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarTools", "StarTools\StarTools.csproj", "{53841EE9-2AEA-4111-B28C-CEAB47FADD53}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Release|Any CPU = Release|Any CPU
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Debug|x64.ActiveCfg = Debug|x64
19 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Debug|x64.Build.0 = Debug|x64
20 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Release|x64.ActiveCfg = Release|x64
23 | {53841EE9-2AEA-4111-B28C-CEAB47FADD53}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {5C3277B2-1420-4B1F-B4DE-C6BE31E1A05F}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/StarTools/StarTools/Page.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
3 | * CopyRight (C) 2012-2020 ShenYongHua(沈永华).
4 | * QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com
5 | *
6 | * Blog: https://www.cnblogs.com/yhuse
7 | * Gitee: https://gitee.com/yhuse/SunnyUI
8 | * GitHub: https://github.com/yhuse/SunnyUI
9 | *
10 | * SunnyUI.dll can be used for free under the GPL-3.0 license.
11 | * If you use this code, please keep this note.
12 | * 如果您使用此代码,请保留此说明。
13 | ******************************************************************************
14 | * 文件名称: UIPage.cs
15 | * 文件说明: 页面基类,从Form继承,可放置于容器内
16 | * 当前版本: V3.0
17 | * 创建日期: 2020-01-01
18 | *
19 | * 2020-01-01: V2.2.0 增加文件说明
20 | ******************************************************************************/
21 |
22 | using Sunny.UI;
23 |
24 | namespace StarTools
25 | {
26 | public static class UILocalize
27 | {
28 | public static string InfoTitle;
29 | public static string SuccessTitle;
30 | public static string WarningTitle;
31 | public static string ErrorTitle;
32 | public static string AskTitle;
33 | public static string InputTitle;
34 | public static string SelectTitle;
35 | public static string CloseAll;
36 | public static string OK;
37 | public static string Cancel;
38 | public static string GridNoData;
39 | public static string GridDataLoading;
40 | public static string GridDataSourceException;
41 | public static string SystemProcessing;
42 | }
43 |
44 | internal class Page
45 | {
46 | ///
47 | /// 确认信息提示框
48 | ///
49 | /// 信息
50 | /// 显示遮罩层
51 | /// 结果
52 | public static bool ShowAskDialog(string msg, bool showMask = true)
53 | {
54 | return UIMessageDialog.ShowMessageDialog(msg, UILocalize.AskTitle, true, UIStyle.Blue, showMask);
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/run_rip.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace StarTools
2 | {
3 | partial class RunRip
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("压制进度");
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunRip));
33 | this.SuspendLayout();
34 | //
35 | // Header
36 | //
37 | treeNode1.Name = "节点0";
38 | treeNode1.Text = "压制进度";
39 | this.Header.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
40 | treeNode1});
41 | //
42 | // RunRip
43 | //
44 | this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
45 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
46 | this.ClientSize = new System.Drawing.Size(800, 450);
47 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
48 | this.Name = "RunRip";
49 | this.Text = "run_rip";
50 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.run_rip_FormClosing);
51 | this.ResumeLayout(false);
52 |
53 | }
54 |
55 | #endregion
56 | }
57 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace StarTools.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StarTools.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 重写当前线程的 CurrentUICulture 属性
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/StarTools/StarTools/StarTools.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace StarTools
2 | {
3 | partial class StarTools
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("压制");
32 | System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("工具");
33 | System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("高级");
34 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StarTools));
35 | this.SuspendLayout();
36 | //
37 | // Aside
38 | //
39 | this.Aside.LineColor = System.Drawing.Color.Black;
40 | this.Aside.Size = new System.Drawing.Size(250, 413);
41 | //
42 | // Header
43 | //
44 | treeNode1.Name = "节点0";
45 | treeNode1.Text = "压制";
46 | treeNode2.Name = "节点0";
47 | treeNode2.Text = "工具";
48 | treeNode3.Name = "节点1";
49 | treeNode3.Text = "高级";
50 | this.Header.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
51 | treeNode1,
52 | treeNode2,
53 | treeNode3});
54 | this.Header.Size = new System.Drawing.Size(908, 110);
55 | this.Header.MenuItemClick += new Sunny.UI.UINavBar.OnMenuItemClick(this.Header_MenuItemClick);
56 | //
57 | // StarTools
58 | //
59 | this.AllowDrop = true;
60 | this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
61 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
62 | this.ClientSize = new System.Drawing.Size(908, 558);
63 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
64 | this.MaximizeBox = false;
65 | this.Name = "StarTools";
66 | this.Text = "StarTools";
67 | this.Load += new System.EventHandler(this.StarTools_Load);
68 | this.ResumeLayout(false);
69 |
70 | }
71 |
72 | #endregion
73 | }
74 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/rip_cmd.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace StarTools
2 | {
3 | partial class RipCmd
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RipCmd));
32 | this.uiProcessBar1 = new Sunny.UI.UIProcessBar();
33 | this.uiRichTextBox1 = new Sunny.UI.UIRichTextBox();
34 | this.PagePanel.SuspendLayout();
35 | this.SuspendLayout();
36 | //
37 | // PagePanel
38 | //
39 | this.PagePanel.Controls.Add(this.uiRichTextBox1);
40 | this.PagePanel.Controls.Add(this.uiProcessBar1);
41 | this.PagePanel.Size = new System.Drawing.Size(800, 270);
42 | //
43 | // uiProcessBar1
44 | //
45 | this.uiProcessBar1.Font = new System.Drawing.Font("微软雅黑", 12F);
46 | this.uiProcessBar1.Location = new System.Drawing.Point(13, 229);
47 | this.uiProcessBar1.MinimumSize = new System.Drawing.Size(70, 23);
48 | this.uiProcessBar1.Name = "uiProcessBar1";
49 | this.uiProcessBar1.ShowValue = false;
50 | this.uiProcessBar1.Size = new System.Drawing.Size(774, 29);
51 | this.uiProcessBar1.TabIndex = 25;
52 | this.uiProcessBar1.Text = "0.0%";
53 | //
54 | // uiRichTextBox1
55 | //
56 | this.uiRichTextBox1.AutoWordSelection = true;
57 | this.uiRichTextBox1.FillColor = System.Drawing.Color.White;
58 | this.uiRichTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
59 | this.uiRichTextBox1.Location = new System.Drawing.Point(13, 8);
60 | this.uiRichTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
61 | this.uiRichTextBox1.Name = "uiRichTextBox1";
62 | this.uiRichTextBox1.Padding = new System.Windows.Forms.Padding(2);
63 | this.uiRichTextBox1.Size = new System.Drawing.Size(774, 213);
64 | this.uiRichTextBox1.TabIndex = 26;
65 | //
66 | // RipCmd
67 | //
68 | this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
70 | this.ClientSize = new System.Drawing.Size(800, 305);
71 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
72 | this.Name = "RipCmd";
73 | this.Text = "rip_cmd";
74 | this.PagePanel.ResumeLayout(false);
75 | this.ResumeLayout(false);
76 |
77 | }
78 |
79 | #endregion
80 | public Sunny.UI.UIProcessBar uiProcessBar1;
81 | public Sunny.UI.UIRichTextBox uiRichTextBox1;
82 | }
83 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/FileDo.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Security;
3 | using System.Windows.Forms;
4 |
5 | namespace StarTools
6 | {
7 | internal static class FileDo
8 | {
9 | public static string GetVideoFile(string initText)
10 | {
11 | var openFileDialog1 = new OpenFileDialog
12 | {
13 | FileName = "Select a video file",
14 | Filter =
15 | @"files (*.mp4;*.mkv;*.flv;*.m2ts;*.ts;*.264;*.h264;*.hevc)|*.mp4;*.mkv;*.flv;*.m2ts;*.ts;*.264;*.h264;*.hevc|All files (*.*)|*.*",
16 | Title = @"Open video file"
17 | };
18 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return initText;
19 | try
20 | {
21 | return openFileDialog1.FileName;
22 | }
23 | catch (SecurityException ex)
24 | {
25 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
26 | $"Details:\n\n{ex.StackTrace}");
27 | return initText;
28 | }
29 | }
30 |
31 | public static IEnumerable GetAudioFiles()
32 | {
33 | var openFileDialog1 = new OpenFileDialog
34 | {
35 | FileName = "Select a audio file",
36 | Filter =
37 | @"Audio files (*.m4a)|*.m4a|All files (*.*)|*.*",
38 | Title = @"Open audio file",
39 | Multiselect = true
40 | };
41 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return null;
42 | try
43 | {
44 | return openFileDialog1.FileNames;
45 | }
46 | catch (SecurityException ex)
47 | {
48 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
49 | $"Details:\n\n{ex.StackTrace}");
50 | return null;
51 | }
52 | }
53 |
54 | public static string GetAssFile(string initText)
55 | {
56 | var openFileDialog1 = new OpenFileDialog
57 | {
58 | FileName = "Select a ass file",
59 | Filter = @"Ass files (*.ass)|*.ass|All files (*.*)|*.*",
60 | Title = @"Open ass file"
61 | };
62 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return initText;
63 | try
64 | {
65 | return openFileDialog1.FileName;
66 | }
67 | catch (SecurityException ex)
68 | {
69 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
70 | $"Details:\n\n{ex.StackTrace}");
71 | return initText;
72 | }
73 | }
74 |
75 | public static string GetSaveFiles(string filekinds)
76 | {
77 | var saveFileDialog1 = new SaveFileDialog
78 | {
79 | FileName = "Output",
80 | Filter = filekinds + @" files (*." + filekinds + @")|*." + filekinds + @"|All files (*.*)|*.*",
81 | Title = @"Save a " + filekinds + @" file"
82 | };
83 |
84 | if (saveFileDialog1.ShowDialog() != DialogResult.OK) return "";
85 | try
86 | {
87 | var filePath = saveFileDialog1.FileName;
88 | return filePath;
89 | }
90 | catch (SecurityException ex)
91 | {
92 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
93 | $"Details:\n\n{ex.StackTrace}");
94 | return "";
95 | }
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/About.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace StarTools
2 | {
3 | partial class About
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(About));
32 | this.uiRichTextBox1 = new Sunny.UI.UIRichTextBox();
33 | this.uiLine1 = new Sunny.UI.UILine();
34 | this.PagePanel.SuspendLayout();
35 | this.SuspendLayout();
36 | //
37 | // PagePanel
38 | //
39 | this.PagePanel.Controls.Add(this.uiLine1);
40 | this.PagePanel.Controls.Add(this.uiRichTextBox1);
41 | this.PagePanel.Size = new System.Drawing.Size(658, 378);
42 | //
43 | // uiRichTextBox1
44 | //
45 | this.uiRichTextBox1.AutoWordSelection = true;
46 | this.uiRichTextBox1.FillColor = System.Drawing.Color.White;
47 | this.uiRichTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
48 | this.uiRichTextBox1.Location = new System.Drawing.Point(13, 44);
49 | this.uiRichTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
50 | this.uiRichTextBox1.Name = "uiRichTextBox1";
51 | this.uiRichTextBox1.Padding = new System.Windows.Forms.Padding(2);
52 | this.uiRichTextBox1.Size = new System.Drawing.Size(632, 320);
53 | this.uiRichTextBox1.TabIndex = 0;
54 | this.uiRichTextBox1.Text = "这是一个基于ffmpeg与显卡压制工具们的GUI操作工具\n用于压制某些不需要精细处理的片源\n依赖管理可完全由自己定义,只需独立的GUI文件即可运行\nGUI框架基于" +
55 | "SunnyGUI\n基础使用教学: https://www.346pro.club \nGithub: https://github.com/hoshinohika" +
56 | "ri/StarTools ";
57 | //
58 | // uiLine1
59 | //
60 | this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
61 | this.uiLine1.Location = new System.Drawing.Point(13, 7);
62 | this.uiLine1.MinimumSize = new System.Drawing.Size(2, 2);
63 | this.uiLine1.Name = "uiLine1";
64 | this.uiLine1.Size = new System.Drawing.Size(632, 29);
65 | this.uiLine1.TabIndex = 1;
66 | this.uiLine1.Text = "简介";
67 | //
68 | // About
69 | //
70 | this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
72 | this.ClientSize = new System.Drawing.Size(658, 413);
73 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
74 | this.Name = "About";
75 | this.Text = "About";
76 | this.PagePanel.ResumeLayout(false);
77 | this.ResumeLayout(false);
78 |
79 | }
80 |
81 | #endregion
82 |
83 | private Sunny.UI.UIRichTextBox uiRichTextBox1;
84 | private Sunny.UI.UILine uiLine1;
85 | }
86 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/CmdUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Management;
4 |
5 | namespace StarTools
6 | {
7 | internal class CmdUtils
8 | {
9 | private Process _cmd;
10 | private string _exe;
11 |
12 | public void SendCmd(RipCmd cmdoom, string shell, string arg)
13 | {
14 | shell = shell + arg;
15 | _cmd = new Process();
16 | var startInfo = new ProcessStartInfo
17 | {
18 | FileName = "cmd.exe",
19 | Arguments = "",
20 | UseShellExecute = false,
21 | RedirectStandardInput = true,
22 | RedirectStandardOutput = true,
23 | RedirectStandardError = true,
24 | CreateNoWindow = true
25 | };
26 | _cmd.StartInfo = startInfo;
27 |
28 | if (_cmd.Start())
29 | {
30 | _exe = "";
31 | _cmd.StandardInput.WriteLine(shell);
32 | var log = _cmd.StandardError.ReadLine();
33 | updateLog(cmdoom, log);
34 | log = "";
35 | do
36 | {
37 | var logm = _cmd.StandardError.ReadLine();
38 | if (logm == null) break;
39 | updateLog(cmdoom, logm + "\n");
40 | log += logm;
41 | } while (true);
42 |
43 | _cmd.Close();
44 | _cmd = null;
45 | }
46 | }
47 |
48 | //TODO: 函数功能分离,创建其他页面使用的窗口
49 | private void updateLog(RipCmd cmd, string log)
50 | {
51 | void Set()
52 | {
53 | if (_exe == "") _exe = log.Substring(0, 5) == "ffmpe" ? "ffmpe" : "enc";
54 | cmd.uiRichTextBox1.AppendText(log);
55 | cmd.uiRichTextBox1.ScrollToCaret();
56 | try
57 | {
58 | if (log.Length <= 11) return;
59 | if (log.Substring(0, 11) == "encode time")
60 | cmd.uiProcessBar1.Value = 100;
61 | else
62 | switch (_exe)
63 | {
64 | case "enc":
65 | cmd.uiProcessBar1.Value = (int) float.Parse(log.Substring(
66 | log.IndexOf("[", StringComparison.Ordinal) + 1,
67 | log.IndexOf("%", StringComparison.Ordinal) -
68 | log.IndexOf("[", StringComparison.Ordinal) - 1));
69 | break;
70 | case "ffmpe":
71 | //TODO: ffmpeg管道模式下的进度条实现
72 | break;
73 | }
74 | }
75 | catch
76 | {
77 | // ignored
78 | }
79 | }
80 |
81 | cmd.Invoke((UpdateLog) Set);
82 | }
83 |
84 | public void CloseCmd()
85 | {
86 | _cmd.KillProcessTree();
87 | _cmd.Close();
88 | }
89 |
90 | private delegate void UpdateLog();
91 | }
92 |
93 | public static class ProcessEx
94 | {
95 | public static void KillProcessTree(this Process parent)
96 | {
97 | var searcher =
98 | new ManagementObjectSearcher("Select * From Win32_Process Where ParentProcessID=" + parent.Id);
99 | var moc = searcher.Get();
100 | foreach (var o in moc)
101 | {
102 | var mo = (ManagementObject) o;
103 | var childProcess = Process.GetProcessById(Convert.ToInt32(mo["ProcessID"]));
104 | childProcess.KillProcessTree();
105 | }
106 |
107 | try
108 | {
109 | if (parent.Id != Process.GetCurrentProcess().Id) parent.Kill();
110 | }
111 | catch
112 | {
113 | // ignored
114 | }
115 | }
116 | }
117 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/StarTools.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using Sunny.UI;
4 |
5 | namespace StarTools
6 | {
7 | public partial class StarTools : UIHeaderAsideMainFrame
8 | {
9 | public StarTools()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | private static void AddUpdateAppSettings(string key, string value)
15 | {
16 | try
17 | {
18 | var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
19 | var settings = configFile.AppSettings.Settings;
20 | if (settings[key] == null)
21 | settings.Add(key, value);
22 | else
23 | settings[key].Value = value;
24 | configFile.Save(ConfigurationSaveMode.Modified);
25 | ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
26 | }
27 | catch (ConfigurationErrorsException)
28 | {
29 | Console.WriteLine(@"Error writing app settings");
30 | }
31 | }
32 |
33 | private void StarTools_Load(object sender, EventArgs e)
34 | {
35 | try
36 | {
37 | var appSettings = ConfigurationManager.AppSettings;
38 |
39 | if (appSettings["ffmpeg_file"] == null)
40 | AddUpdateAppSettings("ffmpeg_file", "tool\\ffmpeg\\ffmpeg.exe");
41 |
42 | if (appSettings["NVEnc_file"] == null)
43 | AddUpdateAppSettings("NVEnc_file", "tool\\HardEnc\\NVEncC64.exe");
44 |
45 | if (appSettings["QSVEnc_file"] == null)
46 | AddUpdateAppSettings("QSVEnc_file", "tool\\HardEnc\\QSVEncC64.exe");
47 |
48 | if (appSettings["VCEEnc_file"] == null)
49 | AddUpdateAppSettings("VCEEnc_file", "tool\\HardEnc\\VCEEncC64.exe");
50 |
51 | if (appSettings["MP4Box_file"] == null)
52 | AddUpdateAppSettings("MP4Box_file", "tool\\MP4Box\\mp4box.exe");
53 |
54 | if (appSettings["mkvmerge_file"] == null)
55 | AddUpdateAppSettings("mkvmerge_file", "tool\\mkvmerge\\mkvmerge.exe");
56 |
57 | if (appSettings["Code_rate_control_mode_selection"] == null)
58 | AddUpdateAppSettings("Code_rate_control_mode_selection", "1");
59 |
60 | if (appSettings["I"] == null)
61 | AddUpdateAppSettings("I", "24");
62 |
63 | if (appSettings["P"] == null)
64 | AddUpdateAppSettings("P", "26");
65 |
66 | if (appSettings["B"] == null)
67 | AddUpdateAppSettings("B", "27");
68 | }
69 | catch (ConfigurationErrorsException)
70 | {
71 | Console.WriteLine(@"Error reading app settings");
72 | }
73 |
74 | Aside.Nodes.Clear();
75 | Aside.CreateNode(AddPage(new About()), 61451, 24);
76 | Aside.SelectFirst();
77 | }
78 |
79 | private void Header_MenuItemClick(string itemText, int menuIndex, int pageIndex)
80 | {
81 | //TODO: 增加新功能
82 | switch (menuIndex)
83 | {
84 | case 0:
85 | Aside.Nodes.Clear();
86 | Aside.CreateNode(AddPage(new Encode()), 61451, 24);
87 | Aside.CreateNode(AddPage(new EncoderBox()), 61451, 24);
88 | Aside.SelectFirst();
89 | break;
90 | case 1:
91 | Aside.Nodes.Clear();
92 | Aside.CreateNode(AddPage(new ffmpeg_Live()), 61451, 24);
93 | Aside.CreateNode(AddPage(new ffmpeg_demux()), 61451, 24);
94 | Aside.CreateNode(AddPage(new Mux()), 61451, 24);
95 | //TODO: 增加封装功能
96 | //Aside.CreateNode(AddPage(new ffmpeg_mux()), 61451, 24);
97 | Aside.SelectFirst();
98 | break;
99 | case 2:
100 | Aside.Nodes.Clear();
101 | Aside.CreateNode(AddPage(new Needed()), 61451, 24);
102 | Aside.SelectFirst();
103 | break;
104 | }
105 | }
106 | }
107 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/ffmpeg_demux.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Diagnostics;
5 | using System.IO;
6 | using System.Windows.Forms;
7 | using Sunny.UI;
8 |
9 | namespace StarTools
10 | {
11 | public partial class ffmpeg_demux : UITitlePage
12 | {
13 | private string _trackNum, _trackKinds;
14 |
15 | public ffmpeg_demux()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void AddVideoFiles_Click(object sender, EventArgs e)
21 | {
22 | VideoFile.Text = FileDo.GetVideoFile("请输入视频文件");
23 | }
24 |
25 | private void VideoFile_DragEnter(object sender, DragEventArgs e)
26 | {
27 | e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
28 | }
29 |
30 | private void VideoFile_DragDrop(object sender, DragEventArgs e)
31 | {
32 | VideoFile.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
33 | }
34 |
35 | private void VideoFile_TextChanged(object sender, EventArgs e)
36 | {
37 | var appSettings = ConfigurationManager.AppSettings;
38 | Rawslist.Items.Clear();
39 | var p = new Process
40 | {
41 | StartInfo =
42 | {
43 | FileName = "cmd.exe",
44 | UseShellExecute = false,
45 | RedirectStandardInput = true,
46 | RedirectStandardOutput = true,
47 | RedirectStandardError = true,
48 | CreateNoWindow = true
49 | }
50 | };
51 | p.Start();
52 | p.StandardInput.WriteLine(appSettings["ffmpeg_file"] + " -i \"" + VideoFile.Text + "\"");
53 | p.StandardInput.AutoFlush = true;
54 | p.StandardInput.WriteLine("exit");
55 | var reader = p.StandardError;
56 | var curLine = reader.ReadLine();
57 | while (!reader.EndOfStream)
58 | {
59 | if (!string.IsNullOrEmpty(curLine))
60 | if (curLine.Contains("Stream #") &&
61 | curLine[curLine.IndexOf("Stream #", StringComparison.Ordinal) - 2] == ' ')
62 | Rawslist.Items.Add(curLine);
63 | curLine = reader.ReadLine();
64 | }
65 |
66 | reader.Close();
67 | p.WaitForExit();
68 | p.Close();
69 | }
70 |
71 | private void SaveFile_Click(object sender, EventArgs e)
72 | {
73 | OutputFile.Text = FileDo.GetSaveFiles("mp4");
74 | }
75 |
76 | private void demux_Click(object sender, EventArgs e)
77 | {
78 | var appSettings = ConfigurationManager.AppSettings;
79 | if (File.Exists(OutputFile.Text))
80 | if (Page.ShowAskDialog("文件已存在,确认覆盖?"))
81 | File.Delete(OutputFile.Text);
82 | else
83 | return;
84 | var p = new Process
85 | {
86 | StartInfo =
87 | {
88 | FileName = "cmd.exe",
89 | UseShellExecute = false,
90 | RedirectStandardInput = true,
91 | RedirectStandardOutput = false,
92 | RedirectStandardError = false,
93 | CreateNoWindow = false
94 | }
95 | };
96 | p.Start();
97 | p.StandardInput.WriteLine(appSettings["ffmpeg_file"] + " -i \"" + VideoFile.Text + "\" -map " + _trackNum +
98 | " -codec copy \"" +
99 | OutputFile.Text + "\"");
100 | }
101 |
102 | private void Rawslist_ItemClick(object sender, EventArgs e)
103 | {
104 | var index = 0;
105 | var j = 0;
106 | var openWith = new Dictionary
107 | {
108 | {"h26", ".h264"},
109 | {"aac", ".m4a"},
110 | {"ass", ".ass"},
111 | {"ala", ".m4a"},
112 | {"mp3", ".mp3"},
113 | {"pcm", ".wav"},
114 | {"fla", ".flac"},
115 | {"hev", ".hevc"}
116 | //TODO: 开放设置,可以手动选择
117 | };
118 | if (Rawslist.SelectedIndex == -1) return;
119 | _trackNum = Rawslist.SelectedItem.ToString()
120 | .Substring(Rawslist.SelectedItem.ToString().IndexOf("Stream #", StringComparison.Ordinal) + 8, 3);
121 | while (true)
122 | {
123 | index = Rawslist.SelectedItem.ToString().IndexOf(":", index, StringComparison.Ordinal);
124 | if (j == 2)
125 | break;
126 | index = Rawslist.SelectedItem.ToString().IndexOf(":", index + 1, StringComparison.Ordinal);
127 |
128 | j++;
129 | }
130 |
131 | _trackKinds = Rawslist.SelectedItem.ToString().Substring(index + 2, 3);
132 | OutputFile.Text =
133 | VideoFile.Text.Substring(0, VideoFile.Text.LastIndexOf(".", StringComparison.Ordinal)) +
134 | @"_demux_" +
135 | Rawslist.SelectedIndex +
136 | openWith[_trackKinds];
137 | }
138 | }
139 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/StarTools/StarTools/ffmpeg_Live.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Diagnostics;
4 | using System.Windows.Forms;
5 | using Sunny.UI;
6 |
7 | namespace StarTools
8 | {
9 | public partial class ffmpeg_Live : UITitlePage
10 | {
11 | public ffmpeg_Live()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | private static void AddUpdateAppSettings(string key, string value)
17 | {
18 | try
19 | {
20 | var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
21 | var settings = configFile.AppSettings.Settings;
22 | if (settings[key] == null)
23 | settings.Add(key, value);
24 | else
25 | settings[key].Value = value;
26 | configFile.Save(ConfigurationSaveMode.Modified);
27 | ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
28 | }
29 | catch (ConfigurationErrorsException)
30 | {
31 | Console.WriteLine(@"Error writing app settings");
32 | }
33 | }
34 |
35 | private void ffmpeg_Live_Load(object sender, EventArgs e)
36 | {
37 | try
38 | {
39 | var appSettings = ConfigurationManager.AppSettings;
40 | if (appSettings["Live_audiomode"] == null)
41 | {
42 | AddUpdateAppSettings("Live_audiomode", "0");
43 | AudioMode.SelectedIndex = 0;
44 | }
45 | else
46 | {
47 | switch (appSettings["Live_audiomode"])
48 | {
49 | case "0":
50 | AudioMode.SelectedIndex = 0;
51 | AudioBox.Hide();
52 | uiLabel8.Hide();
53 | uiLabel7.Show();
54 | break;
55 | case "1":
56 | AudioMode.SelectedIndex = 1;
57 | AudioBox.Show();
58 | uiLabel8.Show();
59 | uiLabel7.Hide();
60 | break;
61 | default:
62 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
63 | break;
64 | }
65 | }
66 |
67 | if (appSettings["Live_audiobit"] == null)
68 | {
69 | AddUpdateAppSettings("Live_audiobit", "192");
70 | AudioBox.Text = @"192";
71 | }
72 | else
73 | {
74 | AudioBox.Text = appSettings["Live_audiobit"];
75 | }
76 | }
77 | catch (ConfigurationErrorsException)
78 | {
79 | Console.WriteLine(@"Error reading app settings");
80 | }
81 | }
82 |
83 | private void AudioMode_SelectedIndexChanged(object sender, EventArgs e)
84 | {
85 | switch (AudioMode.SelectedIndex)
86 | {
87 | case 0:
88 | AddUpdateAppSettings("Live_audiomode", "0");
89 | AudioBox.Hide();
90 | uiLabel8.Hide();
91 | uiLabel7.Show();
92 | break;
93 | case 1:
94 | AddUpdateAppSettings("Live_audiomode", "1");
95 | AudioBox.Show();
96 | uiLabel8.Show();
97 | uiLabel7.Hide();
98 | break;
99 | default:
100 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
101 | break;
102 | }
103 | }
104 |
105 | private void AudioBox_TextChanged(object sender, EventArgs e)
106 | {
107 | AddUpdateAppSettings("Live_audiobit", AudioBox.Text);
108 | }
109 |
110 | private void VideoFile_DragEnter(object sender, DragEventArgs e)
111 | {
112 | e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
113 | }
114 |
115 | private void VideoFile_DragDrop(object sender, DragEventArgs e)
116 | {
117 | VideoFile.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
118 | }
119 |
120 | private void AddVideoFiles_Click(object sender, EventArgs e)
121 | {
122 | VideoFile.Text = FileDo.GetVideoFile("请输入视频文件");
123 | }
124 |
125 | private void Live_Click(object sender, EventArgs e)
126 | {
127 | var appSettings = ConfigurationManager.AppSettings;
128 | if (VideoFile.Text == @"请输入视频文件")
129 | {
130 | ShowErrorDialog(@"请放入源文件!");
131 | return;
132 | }
133 |
134 | if (RTMP.Text == "")
135 | {
136 | ShowErrorDialog(@"请输入RTMP地址!");
137 | return;
138 | }
139 |
140 | if (LiveCode.Text == "")
141 | {
142 | ShowErrorDialog(@"请输入直播码!");
143 | return;
144 | }
145 |
146 | var p = new Process
147 | {
148 | StartInfo =
149 | {
150 | FileName = "cmd.exe",
151 | UseShellExecute = false,
152 | RedirectStandardInput = true,
153 | RedirectStandardOutput = false,
154 | RedirectStandardError = false,
155 | CreateNoWindow = false
156 | }
157 | };
158 |
159 | p.Start();
160 | switch (AudioMode.SelectedIndex)
161 | {
162 | case 0:
163 | p.StandardInput.WriteLine(appSettings["ffmpeg_file"] + " -re -i \"" + VideoFile.Text +
164 | "\" -vcodec copy -acodec copy -f flv -flvflags no_duration_filesize \"" +
165 | RTMP.Text + LiveCode.Text +
166 | "\"");
167 | break;
168 | case 1:
169 | p.StandardInput.WriteLine(appSettings["ffmpeg_file"] + " -re -i \"" + VideoFile.Text +
170 | "\" -vcodec copy -acodec aac -b:a " + AudioBox.Text +
171 | "k -f flv -flvflags no_duration_filesize \"" +
172 | RTMP.Text + LiveCode.Text +
173 | "\"");
174 | break;
175 | default:
176 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
177 | break;
178 | }
179 | }
180 | }
181 | }
--------------------------------------------------------------------------------
/StarTools/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/StarTools/StarTools/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User
7 | Setup.exe
8 |
9 | # User-specific files
10 | *.rsuser
11 | *.suo
12 | *.user
13 | *.userosscache
14 | *.sln.docstates
15 |
16 | # User-specific files (MonoDevelop/Xamarin Studio)
17 | *.userprefs
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 |
33 | # Visual Studio 2015/2017 cache/options directory
34 | .vs/
35 | # Uncomment if you have tasks that create the project's static files in wwwroot
36 | #wwwroot/
37 |
38 | # Visual Studio 2017 auto generated files
39 | Generated\ Files/
40 |
41 | # MSTest test Results
42 | [Tt]est[Rr]esult*/
43 | [Bb]uild[Ll]og.*
44 |
45 | # NUNIT
46 | *.VisualState.xml
47 | TestResult.xml
48 |
49 | # Build Results of an ATL Project
50 | [Dd]ebugPS/
51 | [Rr]eleasePS/
52 | dlldata.c
53 |
54 | # Benchmark Results
55 | BenchmarkDotNet.Artifacts/
56 |
57 | # .NET Core
58 | project.lock.json
59 | project.fragment.lock.json
60 | artifacts/
61 |
62 | # StyleCop
63 | StyleCopReport.xml
64 |
65 | # Files built by Visual Studio
66 | *_i.c
67 | *_p.c
68 | *_h.h
69 | *.ilk
70 | *.meta
71 | *.obj
72 | *.iobj
73 | *.pch
74 | *.pdb
75 | *.ipdb
76 | *.pgc
77 | *.pgd
78 | *.rsp
79 | *.sbr
80 | *.tlb
81 | *.tli
82 | *.tlh
83 | *.tmp
84 | *.tmp_proj
85 | *_wpftmp.csproj
86 | *.log
87 | *.vspscc
88 | *.vssscc
89 | .builds
90 | *.pidb
91 | *.svclog
92 | *.scc
93 |
94 | # Chutzpah Test files
95 | _Chutzpah*
96 |
97 | # Visual C++ cache files
98 | ipch/
99 | *.aps
100 | *.ncb
101 | *.opendb
102 | *.opensdf
103 | *.sdf
104 | *.cachefile
105 | *.VC.db
106 | *.VC.VC.opendb
107 |
108 | # Visual Studio profiler
109 | *.psess
110 | *.vsp
111 | *.vspx
112 | *.sap
113 |
114 | # Visual Studio Trace Files
115 | *.e2e
116 |
117 | # TFS 2012 Local Workspace
118 | $tf/
119 |
120 | # Guidance Automation Toolkit
121 | *.gpState
122 |
123 | # ReSharper is a .NET coding add-in
124 | _ReSharper*/
125 | *.[Rr]e[Ss]harper
126 | *.DotSettings.user
127 |
128 | # JustCode is a .NET coding add-in
129 | .JustCode
130 |
131 | # TeamCity is a build add-in
132 | _TeamCity*
133 |
134 | # DotCover is a Code Coverage Tool
135 | *.dotCover
136 |
137 | # AxoCover is a Code Coverage Tool
138 | .axoCover/*
139 | !.axoCover/settings.json
140 |
141 | # Visual Studio code coverage results
142 | *.coverage
143 | *.coveragexml
144 |
145 | # NCrunch
146 | _NCrunch_*
147 | .*crunch*.local.xml
148 | nCrunchTemp_*
149 |
150 | # MightyMoose
151 | *.mm.*
152 | AutoTest.Net/
153 |
154 | # Web workbench (sass)
155 | .sass-cache/
156 |
157 | # Installshield output folder
158 | [Ee]xpress/
159 |
160 | # DocProject is a documentation generator add-in
161 | DocProject/buildhelp/
162 | DocProject/Help/*.HxT
163 | DocProject/Help/*.HxC
164 | DocProject/Help/*.hhc
165 | DocProject/Help/*.hhk
166 | DocProject/Help/*.hhp
167 | DocProject/Help/Html2
168 | DocProject/Help/html
169 |
170 | # Click-Once directory
171 | publish/
172 |
173 | # Publish Web Output
174 | *.[Pp]ublish.xml
175 | *.azurePubxml
176 | # Note: Comment the next line if you want to checkin your web deploy settings,
177 | # but database connection strings (with potential passwords) will be unencrypted
178 | *.pubxml
179 | *.publishproj
180 |
181 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
182 | # checkin your Azure Web App publish settings, but sensitive information contained
183 | # in these scripts will be unencrypted
184 | PublishScripts/
185 |
186 | # NuGet Packages
187 | *.nupkg
188 | # The packages folder can be ignored because of Package Restore
189 | **/[Pp]ackages/*
190 | # except build/, which is used as an MSBuild target.
191 | !**/[Pp]ackages/build/
192 | # Uncomment if necessary however generally it will be regenerated when needed
193 | #!**/[Pp]ackages/repositories.config
194 | # NuGet v3's project.json files produces more ignorable files
195 | *.nuget.props
196 | *.nuget.targets
197 |
198 | # Microsoft Azure Build Output
199 | csx/
200 | *.build.csdef
201 |
202 | # Microsoft Azure Emulator
203 | ecf/
204 | rcf/
205 |
206 | # Windows Store app package directories and files
207 | AppPackages/
208 | BundleArtifacts/
209 | Package.StoreAssociation.xml
210 | _pkginfo.txt
211 | *.appx
212 |
213 | # Visual Studio cache files
214 | # files ending in .cache can be ignored
215 | *.[Cc]ache
216 | # but keep track of directories ending in .cache
217 | !?*.[Cc]ache/
218 |
219 | # Others
220 | ClientBin/
221 | ~$*
222 | *~
223 | *.dbmdl
224 | *.dbproj.schemaview
225 | *.jfm
226 | *.pfx
227 | *.publishsettings
228 | orleans.codegen.cs
229 |
230 | # Including strong name files can present a security risk
231 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
232 | #*.snk
233 |
234 | # Since there are multiple workflows, uncomment next line to ignore bower_components
235 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
236 | #bower_components/
237 |
238 | # RIA/Silverlight projects
239 | Generated_Code/
240 |
241 | # Backup & report files from converting an old project file
242 | # to a newer Visual Studio version. Backup files are not needed,
243 | # because we have git ;-)
244 | _UpgradeReport_Files/
245 | Backup*/
246 | UpgradeLog*.XML
247 | UpgradeLog*.htm
248 | ServiceFabricBackup/
249 | *.rptproj.bak
250 |
251 | # SQL Server files
252 | *.mdf
253 | *.ldf
254 | *.ndf
255 |
256 | # Business Intelligence projects
257 | *.rdl.data
258 | *.bim.layout
259 | *.bim_*.settings
260 | *.rptproj.rsuser
261 | *- Backup*.rdl
262 |
263 | # Microsoft Fakes
264 | FakesAssemblies/
265 |
266 | # GhostDoc plugin setting file
267 | *.GhostDoc.xml
268 |
269 | # Node.js Tools for Visual Studio
270 | .ntvs_analysis.dat
271 | node_modules/
272 |
273 | # Visual Studio 6 build log
274 | *.plg
275 |
276 | # Visual Studio 6 workspace options file
277 | *.opt
278 |
279 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
280 | *.vbw
281 |
282 | # Visual Studio LightSwitch build output
283 | **/*.HTMLClient/GeneratedArtifacts
284 | **/*.DesktopClient/GeneratedArtifacts
285 | **/*.DesktopClient/ModelManifest.xml
286 | **/*.Server/GeneratedArtifacts
287 | **/*.Server/ModelManifest.xml
288 | _Pvt_Extensions
289 |
290 | # Paket dependency manager
291 | .paket/paket.exe
292 | paket-files/
293 |
294 | # FAKE - F# Make
295 | .fake/
296 |
297 | # JetBrains Rider
298 | .idea/
299 | *.sln.iml
300 |
301 | # CodeRush personal settings
302 | .cr/personal
303 |
304 | # Python Tools for Visual Studio (PTVS)
305 | __pycache__/
306 | *.pyc
307 |
308 | # Cake - Uncomment if you are using it
309 | # tools/**
310 | # !tools/packages.config
311 |
312 | # Tabs Studio
313 | *.tss
314 |
315 | # Telerik's JustMock configuration file
316 | *.jmconfig
317 |
318 | # BizTalk build output
319 | *.btp.cs
320 | *.btm.cs
321 | *.odx.cs
322 | *.xsd.cs
323 |
324 | # OpenCover UI analysis results
325 | OpenCover/
326 |
327 | # Azure Stream Analytics local run output
328 | ASALocalRun/
329 |
330 | # MSBuild Binary and Structured Log
331 | *.binlog
332 |
333 | # NVidia Nsight GPU debugger configuration file
334 | *.nvuser
335 |
336 | # MFractors (Xamarin productivity tool) working folder
337 | .mfractor/
338 |
339 | # Local History for Visual Studio
340 | .localhistory/
341 |
342 | # BeatPulse healthcheck temp database
343 | healthchecksdb
--------------------------------------------------------------------------------
/StarTools/StarTools/EncoderBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using Sunny.UI;
4 |
5 | namespace StarTools
6 | {
7 | public partial class EncoderBox : UITitlePage
8 | {
9 | public EncoderBox()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | private static void AddUpdateAppSettings(string key, string value)
15 | {
16 | try
17 | {
18 | var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
19 | var settings = configFile.AppSettings.Settings;
20 | if (settings[key] == null)
21 | settings.Add(key, value);
22 | else
23 | settings[key].Value = value;
24 | configFile.Save(ConfigurationSaveMode.Modified);
25 | ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
26 | }
27 | catch (ConfigurationErrorsException)
28 | {
29 | Console.WriteLine(@"Error writing app settings");
30 | }
31 | }
32 |
33 | private void EncoderBox_Load(object sender, EventArgs e)
34 | {
35 | try
36 | {
37 | var appSettings = ConfigurationManager.AppSettings;
38 | var result = appSettings["Code_rate_control_mode_selection"] ?? "Not Found";
39 | switch (result)
40 | {
41 | case "1":
42 | uiRadioButton1.Checked = true;
43 | break;
44 | case "2":
45 | uiRadioButton2.Checked = true;
46 | break;
47 | case "3":
48 | uiRadioButton3.Checked = true;
49 | break;
50 | case "Not Found":
51 | AddUpdateAppSettings("Code_rate_control_mode_selection", "1");
52 | uiRadioButton1.Checked = true;
53 | break;
54 | default:
55 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
56 | break;
57 | }
58 |
59 | if (appSettings["Raws_audiomode"] == null)
60 | {
61 | AddUpdateAppSettings("Raws_audiomode", "0");
62 | AudioMode.SelectedIndex = 0;
63 | }
64 | else
65 | {
66 | switch (appSettings["Raws_audiomode"])
67 | {
68 | case "0":
69 | AudioMode.SelectedIndex = 0;
70 | AudioBox.Hide();
71 | uiLabel8.Hide();
72 | uiLabel7.Show();
73 | break;
74 | case "1":
75 | AudioMode.SelectedIndex = 1;
76 | AudioBox.Show();
77 | uiLabel8.Show();
78 | uiLabel7.Hide();
79 | break;
80 | default:
81 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
82 | break;
83 | }
84 | }
85 |
86 | if (appSettings["Raws_audiobit"] == null)
87 | {
88 | AddUpdateAppSettings("Raws_audiobit", "192");
89 | AudioBox.Text = @"192";
90 | }
91 | else
92 | {
93 | AudioBox.Text = appSettings["Raws_audiobit"];
94 | }
95 |
96 | if (appSettings["I"] == null)
97 | {
98 | AddUpdateAppSettings("I", "24");
99 | IBox.Text = @"24";
100 | }
101 | else
102 | {
103 | IBox.Text = appSettings["I"];
104 | }
105 |
106 | if (appSettings["P"] == null)
107 | {
108 | AddUpdateAppSettings("P", "26");
109 | PBox.Text = @"26";
110 | }
111 | else
112 | {
113 | PBox.Text = appSettings["P"];
114 | }
115 |
116 | if (appSettings["B"] == null)
117 | {
118 | AddUpdateAppSettings("B", "27");
119 | BBox.Text = @"27";
120 | }
121 | else
122 | {
123 | BBox.Text = appSettings["B"];
124 | }
125 |
126 | if (appSettings["CBR"] == null)
127 | {
128 | AddUpdateAppSettings("CBR", "3000");
129 | CBRBox.Text = @"3000";
130 | }
131 | else
132 | {
133 | CBRBox.Text = appSettings["CBR"];
134 | }
135 |
136 | if (appSettings["VBR"] == null)
137 | {
138 | AddUpdateAppSettings("VBR", "3000");
139 | VBRBox.Text = @"3000";
140 | }
141 | else
142 | {
143 | VBRBox.Text = appSettings["VBR"];
144 | }
145 | }
146 | catch (ConfigurationErrorsException)
147 | {
148 | Console.WriteLine(@"Error reading app settings");
149 | }
150 | }
151 |
152 | private void Save_Click(object sender, EventArgs e)
153 | {
154 | if (uiRadioButton1.Checked && !uiRadioButton2.Checked && !uiRadioButton3.Checked)
155 | AddUpdateAppSettings("Code_rate_control_mode_selection", "1");
156 | else if (!uiRadioButton1.Checked && uiRadioButton2.Checked && !uiRadioButton3.Checked)
157 | AddUpdateAppSettings("Code_rate_control_mode_selection", "2");
158 | else if (!uiRadioButton1.Checked && !uiRadioButton2.Checked && uiRadioButton3.Checked)
159 | AddUpdateAppSettings("Code_rate_control_mode_selection", "3");
160 | else
161 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
162 |
163 | AddUpdateAppSettings("I", IBox.Text);
164 | AddUpdateAppSettings("P", PBox.Text);
165 | AddUpdateAppSettings("B", BBox.Text);
166 | AddUpdateAppSettings("CBR", CBRBox.Text);
167 | AddUpdateAppSettings("VBR", VBRBox.Text);
168 | AddUpdateAppSettings("Raws_audiobit", AudioBox.Text);
169 |
170 | UIMessageTip.ShowOk("保存成功");
171 | }
172 |
173 | private void AudioMode_SelectedIndexChanged(object sender, EventArgs e)
174 | {
175 | switch (AudioMode.SelectedIndex)
176 | {
177 | case 0:
178 | AddUpdateAppSettings("Raws_audiomode", "0");
179 | AudioBox.Hide();
180 | uiLabel8.Hide();
181 | uiLabel7.Show();
182 | break;
183 | case 1:
184 | AddUpdateAppSettings("Raws_audiomode", "1");
185 | AudioBox.Show();
186 | uiLabel8.Show();
187 | uiLabel7.Hide();
188 | break;
189 | default:
190 | ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
191 | break;
192 | }
193 | }
194 | }
195 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/needed.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Security;
4 | using System.Windows.Forms;
5 | using Sunny.UI;
6 |
7 | namespace StarTools
8 | {
9 | public partial class Needed : UITitlePage
10 | {
11 | public Needed()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | private static void AddUpdateAppSettings(string key, string value)
17 | {
18 | try
19 | {
20 | var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
21 | var settings = configFile.AppSettings.Settings;
22 | if (settings[key] == null)
23 | settings.Add(key, value);
24 | else
25 | settings[key].Value = value;
26 | configFile.Save(ConfigurationSaveMode.Modified);
27 | ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
28 | }
29 | catch (ConfigurationErrorsException)
30 | {
31 | Console.WriteLine(@"Error writing app settings");
32 | }
33 | }
34 |
35 | private void needed_Load(object sender, EventArgs e)
36 | {
37 | try
38 | {
39 | var appSettings = ConfigurationManager.AppSettings;
40 |
41 | if (appSettings["ffmpeg_file"] == null)
42 | {
43 | AddUpdateAppSettings("ffmpeg_file", "tool\\ffmpeg\\ffmpeg.exe");
44 | ffmpeg_file.Text = @"tool\ffmpeg\ffmpeg.exe";
45 | }
46 | else
47 | {
48 | ffmpeg_file.Text = appSettings["ffmpeg_file"];
49 | }
50 |
51 | if (appSettings["NVEnc_file"] == null)
52 | {
53 | AddUpdateAppSettings("NVEnc_file", "tool\\HardEnc\\NVEncC64.exe");
54 | NVEnc_file.Text = @"tool\HardEnc\NVEncC64.exe";
55 | }
56 | else
57 | {
58 | NVEnc_file.Text = appSettings["NVEnc_file"];
59 | }
60 |
61 | if (appSettings["QSVEnc_file"] == null)
62 | {
63 | AddUpdateAppSettings("QSVEnc_file", "tool\\HardEnc\\QSVEncC64.exe");
64 | QSVEnc_file.Text = @"tool\HardEnc\QSVEncC64.exe";
65 | }
66 | else
67 | {
68 | QSVEnc_file.Text = appSettings["QSVEnc_file"];
69 | }
70 |
71 | if (appSettings["VCEEnc_file"] == null)
72 | {
73 | AddUpdateAppSettings("VCEEnc_file", "tool\\HardEnc\\VCEEncC64.exe");
74 | VCEEnc_file.Text = @"tool\HardEnc\VCEEncC64.exe";
75 | }
76 | else
77 | {
78 | VCEEnc_file.Text = appSettings["VCEEnc_file"];
79 | }
80 | }
81 | catch (ConfigurationErrorsException)
82 | {
83 | Console.WriteLine(@"Error reading app settings");
84 | }
85 | }
86 |
87 | private void Save_Click(object sender, EventArgs e)
88 | {
89 | AddUpdateAppSettings("ffmpeg_file", ffmpeg_file.Text);
90 | AddUpdateAppSettings("NVEnc_file", NVEnc_file.Text);
91 | AddUpdateAppSettings("QSVEnc_file", QSVEnc_file.Text);
92 | AddUpdateAppSettings("VCEEnc_file", VCEEnc_file.Text);
93 |
94 | MessageBox.Show(@"保存成功");
95 | Close();
96 | }
97 |
98 | private void button1_Click(object sender, EventArgs e)
99 | {
100 | var openFileDialog1 = new OpenFileDialog
101 | {
102 | FileName = "Select a video file",
103 | Filter = @"ffmpeg files|ffmpeg.exe|All files|*.*",
104 | Title = @"Open video file"
105 | };
106 |
107 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
108 | try
109 | {
110 | ffmpeg_file.Text = openFileDialog1.FileName;
111 | }
112 | catch (SecurityException ex)
113 | {
114 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
115 | $"Details:\n\n{ex.StackTrace}");
116 | }
117 | }
118 |
119 | private void button2_Click(object sender, EventArgs e)
120 | {
121 | var openFileDialog1 = new OpenFileDialog
122 | {
123 | FileName = "Select a video file",
124 | Filter = @"NVEnc files|NVEncC64.exe|All files|*.*",
125 | Title = @"Open video file"
126 | };
127 |
128 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
129 | try
130 | {
131 | NVEnc_file.Text = openFileDialog1.FileName;
132 | }
133 | catch (SecurityException ex)
134 | {
135 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
136 | $"Details:\n\n{ex.StackTrace}");
137 | }
138 | }
139 |
140 | private void button3_Click(object sender, EventArgs e)
141 | {
142 | var openFileDialog1 = new OpenFileDialog
143 | {
144 | FileName = "Select a video file",
145 | Filter = @"QSVEnc files|QSVEncC64.exe|All files|*.*",
146 | Title = @"Open video file"
147 | };
148 |
149 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
150 | try
151 | {
152 | QSVEnc_file.Text = openFileDialog1.FileName;
153 | }
154 | catch (SecurityException ex)
155 | {
156 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
157 | $"Details:\n\n{ex.StackTrace}");
158 | }
159 | }
160 |
161 | private void button4_Click(object sender, EventArgs e)
162 | {
163 | var openFileDialog1 = new OpenFileDialog
164 | {
165 | FileName = "Select a video file",
166 | Filter = @"VCEEnc files|VCEEncC64.exe|All files|*.*",
167 | Title = @"Open video file"
168 | };
169 |
170 | if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
171 | try
172 | {
173 | VCEEnc_file.Text = openFileDialog1.FileName;
174 | }
175 | catch (SecurityException ex)
176 | {
177 | MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
178 | $"Details:\n\n{ex.StackTrace}");
179 | }
180 | }
181 |
182 | private void file_DragEnter(object sender, DragEventArgs e)
183 | {
184 | e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
185 | }
186 |
187 | private void ffmpeg_file_DragDrop(object sender, DragEventArgs e)
188 | {
189 | ffmpeg_file.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
190 | }
191 |
192 | private void NVEnc_file_DragDrop(object sender, DragEventArgs e)
193 | {
194 | NVEnc_file.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
195 | }
196 |
197 | private void VCEEnc_file_DragDrop(object sender, DragEventArgs e)
198 | {
199 | VCEEnc_file.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
200 | }
201 |
202 | private void QSVEnc_file_DragDrop(object sender, DragEventArgs e)
203 | {
204 | QSVEnc_file.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
205 | }
206 | }
207 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/Encode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Windows.Forms;
5 | using Sunny.UI;
6 |
7 | namespace StarTools
8 | {
9 | public partial class Encode : UITitlePage
10 | {
11 | public Encode()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | private static void AddUpdateAppSettings(string key, string value)
17 | {
18 | try
19 | {
20 | var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
21 | var settings = configFile.AppSettings.Settings;
22 | if (settings[key] == null)
23 | settings.Add(key, value);
24 | else
25 | settings[key].Value = value;
26 | configFile.Save(ConfigurationSaveMode.Modified);
27 | ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
28 | }
29 | catch (ConfigurationErrorsException)
30 | {
31 | Console.WriteLine(@"Error writing app settings");
32 | }
33 | }
34 |
35 | private void Encode_Load(object sender, EventArgs e)
36 | {
37 | try
38 | {
39 | var appSettings = ConfigurationManager.AppSettings;
40 | var openWith = new Dictionary
41 | {
42 | {"0", 0},
43 | {"1", 1},
44 | {"2", 2}
45 | };
46 |
47 | if (appSettings["EncoderBox_selected"] == null)
48 | {
49 | AddUpdateAppSettings("EncoderBox_selected", "0");
50 | EncoderBox.SelectedIndex = 0;
51 | }
52 | else
53 | {
54 | EncoderBox.SelectedIndex = openWith[appSettings["EncoderBox_selected"]];
55 | }
56 | }
57 | catch (ConfigurationErrorsException)
58 | {
59 | Console.WriteLine(@"Error reading app settings");
60 | }
61 | }
62 |
63 | private void AddVideoFiles_Click(object sender, EventArgs e)
64 | {
65 | VideoFile.Text = FileDo.GetVideoFile("请输入视频文件");
66 | }
67 |
68 | private void AddAssFiles_Click(object sender, EventArgs e)
69 | {
70 | AssFile.Text = FileDo.GetAssFile("请输入字幕文件");
71 | }
72 |
73 | private void SaveFile_Click(object sender, EventArgs e)
74 | {
75 | OutputFile.Text = FileDo.GetSaveFiles("mp4");
76 | }
77 |
78 | private void VideoFile_TextChanged(object sender, EventArgs e)
79 | {
80 | try
81 | {
82 | OutputFile.Text =
83 | VideoFile.Text.Substring(0, VideoFile.Text.LastIndexOf(".", StringComparison.Ordinal)) +
84 | @"_rip.mp4";
85 | }
86 | catch (Exception exception)
87 | {
88 | Console.WriteLine(exception);
89 | throw;
90 | }
91 | }
92 |
93 | private void File_DragEnter(object sender, DragEventArgs e)
94 | {
95 | e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
96 | }
97 |
98 | private void AssFile_DragDrop(object sender, DragEventArgs e)
99 | {
100 | AssFile.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
101 | }
102 |
103 | private void VideoFile_DragDrop(object sender, DragEventArgs e)
104 | {
105 | VideoFile.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
106 | }
107 |
108 | private void rip_Click(object sender, EventArgs e)
109 | {
110 | var appSettings = ConfigurationManager.AppSettings;
111 | var encoderWith = new Dictionary
112 | {
113 | {0, appSettings["QSVEnc_file"]},
114 | {1, appSettings["NVEnc_file"]},
115 | {2, appSettings["VCEEnc_file"]}
116 | };
117 | var audioWith = new Dictionary
118 | {
119 | {"0", " --audio-copy"},
120 | {"1", " --audio-codec aac --audio-bitrate " + appSettings["Raws_audiobit"]}
121 | };
122 |
123 | if (VideoFile.Text == @"请输入视频文件")
124 | {
125 | ShowErrorDialog(@"请放入源文件!");
126 | return;
127 | }
128 |
129 | if (OutputFile.Text == "")
130 | {
131 | ShowErrorDialog(@"请填写输出文件!");
132 | return;
133 | }
134 |
135 | AddUpdateAppSettings("EncoderBox_selected", EncoderBox.SelectedIndex.ToString());
136 | string cmdLine;
137 | string argLine;
138 | if (AssFile.Text != @"请输入字幕文件")
139 | {
140 | var temp = AssFile.Text;
141 | temp = temp.Replace("\\", "\\\\\\\\");
142 | temp = temp.Insert(temp.IndexOf(":", StringComparison.Ordinal), "\\\\");
143 | var ffmpegWith = new Dictionary
144 | {
145 | {0, appSettings["QSVEnc_file"]},
146 | {1, appSettings["NVEnc_file"]},
147 | {2, appSettings["VCEEnc_file"]}
148 | };
149 |
150 | if (EncoderBox.SelectedIndex == 1)
151 | {
152 | cmdLine = appSettings["NVEnc_file"];
153 | argLine = " --avhw -i \"" + VideoFile.Text +
154 | "\" --audio-codec aac --vpp-subburn filename=\"" +
155 | AssFile.Text + "\",charcode=utf-8,shaping=complex";
156 | }
157 | else
158 | {
159 | cmdLine = appSettings["ffmpeg_file"];
160 | argLine = " -y -i \"" + VideoFile.Text +
161 | "\" -vf \"ass=" + temp +
162 | "\" -codec:a copy -codec:v rawvideo -pix_fmt yuv420p -f nut - | " +
163 | ffmpegWith[EncoderBox.SelectedIndex] + " --avsw -i -";
164 | }
165 | }
166 | else
167 | {
168 | cmdLine = encoderWith[EncoderBox.SelectedIndex];
169 | argLine = " --avhw -i \"" + VideoFile.Text +
170 | "\"";
171 | }
172 |
173 | argLine += audioWith[appSettings["Raws_audiomode"]];
174 |
175 | try
176 | {
177 | var bitWith = new Dictionary
178 | {
179 | {
180 | "1",
181 | " --cqp " + appSettings["I"] + ":" + appSettings["P"] + ":" +
182 | appSettings["B"]
183 | },
184 | {"2", " --cbr " + appSettings["CBR"]},
185 | {"3", " --vbr " + appSettings["VBR"]}
186 | };
187 | argLine += bitWith[appSettings["Code_rate_control_mode_selection"]];
188 | }
189 | catch (Exception exception)
190 | {
191 | Console.WriteLine(exception);
192 | throw;
193 | }
194 |
195 | if (uiCheckBox1.Checked)
196 | argLine += " --interlace tff --vpp-deinterlace normal";
197 |
198 | if (uiCheckBox2.Checked)
199 | argLine = argLine + " --output-res " + WBox.Text + "x" + HBox.Text;
200 |
201 | if (appSettings["Code"] != null && appSettings["Code"] != "") argLine += appSettings["Code"];
202 |
203 | argLine = argLine + " -o \"" + OutputFile.Text + "\"";
204 |
205 | var f = new RunRip(cmdLine, argLine);
206 | f.ShowDialog();
207 | f.Dispose();
208 | }
209 | }
210 | }
--------------------------------------------------------------------------------
/StarTools/StarTools/Mux.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Windows.Forms;
7 | using Sunny.UI;
8 |
9 | namespace StarTools
10 | {
11 | public partial class Mux : UITitlePage
12 | {
13 | public Mux()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | private void AddVideoFiles_Click(object sender, EventArgs e)
19 | {
20 | VideoFile.Text = FileDo.GetVideoFile("请输入视频文件");
21 | }
22 |
23 | private void mkvAddVideoFiles_Click(object sender, EventArgs e)
24 | {
25 | mkvVideoFile.Text = FileDo.GetVideoFile("请输入视频文件");
26 | }
27 |
28 | private void mp4AudioAdd_Click(object sender, EventArgs e)
29 | {
30 | foreach (var i in FileDo.GetAudioFiles()) AudioList.Items.Add(i);
31 | }
32 |
33 | private void mkvAudioAdd_Click(object sender, EventArgs e)
34 | {
35 | foreach (var i in FileDo.GetAudioFiles()) mkvAudioList.Items.Add(i);
36 | }
37 |
38 | private void mkvOthersAdd_Click(object sender, EventArgs e)
39 | {
40 | foreach (var i in FileDo.GetAudioFiles()) mkvOthersList.Items.Add(i);
41 | }
42 |
43 | private void SaveFile_Click(object sender, EventArgs e)
44 | {
45 | OutputFile.Text = FileDo.GetSaveFiles("mp4");
46 | }
47 |
48 | private void mkvSaveFile_Click(object sender, EventArgs e)
49 | {
50 | mkvOutputFile.Text = FileDo.GetSaveFiles("mkv");
51 | }
52 |
53 | private void VideoFile_TextChanged(object sender, EventArgs e)
54 | {
55 | try
56 | {
57 | OutputFile.Text =
58 | VideoFile.Text.Substring(0, VideoFile.Text.LastIndexOf(".", StringComparison.Ordinal)) +
59 | @"_mux.mp4";
60 | AudioList.Items.Clear();
61 | }
62 | catch (Exception exception)
63 | {
64 | Console.WriteLine(exception);
65 | throw;
66 | }
67 | }
68 |
69 | private void mkvVideoFile_TextChanged(object sender, EventArgs e)
70 | {
71 | try
72 | {
73 | mkvOutputFile.Text =
74 | mkvVideoFile.Text.Substring(0, mkvVideoFile.Text.LastIndexOf(".", StringComparison.Ordinal)) +
75 | @"_mux.mkv";
76 | mkvAudioList.Items.Clear();
77 | mkvOthersList.Items.Clear();
78 | }
79 | catch (Exception exception)
80 | {
81 | Console.WriteLine(exception);
82 | throw;
83 | }
84 | }
85 |
86 | private void File_DragEnter(object sender, DragEventArgs e)
87 | {
88 | e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
89 | }
90 |
91 | private void VideoFile_DragDrop(object sender, DragEventArgs e)
92 | {
93 | VideoFile.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
94 | }
95 |
96 | private void mkvVideoFile_DragDrop(object sender, DragEventArgs e)
97 | {
98 | mkvVideoFile.Text = ((Array) e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
99 | }
100 |
101 | private void AudioList_DragDrop(object sender, DragEventArgs e)
102 | {
103 | var fileNames = (string[]) e.Data.GetData(DataFormats.FileDrop);
104 | foreach (var t in fileNames)
105 | AudioList.Items.Add(t);
106 | }
107 |
108 | private void mkvAudioList_DragDrop(object sender, DragEventArgs e)
109 | {
110 | var fileNames = (string[]) e.Data.GetData(DataFormats.FileDrop);
111 | foreach (var t in fileNames)
112 | mkvAudioList.Items.Add(t);
113 | }
114 |
115 | private void mkvOthersList_DragDrop(object sender, DragEventArgs e)
116 | {
117 | var fileNames = (string[]) e.Data.GetData(DataFormats.FileDrop);
118 | foreach (var t in fileNames)
119 | mkvOthersList.Items.Add(t);
120 | }
121 |
122 | private void mp4AudioDel_Click(object sender, EventArgs e)
123 | {
124 | if (AudioList.SelectedIndex != -1)
125 | AudioList.Items.RemoveAt(AudioList.SelectedIndex);
126 | }
127 |
128 | private void mkvAudioDel_Click(object sender, EventArgs e)
129 | {
130 | if (mkvAudioList.SelectedIndex != -1)
131 | mkvAudioList.Items.RemoveAt(mkvAudioList.SelectedIndex);
132 | }
133 |
134 | private void mkvOthersDel_Click(object sender, EventArgs e)
135 | {
136 | if (mkvOthersList.SelectedIndex != -1)
137 | mkvOthersList.Items.RemoveAt(mkvOthersList.SelectedIndex);
138 | }
139 |
140 | private void mp4mux_Click(object sender, EventArgs e)
141 | {
142 | if (OutputFile.Text == "")
143 | {
144 | ShowErrorDialog(@"请填写输出文件!");
145 | return;
146 | }
147 |
148 | var appSettings = ConfigurationManager.AppSettings;
149 | var cmdLine = appSettings["MP4Box_file"] + " -add \"" + VideoFile.Text + "\"";
150 | cmdLine = AudioList.Items.Cast