Imports System.Collections.Concurrent Imports System.ComponentModel Imports System.Drawing.Design Imports System.Reflection Imports System.Runtime.InteropServices Imports System.Text Imports System.Threading Imports System.Threading.Tasks Imports DirectN Imports Microsoft.Win32 Imports StaxRip.UI Public Class GlobalCommands Sub CheckForUpdate() StaxRipUpdate.CheckForUpdateAsync(True, Environment.Is64BitProcess) End Sub Sub ShowLogFile() If File.Exists(p.Log.GetPath()) Then Using form As New LogForm() form.ShowDialog() End Using Else g.ShellExecute(Path.Combine(Folder.Settings, "Log Files")) End If End Sub Sub ShowDemuxTool() Using form As New SimpleSettingsForm("Demux") form.ScaleClientSize(27, 10) Dim ui = form.SimpleUI Dim page = ui.CreateFlowPage("main page") page.SuspendLayout() Dim sourceFile = ui.AddTextButton(page) sourceFile.Label.Text = "Source File:" sourceFile.Edit.Expand = True sourceFile.Edit.TextBox.ReadOnly = True sourceFile.BrowseFile(FileTypes.VideoAudio) Dim outputFolder = ui.AddTextButton(page) outputFolder.Label.Text = "Output Folder:" outputFolder.Edit.Expand = True outputFolder.Edit.TextBox.ReadOnly = True outputFolder.BrowseFolder() page.ResumeLayout() Dim textChanged = Sub(sender As Object, e As EventArgs) If outputFolder.Edit.Text = "" AndAlso File.Exists(sourceFile.Edit.Text) Then outputFolder.Edit.Text = sourceFile.Edit.Text.Dir End If End Sub AddHandler sourceFile.Edit.TextChanged, textChanged form.FileDrop = True AddHandler form.FilesDropped, Sub(files) sourceFile.Edit.Text = files(0) If form.ShowDialog() = DialogResult.OK AndAlso File.Exists(sourceFile.Edit.Text) AndAlso Directory.Exists(outputFolder.Edit.Text) Then Using td As New TaskDialog(Of Demuxer) td.Title = "Select a demuxer" If sourceFile.Edit.Text.Ext = "mkv" Then td.AddCommand("mkvextract", New mkvDemuxer) End If If sourceFile.Edit.Text.Ext.EqualsAny("mp4", "flv") Then td.AddCommand("MP4Box", New MP4BoxDemuxer) End If td.AddCommand("ffmpeg", New ffmpegDemuxer) td.AddCommand("eac3to", New eac3toDemuxer) Dim proj As New Project proj.Init() proj.SourceFile = sourceFile.Edit.Text proj.TargetFile = sourceFile.Edit.Text proj.TempDir = outputFolder.Edit.Text.FixDir If td.Show IsNot Nothing Then td.SelectedValue.Run(proj) s.LastSourceDir = proj.SourceFile.Dir proj.Log.Save(proj) End If End Using End If End Using End Sub Sub StartJobs() g.ProcessJobs() End Sub Sub DynamicMenuItem( id As DynamicMenuItemID) End Sub Sub ShowMacrosDialog() MacrosForm.ShowDialogForm() End Sub Sub ExecuteCommandLine( commandLine As String, waitForExit As Boolean, showProcessWindow As Boolean, useShellExecute As Boolean, workingDirectory As String) Using proc As New Proc(showProcessWindow) proc.Header = "Execute Command Line" proc.CommandLine = Macro.Expand(commandLine) proc.Wait = waitForExit proc.WorkingDirectory = Macro.Expand(workingDirectory) If Not useShellExecute Then proc.Process.StartInfo.UseShellExecute = False End If Try proc.Start() Catch ex As Exception g.ShowException(ex) Log.WriteLine(ex.Message) End Try End Using End Sub Sub StartTool( name As String) Try If Package.Items(name).VerifyOK Then Package.Items(name).LaunchAction?.Invoke End If Catch ex As Exception g.ShowException(ex) End Try End Sub Sub ExecutePowerShellCode( code As String, Optional externalShell As Boolean = False) code = Macro.Expand(code) If externalShell Then g.RunCodeInTerminal(code) Else g.InvokePowerShellCode(code) End If End Sub Sub ExecutePowerShellFile( filepath As String, Optional args As String = Nothing) g.InvokePowerShellCode(Macro.Expand(filepath).ReadAllText, Macro.Expand(args).SplitNoEmpty(";"c)) End Sub Sub SetCrop( left As Integer, top As Integer, right As Integer, bottom As Integer) g.SetCrop(left, top, right, bottom, p.ForcedOutputModDirection, False) g.MainForm.SetCropFilter() End Sub Sub GenerateWikiContent() Documentation.GenerateWikiContent() End Sub Sub Test() If Not g.IsDevelopmentPC Then Exit Sub End If Dim msg = "" msg += NVEnc.Test msg += QSVEnc.Test 'msg += Rav1e.Test 'msg += VCEEnc.Test msg += x264Enc.Test msg += x265Enc.Test For Each pack In Package.Items.Values If pack.IsIncluded Then If pack.Path = "" Then msg += BR2 + "# path missing for " + pack.Name ElseIf Not pack.VersionAllowAny Then If pack.Version = "" Then msg += BR2 + "# version missing for " + pack.Name ElseIf Not pack.IsVersionValid Then msg += BR2 + "# wrong version for " + pack.Name End If End If 'does help file exist? If pack.Path <> "" AndAlso pack.HelpFilename <> "" Then If Not File.Exists(Path.Combine(pack.Directory, pack.HelpFilename)) Then msg += BR2 + $"# Help file of {pack.Name} don't exist!" End If End If End If Next If msg <> "" Then Dim fs = Path.Combine(Folder.Temp, "staxrip test.txt") File.WriteAllText(fs, BR + msg.Trim + BR) g.ShellExecute(fs) Else MsgInfo("All Good!") End If End Sub Sub PlaySound( FilePath As String, Volume As Integer) Try Static player As New Reflector("WMPlayer.OCX.7") Dim settings = player.Invoke("settings", BindingFlags.GetProperty) settings.Invoke("volume", BindingFlags.SetProperty, Volume) settings.Invoke("setMode", "loop", False) player.Invoke("URL", BindingFlags.SetProperty, FilePath) player.Invoke("controls", BindingFlags.GetProperty).Invoke("play") Catch ex As Exception g.ShowException(ex) End Try End Sub Function GetApplicationDetails(Optional includeName As Boolean = True, Optional includeVersion As Boolean = True, Optional includeSettingsVersion As Boolean = True) As String Dim sb = New StringBuilder() Dim version = Assembly.GetExecutingAssembly.GetName.Version If includeName Then sb.Append(Application.ProductName) If includeVersion Then sb.Append($" v{version.Major}.{version.Minor}") If version.Build > 0 OrElse version.Revision > 0 Then sb.Append($".{version.Build}") End If If version.Revision > 0 Then sb.Append($".{version.Revision}") End If If includeSettingsVersion AndAlso s?.Version IsNot Nothing Then If version.Minor <> s.Version.Minor AndAlso version.Minor <> s.Version.Minor - 1 Then sb.Append($" [v{s.Version.Major}.{s.Version.Minor}.{s.Version.Build}]") End If End If End If Return sb.ToString.Trim() End Function Sub OpenHelpTopic( topic As String) Dim form As New HelpForm() Select Case topic Case "info" form.Doc.WriteStart(GetApplicationDetails()) form.Doc.Write("Active Authors", "Dendraspis") form.Doc.Write("Active Contributors", "Patman86, Valdiralita") form.Doc.Write("Retired Authors", "stax76, JKyle, 44vince44, DJATOM, Revan654, NikosD, jernst, Brother John, Freepik, ilko-k, nulledone, vanontom") form.Doc.Writer.WriteRaw("
") form.Doc.Write("Links", "Source on GitHub" & "
Changelog on GitHub" & "
Wiki on GitHub" & "
StaxRip Community on Discord") form.Doc.Writer.WriteRaw("
") Dim licensePath = Path.Combine(Folder.Startup, "License.txt") If licensePath.FileExists Then form.Doc.WriteParagraph(licensePath.ReadAllText.Trim, True) End If Case Else form.Doc.WriteStart("unknown topic") form.Doc.WriteParagraph("The requested help topic '''" + topic + "''' is unknown.") End Select form.Show() End Sub Sub ShowMessageBox( mainInstruction As String, Optional content As String = Nothing, Optional icon As TaskIcon = TaskIcon.Info) Msg(Macro.Expand(mainInstruction), Macro.Expand(content), icon, TaskButton.OK) End Sub Sub ShowMediaInfoBrowse() Using dialog As New OpenFileDialog If dialog.ShowDialog = DialogResult.OK Then g.DefaultCommands.ShowMediaInfo(dialog.FileName) End If End Using End Sub Sub ShowMediaInfo( filepath As String) filepath = Macro.Expand(filepath) If File.Exists(filepath) Then Dim theme = ThemeManager.CurrentTheme Dim args = " --theme-colors=" + "Foreground:" + theme.General.Controls.RichTextBox.ForeColor.ToHTML + "," + "Background:" + theme.General.Controls.RichTextBox.BackColor.ToHTML + "," + "TextSelection:" + Color.DeepSkyBlue.ToColorHSL.ToHTML + "," + "ItemSelection:" + theme.General.Controls.ToolStrip.DropdownBackgroundSelectedColor.ToHTML + "," + "ItemHover:" + theme.General.Controls.ToolStrip.DropdownBackgroundSelectedColor.AddLuminance(0.1).ToHTML + "," + "Border:" + theme.General.Controls.RichTextBox.BorderColor.ToHTML + "," + "Highlight:" + Color.Green.ToColorHSL.ToHTML g.ShellExecute(Package.MediaInfoNET.Path, filepath.Escape + args) Else Using dialog As New OpenFileDialog If dialog.ShowDialog = DialogResult.OK Then ShowMediaInfo(dialog.FileName) End If End Using End If End Sub Sub CopyToClipboard( value As String) Macro.Expand(value).ToClipboard() End Sub Sub WriteLog( header As String, message As String) Log.WriteHeader(Macro.Expand(header)) Log.WriteLine(Macro.Expand(message)) End Sub Sub DeleteFiles( dir As String, filter As String) For Each i In ",;*" If filter.Contains(i) Then filter = filter.Replace(i, " ") End If Next Try For Each i In Directory.GetFiles(Macro.Expand(dir)) For Each i2 In filter.SplitNoEmpty(" ") If i.ToUpperInvariant.EndsWith(i2.ToUpperInvariant) Then FileHelp.Delete(i) End If Next Next Catch ex As Exception g.ShowException(ex) End Try End Sub Sub ImportVideoEncoderCommandLine( commandLine As String) p.VideoEncoder.ImportCommandLine(commandLine) End Sub Sub ImportVideoEncoderCommandLineFromTextFile( filePath As String) Dim commandLine = filePath.ReadAllText() p.VideoEncoder.ImportCommandLine(commandLine) End Sub Sub AddFilter( active As Boolean, name As String, category As String, script As String) p.Script.AddFilter(New VideoFilter(category, name, script, active)) g.MainForm.Assistant() End Sub Sub SetFilter(name As String, category As String, script As String) p.Script.SetFilter(category, name, script) End Sub Sub SetTargetFile( path As String) Dim oldEncodeFile = IO.Path.Combine(p.TempDir, p.TargetFile.Base + "_out." + p.VideoEncoder.OutputExt) p.TargetFile = Macro.Expand(path.TrimQuotes()) Dim newEncodeFile = IO.Path.Combine(p.TempDir, p.TargetFile.Base + "_out." + p.VideoEncoder.OutputExt) If File.Exists(oldEncodeFile) Then File.Move(oldEncodeFile, newEncodeFile) End If End Sub Sub LoadSourceFile( path As String) g.MainForm.OpenVideoSourceFile(path) End Sub Sub LoadSourceFileWithTemplateSelection( path As String) If g.MainForm.LoadTemplateWithSelectionDialog(path) Then g.MainForm.OpenVideoSourceFile(path) End If End Sub Sub LoadSourceFiles( paths As String()) g.MainForm.OpenVideoSourceFiles(paths) End Sub Sub LoadSourceFilesWithTemplateSelection( paths As String()) If g.MainForm.LoadTemplateWithSelectionDialog(paths) Then g.MainForm.OpenVideoSourceFiles(paths) End If End Sub Sub ShowMkvInfo() Using dialog As New OpenFileDialog dialog.Filter = "MKV|*.mkv" If dialog.ShowDialog = DialogResult.OK Then g.RunCodeInTerminal($"& '{Package.mkvinfo.Path}' '{dialog.FileName}'") End If End Using End Sub Sub SaveMKVHDR() Using dialog As New OpenFileDialog dialog.Filter = "mkv|*.mkv" If dialog.ShowDialog = DialogResult.OK Then Try MKVInfo.MetadataHDR(dialog.FileName, Nothing) Catch ex As Exception g.ShowException(ex) End Try End If End Using End Sub Sub SaveGIF() Using dialog As New OpenFileDialog dialog.Multiselect = True If dialog.ShowDialog = DialogResult.OK Then Using form As New SimpleSettingsForm("Gif Options") form.ScaleClientSize(27, 18) Dim ui = form.SimpleUI Dim page = ui.CreateFlowPage("main page") ui.Store = s page.SuspendLayout() Dim paletteGen = ui.AddMenu(Of String) Dim compression = ui.AddMenu(Of String) Dim paletteUse = ui.AddMenu(Of String) Dim time = ui.AddNum() time.Text = "Starting Time:" time.Config = {1.0, 3600.0, 0.2, 1} time.Help = "The Time Position Where the Animation Should start at in Seconds" time.NumEdit.Value = s.Storage.GetDouble("GifTime", 15.0) time.NumEdit.SaveAction = Sub(value) s.Storage.SetDouble("GifTime", value) Dim length = ui.AddNum() length.Text = "Length:" length.Config = {1.0, 9.0, 0.2, 1} length.Help = "The Length of the Animation in Seconds" length.NumEdit.Value = s.Storage.GetDouble("GifLength", 4.2) length.NumEdit.SaveAction = Sub(value) s.Storage.SetDouble("GifLength", value) Dim frameRate = ui.AddNum() frameRate.Text = "Framerate:" frameRate.Config = {15, 60} frameRate.NumEdit.Value = s.Storage.GetInt("GifFrameRate", 15) frameRate.NumEdit.SaveAction = Sub(value) s.Storage.SetInt("GifFrameRate", CInt(value)) Dim scale = ui.AddNum() scale.Text = "Scale:" scale.Config = {240, 2160} scale.NumEdit.Value = s.Storage.GetInt("GifScale", 480) scale.NumEdit.SaveAction = Sub(value) s.Storage.SetInt("GifScale", CInt(value)) paletteGen.Text = "Statistics Mode:" paletteGen.Add("Full", "full") paletteGen.Add("Difference", "diff") paletteGen.Button.Value = s.Storage.GetString("PaletteGen", "diff") paletteGen.Button.SaveAction = Sub(value) s.Storage.SetString("PaletteGen", value) paletteUse.Text = "Diff Mode:" paletteUse.Add("Rectangle", "rectangle") paletteUse.Add("None", "none") paletteUse.Button.Value = s.Storage.GetString("PaletteUse", "rectangle") paletteUse.Button.SaveAction = Sub(value) s.Storage.SetString("PaletteUse", value) compression.Text = "Dither:" compression.Add("Bayer Scale", "dither=bayer:bayer_scale=5") compression.Add("Heckbert", "dither=heckbert") compression.Add("Floyd Steinberg", "dither=floyd_steinberg") compression.Add("Sierra 2", "dither=sierra2") compression.Add("Sierra 2_4a", "dither=sierra2_4a") compression.Add("None", "dither=none") compression.Button.Value = s.Storage.GetString("GifDither", "dither=floyd_steinberg") compression.Button.SaveAction = Sub(value) s.Storage.SetString("GifDither", value) Dim output = ui.AddBool() output.Text = "Output Path" output.Checked = s.Storage.GetBool("GifOutput", False) output.SaveAction = Sub(value) s.Storage.SetBool("GifOutput", value) Dim customDirectory = ui.AddTextMenu() 'Custom Output Folder customDirectory.Label.Visible = False customDirectory.Edit.Text = s.Storage.GetString("GifDirectory", p.DefaultTargetFolder) customDirectory.Edit.SaveAction = Sub(value) s.Storage.SetString("GifDirectory", value) customDirectory.AddMenu("Browse Folder...", Function() g.BrowseFolder(p.DefaultTargetFolder)) AddHandler output.CheckStateChanged, Sub() customDirectory.Visible = output.Checked = True customDirectory.Visible = output.Checked = True page.ResumeLayout() If form.ShowDialog() = DialogResult.OK Then ui.Save() For Each i In dialog.FileNames Try Animation.GIF(i, Nothing) Catch ex As Exception g.ShowException(ex) End Try Next End If End Using End If End Using End Sub Sub SavePNG() Using dialog As New OpenFileDialog dialog.Multiselect = True If dialog.ShowDialog = DialogResult.OK Then Using form As New SimpleSettingsForm("PNG Options") form.ScaleClientSize(27, 15) Dim ui = form.SimpleUI Dim page = ui.CreateFlowPage("main page") ui.Store = s page.SuspendLayout() Dim opt = ui.AddMenu(Of String) Dim time = ui.AddNum() time.Text = "Starting Time:" time.Config = {1.0, 3600.0, 0.2, 1} time.Help = "The Time Position Where the Animation Should start at in Seconds" time.NumEdit.Value = s.Storage.GetDouble("PNGTime", 15.0) time.NumEdit.SaveAction = Sub(value) s.Storage.SetDouble("PNGTime", value) Dim len = ui.AddNum() len.Text = "Length:" len.Config = {1.0, 9.0, 0.2, 1} len.Help = "The Length of the Animation in Seconds" len.NumEdit.Value = s.Storage.GetDouble("PNGLength", 3.8) len.NumEdit.SaveAction = Sub(value) s.Storage.SetDouble("PNGLength", value) Dim frameRate = ui.AddNum() frameRate.Text = "FrameRate:" frameRate.Config = {15, 60} frameRate.NumEdit.Value = s.Storage.GetInt("PNGFrameRate", 15) frameRate.NumEdit.SaveAction = Sub(value) s.Storage.SetInt("PNGFrameRate", CInt(value)) Dim scale = ui.AddNum() scale.Text = "Scale:" scale.Config = {240, 2160} scale.Help = "The Size to Scale the Resolution to" scale.NumEdit.Value = s.Storage.GetInt("PNGScale", 480) scale.NumEdit.SaveAction = Sub(value) s.Storage.SetInt("PNGScale", CInt(value)) Dim settings = ui.AddBool() settings.Text = "Enable Opt" settings.Help = "Enable or Disable the Usage of PNG Opt" settings.Checked = s.Storage.GetBool("OptSetting", False) settings.SaveAction = Sub(value) s.Storage.SetBool("OptSetting", value) AddHandler settings.CheckStateChanged, Sub() opt.Visible = settings.Checked = True End Sub opt.Text = "Opt Settings:" opt.Add("Zlib", "-z0") opt.Add("7zip", "-z1") opt.Add("Zopfli", "-z2") opt.Help = "Compression and Optimization Method Used" + BR + "ZLib = Fastest" + BR + "7Zip = Balance" + BR + "Zopfli = Slowest" opt.Button.Value = s.Storage.GetString("PNGopt", "-z1") opt.Button.SaveAction = Sub(value) s.Storage.SetString("PNGopt", value) opt.Visible = settings.Checked = True Dim output = ui.AddBool() output.Text = "Output Path" output.Checked = s.Storage.GetBool("PNGOutput", False) output.SaveAction = Sub(value) s.Storage.SetBool("PNGOutput", value) Dim customDir = ui.AddTextMenu() 'Custom Output Directory customDir.Label.Visible = False customDir.Edit.Text = s.Storage.GetString("PNGDirectory", p.DefaultTargetFolder) customDir.Edit.SaveAction = Sub(value) s.Storage.SetString("PNGDirectory", value) customDir.AddMenu("Browse Folder...", Function() g.BrowseFolder(p.DefaultTargetFolder)) AddHandler output.CheckStateChanged, Sub() customDir.Visible = output.Checked = True End Sub customDir.Visible = output.Checked = True page.ResumeLayout() If form.ShowDialog() = DialogResult.OK Then ui.Save() For Each i In dialog.FileNames Try Animation.aPNG(i, Nothing) Catch ex As Exception g.ShowException(ex) End Try Next End If End Using End If End Using End Sub Async Sub ShowThumbnailerDialogAsync() Using dialog As New OpenFileDialog() dialog.Title = "Select the video files - for Thumbnailer settings go to Project Options!" dialog.SetFilter(FileTypes.Video) dialog.Multiselect = True If dialog.ShowDialog() = DialogResult.OK Then Dim filePaths = dialog.FileNames If filePaths.Length > 0 Then Dim sw = New Stopwatch() sw.Start() Dim reportWhenFinished = True Dim reportTD As TaskDialog(Of DialogResult) = Nothing Dim summaryTD As TaskDialog(Of DialogResult) = Nothing Dim closingTD As TaskDialog(Of DialogResult) = Nothing Dim cts = New CancellationTokenSource() Dim mainFormClosingHandler As FormClosingEventHandler = Nothing mainFormClosingHandler = Sub(sender As Object, e As FormClosingEventArgs) If Not e.Cancel Then Using closingTD closingTD = New TaskDialog(Of DialogResult)(DialogResult.Yes) closingTD.Icon = TaskIcon.Warning closingTD.Title = "Close while Thumbnailer is running?" closingTD.Content = "StaxRip shall be closed while Thumbnailer is still running." closingTD.Content += $"{BR2}These are your options:" closingTD.Content += $"{BR}(1) Leave this dialog open and StaxRip will continue the closing procedure as soon as Thumbnailer finishes." closingTD.Content += $" If you have modified the project, you may be asked to save it first." closingTD.Content += $"{BR}(2) YES - Forces Thumbnailer to stop immediately and StaxRip will continue closing." closingTD.Content += $"{BR}(3) NO - Cancels the closing procedure and StaxRip keeps running." closingTD.AddButton(DialogResult.Yes) closingTD.AddButton(DialogResult.No) If closingTD.Show() = DialogResult.No Then e.Cancel = True End If End Using End If End Sub Dim thumbnailerTask = Task.Run( Async Function() AddHandler g.MainForm.FormClosing, mainFormClosingHandler Dim proceededSources = Await Thumbnailer.RunAsync(cts.Token, p, filePaths) If reportTD IsNot Nothing AndAlso Not reportTD.IsDisposingOrDisposed Then reportTD.Close() End If If closingTD IsNot Nothing AndAlso Not closingTD.IsDisposingOrDisposed Then closingTD.Close() End If sw.Stop() RemoveHandler g.MainForm.FormClosing, mainFormClosingHandler Return proceededSources End Function, cts.Token) Using reportTD reportTD = New TaskDialog(Of DialogResult)(DialogResult.Yes) reportTD.Icon = TaskIcon.Question reportTD.Title = "This might take a while..." reportTD.Content = If(filePaths.Length = 1, "The thumbnail sheet is generated in the background. Do you want to get informed when the thumbnail sheet is processed?", "The thumbnail sheets are generated in the background. Do you want to get informed when all thumbnail sheets are processed?") reportTD.AddButton(DialogResult.Yes) reportTD.AddButton(DialogResult.No) reportWhenFinished = reportTD.Show() = DialogResult.Yes End Using If reportWhenFinished Then Dim proceededSources = Await thumbnailerTask RemoveHandler g.MainForm.FormClosing, mainFormClosingHandler If proceededSources Is Nothing OrElse Not proceededSources.Any() Then Return Dim proceededFailedSources = proceededSources.Where(Function(x) Not x.Value) Dim proceededSucceededSources = proceededSources.Where(Function(x) x.Value) Dim attention = proceededFailedSources.Any() Using summaryTD summaryTD = New TaskDialog(Of DialogResult)() summaryTD.Icon = If(attention, TaskIcon.Warning, TaskIcon.Info) summaryTD.Title = If(proceededSources.Count = 1, If(attention, "Thumbnail sheet creation failed!", "Thumbnail sheet has been created."), If(attention, If(proceededSucceededSources.Any(), "Some thumbnail sheet creation failed!", "All thumbnail sheet creation failed!"), "All thumbnail sheets have been created.")) For i = 0 To proceededSources.Count - 1 Dim key = proceededSources.ElementAtOrDefault(i).Key Dim value = proceededSources.ElementAtOrDefault(i).Value If value Then summaryTD.ExpandedContent += $"✔ ""{key}""{BR}" Else summaryTD.Content += $"❌ ""{key}""{BR}" End If Next summaryTD.ExpandedContent += $"Duration: {sw.ElapsedMilliseconds} ms" summaryTD.AddButton(DialogResult.OK) summaryTD.Show() End Using End If End If End If End Using End Sub Sub ShowMediaInfoFolderViewDialog() Using dialog As New FolderBrowserDialog dialog.ShowNewFolderButton = False dialog.SetSelectedPath(s.Storage.GetString("MediaInfo Folder View folder")) If dialog.ShowDialog = DialogResult.OK Then s.Storage.SetString("MediaInfo Folder View folder", dialog.SelectedPath) g.InvokePowerShellCode($". '{Package.GetMediaInfo.Path}'; Get-ChildItem '{dialog.SelectedPath}' | Get-MediaInfo | Out-GridView") End If End Using End Sub Sub ResetSettings() Dim sb As New SelectionBox(Of String) sb.Title = "Reset Settings" sb.Text = "Please select a setting to reset." Dim appSettings As New ApplicationSettings appSettings.Init() For Each i In appSettings.Versions.Keys sb.AddItem(i) Next sb.Items.Sort() If sb.Show = DialogResult.OK Then s.Versions(sb.SelectedValue) = -1 MsgInfo("Will be reseted on next startup.", sb.SelectedValue) End If End Sub Sub ShowRemovedFunctionalityMessage() MsgWarn("Functionality is no longer available.") End Sub Sub AddTags( tags As String) For Each i In tags.Split(";"c) If i.Contains("=") Then Dim left = i.Left("=").Trim Dim right = i.Right("=").Trim p.VideoEncoder.Muxer.Tags.Add(New StringPair(left, right)) End If Next End Sub End Class