Beispiel #1
0
        void AutoSaveList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (AutoSaveList.SelectedIndex == -1) return;

            FileInfo info = new FileInfo(mW.autosaveDir + "\\" + AutoSaveList.Items[AutoSaveList.SelectedIndex].ToString());
            SubtitleScript script;
            if (info.Name.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
                script = new ZipSubtitleScript(info.FullName);
            else
                script = new SubtitleScript(info.FullName);

            label1.Text = "Lineas: " + script.LineCount;
            label2.Text = "Estilos: " + script.StyleCount;
            label3.Text = "Fecha: " + info.LastWriteTime.Day.ToString() + "/" + info.LastWriteTime.Month.ToString()+"/"+info.LastWriteTime.Year.ToString();
            label4.Text = "Tamaño: " + info.Length/1024 +"KB";
            label5.Text = "Hora: " + info.LastWriteTime.TimeOfDay.ToString();
            label6.Text = "Adjuntos: "+( (script.HasAttachments)? "Sí ("+script.AttachmentCount+" archivo/s)" : "No");
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            FileInfo info = new FileInfo(Path.Combine(mW.autosaveDir,AutoSaveList.Items[AutoSaveList.SelectedIndex].ToString()));

            SaveFileDialog sfd = new SaveFileDialog();
            sfd.FileName = info.Name.Replace(".TranslateW.AUTOSAVE", "").Replace(".perrySub.AUTOSAVE", "").Replace(".zip", "");
            sfd.Filter = "Archivo ASS (*.ass)|*.ass";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                SubtitleScript script;
                if (info.Name.EndsWith(".zip", StringComparison.InvariantCultureIgnoreCase))
                    script = new ZipSubtitleScript(info.FullName);
                else
                    script = new SubtitleScript(info.FullName);
                script.SaveToFile(sfd.FileName);
                if (MessageBox.Show("Archivo restaurado correctamente.\n¿Deseas cargarlo en el programa principal?", mainW.appTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    mW.openFile = sfd.FileName;
                    mW.loadFile(sfd.FileName);
                }
            }
        }
Beispiel #3
0
        private void autoSave()
        {
            string fn = mW.autosaveDir+"\\"+ mW.openFile.Substring(mW.openFile.LastIndexOf('\\')+1) + ".TranslateW.AUTOSAVE";

            toolStripStatusLabel2.Text = "Guardando " + fn + "...";
            //mW.SaveFile(fn);
            ZipSubtitleScript zips = new ZipSubtitleScript(mW.script);
            zips.SaveToZip(fn);

            toolStripStatusLabel2.Text = "[" + System.DateTime.Now.ToString() + "] " + fn + " guardado.";
        }
Beispiel #4
0
 void AutoSave_Tick(object sender, EventArgs e)
 {
     string ts = openFile.Substring(openFile.LastIndexOf('\\') + 1);
     string s = autosaveDir + "\\" + ts + ".perrySub.AUTOSAVE";
     // script.SaveToFile(s);
     ZipSubtitleScript zipscript = new ZipSubtitleScript(script);
     zipscript.SaveToZip(s);
     setStatus("[ " + DateTime.Now.ToString() + " ] Archivo " + s + " guardado.");
 }
Beispiel #5
0
        private void button7_Click(object sender, EventArgs e)
        {
            DirectoryInfo di = new DirectoryInfo(mW.autosaveDir);
            FileInfo[] fia = di.GetFiles("*.AUTOSAVE");

            foreach (FileInfo f in fia)
            {
                ZipSubtitleScript zipscript = new ZipSubtitleScript();
                zipscript.LoadFromFile(f.FullName);
                zipscript.SaveToZip(f.FullName);

                File.Delete(f.FullName);
            }

            MessageBox.Show(fia.Length + " archivos comprimidos.", "PerrySub", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }