Ejemplo n.º 1
0
        void TemplateName_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (TemplateName.SelectedIndex < 1) return;
            headerASS tmp = new headerASS();
            tmp.LoadFrom(templateDir + "\\" + TemplateName.Text + ".template");
            foreach (string s in tmp.GetHeaderList())
            {
                int idx = s.IndexOf(':');
                if (idx > 0)
                {
                    string k = s.Substring(0, idx);
                    string v = s.Substring(idx + 2);
                    script.GetHeader().SetHeaderValue(k, v);
                }
            }

            if (tmp.ExistsHeaderValue("Last Style Storage"))
            {
                StreamReader sr = null;
                try
                {
                    string fname = stylesDir + "\\" + tmp.GetHeaderValue("Last Style Storage") + ".Styles";
                    sr = FileAccessWrapper.OpenTextFile(fname);

                    string linea;
                    while ((linea = sr.ReadLine()) != null)
                    {
                        estiloV4 v = new estiloV4(linea);

                        // si existen -->   == -> no añadir
                        //                  != -> preguntar (si/no/si a todo)
                        bool existe = false;
                        foreach (estiloV4 est in script.GetStyles())
                        {
                            if (est.Name == v.Name)
                                existe = true;
                        }
                        if (!existe)
                            script.GetStyles().Insert(0,v);
                    }

                    sr.Close();
                }
                catch { }
            }
        }
Ejemplo n.º 2
0
        void toolStripTextBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            switch (Convert.ToInt32(e.KeyChar))
            {
                case 13:

                    if (listBox1.Items.Contains(toolStripTextBox1.Text))
                        MessageBox.Show("Ya existe un template con ese nombre", mainW.appTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    else
                    {
                        headerASS bleh = new headerASS();
                        bleh.SetHeaderDefaults();
                        bleh.SaveTo(mW.templateDir+"\\"+toolStripTextBox1.Text + ".template");
                        contextNuevo.Hide();

                        RefreshList();
                        SendKeys.Send("");
                        e.Handled = true;
                    }
                    break;
            }
        }
Ejemplo n.º 3
0
        private void InitVariables()
        {
            Header = new headerASS();
            Styles = new ArrayList();
            Lines = new LineArrayList();
            Attachments = new Attachments();

            name = "Nuevo Archivo de PerrySub.ass";
        }