예제 #1
0
        public SettingsUC(ParentForm myForm, Color backColor)
        {
            InitializeComponent();
            BackColor = backColor;

            m_frmParent = myForm;
            textBoxWithVideoExts.Text = m_frmParent.VideoExtensions.ToString();
            textBoxWithSubExts.Text = m_frmParent.SubExtensions.ToString();
            initDirTextBox.Text = m_frmParent.StartFolderString;
        }
예제 #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ExtensionList videoExtensions = new ExtensionList();
            ExtensionList subExtensions   = new ExtensionList();

            #region read from xml using RND.XML
            //XmlStorage myXmlStorage = new XmlStorage("Extensions", System.Convert.ToChar(" "));
            //try
            //{
            //    using (Stream fStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None))
            //    {
            //        //
            //        myXmlStorage.Load(fStream);
            //    }
            //}
            //catch (Exception)
            //{
            //}
            //videoExtensions = (ExtensionList)myXmlStorage.ReadEntry("VideoExt");
            //subExtensions = (ExtensionList)myXmlStorage.ReadEntry("SubExt");
            #endregion
            #region Read xml-file with user extensions using Standard XML
            XmlSerializer xmlFormat = new XmlSerializer(typeof(List <ExtensionList>), "Extensions");
            try
            {
                using (Stream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None))
                {
                    try
                    {
                        List <ExtensionList> myList = (List <ExtensionList>)xmlFormat.Deserialize(fStream);
                        videoExtensions = myList[0];
                        subExtensions   = myList[1];
                    }
                    catch (Exception)
                    {
                        Debug.WriteLine("xmlFormat.Deserialize(fStream) fails");
                    }
                    finally { fStream.Close(); }
                }
            }
            catch (Exception)
            {
                Debug.WriteLine("Fail to open xml file");
            }
            #endregion
            if (videoExtensions == null || videoExtensions.ToString() == "")
            {
                videoExtensions = ExtensionList.Parse(".avi;.mkv;.ogm;.mpeg;.mpg;.vid;.xvid;.m4v;.wmv;");
            }

            if (subExtensions == null || subExtensions.ToString() == "")
            {
                subExtensions = ExtensionList.Parse(".srt;.ass;.ssa;.rt;.js;.sub;");
            }

            //serialize into XML
            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

            //start App
            myForm = new ParentForm(videoExtensions, subExtensions, args);
            Application.Run(myForm);//Form1(LIST)
        }
예제 #3
0
 public ToolStripUserControl(ParentForm rr, Color backColor)
     : base(new SettingsUC(rr, backColor))
 {
     this.LostFocus += ToolStripUserControl_LostFocus;
 }
예제 #4
0
 public ToolStripUserControl(ParentForm rr, Color backColor) : base(new SettingsUC(rr, backColor))
 {
     this.LostFocus += ToolStripUserControl_LostFocus;
 }
예제 #5
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ExtensionList videoExtensions = new ExtensionList();
            ExtensionList subExtensions = new ExtensionList();

            #region read from xml using RND.XML
            //XmlStorage myXmlStorage = new XmlStorage("Extensions", System.Convert.ToChar(" "));
            //try
            //{
            //    using (Stream fStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None))
            //    {
            //        //
            //        myXmlStorage.Load(fStream);
            //    }
            //}
            //catch (Exception)
            //{
            //}
            //videoExtensions = (ExtensionList)myXmlStorage.ReadEntry("VideoExt");
            //subExtensions = (ExtensionList)myXmlStorage.ReadEntry("SubExt");
            #endregion
            #region Read xml-file with user extensions using Standard XML
            XmlSerializer xmlFormat = new XmlSerializer(typeof(List<ExtensionList>), "Extensions");
            try
            {
                using (Stream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None))
                {
                    try
                    {
                        List<ExtensionList> myList = (List<ExtensionList>)xmlFormat.Deserialize(fStream);
                        videoExtensions = myList[0];
                        subExtensions = myList[1];
                    }
                    catch (Exception)
                    {
                        Debug.WriteLine("xmlFormat.Deserialize(fStream) fails");
                    }
                    finally { fStream.Close(); }
                }
            }
            catch (Exception)
            {
                Debug.WriteLine("Fail to open xml file");
            }
            #endregion
            if (videoExtensions ==null ||videoExtensions.ToString() == "")
            {
              videoExtensions = ExtensionList.Parse(".avi;.mkv;.ogm;.mpeg;.mpg;.vid;.xvid;.m4v;.wmv;");
            }

            if (subExtensions == null|| subExtensions.ToString() == "")
                subExtensions = ExtensionList.Parse(".srt;.ass;.ssa;.rt;.js;.sub;");

            //serialize into XML
            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

            //start App
            myForm = new ParentForm(videoExtensions, subExtensions, args);
            Application.Run(myForm);//Form1(LIST)
        }