Beispiel #1
0
        public static bool ImportMxfFile(string file)
        {
            //verify tuners are setup in WMC prior to importing
            var deviceCount = 0;

            using (var devices = new Devices(WmcStore.WmcObjectStore))
            {
                foreach (Device device in devices)
                {
                    if (device.Name.ToLower().Contains("delete"))
                    {
                        continue;
                    }
                    ++deviceCount;
                    break;
                }
            }

            if (deviceCount == 0)
            {
                Logger.WriteError("There are no devices/tuners configured in the database store. Perform WMC TV Setup prior to importing guide listings. Aborting Import.");
                return(false);
            }

            // do the import with or without progress form
            if (!showProgress)
            {
                return(WmcUtilities.ImportMxfFile(file));
            }
            var frm = new frmImport(file, false);

            frm.ShowDialog();
            return(frm.Success);
        }
Beispiel #2
0
        public static bool importMxfFile(string filename)
        {
            // verify tuners are setup in WMC prior to importing
            int deviceCount = 0;

            using (Devices devices = new Devices(Store.objectStore))
            {
                foreach (Device device in devices)
                {
                    if (!device.Name.ToLower().Contains("delete"))
                    {
                        ++deviceCount;
                        break;
                    }
                }
            }
            if (deviceCount == 0)
            {
                Logger.WriteError("There are no devices/tuners configured in the database store. Perform WMC TV Setup prior to importing guide lisitngs. Aborting Import.");
                return(false);
            }

            // do the import with or without progress form
            if (showProgress)
            {
                frmImport frm = new frmImport(filename);
                frm.ShowDialog();
                return(frm.success);
            }
            else
            {
                return(mxfImport.importMxfFile(filename));
            }
        }
Beispiel #3
0
        private bool openEpg123Configuration()
        {
            string text    = "You have both the EPG123 executable for guide listings from Schedules Direct and the HDHR2MXF executable for guide listings from SiliconDust.\n\nDo you wish to proceed with HDHR2MXF?";
            string caption = "Multiple Guide Sources";

            if ((File.Exists(Helper.Epg123ExePath) && File.Exists(Helper.Hdhr2mxfExePath) && DialogResult.Yes == MessageBox.Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) ||
                (File.Exists(Helper.Hdhr2mxfExePath) && !File.Exists(Helper.Epg123ExePath)))
            {
                updateStatusText("Running HDHR2MXF to create the guide ...");
                Logger.WriteVerbose("Running HDHR2MXF to create the guide ...");

                ProcessStartInfo startInfo = new ProcessStartInfo()
                {
                    FileName  = Helper.Hdhr2mxfExePath,
                    Arguments = "-update",
                };
                Process hdhr2mxf = Process.Start(startInfo);
                hdhr2mxf.WaitForExit();

                if (hdhr2mxf.ExitCode == 0)
                {
                    // use the client to import the mxf file
                    frmImport importForm = new frmImport(Helper.Epg123MxfPath);
                    importForm.ShowDialog();

                    // kick off the reindex
                    if (importForm.success)
                    {
                        mxfImport.reindexDatabase();
                        mxfImport.reindexPvrSchedule();
                    }
                    else
                    {
                        MessageBox.Show("There was an error importing the MXF file.", "Import Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        updateStatusText("Click the 'Step 3' button to try again.");
                        return(cbAutostep.Checked = false);
                    }
                }
                else
                {
                    MessageBox.Show("There was an error using HDHR2MXF to create the MXF file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    updateStatusText("Click the 'Step 3' button to try again.");
                    return(cbAutostep.Checked = false);
                }

                return(true);
            }

            updateStatusText("Opening EPG123 Configuration GUI ...");
            Logger.WriteVerbose("Opening EPG123 Configuration GUI ...");
            Process procEpg123;

            if (epg123Running())
            {
                Process[] processes = Process.GetProcessesByName("epg123");
                procEpg123 = processes[0];
                if (IsIconic(procEpg123.MainWindowHandle))
                {
                    ShowWindow(procEpg123.MainWindowHandle, SW_RESTORE);
                }
            }
            else
            {
                // start epg123 configuration GUI
                procEpg123 = Process.Start(Helper.Epg123ExePath);
                procEpg123.WaitForInputIdle(10000);
            }
            SetForegroundWindow(procEpg123.MainWindowHandle);
            updateStatusText("Waiting for EPG123 to close ...");
            Logger.WriteVerbose("Waiting for EPG123 to close ...");

            do
            {
                Thread.Sleep(100);
                Application.DoEvents();
            } while (!procEpg123.HasExited);
            updateStatusText(string.Empty);

            return(true);
        }