Ejemplo n.º 1
0
 public static void saveTemplate(MainTemplate template)
 {
     XmlSerializer s = new XmlSerializer(typeof(MainTemplate));
     TextWriter w = new StreamWriter(Application.StartupPath + "\\Templates\\Simple\\" + template.templateName + ".tpl");
     s.Serialize(w, template);
     w.Close();
 }
Ejemplo n.º 2
0
        public static MainTemplate loadTemplate(String templateName)
        {
            MainTemplate template = new MainTemplate();

            XmlSerializer s = new XmlSerializer(typeof(MainTemplate));

            TextReader r = new StreamReader(Application.StartupPath + "\\Templates\\Simple\\" + templateName + ".tpl");
            template = (MainTemplate)s.Deserialize(r);
            r.Close();
            return template;
        }
Ejemplo n.º 3
0
        private void cbTemplates_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
               // LogBook.Instance.addLogLine("Template Management", "TemplateManagement", "TemplateManagement", false);

                mainTemplate = SimpleTemplateController.loadTemplate(templateCombo.SelectedItem.ToString());
               // LogBook.Instance.addLogLine(DateTime.Now.ToString("t") + ": Loaded template " + templateCombo.SelectedItem + " ...", "TemplateManagement", "", false);
                videoBR.Text = mainTemplate.vidBitRate;
                fileSize.Text = mainTemplate.fileSize;
                vidQualCombo.SelectedIndex = int.Parse(mainTemplate.vidQuality);
                videoCombo.SelectedIndex = int.Parse(mainTemplate.vidCodec);
                fieldCombo.SelectedIndex = int.Parse(mainTemplate.fieldFilter);
                resizeCombo.SelectedIndex = int.Parse(mainTemplate.resizeFilter);
                widthHeight.Text = mainTemplate.widthHeight;
                audioBR.Text = mainTemplate.audBitrate;
                if (mainTemplate.selectedVideo == "0")
                    bitRateRadio.Checked = true;
                else
                    fileSizeRadio.Checked = true;
                audioCombo.SelectedIndex = int.Parse(mainTemplate.audCodec);
                containerCombo.SelectedIndex = int.Parse(mainTemplate.containerFormat);
                noiseCombo.SelectedIndex = int.Parse(mainTemplate.denoiseFilter);
                sharpCombo.SelectedIndex = int.Parse(mainTemplate.sharpenFilter);
                subText.Text = mainTemplate.subtitle;
                customFilter = mainTemplate.customAvs;

            }
            catch
            {

            }
        }
Ejemplo n.º 4
0
        private void saveOptButton_Click(object sender, EventArgs e)
        {
            try
            {
                mainTemplate = new MainTemplate
                {
                    vidBitRate = videoBR.Text,
                    fileSize = fileSize.Text,
                    vidQuality = vidQualCombo.SelectedIndex.ToString(),
                    vidCodec = videoCombo.SelectedIndex.ToString(),
                    fieldFilter = fieldCombo.SelectedIndex.ToString(),
                    resizeFilter = resizeCombo.SelectedIndex.ToString(),
                    widthHeight = widthHeight.Text,
                    audBitrate = audioBR.Text,
                    audCodec = audioCombo.SelectedIndex.ToString(),
                    containerFormat = containerCombo.SelectedIndex.ToString(),
                    denoiseFilter = noiseCombo.SelectedIndex.ToString(),
                    sharpenFilter = sharpCombo.SelectedIndex.ToString(),
                    subtitle = subText.Text,
                    customAvs = customFilter,
                };
                if (bitRateRadio.Checked)
                    mainTemplate.selectedVideo = "0";
                else
                    mainTemplate.selectedVideo = "1";

                try
                {
                    mainTemplate.templateName = InputBox.Show("Enter template name", "Template Name", templateCombo.Items[templateCombo.SelectedIndex].ToString());
                    if (!String.IsNullOrEmpty(mainTemplate.templateName))
                    {
                        SimpleTemplateController.saveTemplate(mainTemplate);
                    }
                }
                catch
                {
                    mainTemplate.templateName = InputBox.Show("Enter template name", "Template Name", "default");
                    if (!String.IsNullOrEmpty(mainTemplate.templateName))
                        SimpleTemplateController.saveTemplate(mainTemplate);
                }

                loadSettings();
            }
            catch
            {

            }
        }
Ejemplo n.º 5
0
        public void loadSettings()
        {
            try
            {
                templateCombo.Items.Clear();
                if (!Directory.Exists(Application.StartupPath + "\\Templates\\Simple\\"))
                    Directory.CreateDirectory(Application.StartupPath + "\\Templates\\Simple\\");
                DirectoryInfo directory = new DirectoryInfo(Application.StartupPath + "\\Templates\\Simple\\");
                mainTemplate = new MainTemplate();
                foreach (FileInfo file in directory.GetFiles())
                {
                    templateCombo.Items.Add(file.Name.Substring(0, file.Name.Length - 4));
                }

                try
                {
                    templateCombo.SelectedIndex = 0;
                }
                catch
                {
                }
            }
            catch
            {
            }
        }