Beispiel #1
0
        private void Export()
        {
            if (txtInput.Text == String.Empty)
            {
                throw new ExportException("Please select an input folder.");
            }

            if (txtOutput.Text == String.Empty)
            {
                throw new ExportException("Please select an output folder.");
            }

            DirectoryInfo input = new DirectoryInfo(txtInput.Text);

            if (!input.Exists)
            {
                throw new ExportException("Could not find the input folder.");
            }

            FileInfo[] files = input.GetFiles("*.ath");

            if (files.Length <= 0)
            {
                throw new ExportException("Could not find any supported files in the input folder.");
            }

            DirectoryInfo output = new DirectoryInfo(txtOutput.Text);

            if (!output.Exists)
            {
                DialogResult result = MessageBox.Show("Output folder does not exist. Do you want to create it?", "Create new folder?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    output.Create();
                }
                else
                {
                    throw new ExportException("Could not create the output folder.");
                }

                output.Refresh();
            }

            for (int i = 0; i < files.Length; i++)
            {
                ATHDocument athDoc = new ATHDocument(files[i].OpenRead());
                ATFDocument atfDoc = new ATFDocument(athDoc);

                atfDoc.SaveAllData(output);
            }

            MessageBox.Show("Export is complete.", "MGU Speech Exporter", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public ATFDocument(ATHDocument headers)
        {
            Headers = headers;
            Entries = new ATFEntry[Headers.EntryCount];

            for (int i = 0; i < Headers.EntryCount; i++)
            {
                Entries[i] = new ATFEntry(Headers.Entries[i], this);
            }

            PathInfo = new FileInfo(Path.ChangeExtension(Headers.PathInfo.FullName, "atf"));
        }
Beispiel #3
0
        public ATHEntry(BinaryReader br, ATHDocument document, int index)
        {
            Document = document;
            Index    = index;

            TextOffset = 0;
            WaveOffset = 0;
            WaveSize   = 0;

            IsValid = false;

            SetEntry(br);
        }
Beispiel #4
0
        public ATHEntry(FileStream fs, ATHDocument document, int index)
        {
            Document = document;
            Index    = index;

            TextOffset = 0;
            WaveOffset = 0;
            WaveSize   = 0;

            IsValid = false;

            SetEntry(fs);
        }