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 MemoForm_Load(object sender, EventArgs e) { if (Global.IS_WOLFCOM) { this.HeaderPanel.BackgroundImage = (Image)Properties.Resources.topbar45; } LangCtrl.reText(this); if (dRecord != null) { ListBox.Items.Clear(); using (RPM_DataFile rpmDataFile = new RPM_DataFile()) { dRecord = rpmDataFile.GetDataFile(RecId); foreach (FileMemo fileMemo in dRecord.FileMemos) { ListBox.Items.Add(new ListItem() { Text = fileMemo.ShortDesc, Description = string.Format("{0} - {1} [{2}]", fileMemo.Timestamp, fileMemo.AccountName, fileMemo.BadgeNumber), Tag = fileMemo.Id }); } } } SetLanguage(); }
private void CopySelectedFiles() { btn_Close.Enabled = false; btn_OK.Enabled = false; progBar.Visible = true; progBar.Maximum = this.FileList.Count; progBar.Invalidate(); Application.DoEvents(); using (RPM_DataFile rpmDataFile = new RPM_DataFile()) { int num = 1; foreach (Guid file in this.FileList) { progBar.Value = num++; progBar.Invalidate(); rpmDataFile.GetDataFile(file).AccountId = AccountID; } } Close(); }
public void LoadData(Guid Id) { if (Global.IS_WOLFCOM) { HeaderPanel.BackgroundImage = (Image)Properties.Resources.topbar45; } using (RPM_DataFile rpmDataFile = new RPM_DataFile()) { DataFile dataFile = rpmDataFile.GetDataFile(Id); txtFileTimestamp.Text = dataFile.FileTimestamp.ToString(); txtFileSize.Text = string.Format("{0}", dataFile.FileSize); txtFileExt.Text = dataFile.FileExtension; txtFileName.Text = dataFile.OriginalFileName; txtAdded.Text = dataFile.FileAddedTimestamp.ToString(); txtCAD.Text = dataFile.CADNumber; txtRMS.Text = dataFile.RMSNumber; txtSet.Text = dataFile.SetName; txtClassification.Text = dataFile.Classification; } }
private void mnuAddMemo_Click(object sender, EventArgs e) { this.BackColor = Color.FromArgb(250, 250, 250); EditorForm editorForm = new EditorForm(this.sRecord.SlideNumber); if (editorForm.ShowDialog(this) == DialogResult.OK) { FileMemo fileMemo = new FileMemo() { AccountName = this.aRecord.ToString(), BadgeNumber = this.aRecord.BadgeNumber, Timestamp = new DateTime?(DateTime.Now), Memo = editorForm.RTF, Text = editorForm.DocText }; if (fileMemo.Text.Length >= 64) { fileMemo.ShortDesc = this.CleanInput(fileMemo.Text.Substring(0, 64)); } else { fileMemo.ShortDesc = this.CleanInput(fileMemo.Text); } using (RPM_DataFile rPMDataFile = new RPM_DataFile()) { DataFile dataFile = rPMDataFile.GetDataFile(this.sRecord.dRecord.Id); fileMemo.DataFile = dataFile; dataFile.FileMemos.Add(fileMemo); rPMDataFile.SaveUpdate(dataFile); rPMDataFile.Save(); } this.sRecord.IsMemo = true; this.Thumbnail.Invalidate(); this.SetSelectMode(); } }
private void CopyMemos(DataFile dRecord) { try { if (dRecord != null) { using (RPM_DataFile rPMDataFile = new RPM_DataFile()) { foreach (FileMemo fileMemo in rPMDataFile.GetDataFile(dRecord.Id).FileMemos) { string shortDesc = fileMemo.ShortDesc; string str = Path.Combine(this.FolderName, string.Format("{0}.rtf", shortDesc)); using (StreamWriter streamWriter = new StreamWriter(str)) { streamWriter.Write(fileMemo.Memo); } } } } } catch { } }
public bool DeleteSlideFile(int days) { this.sRecord.Action = ACTION.NONE; bool flag = false; if (days > 0 && (this.sRecord.dRecord.Classification.ToUpper().Equals("UNCLASSIFIED") || string.IsNullOrEmpty(this.sRecord.dRecord.Classification))) { DateTime value = this.sRecord.dRecord.FileAddedTimestamp.Value; value = value.AddDays((double)days); if (DateTime.Now > value) { this.picDelete.Visible = true; Application.DoEvents(); DateTime now = DateTime.Now; object[] year = new object[] { now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, now.Millisecond }; string str = string.Format("{0}{1:00}{2:00}_{3:00}{4:00}{5:00}.{6:0000}.zip", year); string str1 = Path.Combine(this.sRecord.dRecord.UNCName, this.sRecord.dRecord.UNCPath); string str2 = Path.Combine(Network.FormatPath(str1), string.Format("{0}{1}", this.sRecord.dRecord.StoredFileName, this.sRecord.dRecord.FileExtension)); if (!File.Exists(str2)) { MessageBox.Show(this, string.Format(LangCtrl.GetString("sld_SourceFile", "Source File Not Found: {0}"), str2), "File Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { string empty = string.Empty; string empty1 = string.Empty; using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig()) { GlobalConfig configRecord = rPMGlobalConfig.GetConfigRecord("RET_UNC_ROOT"); if (configRecord != null) { empty = configRecord.Value; } configRecord = rPMGlobalConfig.GetConfigRecord("RET_UNC_PATH"); if (configRecord != null) { empty1 = configRecord.Value; } } if (!string.IsNullOrEmpty(empty) && !string.IsNullOrEmpty(empty1)) { string str3 = Network.FormatPath(Path.Combine(empty, empty1)); if (!Directory.Exists(str3)) { MessageBox.Show(this, LangCtrl.GetString("sld_ArchiveFolder", "Archive Folder Not Set!\nContact your system administrator."), "Archive Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (Zip.ZipToFile(str2, str3, str)) { using (RPM_DataFile rPMDataFile = new RPM_DataFile()) { DataFile dataFile = rPMDataFile.GetDataFile(this.sRecord.dRecord.Id); dataFile.PurgeFileName = str; dataFile.PurgeTimestamp = new DateTime?(DateTime.Now); dataFile.IsPurged = new bool?(true); rPMDataFile.SaveUpdate(dataFile); rPMDataFile.Save(); try { File.Delete(str2); } catch (Exception exception1) { Exception exception = exception1; MessageBox.Show(this, exception.Message, "Delete Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } if (!File.Exists(str2)) { Global.Log("USER DELETE", string.Format("File: {0}", str2)); flag = true; } } } } } this.picDelete.Visible = false; Application.DoEvents(); } } return(flag); }
private void Export() { this.FileFolders.Clear(); Stopwatch stopwatch = new Stopwatch(); int num = 0; if (FileID.Count > 0) { stopwatch.Start(); progBar.Maximum = FileID.Count; using (RPM_DataFile rPMDataFile = new RPM_DataFile()) { foreach (Guid fileID in FileID) { progFile.Value = 0; DataFile dataFile = rPMDataFile.GetDataFile(fileID); string folderPath = FolderPath; ExportForm exportForm = this; int folderCount = exportForm.FolderCount; int num1 = folderCount; exportForm.FolderCount = folderCount + 1; FolderName = Path.Combine(folderPath, string.Format("FILE_{0}", num1)); if (!Directory.Exists(FolderName)) { Directory.CreateDirectory(FolderName); Network.SetAcl(FolderName); } FileFolders.Add(FolderName); ListItem listItem1 = new ListItem(); vProgressBar _vProgressBar = progBar; ExportForm exportForm1 = this; int fileCount = exportForm1.FileCount; int num2 = fileCount; exportForm1.FileCount = fileCount + 1; _vProgressBar.Value = num2; progBar.Invalidate(); Application.DoEvents(); picThumbnail.Image = Utilities.ByteArrayToImage(dataFile.Thumbnail); picThumbnail.Invalidate(); Application.DoEvents(); WriteFileInfo(dataFile); CopyFile(dataFile); listItem1.Text = string.Format("Export: {0}", string.Concat(dataFile.OriginalFileName, dataFile.FileExtension)); HashAlgorithm sHA1 = HashAlgorithms.SHA1; switch (dataFile.HashAlgorithm) { case HASH_ALGORITHM.MD5: { sHA1 = HashAlgorithms.MD5; break; } case HASH_ALGORITHM.SHA1: { sHA1 = HashAlgorithms.SHA1; break; } case HASH_ALGORITHM.SHA256: { sHA1 = HashAlgorithms.SHA256; break; } case HASH_ALGORITHM.SHA384: { sHA1 = HashAlgorithms.SHA384; break; } case HASH_ALGORITHM.SHA512: { sHA1 = HashAlgorithms.SHA512; break; } case HASH_ALGORITHM.RIPEMD160: { sHA1 = HashAlgorithms.RIPEMD160; break; } } string hashFromFile = Hash.GetHashFromFile(TargetFileName, sHA1); BeginInvoke(new MethodInvoker(() => { lblExportFileName.Text = string.Concat(dataFile.OriginalFileName, dataFile.FileExtension); lblExportHash.Text = Convert.ToString(hashFromFile); })); if (!hashFromFile.Equals(dataFile.FileHashCode)) { num++; listItem1.Description = string.Format(LangCtrl.GetString("txt_FileHashFail", "File validate Failed {0} x {1}"), dataFile.FileHashCode, hashFromFile); listItem1.ImageIndex = 2; vListBox.Items.Insert(listItem1, 0); } else { listItem1.ImageIndex = 1; listItem1.Description = string.Format(LangCtrl.GetString("txt_HashVerified", "File Hash code Verified: {0}"), hashFromFile); } vListBox.Items.Insert(listItem1, 0); CopyMemos(dataFile); CopyThumbnails(dataFile); Global.Log("EXPORT", string.Format(LangCtrl.GetString("txt_DiscExport", "Export: {0}{1} - {2}"), dataFile.StoredFileName, dataFile.FileExtension, dataFile.ShortDesc)); Application.DoEvents(); int num3 = 0; try { using (RPM_Snapshot rPMSnapshot = new RPM_Snapshot()) { List <Snapshot> snapshots = rPMSnapshot.GetSnapshots(fileID); if (snapshots.Count > 0) { foreach (Snapshot snapshot in snapshots) { string str1 = Path.Combine(snapshot.UNCName, snapshot.UNCPath); SourceFileName = Network.FormatPath(Path.Combine(str1, snapshot.StoredFileName)); string str2 = string.Concat("Snapshot_", num3, snapshot.FileExtension); TargetFileName = Path.Combine(FolderName, str2); if (!File.Exists(SourceFileName)) { continue; } File.Copy(SourceFileName, TargetFileName, true); num3++; } } } } catch { } } if (EFD.IsZipFile) { BeginInvoke(new MethodInvoker(() => { ListItem listItem = new ListItem() { ImageIndex = 5, Text = LangCtrl.GetString("txt_SecuringFiles", "Securing Selected Files...Please wait...") }; vListBox.Items.Insert(listItem, 0); })); if (EFD.ZipName.Contains(".")) { EFD.ZipName = this.EFD.ZipName.Substring(0, this.EFD.ZipName.IndexOf('.')); } //TODO : ref ExportFileData eFD = EFD; eFD.ZipName = string.Concat(eFD.ZipName, ".zip"); if (Zip.ZipFolders(this.FileFolders, Path.Combine(this.FolderPath, this.EFD.ZipName), this.EFD.ZipPwd)) { Global.Log("EXPORT_ZIP", string.Format(LangCtrl.GetString("txt_ExportSecure", "Export secure file {0}"), Path.Combine(this.FolderPath, this.EFD.ZipName))); foreach (string fileFolder in this.FileFolders) { Directory.Delete(fileFolder, true); } } } stopwatch.Stop(); base.BeginInvoke(new MethodInvoker(() => { this.picThumbnail.Image = null; this.lblExportFileName.Text = string.Empty; this.lblExportHash.Text = string.Empty; TimeSpan timeSpan = TimeSpan.FromMilliseconds((double)stopwatch.ElapsedMilliseconds); string str = string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D2}", new object[] { timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds }); ListItem listItem = new ListItem(); if (this.EFD.IsZipFile) { listItem.ImageIndex = 5; listItem.Text = string.Format(LangCtrl.GetString("txt_SecureFileCreated", "Secure File Created > {0}"), this.EFD.ZipName); this.vListBox.Items.Insert(listItem, 0); } listItem = new ListItem(); if (!this.IsDVD) { listItem.ImageIndex = 3; listItem.Text = string.Format(LangCtrl.GetString("txt_ExportCompleted", "Export Completed > {0} Files in {1}"), this.FileID.Count, str); Global.Log("EXPORT-COMPLETE", listItem.Text); } else { listItem.ImageIndex = 4; listItem.Text = string.Format(LangCtrl.GetString("txt_DiscPrep", "Disc Prep Completed > {0} Files in {1}"), this.FileID.Count, str); } listItem.Description = string.Format(LangCtrl.GetString("txt_ExportFileErrors", "File Errors: {0}"), num); this.vListBox.Items.Insert(listItem, 0); base.BeginInvoke(new MethodInvoker(() => { this.lblExportFileName.Text = string.Empty; this.lblExportHash.Text = string.Empty; })); })); } } base.BeginInvoke(new MethodInvoker(() => { try { if (!this.IsDVD) { this.picThumbnail.SizeMode = PictureBoxSizeMode.CenterImage; this.picThumbnail.Image = Properties.Resources.export; this.lbl_FileName.Text = LangCtrl.GetString("txt_FileExportCompleted", "File Export Completed..."); this.lbl_HashCode.Text = string.Empty; } else { this.picThumbnail.SizeMode = PictureBoxSizeMode.CenterImage; this.picThumbnail.Image = Properties.Resources.burndisc; this.lbl_FileName.Text = LangCtrl.GetString("txt_RecToDisc", "Record Files to Disc..."); this.lbl_HashCode.Text = string.Empty; (new ExportCD() { RootFolder = this.TEMP_FOLDER }).ShowDialog(this); DirectoryInfo directoryInfo = new DirectoryInfo(this.TEMP_FOLDER); FileInfo[] files = directoryInfo.GetFiles(); for (int i = 0; i < (int)files.Length; i++) { files[i].Delete(); } DirectoryInfo[] directories = directoryInfo.GetDirectories(); for (int j = 0; j < (int)directories.Length; j++) { directories[j].Delete(true); } Directory.Delete(this.TEMP_FOLDER); this.BurnCompleteCallback(); } } catch { } })); }