Example #1
0
 public string getOutFileName()
 {
     return(InputFile.Substring(0, InputFile.LastIndexOf("."))
            + "_"
            + String.Format(@"CarConv_B{0}_S{1}_N{2}_%02d", nudVideoBitrate.Value, nudSplitSize.Value, cbNormalizeAudio.Checked)
            + ".mp4");//here we force the mp4 format
 }
Example #2
0
 public string getOutFileName()
 {
     /*return InputFile.Insert(InputFile.LastIndexOf("."), "_"
      + String.Format(@"CMp3"));*/
     return(InputFile.Substring(0, InputFile.LastIndexOf("."))
            + "_"
            + "CMp3"
            + ".mp3");
 }
Example #3
0
        private void UploadButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                var byteArray = File.ReadAllBytes(InputFile);
                var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier);
                appointmentDataRepository.Upload(new AudioAppointment {
                    AppointmentId = this.appointmentID,
                    DateTime      = DateTime.Now,
                    PatientId     = EHealthCareDesktopApp.Properties.Settings.Default.PatientID,
                    FileName      = InputFile.Substring(InputFile.LastIndexOf("\\") + 1, (InputFile.Length - InputFile.LastIndexOf("\\") - 1)),
                    Audio         = byteArray,
                });

                LoadAudioFiles();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            ParseArgs(args, ToolName);

            InitializeLogger();

            PrintWelcome(ToolName, RevisionResource);

            try
            {
                //copy processing file
                var procFile = new ProcessingFile(InputFile);

                //make output file name
                if (ChoosenOutputFile == null)
                {
                    if (InputFile.Contains("."))
                    {
                        ChoosenOutputFile = InputFile.Remove(InputFile.LastIndexOf(".")) + ".xlsx";
                    }
                    else
                    {
                        ChoosenOutputFile = InputFile + ".xlsx";
                    }
                }

                //parse the document
                using (var reader = new StructuredStorageReader(procFile.File.FullName))
                {
                    var xlsDoc = new XlsDocument(reader);

                    var    outType           = Converter.DetectOutputType(xlsDoc);
                    string conformOutputFile = Converter.GetConformFilename(ChoosenOutputFile, outType);
                    using (var spreadx = SpreadsheetDocument.Create(conformOutputFile, outType))
                    {
                        //start time
                        var start = DateTime.Now;
                        TraceLogger.Info("Converting file {0} into {1}", InputFile, conformOutputFile);

                        Converter.Convert(xlsDoc, spreadx);

                        var end  = DateTime.Now;
                        var diff = end.Subtract(start);
                        TraceLogger.Info("Conversion of file {0} finished in {1} seconds", InputFile, diff.TotalSeconds.ToString(CultureInfo.InvariantCulture));
                    }
                }
            }
            catch (ParseException ex)
            {
                TraceLogger.Error("Could not convert {0} because it was created by an unsupported application (Excel 95 or older).", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
            catch (DirectoryNotFoundException ex)
            {
                TraceLogger.Error(ex.Message);
                TraceLogger.Debug(ex.ToString());
            }
            catch (FileNotFoundException ex)
            {
                TraceLogger.Error(ex.Message);
                TraceLogger.Debug(ex.ToString());
            }
            catch (Exception ex)
            {
                TraceLogger.Error("Conversion of file {0} failed.", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
        }
Example #5
0
        public static void Main(string[] args)
        {
            ParseArgs(args, ToolName);

            InitializeLogger();

            PrintWelcome(ToolName, RevisionResource);

            // convert
            try
            {
                //copy processing file
                var procFile = new ProcessingFile(InputFile);

                //make output file name
                if (ChoosenOutputFile == null)
                {
                    if (InputFile.Contains("."))
                    {
                        ChoosenOutputFile = InputFile.Remove(InputFile.LastIndexOf(".")) + ".docx";
                    }
                    else
                    {
                        ChoosenOutputFile = InputFile + ".docx";
                    }
                }

                //open the reader
                using (var reader = new StructuredStorageReader(procFile.File.FullName))
                {
                    //parse the input document
                    var doc = new WordDocument(reader);

                    //prepare the output document
                    var    outType           = Converter.DetectOutputType(doc);
                    string conformOutputFile = Converter.GetConformFilename(ChoosenOutputFile, outType);
                    var    docx = WordprocessingDocument.Create(conformOutputFile, outType);

                    //start time
                    var start = DateTime.Now;
                    TraceLogger.Info("Converting file {0} into {1}", InputFile, conformOutputFile);

                    //convert the document
                    Converter.Convert(doc, docx);

                    var end  = DateTime.Now;
                    var diff = end.Subtract(start);
                    TraceLogger.Info("Conversion of file {0} finished in {1} seconds", InputFile, diff.TotalSeconds.ToString(CultureInfo.InvariantCulture));
                }
            }
            catch (DirectoryNotFoundException ex)
            {
                TraceLogger.Error(ex.Message);
                TraceLogger.Debug(ex.ToString());
            }
            catch (FileNotFoundException ex)
            {
                TraceLogger.Error(ex.Message);
                TraceLogger.Debug(ex.ToString());
            }
            catch (ReadBytesAmountMismatchException ex)
            {
                TraceLogger.Error("Input file {0} is not a valid Microsoft Word 97-2003 file.", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
            catch (MagicNumberException ex)
            {
                TraceLogger.Error("Input file {0} is not a valid Microsoft Word 97-2003 file.", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
            catch (UnspportedFileVersionException ex)
            {
                TraceLogger.Error("File {0} has been created with a Word version older than Word 97.", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
            catch (ByteParseException ex)
            {
                TraceLogger.Error("Input file {0} is not a valid Microsoft Word 97-2003 file.", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
            catch (MappingException ex)
            {
                TraceLogger.Error("There was an error while converting file {0}: {1}", InputFile, ex.Message);
                TraceLogger.Debug(ex.ToString());
            }
            catch (Exception ex)
            {
                TraceLogger.Error("Conversion of file {0} failed.", InputFile);
                TraceLogger.Debug(ex.ToString());
            }
        }
 public string getOutFileName()
 {
     return(InputFile.Insert(InputFile.LastIndexOf("."), "_"
                             + String.Format(@"I2P")));
 }
 public string getOutFileName()
 {
     return(InputFile.Insert(InputFile.LastIndexOf("."), "_"
                             + String.Format(@"HCSub_S{0}", Path.GetFileName(tbSubInput.Text))));
 }
Example #8
0
        static void Main(string[] args)
        {
            ParseArgs(args, ToolName);

            InitializeLogger();

            PrintWelcome(ToolName, RevisionResource);

            if (CreateContextMenuEntry)
            {
                // create context menu entry
                try
                {
                    TraceLogger.Info("Creating context menu entry for xls2x ...");
                    RegisterForContextMenu(GetContextMenuKey(ContextMenuInputExtension, ContextMenuText));
                    TraceLogger.Info("Succeeded.");
                }
                catch (Exception)
                {
                    TraceLogger.Info("Failed. Sorry :(");
                }
            }
            else
            {
                try
                {
                    //copy processing file
                    ProcessingFile procFile = new ProcessingFile(InputFile);

                    //make output file name
                    if (ChoosenOutputFile == null)
                    {
                        if (InputFile.Contains("."))
                        {
                            ChoosenOutputFile = InputFile.Remove(InputFile.LastIndexOf(".")) + ".xlsx";
                        }
                        else
                        {
                            ChoosenOutputFile = InputFile + ".xlsx";
                        }
                    }

                    //parse the document
                    using (StructuredStorageReader reader = new StructuredStorageReader(procFile.File.FullName))
                    {
                        XlsDocument xlsDoc = new XlsDocument(reader);

                        OpenXmlPackage.DocumentType outType = Converter.DetectOutputType(xlsDoc);
                        string conformOutputFile            = Converter.GetConformFilename(ChoosenOutputFile, outType);
                        using (SpreadsheetDocument spreadx = SpreadsheetDocument.Create(conformOutputFile, outType))
                        {
                            //start time
                            DateTime start = DateTime.Now;
                            TraceLogger.Info("Converting file {0} into {1}", InputFile, conformOutputFile);

                            Converter.Convert(xlsDoc, spreadx);

                            DateTime end  = DateTime.Now;
                            TimeSpan diff = end.Subtract(start);
                            TraceLogger.Info("Conversion of file {0} finished in {1} seconds", InputFile, diff.TotalSeconds.ToString(CultureInfo.InvariantCulture));
                        }
                    }
                }
                catch (ParseException ex)
                {
                    TraceLogger.Error("Could not convert {0} because it was created by an unsupported application (Excel 95 or older).", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (DirectoryNotFoundException ex)
                {
                    TraceLogger.Error(ex.Message);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (FileNotFoundException ex)
                {
                    TraceLogger.Error(ex.Message);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (ZipCreationException ex)
                {
                    TraceLogger.Error("Could not create output file {0}.", ChoosenOutputFile);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (Exception ex)
                {
                    TraceLogger.Error("Conversion of file {0} failed.", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
            }
        }
Example #9
0
 public string getOutFileName()
 {
     return(InputFile.Insert(InputFile.LastIndexOf("."), "_"
                             + String.Format(@"ChAuNR_A{0}", Path.GetFileName(tbAudioInput.Text))));
 }
Example #10
0
 public string getOutFileName()
 {
     return(InputFile.Insert(InputFile.LastIndexOf("."), "_"
                             + String.Format(@"ChgSpeed_D{0:0.0}_FPS{1}", nudSpeedDivide.Value, nudOutputFrameRate.Value)));
 }
 public string getOutFileName()
 {
     return(InputFile.Insert(InputFile.LastIndexOf("."), "_"
                             + String.Format(@"Resize_W{0}_H{1}", nudWidth.Value
                                             , nudHeight.Value)));
 }
Example #12
0
        public static void Main(string[] args)
        {
            ParseArgs(args, ToolName);

            InitializeLogger();

            PrintWelcome(ToolName);

            if (CreateContextMenuEntry)
            {
                // create context menu entry
                try
                {
                    TraceLogger.Info("Creating context menu entry for doc2x ...");
                    RegisterForContextMenu(GetContextMenuKey(ContextMenuInputExtension, ContextMenuText));
                    TraceLogger.Info("Succeeded.");
                }
                catch (Exception)
                {
                    TraceLogger.Info("Failed. Sorry :(");
                }
            }
            else
            {
                // convert
                try
                {
                    //copy processing file
                    ProcessingFile procFile = new ProcessingFile(InputFile);

                    //make output file name
                    if (ChoosenOutputFile == null)
                    {
                        if (InputFile.Contains("."))
                        {
                            ChoosenOutputFile = InputFile.Remove(InputFile.LastIndexOf(".")) + ".docx";
                        }
                        else
                        {
                            ChoosenOutputFile = InputFile + ".docx";
                        }
                    }

                    //open the reader
                    using (StructuredStorageReader reader = new StructuredStorageReader(procFile.File.FullName))
                    {
                        //parse the input document
                        WordDocument doc = new WordDocument(reader);

                        //prepare the output document
                        OpenXmlPackage.DocumentType outType = Converter.DetectOutputType(doc);
                        string conformOutputFile            = Converter.GetConformFilename(ChoosenOutputFile, outType);
                        WordprocessingDocument docx         = WordprocessingDocument.Create(conformOutputFile, outType);

                        //start time
                        DateTime start = DateTime.Now;
                        TraceLogger.Info("Converting file {0} into {1}", InputFile, conformOutputFile);

                        //convert the document
                        Converter.Convert(doc, docx);

                        DateTime end  = DateTime.Now;
                        TimeSpan diff = end.Subtract(start);
                        TraceLogger.Info("Conversion of file {0} finished in {1} seconds", InputFile, diff.TotalSeconds.ToString(CultureInfo.InvariantCulture));
                    }
                }
                catch (DirectoryNotFoundException ex)
                {
                    TraceLogger.Error(ex.Message);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (FileNotFoundException ex)
                {
                    TraceLogger.Error(ex.Message);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (ReadBytesAmountMismatchException ex)
                {
                    TraceLogger.Error("Input file {0} is not a valid Microsoft Word 97-2003 file.", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (MagicNumberException ex)
                {
                    TraceLogger.Error("Input file {0} is not a valid Microsoft Word 97-2003 file.", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (UnspportedFileVersionException ex)
                {
                    TraceLogger.Error("File {0} has been created with a Word version older than Word 97.", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (ByteParseException ex)
                {
                    TraceLogger.Error("Input file {0} is not a valid Microsoft Word 97-2003 file.", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (MappingException ex)
                {
                    TraceLogger.Error("There was an error while converting file {0}: {1}", InputFile, ex.Message);
                    TraceLogger.Debug(ex.ToString());
                }
                catch (ZipCreationException ex)
                {
                    TraceLogger.Error("Could not create output file {0}.", ChoosenOutputFile);
                    //TraceLogger.Error("Perhaps the specified outputfile was a directory or contained invalid characters.");
                    TraceLogger.Debug(ex.ToString());
                }
                catch (Exception ex)
                {
                    TraceLogger.Error("Conversion of file {0} failed.", InputFile);
                    TraceLogger.Debug(ex.ToString());
                }
            }
        }