public void ListTags(Guid FileID) { File_ID = FileID; using (RPM_DataFile rpmDataFile = new RPM_DataFile()) { DataFile dataFile = rpmDataFile.GetDataFile(FileID); FileName = string.Format("{0}{1}", dataFile.StoredFileName, dataFile.FileExtension); } vListBox.Items.Clear(); vListBox.SelectedIndex = -1; using (RPM_VideoTag rpmVideoTag = new RPM_VideoTag()) { TagList = rpmVideoTag.GetTagList(FileID); foreach (VideoTag tag in TagList) { ListItem listItem = new ListItem(); listItem.Text = string.Format("{0}", tag.ShortDesc); TimeSpan timeSpan1 = new TimeSpan(0, 0, Convert.ToInt32(tag.StartTime)); TimeSpan timeSpan2 = new TimeSpan(0, 0, Convert.ToInt32(tag.EndTime)); string str1 = string.Format("{0:00}:{1:00}:{2:D2}", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds); string str2 = string.Format("{0:00}:{1:00}:{2:D2}", timeSpan2.Hours, timeSpan2.Minutes, timeSpan2.Seconds); listItem.Description = string.Format("{0} - {1}", str1, str2); listItem.Tag = tag; listItem.ImageIndex = 0; vListBox.Items.Add(listItem); } } }
private void DeleteTags() { if (vListBox.Items.Count <= 0 || MessageBox.Show(this, LangCtrl.GetString("tp_DeleteMarks", "Delete checked Marks?"), "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } foreach (ListItem listItem in vListBox.Items) { using (RPM_VideoTag rpmVideoTag = new RPM_VideoTag()) { if (listItem.IsChecked.Value) { VideoTag tag1 = (VideoTag)listItem.Tag; VideoTag tag2 = rpmVideoTag.GetTag(tag1.Id); rpmVideoTag.DeleteVideoTag(tag2); rpmVideoTag.Save(); Global.Log("MARK-DELETE", string.Format("Delete: {0} / {1} for {2}", listItem.Text.ToUpper(), listItem.Description, FileName)); } } } ListTags(File_ID); }
private void MergeFiles() { string empty = string.Empty; int num = 0; if (this.media.Count > 0) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Network.SetAcl(this.VideoPath); using (RPM_VideoTag rPMVideoTag = new RPM_VideoTag()) { foreach (MediaFile medium in this.media) { this.TagList = rPMVideoTag.GetTagList(medium.FileID); foreach (VideoTag tagList in this.TagList) { TimeSpan timeSpan = new TimeSpan(0, 0, Convert.ToInt32(tagList.StartTime)); TimeSpan timeSpan1 = new TimeSpan(0, 0, Convert.ToInt32(tagList.EndTime)); string str = string.Format("{0:00}:{1:00}:{2:D2}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds); string str1 = string.Format("{0:00}:{1:00}:{2:D2}", timeSpan1.Hours, timeSpan1.Minutes, timeSpan1.Seconds); TimeSpan timeSpan2 = timeSpan1 - timeSpan; string str2 = string.Format("{0:00}:{1:00}:{2:D2}", timeSpan2.Hours, timeSpan2.Minutes, timeSpan2.Seconds); ListItemsCollection items = this.vListBox.Items; object[] shortDesc = new object[] { tagList.ShortDesc, str, str1, str2 }; items.Insert(string.Format("{0} {1}-{2} Len: {3}", shortDesc), 0); string str3 = string.Format("{0}{1}", num, Path.GetExtension(medium.FileName)); try { ProcessStartInfo processStartInfo = new ProcessStartInfo() { UseShellExecute = false, CreateNoWindow = true, FileName = Path.Combine(Directory.GetCurrentDirectory(), "ffmpeg.exe") }; processStartInfo.CreateNoWindow = true; object[] fileName = new object[] { str, medium.FileName, str2, this.VideoPath, str3 }; processStartInfo.Arguments = string.Format("-v 0 -y -ss {0} -i \"{1}\" -t {2} -c:v copy -c:a copy \"{3}\\{4}\"", fileName); Process.Start(processStartInfo).WaitForExit(); } catch (Exception exception1) { Exception exception = exception1; this.vListBox.Items.Insert(exception.Message, 0); MessageBox.Show(exception.Message); } string str4 = Path.Combine(this.VideoPath, str3); if (!File.Exists(str4)) { this.vListBox.Items.Insert(string.Format(LangCtrl.GetString("mv_ErrorCreating", "Error creating: {0}"), str3), 0); } else { this.tFiles.Add(string.Format("{0}", str4)); num++; } } } string[] strArrays = new string[this.tFiles.Count]; int num1 = 0; foreach (string tFile in this.tFiles) { if (!File.Exists(tFile)) { continue; } strArrays[num1] = tFile; num1++; } if ((int)strArrays.Length > 0) { string str5 = "MP4"; if (this.btnAVI.Checked) { str5 = "AVI"; } if (this.btnMOV.Checked) { str5 = "MOV"; } string str6 = string.Format("{0}\\{1}.{2}", this.VideoPath, this.txtName.Text, str5); empty = str6; this.vListBox.Items.Insert(LangCtrl.GetString("mv_Merging", "Merging Video Files...This may take a few minutes..."), 0); Thread.Sleep(3000); if ((int)strArrays.Length != 1) { try { ConcatSettings concatSetting = new ConcatSettings(); FFMpegConverter fFMpegConverter = new FFMpegConverter(); Thread.Sleep(1000); fFMpegConverter.ConcatMedia(strArrays, str6, str5, concatSetting); } catch (Exception exception2) { this.vListBox.Items.Insert(exception2.Message, 0); } } else { File.Move(strArrays[0], str6); } } if (!this.chk_SaveSegments.Checked) { try { foreach (string tFile1 in this.tFiles) { if (!File.Exists(tFile1)) { continue; } File.Delete(tFile1); } } catch (Exception exception3) { this.vListBox.Items.Insert(exception3.Message, 0); } } stopwatch.Stop(); TimeSpan elapsed = stopwatch.Elapsed; string str7 = string.Format("{0:00}:{1:00}:{2:D2}", elapsed.Hours, elapsed.Minutes, elapsed.Seconds); this.vListBox.Items.Insert(string.Format(LangCtrl.GetString("mv_MergeComplete", "{0} - File Merge completed. Elapsed Time {1}"), DateTime.Now, str7), 0); if (File.Exists(empty) && Global.IsRights(Global.RightsProfile, UserRights.REDACT) && Global.IsRedact) { base.BeginInvoke(new MethodInvoker(() => { if (MessageBox.Show(this, LangCtrl.GetString("mv_RedactVideo", "Redact video file?"), "Redact", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Global.Log("REDACT", string.Format("Redact Video Merge: {0}", empty)); Process.Start(new ProcessStartInfo() { FileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Redact/VideoEditor.exe"), Arguments = string.Concat("\"", empty, "\"") }); } catch { } } })); } } base.BeginInvoke(new MethodInvoker(() => { this.btn_Close.Enabled = true; this.pictureBox1.Visible = false; })); } }