示例#1
0
 public Project(Project orig)
 {
     try
     {
         this.demuxedStreamList = new TitleInfo(orig.demuxedStreamList);
         this.m2tsList.Clear();
         foreach (string s in orig.m2tsList)
         {
             this.m2tsList.Add(s);
         }
         this.settings = new UserSettings(orig.settings);
         this.titleIndex = orig.titleIndex;
         this.titleList.Clear();
         foreach (TitleInfo ti in orig.titleList)
         {
             this.titleList.Add(new TitleInfo(ti));
         }
     }
     catch (Exception)
     {
     }
 }
示例#2
0
 public virtual void Init(Project project)
 {
     try
     {
         this._project = new Project(project);
     }
     catch (Exception)
     {
     }
 }
示例#3
0
 private void buttonQueue_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SavePosition();
         Project project = new Project(settings, demuxedStreamList, titleList, comboBoxTitle.SelectedIndex, m2tsList);
         projectQueue.Add(project);
         queueWindow.UpdateQueue();
     }
     catch (Exception)
     {
     }
 }
示例#4
0
        private void menuItemFileOpen_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = Global.Res("ProjectFileFilter");
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Project project = new Project();
                    if (Project.LoadProjectFile(ref project, ofd.FileName))
                    {
                        settings = new UserSettings(project.settings);
                        titleList.Clear();
                        foreach (TitleInfo ti in project.titleList)
                        {
                            titleList.Add(new TitleInfo(ti));
                        }
                        UpdateTitleList();
                        comboBoxTitle.SelectedIndex = project.titleIndex;
                        demuxedStreamList = new TitleInfo(project.demuxedStreamList);

                        m2tsList.Clear();
                        foreach (string s in project.m2tsList)
                        {
                            m2tsList.Add(s);
                        }

                        UpdateFromSettings(true);
                        demuxedStreamsWindow.UpdateDemuxedStreams();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
示例#5
0
 private void menuItemFileSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Project project = new Project(settings, demuxedStreamList, titleList, comboBoxTitle.SelectedIndex, m2tsList);
         SaveFileDialog sfd = new SaveFileDialog();
         sfd.Filter = Global.Res("ProjectFileFilter");
         if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Project.SaveProjectFile(project, sfd.FileName);
         }
     }
     catch (Exception)
     {
     }
 }
示例#6
0
        private void DoPlugin(PluginType pluginType)
        {
            try
            {
                foreach (PluginBase plugin in pluginList)
                {
                    if (plugin.Settings.activated && plugin.getPluginType() == pluginType)
                    {
                        Project project = new Project(settings, demuxedStreamList, titleList, comboBoxTitle.SelectedIndex, m2tsList);
                        plugin.Init(project);
                        plugin.Process();

                        settings = new UserSettings(plugin.project.settings);
                        titleList.Clear();
                        foreach (TitleInfo ti in plugin.project.titleList)
                        {
                            titleList.Add(new TitleInfo(ti));
                        }
                        UpdateTitleList();
                        comboBoxTitle.SelectedIndex = plugin.project.titleIndex;
                        demuxedStreamList = new TitleInfo(plugin.project.demuxedStreamList);

                        m2tsList.Clear();
                        foreach (string s in plugin.project.m2tsList)
                        {
                            m2tsList.Add(s);
                        }

                        UpdateFromSettings(true);
                        demuxedStreamsWindow.UpdateDemuxedStreams();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
示例#7
0
        public static bool SaveProjectFile(Project project, string filename)
        {
            MemoryStream ms = null;
            FileStream fs = null;
            XmlSerializer xs = null;

            try
            {
                ms = new MemoryStream();
                fs = new FileStream(filename, FileMode.Create, FileAccess.Write);

                xs = new XmlSerializer(typeof(Project));
                xs.Serialize(ms, project);
                ms.Seek(0, SeekOrigin.Begin);

                fs.Write(ms.ToArray(), 0, (int)ms.Length);
                ms.Close();
                fs.Close();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                if (ms != null) ms.Close();
                if (fs != null) fs.Close();
            }
        }
示例#8
0
        public static bool LoadProjectFile(ref Project project, string filename)
        {
            MemoryStream ms = null;

            try
            {
                if (!File.Exists(filename)) return false;
                byte[] data = File.ReadAllBytes(filename);
                XmlSerializer xs = new XmlSerializer(typeof(Project));
                ms = new MemoryStream(data);
                ms.Seek(0, SeekOrigin.Begin);

                project = (Project)xs.Deserialize(ms);
                ms.Close();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                if (ms != null) ms.Close();
            }
        }
示例#9
0
 public virtual void Init(Project project, PluginType requestType)
 {
     try
     {
         this._project = new Project(project);
         this._requestType = requestType;
     }
     catch (Exception)
     {
     }
 }