From 13084a23bb7d67f2fb4877a3259971d4f93e6a39 Mon Sep 17 00:00:00 2001 From: qwqcode <1149527164@qq.com> Date: Mon, 24 Jun 2019 03:10:52 +0800 Subject: [PATCH] first commit --- .gitignore | 298 ++++++++++++++++++ README.md | Bin 0 -> 40 bytes SubtitleRenamer.sln | 25 ++ SubtitleRenamer/Action.cs | 174 ++++++++++ SubtitleRenamer/MainForm.Designer.cs | 119 +++++++ SubtitleRenamer/MainForm.cs | 76 +++++ SubtitleRenamer/MainForm.resx | 120 +++++++ SubtitleRenamer/Program.cs | 21 ++ SubtitleRenamer/Properties/AssemblyInfo.cs | 36 +++ .../Properties/Resources.Designer.cs | 71 +++++ SubtitleRenamer/Properties/Resources.resx | 117 +++++++ .../Properties/Settings.Designer.cs | 30 ++ SubtitleRenamer/Properties/Settings.settings | 7 + SubtitleRenamer/SubtitleRenamer.csproj | 81 +++++ 14 files changed, 1175 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 SubtitleRenamer.sln create mode 100644 SubtitleRenamer/Action.cs create mode 100644 SubtitleRenamer/MainForm.Designer.cs create mode 100644 SubtitleRenamer/MainForm.cs create mode 100644 SubtitleRenamer/MainForm.resx create mode 100644 SubtitleRenamer/Program.cs create mode 100644 SubtitleRenamer/Properties/AssemblyInfo.cs create mode 100644 SubtitleRenamer/Properties/Resources.Designer.cs create mode 100644 SubtitleRenamer/Properties/Resources.resx create mode 100644 SubtitleRenamer/Properties/Settings.Designer.cs create mode 100644 SubtitleRenamer/Properties/Settings.settings create mode 100644 SubtitleRenamer/SubtitleRenamer.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..98761ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,298 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# my rules +local diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6e9e2c79d75e57c2b830f310f88727b26e74299f GIT binary patch literal 40 rcmezWPnki1A()|*A&H@cArpvm7*ZL6fH;pKks%jI7cuZMa4`S?(e4Ot literal 0 HcmV?d00001 diff --git a/SubtitleRenamer.sln b/SubtitleRenamer.sln new file mode 100644 index 0000000..529a34e --- /dev/null +++ b/SubtitleRenamer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29009.5 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubtitleRenamer", "SubtitleRenamer\SubtitleRenamer.csproj", "{82F1F4BF-02B6-4262-BAE5-5185FDDD129B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {82F1F4BF-02B6-4262-BAE5-5185FDDD129B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82F1F4BF-02B6-4262-BAE5-5185FDDD129B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82F1F4BF-02B6-4262-BAE5-5185FDDD129B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82F1F4BF-02B6-4262-BAE5-5185FDDD129B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A26A5150-2C33-4CB5-880F-0E1F4CC71CC8} + EndGlobalSection +EndGlobal diff --git a/SubtitleRenamer/Action.cs b/SubtitleRenamer/Action.cs new file mode 100644 index 0000000..4db7eb9 --- /dev/null +++ b/SubtitleRenamer/Action.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace SubtitleRenamer +{ + public partial class MainForm + { + private static string OpenPath = ""; + private static List VideoFileList = new List { }; + private static List SubtitleFileList = new List { }; + + private static List VideoExts = new List { ".mp4", ".mkv", ".rmvb", ".mov" }; + private static List SubtitleExts = new List { ".srt", ".ass", ".ssa", ".sub", ".idx" }; + + private static Dictionary VideoEpisDict = new Dictionary { }; // 文件名 -> 集数 + private static Dictionary SubtitleEpisDict = new Dictionary { }; + + private static Dictionary SubtitleRenameDict = new Dictionary { }; // 之前文件名 -> 修改后文件名 + + private void ReloadFiles() + { + MatchEpisodeBtn.Enabled = false; + if (OpenPath == null || OpenPath.Trim() == "") return; + + var folder = new DirectoryInfo(OpenPath); + var files = folder.GetFiles("*"); + + // 视频文件 + VideoFileList.Clear(); + foreach (var file in files.Where(s => VideoExts.Contains(s.Extension.ToString().ToLower()))) + VideoFileList.Add(file); + + // 字幕文件 + SubtitleFileList.Clear(); + foreach (var file in files.Where(s => SubtitleExts.Contains(s.Extension.ToString().ToLower()))) + SubtitleFileList.Add(file); + + // 清空历史数据 + MatchEpisodeBtn.Enabled = true; + StartBtn.Enabled = false; + SubtitleRenameDict.Clear(); + VideoEpisDict.Clear(); + SubtitleEpisDict.Clear(); + + // 刷新文件列表 + RefreshFileListBox(); + } + + private void RefreshFileListBox() + { + FileListBox.Items.Clear(); + FileListBox.Items.Add(">> 字幕"); + foreach (var file in SubtitleFileList) + { + var str = ""; + str += " "; + if (SubtitleEpisDict.ContainsKey(file.Name)) + str += $"[集数:{SubtitleEpisDict[file.Name]}] "; + str += file.Name; + FileListBox.Items.Add(str); + if (SubtitleRenameDict.ContainsKey(file.Name)) + { + FileListBox.Items.Add(String.Format("{0,12}", " => ") + SubtitleRenameDict[file.Name]); + } + } + FileListBox.Items.Add(""); + FileListBox.Items.Add(">> 视频"); + foreach (var file in VideoFileList) + { + var str = ""; + str += " "; + if (VideoEpisDict.ContainsKey(file.Name)) + str += $"[集数:{VideoEpisDict[file.Name]}] "; + str += file.Name; + FileListBox.Items.Add(str); + } + } + + // 匹配 视频 & 字幕 集数位置 + private void MatchEpisode() + { + int beginPos = GetEpisodePosByTwoStr(VideoFileList[0].Name, VideoFileList[1].Name); // 视频文件名集数开始位置 + int subBeginPos = GetEpisodePosByTwoStr(SubtitleFileList[0].Name, SubtitleFileList[1].Name); // 字幕文件名集数开始位置 + + if (beginPos <= -1 || subBeginPos <= -1) + { + MessageBox.Show("无法正确匹配集数位置,需进一步手动确认", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + // 集数字典更新 + VideoEpisDict.Clear(); + foreach (var file in VideoFileList) + VideoEpisDict[file.Name] = GetEpisByFileName(file.Name, beginPos: beginPos); + + SubtitleEpisDict.Clear(); + foreach (var file in SubtitleFileList) + SubtitleEpisDict[file.Name] = GetEpisByFileName(file.Name, beginPos: subBeginPos); + + // 生成改名字典 + SubtitleRenameDict.Clear(); + foreach (var item in SubtitleEpisDict) + { + var subtitleFileName = item.Key; + var subtitleFileExt = Path.GetExtension(subtitleFileName); + var subtitleEpis = item.Value; + // 查询对应集数的视频文件名 + var videoItems = VideoEpisDict.Where(s => s.Value == subtitleEpis); // TODO: 首字符多0少0需处理一下 + if (videoItems.Count() > 0) + { + var videoFileName = videoItems.First().Key.ToString(); + var afterSubtitleFileName = videoFileName.Remove(videoFileName.LastIndexOf(".")) + subtitleFileExt; + SubtitleRenameDict[subtitleFileName] = afterSubtitleFileName; + } + } + + // 刷新文件列表 + RefreshFileListBox(); + + // 设置改名按钮可用 + StartBtn.Enabled = true; + } + + // 通过比对两个文件名中 数字 不同的部分来得到 集数 的位置 + private int GetEpisodePosByTwoStr(string strA, string strB) + { + var numGrpA = Regex.Matches(strA.ToString(), @"(\d+)"); + var numGrpB = Regex.Matches(strB.ToString(), @"(\d+)"); + int beginPos = -1; + + for (int i = 0; i < numGrpA.Count; i++) + { + var A = numGrpA[i]; + var B = numGrpB[i]; + if (A.Value != B.Value && A.Index == B.Index) + { + // 若两个 val 不同,则记录位置 + beginPos = numGrpA[i].Index; + break; + } + } + + return beginPos; + } + + /// 获取集数 + private string GetEpisByFileName(string fileName, int beginPos) + { + if (beginPos <= -1) + { + return null; + } + + var str = fileName.Substring(beginPos); + return Regex.Matches(str, @"(\d+)")[0].Value; // 为了获得完整的数字,无论多少位 + } + + /// 执行改名操作 + private void StartRename() + { + MessageBox.Show("修改文件名代码还没写... 睡觉了..."); + } + } +} diff --git a/SubtitleRenamer/MainForm.Designer.cs b/SubtitleRenamer/MainForm.Designer.cs new file mode 100644 index 0000000..f6e89e5 --- /dev/null +++ b/SubtitleRenamer/MainForm.Designer.cs @@ -0,0 +1,119 @@ +namespace SubtitleRenamer +{ + partial class MainForm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.PathSelBtn = new System.Windows.Forms.Button(); + this.PathTextBox = new System.Windows.Forms.TextBox(); + this.FileListBox = new System.Windows.Forms.ListBox(); + this.StartBtn = new System.Windows.Forms.Button(); + this.MatchEpisodeBtn = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // PathSelBtn + // + this.PathSelBtn.Location = new System.Drawing.Point(12, 12); + this.PathSelBtn.Name = "PathSelBtn"; + this.PathSelBtn.Size = new System.Drawing.Size(96, 23); + this.PathSelBtn.TabIndex = 0; + this.PathSelBtn.Text = "打开文件夹"; + this.PathSelBtn.UseVisualStyleBackColor = true; + this.PathSelBtn.Click += new System.EventHandler(this.PathSelBtn_Click); + // + // PathTextBox + // + this.PathTextBox.Location = new System.Drawing.Point(114, 13); + this.PathTextBox.Name = "PathTextBox"; + this.PathTextBox.ReadOnly = true; + this.PathTextBox.Size = new System.Drawing.Size(490, 21); + this.PathTextBox.TabIndex = 1; + // + // FileListBox + // + this.FileListBox.FormattingEnabled = true; + this.FileListBox.HorizontalScrollbar = true; + this.FileListBox.ItemHeight = 12; + this.FileListBox.Location = new System.Drawing.Point(12, 50); + this.FileListBox.Name = "FileListBox"; + this.FileListBox.Size = new System.Drawing.Size(592, 352); + this.FileListBox.TabIndex = 2; + // + // StartBtn + // + this.StartBtn.Enabled = false; + this.StartBtn.Location = new System.Drawing.Point(166, 415); + this.StartBtn.Name = "StartBtn"; + this.StartBtn.Size = new System.Drawing.Size(135, 23); + this.StartBtn.TabIndex = 3; + this.StartBtn.Text = "2. 执行重命名"; + this.StartBtn.UseVisualStyleBackColor = true; + this.StartBtn.Click += new System.EventHandler(this.StartBtn_Click); + // + // MatchEpisodeBtn + // + this.MatchEpisodeBtn.Enabled = false; + this.MatchEpisodeBtn.Location = new System.Drawing.Point(12, 415); + this.MatchEpisodeBtn.Name = "MatchEpisodeBtn"; + this.MatchEpisodeBtn.Size = new System.Drawing.Size(135, 23); + this.MatchEpisodeBtn.TabIndex = 4; + this.MatchEpisodeBtn.Text = "1. 自动匹配集数"; + this.MatchEpisodeBtn.UseVisualStyleBackColor = true; + this.MatchEpisodeBtn.Click += new System.EventHandler(this.MatchEpisodeBtn_Click); + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.ClientSize = new System.Drawing.Size(619, 450); + this.Controls.Add(this.MatchEpisodeBtn); + this.Controls.Add(this.StartBtn); + this.Controls.Add(this.FileListBox); + this.Controls.Add(this.PathTextBox); + this.Controls.Add(this.PathSelBtn); + this.MaximizeBox = false; + this.Name = "MainForm"; + this.ShowIcon = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "字幕文件批量重命名 - qwqaq.com"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button PathSelBtn; + private System.Windows.Forms.TextBox PathTextBox; + private System.Windows.Forms.ListBox FileListBox; + private System.Windows.Forms.Button StartBtn; + private System.Windows.Forms.Button MatchEpisodeBtn; + } +} + diff --git a/SubtitleRenamer/MainForm.cs b/SubtitleRenamer/MainForm.cs new file mode 100644 index 0000000..0dd8ebc --- /dev/null +++ b/SubtitleRenamer/MainForm.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace SubtitleRenamer +{ + public partial class MainForm : Form + { + public MainForm() + { + InitializeComponent(); + } + + private void PathSelBtn_Click(object sender, EventArgs e) + { + FolderBrowserDialog PathSelDialog = new FolderBrowserDialog(); + if (OpenPath != null) + { + PathSelDialog.SelectedPath = OpenPath; + } + PathSelDialog.ShowDialog(); + PathTextBox.Text = OpenPath = PathSelDialog.SelectedPath; + + // 刷新文件列表 + ReloadFiles(); + } + + private void StartBtn_Click(object sender, EventArgs e) + { + StartRename(); + } + + private void MatchEpisodeBtn_Click(object sender, EventArgs e) + { + MatchEpisode(); + } + + /// + /// 输入对话框 + /// + /// + /// + /// + public static string InputDialog(string text, string caption) + { + Form prompt = new Form() + { + Width = 500, + Height = 150, + FormBorderStyle = FormBorderStyle.FixedDialog, + Text = caption, + TopMost = true, + StartPosition = FormStartPosition.CenterScreen + }; + Label textLabel = new Label() { Left = 20, Top = 20, Text = text, Width = 460 }; + TextBox textBox = new TextBox() { Left = 20, Top = 40, Width = 460 }; + Button confirmation = new Button() { Text = "完成", Left = 360, Width = 120, Top = 70, DialogResult = DialogResult.OK }; + confirmation.Click += (sender, e) => { prompt.Close(); }; + prompt.Controls.Add(textBox); + prompt.Controls.Add(confirmation); + prompt.Controls.Add(textLabel); + prompt.AcceptButton = confirmation; + + return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""; + } + } +} diff --git a/SubtitleRenamer/MainForm.resx b/SubtitleRenamer/MainForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SubtitleRenamer/MainForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SubtitleRenamer/Program.cs b/SubtitleRenamer/Program.cs new file mode 100644 index 0000000..f4dfcf8 --- /dev/null +++ b/SubtitleRenamer/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace SubtitleRenamer +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/SubtitleRenamer/Properties/AssemblyInfo.cs b/SubtitleRenamer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5d510cc --- /dev/null +++ b/SubtitleRenamer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("SubtitleRenamer")] +[assembly: AssemblyDescription("字幕文件批量改名工具")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("qwqaq.com")] +[assembly: AssemblyProduct("SubtitleRenamer")] +[assembly: AssemblyCopyright("Copyright © qwqaq.com 2019")] +[assembly: AssemblyTrademark("qwqaq.com")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("82f1f4bf-02b6-4262-bae5-5185fddd129b")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.1.0.0")] +[assembly: AssemblyFileVersion("0.1.0.0")] diff --git a/SubtitleRenamer/Properties/Resources.Designer.cs b/SubtitleRenamer/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d2893cb --- /dev/null +++ b/SubtitleRenamer/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace SubtitleRenamer.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SubtitleRenamer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 覆盖当前线程的 CurrentUICulture 属性 + /// 使用此强类型的资源类的资源查找。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/SubtitleRenamer/Properties/Resources.resx b/SubtitleRenamer/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/SubtitleRenamer/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SubtitleRenamer/Properties/Settings.Designer.cs b/SubtitleRenamer/Properties/Settings.Designer.cs new file mode 100644 index 0000000..ce2167c --- /dev/null +++ b/SubtitleRenamer/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SubtitleRenamer.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/SubtitleRenamer/Properties/Settings.settings b/SubtitleRenamer/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/SubtitleRenamer/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SubtitleRenamer/SubtitleRenamer.csproj b/SubtitleRenamer/SubtitleRenamer.csproj new file mode 100644 index 0000000..41937f7 --- /dev/null +++ b/SubtitleRenamer/SubtitleRenamer.csproj @@ -0,0 +1,81 @@ + + + + + Debug + AnyCPU + {82F1F4BF-02B6-4262-BAE5-5185FDDD129B} + WinExe + SubtitleRenamer + SubtitleRenamer + v4.0 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Form + + + Form + + + MainForm.cs + + + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + \ No newline at end of file