Example #1
0
        private void button14_Click(object sender, EventArgs e)
        {
            // guardar cambios

            if (listBox4.SelectedIndex == -1) return;
            if (!cliente.Connect())
            {
                mW.errorMsg("No se ha podido establecer la conexión con el servidor");
                return;
            }

            WorkDict = listBox4.SelectedItem.ToString();

            KeyDefin = new Hashtable();
            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                if (dataGridView2[0, i].Value != null && dataGridView2[1, i].Value != null)
                {
                    string key = dataGridView2[0, i].Value.ToString();
                    string valor = dataGridView2[1, i].Value.ToString();

                    if (!key.Equals("")) KeyDefin.Add(key, valor);

                }
            }

            SaveProgress = new ActionProgressW(mW, "Guardando datos en el diccionario de términos...");
            SaveProgress.Show();
            SaveProgress.CancelButton.Enabled = false;

            SaveInDictionary = new Thread(new ThreadStart(T_UpdateDictionary));
            SaveInDictionary.Start();
        }
Example #2
0
        private void MkvMagic()
        {
            if (!(File.Exists(Application.StartupPath + "\\MediaInfo.dll") && File.Exists(Application.StartupPath + "\\MediaInfoWrapper.dll")))
                errorMsg("No encontrado 'MediaInfo.dll' o 'MediaInfoWrapper.dll'. Opción deshabilitada");

            if (!File.Exists(Application.StartupPath + "\\mkvextract.exe"))
                errorMsg("No encontrado 'MKVextract.exe'. Opción deshabilitada");

            if (openFile != null)
            {
                if (MessageBox.Show("Esto abrirá un archivo de script nuevo.\n¿Seguro que deseas continuar?", appTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    return;
            }

            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Archivos MKV (*.mkv)|*.mkv";
            ofd.Multiselect = false;
            ofd.CheckFileExists = true;
            try
            {
                ofd.InitialDirectory = getFromConfigFile("mainW_WorkDirectory");
            }
            catch
            {
                ofd.InitialDirectory = System.Environment.SpecialFolder.MyDocuments.ToString();
                updateReplaceConfigFile("mainW_WorkDirectory", ofd.InitialDirectory);

            }
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                ArrayList tracks = GetSubtitleTrackID(ofd.FileName);
                MKVVideoName = ofd.FileName;
                if (tracks == null) errorMsg("Este archivo no contiene una pista de subtítulos ASS o SRT.");
                else
                {
                    int ttt = 0;
                    TextTrack tt;
                    if (tracks.Count == 1)
                    {
                        tt = (TextTrack)tracks[0];
                        ttt = int.Parse(tt.ID);
                    }
                    else
                    {
                        ChooseTrack cs = new ChooseTrack(tracks);
                        cs.ShowDialog();
                        tt = (TextTrack)tracks[cs.listaTracks.SelectedIndex];
                        ttt = int.Parse(tt.ID);
                        cs.Dispose();
                    }

                    FileInfo fi = new FileInfo(ofd.FileName);

                    string extension = ".ass";
                    if (tt.CodecString.Equals("UTF-8", StringComparison.InvariantCultureIgnoreCase))
                        extension = ".srt";

                    MKVAssName = fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length) + extension;
                    MKVAssName = MKVAssName.Replace(",", "_"); // odiosos archivos con comas, cojones -_-

                    setStatus("Extrayendo a " + MKVAssName + " (esto puede tardar unos segundos)");

                    MKVProgress = new ActionProgressW(this, "Demuxeando subtítulos");
                    MKVProgress.Show();

                    //Process pi = new Process();
                    ProcessStartInfo pi = new ProcessStartInfo(Application.StartupPath + "\\mkvextract.exe");
                    pi.Arguments = "tracks \"" + ofd.FileName + "\" " + ttt + ":\"" + MKVAssName + "\"";
                    pi.CreateNoWindow = true;
                    pi.WorkingDirectory = Application.StartupPath;
                    pi.UseShellExecute = false;

                    //pi.RedirectStandardError = true;
                    pi.RedirectStandardOutput = true;

                    MKVProc = new Process {StartInfo = pi, EnableRaisingEvents = true, SynchronizingObject = this};

                    MKVOutput = new Thread(new ThreadStart(T_MKVReadOutput));
                    MKVAnalysis = new Thread(new ThreadStart(T_MKVUpdate));

                    MKVProc.Exited += new EventHandler(MKVProc_Exited);

                    MKVProc.Start();
                    MKVAnalysis.Start();
                    MKVOutput.Start();

                }

            }
        }
Example #3
0
        private void button13_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            fbd.SelectedPath = textDir.Text;
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                SaveFileDialog sfd = new SaveFileDialog();
                string time = DateTime.Now.Day + "." + DateTime.Now.Month + "." + DateTime.Now.Year;
                sfd.FileName = "Backup Scripts [" + nickname.Text + "] (" + time + ").zip";
                sfd.InitialDirectory = textBackup.Text;
                sfd.Filter = "Archivo ZIP (*.zip)|*.zip";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    // este es el que tardará una animalada = threaded
                    zw2 = new ZipWrapper();

                    TodosProgreso = new ActionProgressW(mW, "Obteniendo la lista de archivos a comprimir...");
                    TodosProgreso.CancelButton.Enabled = false;

                    TodosProgreso.Show();

                    zw2.ArchivoComprimido += new ZipWrapperArchivoComprimido(zw2_ArchivoComprimido);
                    zw2.CompresionFinalizada += new ZipWrapperCompresionFinalizada(zw2_CompresionFinalizada);

                    zw2.Mask = "*.ass;*.ssa;*.txt";
                    zw2.WorkDir = fbd.SelectedPath;
                    zw2.ZipFile = sfd.FileName;

                    Thread t = new Thread(new ThreadStart(ComprimirTodosLosScripts));
                    t.Start();
                }

            }
        }