コード例 #1
0
ファイル: MainForm.cs プロジェクト: kalvdans/openmovement
        private void wearTimeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Make .WTV.CSV
            //  * Epochs (number of 0.5 minute periods)
            bool regenerateWav = (Control.ModifierKeys & Keys.Shift) != 0;
            string[] inputFiles = GetSelectedFilesForConvert(".wtv.csv");
            if (inputFiles == null) { return; }
            ExportWtvForm optionsForm = new ExportWtvForm();
            DialogResult dr = optionsForm.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.OK) { return; }
            string[] files = CheckWavConversion(inputFiles, regenerateWav);
            if (files == null) { return; }
            List<string> outputList = new List<string>();
            foreach (string file in files)
            {
                List<string> args = new List<string>();
                string input = Path.ChangeExtension(file, ".wav");
                string final = Path.ChangeExtension(file, ".wtv.csv");
                string output = final + ".part";

                args.Add("\"" + input + "\"");
                args.Add("-wtv-epoch"); args.Add("" + optionsForm.Epoch);
                args.Add("-wtv-file"); args.Add("\"" + output + "\"");
                ProcessingForm processingForm = new ProcessingForm(OMCONVERT_EXE, args, output, final);
                dr = processingForm.ShowDialog();
                if (dr == System.Windows.Forms.DialogResult.Cancel) { break; }
                outputList.Add(Path.GetFileName(final));
            }
            MessageBoxEx.Show(this, "Output " + outputList.Count + "/" + files.Length + ":\r\n\r\n" + string.Join("\r\n", outputList.ToArray()) + "\r\n\r\n", "Complete", MessageBoxExButtons.OK, MessageBoxExIcon.Information, MessageBoxExDefaultButton.Button1);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: kalvdans/openmovement
        private bool DoWavConvert(string[] files, string ext, int rate, bool calibrate, bool autoClose)
        {
            if (files == null) { return false; }
            List<string> outputList = new List<string>();

            foreach (string file in files)
            {
                List<string> args = new List<string>();
                string input = file;
                string final = Path.ChangeExtension(file, ".wav");
                string output = final + ".part";

                args.Add("\"" + input + "\"");
                if (rate > 0) { args.Add("-resample"); args.Add("" + rate); }
                args.Add("-calibrate"); args.Add(calibrate ? "1" : "0");
                args.Add("-out"); args.Add("\"" + output + "\"");
                ProcessingForm processingForm = new ProcessingForm(OMCONVERT_EXE, args, output, final);
                DialogResult dr = processingForm.ShowDialog();
                if (dr == DialogResult.Cancel) { return false; }
                outputList.Add(Path.GetFileName(final));
            }

            if (!autoClose)
            {
                MessageBoxEx.Show(this, "Output " + outputList.Count + "/" + files.Length + ":\r\n\r\n" + string.Join("\r\n", outputList.ToArray()) + "\r\n\r\n", "Complete", MessageBoxExButtons.OK, MessageBoxExIcon.Information, MessageBoxExDefaultButton.Button1);
            }
            return true;
        }