From: Vásáry Dániel Date: Sun, 26 Nov 2017 23:27:53 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=ab26a2022df458e12016a83ca27622a1a7a606fe;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30770 --- diff --git a/client/AudioRecorder/AudioDeviceSelectorForm.cs b/client/AudioRecorder/AudioDeviceSelectorForm.cs index 77386177..20f62e2a 100644 --- a/client/AudioRecorder/AudioDeviceSelectorForm.cs +++ b/client/AudioRecorder/AudioDeviceSelectorForm.cs @@ -44,7 +44,7 @@ namespace AudioRecorder { private void okButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; - parameters.audio_device_name = deviceNames[audioDevicesComboBox.SelectedIndex]; + parameters.DeviceName = deviceNames[audioDevicesComboBox.SelectedIndex]; Close(); } diff --git a/client/AudioRecorder/AudioRecorder.csproj b/client/AudioRecorder/AudioRecorder.csproj index 53fd4f12..737fd17c 100644 --- a/client/AudioRecorder/AudioRecorder.csproj +++ b/client/AudioRecorder/AudioRecorder.csproj @@ -123,20 +123,18 @@ AudioDeviceSelectorForm.cs - - UserControl + + Form - - CustomTrackBar.cs + + OctopusIDSelectorForm.cs - + Form - - FileNameForm.cs + + Form1.cs - - @@ -165,18 +163,15 @@ - - Component - AudioDeviceSelectorForm.cs - - CustomTrackBar.cs + + OctopusIDSelectorForm.cs - - FileNameForm.cs + + Form1.cs MainForm.cs diff --git a/client/AudioRecorder/AudioRecorderSettings.cs b/client/AudioRecorder/AudioRecorderSettings.cs index c7d2549c..70fb8924 100644 --- a/client/AudioRecorder/AudioRecorderSettings.cs +++ b/client/AudioRecorder/AudioRecorderSettings.cs @@ -1,27 +1,23 @@ using System; using Newtonsoft.Json; using System.IO; -using System.Windows.Forms; +using MaestroShared.Configuration; +using MaestroShared.Commons; namespace AudioRecorder { public class AudioRecorderSettings { - public String audio_device_name { get; set; } - public String unc_path { get; set; } - public int loud_percent { get; set; } - public String working_dir { get; set; } - - public Uri address { get; set; } - public String userName { get; set; } - public String password { get; set; } - public int timeout { get; set; } - + public string DeviceName { get; set; } + public int PeekMeterStep { get; set; } + public Uri WorkingDirectory { get; set; } + public OctopusMetadata Metadata { get; set; } + public Target Target { get; set; } public void Save(string fileName) { try { - File.WriteAllText(fileName, JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented)); + File.WriteAllText(fileName, JsonConvert.SerializeObject(this, Formatting.Indented)); } catch (Exception e) { - MessageBox.Show(e.Message); + MsgBox.Error(e.Message); } } } diff --git a/client/AudioRecorder/Configuration/audiorecorder.json b/client/AudioRecorder/Configuration/audiorecorder.json index 720bf366..0f5ca669 100644 --- a/client/AudioRecorder/Configuration/audiorecorder.json +++ b/client/AudioRecorder/Configuration/audiorecorder.json @@ -1,15 +1,14 @@ { - "audio_device_name": "", - "working_dir": "C:\\temp", - "loud_percent": 200, - "target" : { + "deviceName": "", + "workingDirectory": "file://C:\\temp", + "peekMeterStep": 200, + "target": { "label": "Octopus mappába küldés", "processor": "FTPTargetProcessor", "tag": "Betöltés", "outputFormat": "%ID%", "subFolderFormat": "%IDROOT%-%TEXT%", "killDateDays": 7, - "saveArchiveMetadata": false, "remote": { "address": "ftp://10.10.1.100/OCTOPUS", "userName": "mediacube", @@ -17,8 +16,11 @@ "timeout": 1000 } }, - "address": "http://10.10.1.27/services/rest/octopus/", - "userName": "dani", - "password": "dani", - "timeout": 1000 + "metadata" : { + "disableStoryCheck": true, + "server": { + "address": "http://10.10.1.27/services/rest/octopus/", + "timeout": 1000 + } + } } \ No newline at end of file diff --git a/client/AudioRecorder/CustomTrackBar.Designer.cs b/client/AudioRecorder/CustomTrackBar.Designer.cs deleted file mode 100644 index 6048f847..00000000 --- a/client/AudioRecorder/CustomTrackBar.Designer.cs +++ /dev/null @@ -1,75 +0,0 @@ -namespace AudioRecorder -{ - partial class CustomTrackBar - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tickLabel = new System.Windows.Forms.Label(); - this.trackBar1 = new System.Windows.Forms.TrackBar(); - ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit(); - this.SuspendLayout(); - // - // tickLabel - // - this.tickLabel.AutoSize = true; - this.tickLabel.ForeColor = System.Drawing.SystemColors.AppWorkspace; - this.tickLabel.Location = new System.Drawing.Point(19, 100); - this.tickLabel.Name = "tickLabel"; - this.tickLabel.Size = new System.Drawing.Size(13, 13); - this.tickLabel.TabIndex = 1; - this.tickLabel.Text = "_"; - // - // trackBar1 - // - this.trackBar1.Location = new System.Drawing.Point(0, 0); - this.trackBar1.Name = "trackBar1"; - this.trackBar1.Orientation = System.Windows.Forms.Orientation.Vertical; - this.trackBar1.Size = new System.Drawing.Size(45, 214); - this.trackBar1.TabIndex = 0; - this.trackBar1.TickFrequency = 0; - this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged); - // - // CustomTrackBar - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.tickLabel); - this.Controls.Add(this.trackBar1); - this.Name = "CustomTrackBar"; - this.Size = new System.Drawing.Size(40, 213); - ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label tickLabel; - private System.Windows.Forms.TrackBar trackBar1; - } -} diff --git a/client/AudioRecorder/CustomTrackBar.cs b/client/AudioRecorder/CustomTrackBar.cs deleted file mode 100644 index 0a997d85..00000000 --- a/client/AudioRecorder/CustomTrackBar.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace AudioRecorder { - public partial class CustomTrackBar : UserControl { - public delegate void SetValueDelegate(int value); - - public MainForm MainForm { get; set; } - - private SetValueDelegate setValueDelegate; - - public CustomTrackBar() { - InitializeComponent(); - } - - public void setMinimumMaximumSizesAndVolume(int minimum, int maximum, int value) { - trackBar1.Maximum = maximum; - trackBar1.Minimum = minimum; - trackBar1.Value = value; - } - - public void setTickLabelLocationByPercentage(int percentage) { - //mert a magasága a trackbarnak 200 - tickLabel.Location = new Point(tickLabel.Location.X, 200 - (percentage * 2)); - } - - private void trackBar1_ValueChanged(object sender, EventArgs e) { - MainForm.volumeChanged(sender, e); - } - - public void SetValue(int value) { - if (trackBar1.InvokeRequired) { - setValueDelegate = SetTrackBarValue; - this.Invoke(setValueDelegate, new Object[] { value }); - } else SetTrackBarValue(value); - } - - private void SetTrackBarValue(int value) { - trackBar1.Value = value; - } - } -} diff --git a/client/AudioRecorder/FileNameForm.cs b/client/AudioRecorder/FileNameForm.cs deleted file mode 100644 index d332f58e..00000000 --- a/client/AudioRecorder/FileNameForm.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Windows.Forms; -using OctopusClient; -using MaestroShared.Configuration; - -namespace AudioRecorder { - public partial class FileNameForm : Form { - private String result; - private MainForm mainForm; - public string ID { get; internal set; } - - public FileNameForm(MainForm mainForm, AudioRecorderSettings settings) { - InitializeComponent(); - this.mainForm = mainForm; - octopusIDSelector1.IDChangedEvent = IdChangedEvent; - octopusIDSelector1.Parameters = new OctopusParameters() { - UserName = "Hangalámondó", - Configuration = new OctopusMetadata() { - Server = new Connection() { - Address = settings.address, - Password = settings.password, - UserName = settings.userName, - Timeout = settings.timeout - } - } - }; - } - - private void IdChangedEvent(string id, string name, string text) { - buttonOK.Enabled = !String.IsNullOrEmpty(id); - ID = name; - } - - - private void cancelButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.Cancel; - Close(); - } - - private void buttonOK_Click(object sender, EventArgs e) { - DialogResult = DialogResult.OK; - Close(); - } - } -} diff --git a/client/AudioRecorder/FileWorker.cs b/client/AudioRecorder/FileWorker.cs deleted file mode 100644 index 1e7c22aa..00000000 --- a/client/AudioRecorder/FileWorker.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace AudioRecorder { - public class FileWorker : IFileWorker { - - public void copy(String source, String destination) { - File.Copy(source, destination, true); - } - - public void deleteFiles(List files) { - foreach (String actual in files) - if (File.Exists(actual)) - File.Delete(actual); - } - } -} diff --git a/client/AudioRecorder/Form1.Designer.cs b/client/AudioRecorder/Form1.Designer.cs new file mode 100644 index 00000000..7f4d80d6 --- /dev/null +++ b/client/AudioRecorder/Form1.Designer.cs @@ -0,0 +1,114 @@ +namespace AudioRecorder { + partial class Form1 { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.checkBox1); + this.flowLayoutPanel1.Controls.Add(this.checkBox2); + this.flowLayoutPanel1.Controls.Add(this.checkBox3); + this.flowLayoutPanel1.Controls.Add(this.textBox1); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(305, 100); + this.flowLayoutPanel1.TabIndex = 0; + // + // checkBox1 + // + this.checkBox1.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBox1.AutoSize = true; + this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.checkBox1.Location = new System.Drawing.Point(3, 3); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(71, 23); + this.checkBox1.TabIndex = 0; + this.checkBox1.Text = "checkBox1"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // checkBox2 + // + this.checkBox2.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBox2.AutoSize = true; + this.checkBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.checkBox2.Location = new System.Drawing.Point(80, 3); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(71, 23); + this.checkBox2.TabIndex = 1; + this.checkBox2.Text = "checkBox2"; + this.checkBox2.UseVisualStyleBackColor = true; + this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); + // + // checkBox3 + // + this.checkBox3.Appearance = System.Windows.Forms.Appearance.Button; + this.checkBox3.AutoSize = true; + this.checkBox3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.flowLayoutPanel1.SetFlowBreak(this.checkBox3, true); + this.checkBox3.Location = new System.Drawing.Point(157, 3); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Size = new System.Drawing.Size(71, 23); + this.checkBox3.TabIndex = 2; + this.checkBox3.Text = "checkBox3"; + this.checkBox3.UseVisualStyleBackColor = true; + // + // textBox1 + // + this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1.Location = new System.Drawing.Point(3, 32); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(243, 20); + this.textBox1.TabIndex = 3; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(305, 346); + this.Controls.Add(this.flowLayoutPanel1); + this.Name = "Form1"; + this.Text = "Form1"; + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.CheckBox checkBox3; + private System.Windows.Forms.TextBox textBox1; + } +} \ No newline at end of file diff --git a/client/AudioRecorder/Form1.cs b/client/AudioRecorder/Form1.cs new file mode 100644 index 00000000..071752da --- /dev/null +++ b/client/AudioRecorder/Form1.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AudioRecorder { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + } + + private void checkBox2_CheckedChanged(object sender, EventArgs e) { + + } + } +} diff --git a/client/AudioRecorder/CustomTrackBar.resx b/client/AudioRecorder/Form1.resx similarity index 100% rename from client/AudioRecorder/CustomTrackBar.resx rename to client/AudioRecorder/Form1.resx diff --git a/client/AudioRecorder/IFileWorker.cs b/client/AudioRecorder/IFileWorker.cs deleted file mode 100644 index a7eb761c..00000000 --- a/client/AudioRecorder/IFileWorker.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace AudioRecorder { - public interface IFileWorker { - void copy(String source, String destination); - void deleteFiles(List files); - } -} diff --git a/client/AudioRecorder/MainForm.Designer.cs b/client/AudioRecorder/MainForm.Designer.cs index a565f469..06a2b73b 100644 --- a/client/AudioRecorder/MainForm.Designer.cs +++ b/client/AudioRecorder/MainForm.Designer.cs @@ -33,15 +33,16 @@ namespace AudioRecorder { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.pauseButton = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.tbVolume = new System.Windows.Forms.TrackBar(); this.pmVolume = new Ernzo.WinForms.Controls.PeakMeterCtrl(); - this.txtRecordFilePath = new System.Windows.Forms.Label(); this.playButton = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.tbVolume = new System.Windows.Forms.TrackBar(); + this.txtRecordFilePath = new System.Windows.Forms.TextBox(); + this.pbUpload = new System.Windows.Forms.ProgressBar(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tbVolume)).BeginInit(); + this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // recordButton @@ -51,12 +52,12 @@ namespace AudioRecorder { this.recordButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.recordButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.recordButton.Image = ((System.Drawing.Image)(resources.GetObject("recordButton.Image"))); - this.recordButton.Location = new System.Drawing.Point(51, 85); + this.recordButton.Location = new System.Drawing.Point(33, 79); this.recordButton.Name = "recordButton"; - this.recordButton.Size = new System.Drawing.Size(129, 56); + this.recordButton.Size = new System.Drawing.Size(181, 56); this.recordButton.TabIndex = 0; this.recordButton.Text = "Record"; - this.recordButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.recordButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.recordButton.UseVisualStyleBackColor = false; this.recordButton.Click += new System.EventHandler(this.OnRecordClick); // @@ -68,14 +69,14 @@ namespace AudioRecorder { this.stopButton.Enabled = false; this.stopButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image"))); - this.stopButton.Location = new System.Drawing.Point(51, 186); + this.stopButton.Location = new System.Drawing.Point(33, 180); this.stopButton.Name = "stopButton"; - this.stopButton.Size = new System.Drawing.Size(129, 38); + this.stopButton.Size = new System.Drawing.Size(181, 38); this.stopButton.TabIndex = 1; this.stopButton.Text = "Stop "; - this.stopButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.stopButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.stopButton.UseVisualStyleBackColor = false; - this.stopButton.Click += new System.EventHandler(this.stop_Click); + this.stopButton.Click += new System.EventHandler(this.OnStopClick); // // timecodeLabel // @@ -91,13 +92,13 @@ namespace AudioRecorder { // btnSelectAudio // this.btnSelectAudio.BackColor = System.Drawing.Color.White; - this.btnSelectAudio.Location = new System.Drawing.Point(8, 19); + this.btnSelectAudio.Location = new System.Drawing.Point(9, 19); this.btnSelectAudio.Name = "btnSelectAudio"; - this.btnSelectAudio.Size = new System.Drawing.Size(307, 23); + this.btnSelectAudio.Size = new System.Drawing.Size(312, 23); this.btnSelectAudio.TabIndex = 3; this.btnSelectAudio.Text = "Select audio"; this.btnSelectAudio.UseVisualStyleBackColor = false; - this.btnSelectAudio.Click += new System.EventHandler(this.selectAudioButton_Click); + this.btnSelectAudio.Click += new System.EventHandler(this.OnSelectAudioClick); // // groupBox1 // @@ -119,14 +120,14 @@ namespace AudioRecorder { this.pauseButton.Enabled = false; this.pauseButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold); this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image"))); - this.pauseButton.Location = new System.Drawing.Point(51, 148); + this.pauseButton.Location = new System.Drawing.Point(33, 142); this.pauseButton.Name = "pauseButton"; - this.pauseButton.Size = new System.Drawing.Size(129, 32); + this.pauseButton.Size = new System.Drawing.Size(181, 32); this.pauseButton.TabIndex = 3; this.pauseButton.Text = "Pause "; - this.pauseButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.pauseButton.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.pauseButton.UseVisualStyleBackColor = false; - this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click); + this.pauseButton.Click += new System.EventHandler(this.OnPauseClick); // // groupBox2 // @@ -138,6 +139,20 @@ namespace AudioRecorder { this.groupBox2.TabIndex = 6; this.groupBox2.TabStop = false; // + // tbVolume + // + this.tbVolume.LargeChange = 10; + this.tbVolume.Location = new System.Drawing.Point(27, 16); + this.tbVolume.Maximum = 100; + this.tbVolume.Name = "tbVolume"; + this.tbVolume.Orientation = System.Windows.Forms.Orientation.Vertical; + this.tbVolume.Size = new System.Drawing.Size(45, 220); + this.tbVolume.SmallChange = 2; + this.tbVolume.TabIndex = 13; + this.tbVolume.TickFrequency = 10; + this.tbVolume.TickStyle = System.Windows.Forms.TickStyle.Both; + this.tbVolume.ValueChanged += new System.EventHandler(this.OnVolumeChanged); + // // pmVolume // this.pmVolume.BandsCount = 1; @@ -156,23 +171,17 @@ namespace AudioRecorder { this.pmVolume.TabIndex = 12; this.pmVolume.Text = "pmVolume"; // - // fileNameLabel - // - this.txtRecordFilePath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.txtRecordFilePath.Location = new System.Drawing.Point(8, 45); - this.txtRecordFilePath.Name = "fileNameLabel"; - this.txtRecordFilePath.Size = new System.Drawing.Size(233, 23); - this.txtRecordFilePath.TabIndex = 8; - // // playButton // this.playButton.BackColor = System.Drawing.Color.White; this.playButton.Enabled = false; + this.playButton.FlatAppearance.BorderSize = 0; + this.playButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.playButton.Image = ((System.Drawing.Image)(resources.GetObject("playButton.Image"))); this.playButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.playButton.Location = new System.Drawing.Point(247, 45); + this.playButton.Location = new System.Drawing.Point(250, 46); this.playButton.Name = "playButton"; - this.playButton.Size = new System.Drawing.Size(68, 23); + this.playButton.Size = new System.Drawing.Size(71, 23); this.playButton.TabIndex = 9; this.playButton.Text = "Play"; this.playButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; @@ -181,35 +190,37 @@ namespace AudioRecorder { // // groupBox3 // + this.groupBox3.Controls.Add(this.pbUpload); + this.groupBox3.Controls.Add(this.txtRecordFilePath); this.groupBox3.Controls.Add(this.btnSelectAudio); this.groupBox3.Controls.Add(this.playButton); - this.groupBox3.Controls.Add(this.txtRecordFilePath); this.groupBox3.Location = new System.Drawing.Point(15, 258); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(332, 86); + this.groupBox3.Size = new System.Drawing.Size(332, 97); this.groupBox3.TabIndex = 10; this.groupBox3.TabStop = false; // - // tbVolume + // txtRecordFilePath // - this.tbVolume.LargeChange = 10; - this.tbVolume.Location = new System.Drawing.Point(27, 16); - this.tbVolume.Maximum = 100; - this.tbVolume.Name = "tbVolume"; - this.tbVolume.Orientation = System.Windows.Forms.Orientation.Vertical; - this.tbVolume.Size = new System.Drawing.Size(45, 220); - this.tbVolume.SmallChange = 2; - this.tbVolume.TabIndex = 13; - this.tbVolume.TickFrequency = 10; - this.tbVolume.TickStyle = System.Windows.Forms.TickStyle.Both; - this.tbVolume.ValueChanged += new System.EventHandler(this.OnVolumeChanged); + this.txtRecordFilePath.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.txtRecordFilePath.Location = new System.Drawing.Point(10, 46); + this.txtRecordFilePath.Name = "txtRecordFilePath"; + this.txtRecordFilePath.Size = new System.Drawing.Size(233, 23); + this.txtRecordFilePath.TabIndex = 10; + // + // pbUpload + // + this.pbUpload.Location = new System.Drawing.Point(9, 75); + this.pbUpload.Name = "pbUpload"; + this.pbUpload.Size = new System.Drawing.Size(312, 9); + this.pbUpload.TabIndex = 11; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(365, 350); + this.ClientSize = new System.Drawing.Size(363, 370); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -225,8 +236,9 @@ namespace AudioRecorder { this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); - this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.tbVolume)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); this.ResumeLayout(false); } @@ -239,12 +251,13 @@ namespace AudioRecorder { private System.Windows.Forms.Button btnSelectAudio; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label txtRecordFilePath; private System.Windows.Forms.Button playButton; private System.Windows.Forms.Button pauseButton; private System.Windows.Forms.GroupBox groupBox3; private Ernzo.WinForms.Controls.PeakMeterCtrl pmVolume; private System.Windows.Forms.TrackBar tbVolume; + private System.Windows.Forms.TextBox txtRecordFilePath; + private System.Windows.Forms.ProgressBar pbUpload; } } diff --git a/client/AudioRecorder/MainForm.cs b/client/AudioRecorder/MainForm.cs index b14e058e..8b013eaf 100644 --- a/client/AudioRecorder/MainForm.cs +++ b/client/AudioRecorder/MainForm.cs @@ -7,6 +7,11 @@ using System.Windows.Forms; using System.IO; using MaestroShared.Configuration; using System.ComponentModel; +using MaestroShared.Commons; +using MaestroShared.Target; +using OctopusClient; +using System.Security.Principal; +using MaestroShared.Targets; namespace AudioRecorder { public delegate void RefreshPanelDelegate(); @@ -14,20 +19,22 @@ namespace AudioRecorder { public partial class MainForm : Form { private const String CONFIG_FILE = "Configuration/audiorecorder.json"; - + private const string WAV_EXT = ".WAV"; private IAudioDevicesDetector devicesDetector; private List audioDevicesNames; private int selectedDeviceIndex = -1; private WavRecorder recorder; private AudioRecorderSettings parameters; private ITimeCodeWorker timeCodeWorker; - private IFileWorker fileWorker; private bool recording; private Timer countDownTimer; private int countDown = 3; private MMDevice currentDevice; private bool pausing; private BackgroundWorker volumeMonitor; + private string currentRecordingPath; + private Story currentStory; + ITargetProcessor processor; public MainForm() { InitializeComponent(); @@ -60,32 +67,33 @@ namespace AudioRecorder { private void Cleanup() { if (CurrentDevice != null) - CurrentDevice.AudioEndpointVolume.OnVolumeNotification -= AudioEndpointVolume_OnVolumeNotification; + CurrentDevice.AudioEndpointVolume.OnVolumeNotification -= OnAudioEndpointVolumeChanged; if (recorder != null) - recorder = null; + recorder.Dispose(); + } private void OnMainShown(object sender, EventArgs e) { - try { parameters = Loader.Get(CONFIG_FILE); - UpdateGUI(); + processor = TargetProcessor.Create(parameters.Target.Processor); + pbUpload.DataBindings.Add(new Binding("Value", processor, "Progress")); - fileWorker = new FileWorker(); + UpdateGUI(); timeCodeWorker = new TimeCodeWorker(timecodeLabel); countDownTimer = new Timer(); countDownTimer.Interval = 1000; - countDownTimer.Tick += new EventHandler(timer_Tick); + countDownTimer.Tick += new EventHandler(OnCountDownTick); devicesDetector = new AudioDevicesDetector(); devicesDetector.findDevices(); audioDevicesNames = devicesDetector.getDeviceNames(); - if (!String.IsNullOrEmpty(parameters.audio_device_name) && audioDevicesNames != null) - SelectedDeviceIndex = audioDevicesNames.IndexOf(parameters.audio_device_name); + if (!String.IsNullOrEmpty(parameters.DeviceName) && audioDevicesNames != null) + SelectedDeviceIndex = audioDevicesNames.IndexOf(parameters.DeviceName); if (SelectedDeviceIndex < 0) ShowAudioDeviceSelectorForm(); } catch (Exception ex) { - MessageBox.Show(ex.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); + MsgBox.Error(ex.Message); } } @@ -93,11 +101,12 @@ namespace AudioRecorder { while (!e.Cancel) { try { float value = currentDevice.AudioMeterInformation.MasterPeakValue * 1000; - int[] levels = { (int) Math.Floor(value) }; - Debug.WriteLine(String.Format($"Values {levels[0]}")); + int[] levels = { (int)Math.Floor(value) }; + //Debug.WriteLine(String.Format($"Values {levels[0]}")); pmVolume.SetData(levels, 0, 1); System.Threading.Thread.Sleep(100); - } catch (Exception ex) { + } + catch (Exception ex) { Debug.WriteLine(ex.Message); } } @@ -105,7 +114,7 @@ namespace AudioRecorder { private void UpdateGUI() { if (CurrentDevice == null) { - int steps = parameters.loud_percent; + int steps = parameters.PeekMeterStep; pmVolume.SetRange(steps * 3, steps * 4, steps * 5); pmVolume.SetData(new int[] { 0 }, 0, 1); recordButton.Enabled = false; @@ -119,7 +128,7 @@ namespace AudioRecorder { Debug.WriteLine($"Levels {CurrentDevice.AudioEndpointVolume.VolumeRange.MinDecibels} {CurrentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels} V {CurrentDevice.AudioEndpointVolume.MasterVolumeLevel}"); recordButton.Enabled = true; recordButton.BackColor = Color.Lime; - btnSelectAudio.Text = parameters.audio_device_name; + btnSelectAudio.Text = parameters.DeviceName; volumeMonitor = new BackgroundWorker(); volumeMonitor.WorkerSupportsCancellation = true; volumeMonitor.DoWork += OnMonitorVolume; @@ -136,22 +145,18 @@ namespace AudioRecorder { } public void Initialize() { - currentDevice.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification; - recorder = new WavRecorder(SelectedDeviceIndex, CurrentDevice, this); - } - - void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data) { - this.BeginInvoke(new Action(() => { - tbVolume.Value = (int)Math.Round(CurrentDevice.AudioEndpointVolume.MasterVolumeLevel); - })); - } - - - private void stop_Click(object sender, EventArgs e) { - stopRecording(); + currentDevice.AudioEndpointVolume.OnVolumeNotification += OnAudioEndpointVolumeChanged; + try { + //if (!Directory.Exists(parameters.WorkingDirectory.LocalPath)) + Directory.CreateDirectory(parameters.WorkingDirectory.LocalPath); + recorder = new WavRecorder(SelectedDeviceIndex, CurrentDevice); + } + catch (Exception ex) { + MsgBox.Error(ex.Message); + } } - private void startRecord() { + private void StartRecord() { try { recording = true; recorder.StartRecording(txtRecordFilePath.Text); @@ -165,12 +170,21 @@ namespace AudioRecorder { recordButton.BackColor = Color.White; } catch (Exception e) { - MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); + MsgBox.Error(e.Message); } } + private void OnCountDownTick(object sender, EventArgs e) { + recordButton.Text = countDown.ToString(); + if (countDown-- < 0) { + countDownTimer.Stop(); + recordButton.Text = StringResources.RECORD; + StartRecord(); + countDown = 3; + } + } - private void stopRecording() { + private void StopRecord() { try { recording = false; recordButton.Enabled = true; @@ -178,83 +192,67 @@ namespace AudioRecorder { btnSelectAudio.Enabled = true; pauseButton.Enabled = false; - recorder.StopRecording(); + recorder.StopRecord(); timeCodeWorker.Stop(); playButton.Enabled = true; stopButton.BackColor = Color.White; recordButton.BackColor = Color.Lime; - //copyFileToUncPath(); + Export(); } catch (Exception e) { - MessageBox.Show(e.Message, StringResources.ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); + MsgBox.Error(e.Message); } } - private void copyFileToUncPath() { - FileInfo fileInfo = new FileInfo(recorder.getCurentWavFilePath()); - String wavFileName = fileInfo.Name; - String wavUncPath = DetermineWorkingDirectory(parameters.unc_path, fileInfo.Name); - if (!Directory.Exists(wavUncPath)) - Directory.CreateDirectory(wavUncPath); - wavUncPath = Path.Combine(wavUncPath, fileInfo.Name); - //String.Format("{0}{1}{2}", settings.getUncPath(), Path.DirectorySeparatorChar, wavFileName); - fileWorker.copy(recorder.getCurentWavFilePath(), wavUncPath); - } - - protected String DetermineWorkingDirectory(string path, string ID) { - string result = path; - string subDir = ID; - if (ID.Contains("_")) - subDir = ID.Split('_')[0]; - if (ID.Contains(".")) - subDir = ID.Split('.')[0]; - result = Path.Combine(path, subDir); - return result; - } - private void OnRecordClick(object sender, EventArgs e) { - FileNameForm idSelectorForm = new FileNameForm(this, parameters); + OctopusIDSelectorForm idSelectorForm = new OctopusIDSelectorForm(parameters); if (idSelectorForm.ShowDialog() == DialogResult.Cancel) return; - //string fileName = String.Format("{0}{1}", StringResources.DOT_WAV); - //currentFilePath = Path.Combine(parameters.working_dir, fileName); - recordFireEvent(idSelectorForm.ID); + currentStory = idSelectorForm.SelectedStory; + currentRecordingPath = CreateCurrenRecordingPath(parameters.WorkingDirectory.LocalPath, currentStory.ID); + txtRecordFilePath.Text = currentRecordingPath; + if (String.IsNullOrEmpty(currentRecordingPath)) + return; + txtRecordFilePath.SelectionStart = txtRecordFilePath.Text.Length - 1; + txtRecordFilePath.SelectionLength = 0; + recordButton.Enabled = false; + countDownTimer.Start(); //startRecord(); } - public void recordFireEvent(String id) { - recordButton.Enabled = false; - if (!Directory.Exists(parameters.working_dir)) - Directory.CreateDirectory(parameters.working_dir); - - txtRecordFilePath.Text = GetCurrentFileNameAndPath(parameters.working_dir, id); ; - countDownTimer.Start(); + private void OnStopClick(object sender, EventArgs e) { + StopRecord(); + } + + private void OnPauseClick(object sender, EventArgs e) { + pausing = !pausing; + recorder.pauseRecording(pausing); + timeCodeWorker.Pause(pausing); + } + + private void OnPlayClick(object sender, EventArgs e) { + if (String.IsNullOrEmpty(currentRecordingPath) || !File.Exists(currentRecordingPath)) + return; + Process process = new Process(); + process.StartInfo = new ProcessStartInfo() { + FileName = currentRecordingPath + }; + process.Start(); } - private string GetCurrentFileNameAndPath(string path, string id) { - string fileName = String.Format("{0}{1}", id, ".WAV"); + private string CreateCurrenRecordingPath(string path, string id) { + string fileName = String.Format("{0}{1}", id, WAV_EXT); int i = 1; string fullPath = Path.Combine(path, fileName); while (File.Exists(fullPath)) { - fileName = String.Format("{0}-{1}{2}", id, i, ".WAV"); + fileName = String.Format("{0}-{1}{2}", id, i, WAV_EXT); fullPath = Path.Combine(path, fileName); i++; } - return fileName; + return fullPath; } - void timer_Tick(object sender, EventArgs e) { - recordButton.Text = countDown.ToString(); - countDown -= 1; - if (countDown < 0) { - countDownTimer.Stop(); - recordButton.Text = StringResources.RECORD; - startRecord(); - countDown = 3; - } - } - - private void selectAudioButton_Click(object sender, EventArgs e) { + private void OnSelectAudioClick(object sender, EventArgs e) { ShowAudioDeviceSelectorForm(true); } @@ -270,57 +268,46 @@ namespace AudioRecorder { parameters.Save(CONFIG_FILE); } - private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { - if (recording) - e.Cancel = true; - else - deleteTemporariFiles(); - } - - private void deleteTemporariFiles() { - //if (recorder != null) { - // List createdFiles = recorder.getCreatedFiles(); - // fileWorker.deleteFiles(createdFiles); - //} - } - - private void OnPlayClick(object sender, EventArgs e) { - Process process = new Process(); - ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = new FileInfo(txtRecordFilePath.Text).FullName; - process.StartInfo = startInfo; - process.Start(); - } - - private void volumeTrackBar_ValueChanged(object sender, EventArgs e) { - TrackBar trackbar = sender as TrackBar; - if (trackbar == null) - return; - if (CurrentDevice == null) - return; - int value = trackbar.Value; - CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = value; + void OnAudioEndpointVolumeChanged(AudioVolumeNotificationData data) { + this.BeginInvoke(new Action(() => { + tbVolume.Value = (int)Math.Round(CurrentDevice.AudioEndpointVolume.MasterVolumeLevel); + })); } - private void pauseButton_Click(object sender, EventArgs e) { - pausing = !pausing; - recorder.pauseRecording(pausing); - timeCodeWorker.Pause(pausing); + private void OnVolumeChanged(object sender, EventArgs e) { + CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = tbVolume.Value; + Debug.WriteLine($"Levels {CurrentDevice.AudioEndpointVolume.VolumeRange.MinDecibels} {CurrentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels} V {CurrentDevice.AudioEndpointVolume.MasterVolumeLevel}"); } - public void volumeChanged(object sender, EventArgs e) { - TrackBar trackbar = sender as TrackBar; - if (trackbar == null) - return; - if (CurrentDevice == null) - return; - int value = trackbar.Value; - CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = value; + private void Export() { + TargetProcessorParameter processorParameter = new TargetProcessorParameter() { + SourceConfig = new Source() { + Local = new Connection() { + Address = parameters.WorkingDirectory + } + }, + TargetConfig = parameters.Target, + ID = currentStory.ID, + MetadataText = currentStory.Name, + InputFileName = Path.GetFileName(currentRecordingPath), + UserName = WindowsIdentity.GetCurrent().Name + }; + + ITargetProcessor processor = TargetProcessor.Create(parameters.Target.Processor); + processor.Initialize(null, processorParameter); + processor.Execute(); + + if (TargetProcessor.READY.Equals(processor.Status)) + MsgBox.Info(String.Format($"Sikeres betöltés: {processor.Output}")); + else + MsgBox.Error(processor.Message); } - private void OnVolumeChanged(object sender, EventArgs e) { - CurrentDevice.AudioEndpointVolume.MasterVolumeLevel = tbVolume.Value; - Debug.WriteLine($"Levels {CurrentDevice.AudioEndpointVolume.VolumeRange.MinDecibels} {CurrentDevice.AudioEndpointVolume.VolumeRange.MaxDecibels} V {CurrentDevice.AudioEndpointVolume.MasterVolumeLevel}"); + private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { + if (recording) + e.Cancel = true; + else + Cleanup(); } } } diff --git a/client/AudioRecorder/FileNameForm.Designer.cs b/client/AudioRecorder/OctopusIDSelectorForm.Designer.cs similarity index 55% rename from client/AudioRecorder/FileNameForm.Designer.cs rename to client/AudioRecorder/OctopusIDSelectorForm.Designer.cs index 0a36f7f3..e60cbe4e 100644 --- a/client/AudioRecorder/FileNameForm.Designer.cs +++ b/client/AudioRecorder/OctopusIDSelectorForm.Designer.cs @@ -1,5 +1,5 @@ namespace AudioRecorder { - partial class FileNameForm { + partial class OctopusIDSelectorForm { /// /// Required designer variable. /// @@ -23,71 +23,86 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FileNameForm)); - this.octopusIDSelector1 = new OctopusClient.OctopusIDSelector(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OctopusIDSelectorForm)); + this.octopusIDSelector = new OctopusClient.OctopusIDSelector(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonOK = new System.Windows.Forms.Button(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // - // octopusIDSelector1 + // octopusIDSelector // - this.octopusIDSelector1.BackColor = System.Drawing.Color.White; - this.octopusIDSelector1.IDChangedEvent = null; - this.octopusIDSelector1.Location = new System.Drawing.Point(7, 8); - this.octopusIDSelector1.Margin = new System.Windows.Forms.Padding(10); - this.octopusIDSelector1.Name = "octopusIDSelector1"; - this.octopusIDSelector1.Padding = new System.Windows.Forms.Padding(10); - this.octopusIDSelector1.Size = new System.Drawing.Size(271, 337); - this.octopusIDSelector1.TabIndex = 5; + this.octopusIDSelector.BackColor = System.Drawing.Color.White; + this.octopusIDSelector.Dock = System.Windows.Forms.DockStyle.Fill; + this.octopusIDSelector.IDChangedEvent = null; + this.octopusIDSelector.Location = new System.Drawing.Point(0, 0); + this.octopusIDSelector.Margin = new System.Windows.Forms.Padding(0); + this.octopusIDSelector.Name = "octopusIDSelector"; + this.octopusIDSelector.Padding = new System.Windows.Forms.Padding(4); + this.octopusIDSelector.Size = new System.Drawing.Size(395, 355); + this.octopusIDSelector.TabIndex = 5; // // buttonCancel // this.buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.buttonCancel.Location = new System.Drawing.Point(118, 356); + this.buttonCancel.Location = new System.Drawing.Point(228, 7); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 6; - this.buttonCancel.Text = "Mégse"; + this.buttonCancel.Text = "Mégsem"; this.buttonCancel.UseVisualStyleBackColor = true; // - // buttonRendben + // buttonOK // this.buttonOK.Enabled = false; - this.buttonOK.Location = new System.Drawing.Point(195, 356); - this.buttonOK.Name = "buttonRendben"; + this.buttonOK.Location = new System.Drawing.Point(309, 7); + this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.TabIndex = 7; this.buttonOK.Text = "Rendben"; this.buttonOK.UseVisualStyleBackColor = true; - this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + this.buttonOK.Click += new System.EventHandler(this.OnOKClick); // - // FileNameForm + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.buttonOK); + this.flowLayoutPanel1.Controls.Add(this.buttonCancel); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 355); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(4); + this.flowLayoutPanel1.Size = new System.Drawing.Size(395, 37); + this.flowLayoutPanel1.TabIndex = 8; + // + // OctopusIDSelectorForm // - this.AcceptButton = this.buttonOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.CancelButton = this.buttonCancel; - this.ClientSize = new System.Drawing.Size(276, 383); + this.ClientSize = new System.Drawing.Size(395, 392); this.ControlBox = false; - this.Controls.Add(this.buttonOK); - this.Controls.Add(this.buttonCancel); - this.Controls.Add(this.octopusIDSelector1); + this.Controls.Add(this.octopusIDSelector); + this.Controls.Add(this.flowLayoutPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "FileNameForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Name = "OctopusIDSelectorForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "File Name"; + this.flowLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); } #endregion - private OctopusClient.OctopusIDSelector octopusIDSelector1; + private OctopusClient.OctopusIDSelector octopusIDSelector; private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; } } \ No newline at end of file diff --git a/client/AudioRecorder/OctopusIDSelectorForm.cs b/client/AudioRecorder/OctopusIDSelectorForm.cs new file mode 100644 index 00000000..a1473a73 --- /dev/null +++ b/client/AudioRecorder/OctopusIDSelectorForm.cs @@ -0,0 +1,37 @@ +using System; +using System.Windows.Forms; +using OctopusClient; +using System.Security.Principal; + +namespace AudioRecorder { + public partial class OctopusIDSelectorForm : Form { + public Story SelectedStory { get; internal set; } + + public OctopusIDSelectorForm(AudioRecorderSettings settings) { + InitializeComponent(); + octopusIDSelector.IDChangedEvent = IdChangedEvent; + octopusIDSelector.Parameters = new OctopusParameters() { + UserName = WindowsIdentity.GetCurrent().Name, + Configuration = settings.Metadata, + }; + } + + private void IdChangedEvent(string id, string name, string text) { + buttonOK.Enabled = !String.IsNullOrEmpty(id); + SelectedStory = new Story() { + ID = name, + Name = text + }; + } + + private void OnCancelClick(object sender, EventArgs e) { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void OnOKClick(object sender, EventArgs e) { + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/client/AudioRecorder/FileNameForm.resx b/client/AudioRecorder/OctopusIDSelectorForm.resx similarity index 100% rename from client/AudioRecorder/FileNameForm.resx rename to client/AudioRecorder/OctopusIDSelectorForm.resx diff --git a/client/AudioRecorder/VerticalProgressBar.cs b/client/AudioRecorder/VerticalProgressBar.cs deleted file mode 100644 index 2cc3d0f1..00000000 --- a/client/AudioRecorder/VerticalProgressBar.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using System.Runtime.InteropServices; - -namespace AudioRecorder { - class VerticalProgressBar : ProgressBar { - - [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)] - public extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList); - - public VerticalProgressBar() { - Style = ProgressBarStyle.Blocks; - } - - protected override void CreateHandle() { - base.CreateHandle(); - try { - SetWindowTheme(this.Handle, "", ""); - } - catch { } - } - - protected override CreateParams CreateParams { - get { - CreateParams cp = base.CreateParams; - cp.Style |= 0x04; - return cp; - } - } - } -} diff --git a/client/AudioRecorder/WavRecorder.cs b/client/AudioRecorder/WavRecorder.cs index ce0ac740..f5b215ba 100644 --- a/client/AudioRecorder/WavRecorder.cs +++ b/client/AudioRecorder/WavRecorder.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using NAudio.Wave; using NAudio.CoreAudioApi; +using System.IO; +using MaestroShared.Commons; namespace AudioRecorder { public class WavRecorder { @@ -11,16 +13,14 @@ namespace AudioRecorder { private IWaveIn sourceStream; private WaveFileWriter waveWriter; private String filePath; - private List createdWavFiles; + private List recordedFiles; private MMDevice device; - private MainForm mainForm; private volatile bool pausing; - public WavRecorder(int inputDeviceIndex, MMDevice device, MainForm mainForm) { + public WavRecorder(int inputDeviceIndex, MMDevice device) { this.inputDeviceIndex = inputDeviceIndex; - createdWavFiles = new List(); + recordedFiles = new List(); this.device = device; - this.mainForm = mainForm; } public void StartRecording(String filePath) { @@ -31,7 +31,7 @@ namespace AudioRecorder { sourceStream.DataAvailable += newEventHandler(); waveWriter = newWavFileWriter(); sourceStream.StartRecording(); - createdWavFiles.Add(filePath); + recordedFiles.Add(filePath); } protected virtual EventHandler newEventHandler() { @@ -59,7 +59,20 @@ namespace AudioRecorder { } } - public void StopRecording() { + public void Dispose() { + foreach (String file in recordedFiles) { + if (File.Exists(file)) { + try { + File.Delete(file); + } + catch (Exception ex) { + MsgBox.Exclamation(ex.Message); + } + } + } + } + + public void StopRecord() { if (sourceStream != null) { sourceStream.StopRecording(); sourceStream.Dispose(); @@ -76,12 +89,5 @@ namespace AudioRecorder { this.pausing = pausing; } - public List getCreatedFiles() { - return createdWavFiles; - } - - public String getCurentWavFilePath() { - return filePath; - } } } diff --git a/client/MaestroShared/Commons/MsgBox.cs b/client/MaestroShared/Commons/MsgBox.cs new file mode 100644 index 00000000..044df304 --- /dev/null +++ b/client/MaestroShared/Commons/MsgBox.cs @@ -0,0 +1,21 @@ +using System.Windows.Forms; + +namespace MaestroShared.Commons { + public class MsgBox { + public static void Info(string text) { + MessageBox.Show(text, null, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + public static void Error(string text) { + MessageBox.Show(text, null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + public static void Warning(string text) { + MessageBox.Show(text, null, MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + + public static void Exclamation(string text) { + MessageBox.Show(text, null, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } + } +} diff --git a/client/MaestroShared/MaestroShared.csproj b/client/MaestroShared/MaestroShared.csproj index 2d5b76ce..002a9c55 100644 --- a/client/MaestroShared/MaestroShared.csproj +++ b/client/MaestroShared/MaestroShared.csproj @@ -80,6 +80,7 @@ + @@ -103,6 +104,11 @@ + + True + True + Resources.resx + @@ -129,6 +135,34 @@ ColorSlider.cs + + PublicResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/MaestroShared/Properties/Resources.Designer.cs b/client/MaestroShared/Properties/Resources.Designer.cs new file mode 100644 index 00000000..fdfa5f1d --- /dev/null +++ b/client/MaestroShared/Properties/Resources.Designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// +// 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 MaestroShared.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MaestroShared.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_fiber_manual_record_black_24dp_1x { + get { + object obj = ResourceManager.GetObject("ic_fiber_manual_record_black_24dp_1x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_fiber_manual_record_black_24dp_2x { + get { + object obj = ResourceManager.GetObject("ic_fiber_manual_record_black_24dp_2x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_pause_black_24dp_1x { + get { + object obj = ResourceManager.GetObject("ic_pause_black_24dp_1x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_pause_black_24dp_2x { + get { + object obj = ResourceManager.GetObject("ic_pause_black_24dp_2x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_play_arrow_black_24dp_1x { + get { + object obj = ResourceManager.GetObject("ic_play_arrow_black_24dp_1x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_play_arrow_black_24dp_2x { + get { + object obj = ResourceManager.GetObject("ic_play_arrow_black_24dp_2x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_stop_black_24dp_1x { + get { + object obj = ResourceManager.GetObject("ic_stop_black_24dp_1x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap ic_stop_black_24dp_2x { + get { + object obj = ResourceManager.GetObject("ic_stop_black_24dp_2x", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/client/MaestroShared/Properties/Resources.resx b/client/MaestroShared/Properties/Resources.resx new file mode 100644 index 00000000..895f6dbd --- /dev/null +++ b/client/MaestroShared/Properties/Resources.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + ..\Resources\ic_fiber_manual_record_black_24dp_1x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_fiber_manual_record_black_24dp_2x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_pause_black_24dp_1x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_pause_black_24dp_2x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_play_arrow_black_24dp_1x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_play_arrow_black_24dp_2x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_stop_black_24dp_1x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ic_stop_black_24dp_2x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/client/MaestroShared/Resources/ic_fiber_manual_record_black_24dp_1x.png b/client/MaestroShared/Resources/ic_fiber_manual_record_black_24dp_1x.png new file mode 100644 index 00000000..cfc8b4e6 Binary files /dev/null and b/client/MaestroShared/Resources/ic_fiber_manual_record_black_24dp_1x.png differ diff --git a/client/MaestroShared/Resources/ic_fiber_manual_record_black_24dp_2x.png b/client/MaestroShared/Resources/ic_fiber_manual_record_black_24dp_2x.png new file mode 100644 index 00000000..3eb79e4c Binary files /dev/null and b/client/MaestroShared/Resources/ic_fiber_manual_record_black_24dp_2x.png differ diff --git a/client/MaestroShared/Resources/ic_pause_black_24dp_1x.png b/client/MaestroShared/Resources/ic_pause_black_24dp_1x.png new file mode 100644 index 00000000..6145664b Binary files /dev/null and b/client/MaestroShared/Resources/ic_pause_black_24dp_1x.png differ diff --git a/client/MaestroShared/Resources/ic_pause_black_24dp_2x.png b/client/MaestroShared/Resources/ic_pause_black_24dp_2x.png new file mode 100644 index 00000000..74068eae Binary files /dev/null and b/client/MaestroShared/Resources/ic_pause_black_24dp_2x.png differ diff --git a/client/MaestroShared/Resources/ic_play_arrow_black_24dp_1x.png b/client/MaestroShared/Resources/ic_play_arrow_black_24dp_1x.png new file mode 100644 index 00000000..d78c57ba Binary files /dev/null and b/client/MaestroShared/Resources/ic_play_arrow_black_24dp_1x.png differ diff --git a/client/MaestroShared/Resources/ic_play_arrow_black_24dp_2x.png b/client/MaestroShared/Resources/ic_play_arrow_black_24dp_2x.png new file mode 100644 index 00000000..f208795f Binary files /dev/null and b/client/MaestroShared/Resources/ic_play_arrow_black_24dp_2x.png differ diff --git a/client/MaestroShared/Resources/ic_stop_black_24dp_1x.png b/client/MaestroShared/Resources/ic_stop_black_24dp_1x.png new file mode 100644 index 00000000..0588f0b4 Binary files /dev/null and b/client/MaestroShared/Resources/ic_stop_black_24dp_1x.png differ diff --git a/client/MaestroShared/Resources/ic_stop_black_24dp_2x.png b/client/MaestroShared/Resources/ic_stop_black_24dp_2x.png new file mode 100644 index 00000000..b002ab78 Binary files /dev/null and b/client/MaestroShared/Resources/ic_stop_black_24dp_2x.png differ diff --git a/client/MaestroShared/Targets/FTPTargetProcessor.cs b/client/MaestroShared/Targets/FTPTargetProcessor.cs index ee19782a..cc539220 100644 --- a/client/MaestroShared/Targets/FTPTargetProcessor.cs +++ b/client/MaestroShared/Targets/FTPTargetProcessor.cs @@ -20,14 +20,14 @@ namespace MaestroShared.Targets { public override void Initialize(Control parent, TargetProcessorParameter parameters) { base.Initialize(parent, parameters); FtpTrace.LogFunctions = false; - if (!(parameters.SourceConfig is UNCSource)) { - inputFile = null; - string address = parameters?.SourceConfig?.Remote?.Address.ToString(); - if (address == null) - throw new Exception("Missing 'source.remote' parameter."); - Uri inputUri = new Uri(Path.Combine(address, parameters.InputFileName)); - Input = inputUri.ToString(); - } + string address = parameters?.SourceConfig?.Remote?.Address.ToString(); + if (address == null) + return; + inputFile = null; + //if (address == null) + // throw new Exception("Missing 'source.remote' parameter."); + Uri inputUri = new Uri(Path.Combine(address, parameters.InputFileName)); + Input = inputUri.ToString(); } protected override void BeforeExecute() { diff --git a/server/-configuration/log4j2.xml b/server/-configuration/log4j2.xml index 81aa0cd2..0471c374 100644 --- a/server/-configuration/log4j2.xml +++ b/server/-configuration/log4j2.xml @@ -45,9 +45,9 @@ - + - + diff --git a/server/user.jobengine.executors/config/config.xml b/server/user.jobengine.executors/config/config.xml index ddf4d6ba..cf02215e 100644 --- a/server/user.jobengine.executors/config/config.xml +++ b/server/user.jobengine.executors/config/config.xml @@ -1,12 +1,12 @@ + - diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/FakeStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/FakeStep.java index 151a5020..061d0b98 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/FakeStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/FakeStep.java @@ -17,12 +17,9 @@ public class FakeStep extends JobStep { if (!canContinue()) break; jobRuntime.incrementProgress((i + 1) * count); - Thread.sleep(100); + Thread.sleep(1000); logger.info(getMarker(), "Log markered"); logger.info("Progress {}", jobRuntime.getProgress()); - logger.info("Progress {}", jobRuntime.getProgress()); - logger.info("Progress {}", jobRuntime.getProgress()); - logger.info("Progress {}", jobRuntime.getProgress()); } } catch (Exception e) { logger.error(e.getMessage()); diff --git a/server/user.jobengine.osgi.server/pages/index.zul b/server/user.jobengine.osgi.server/pages/index.zul index 66adf193..3e3577e4 100644 --- a/server/user.jobengine.osgi.server/pages/index.zul +++ b/server/user.jobengine.osgi.server/pages/index.zul @@ -57,7 +57,7 @@ - +
diff --git a/server/user.jobengine.osgi.server/pages/joblist.zul b/server/user.jobengine.osgi.server/pages/joblist.zul index cfbc89fb..5dd0c476 100644 --- a/server/user.jobengine.osgi.server/pages/joblist.zul +++ b/server/user.jobengine.osgi.server/pages/joblist.zul @@ -25,8 +25,10 @@
-
@@ -37,13 +39,13 @@ onSelect="@command('selectJob')" style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style" sclass="listbox-normal-style" > - - - - - - - + + + + + + +