Ejemplo n.º 1
0
        /* G E N  C O U N T S */
        /*----------------------------------------------------------------------------
            %%Function: CountsData
            %%Qualified: GenCount.CountsData.CountsData
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        public CountsData(StatusBox.StatusRpt srpt)
        {
            m_srpt = srpt;
        }
Ejemplo n.º 2
0
        /* A W  M A I N  F O R M */
        /*----------------------------------------------------------------------------
            %%Function: AwMainForm
            %%Qualified: ArbWeb.AwMainForm.AwMainForm
            %%Contact: rlittle

        ----------------------------------------------------------------------------*/
        public AwMainForm(string[] rgsCmdLine)
        {
            //
            // Required for Windows Form Designer support
            //
            m_plCursor = new List<Cursor>();

            InitializeComponent();

            m_srpt = new StatusBox.StatusRpt(m_recStatus);
            m_awc = new ArbWebControl(m_srpt);
            m_fDontUpdateProfile = true;
            RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software\\Thetasoft\\ArbWeb");

            if (rk == null)
                rk = Registry.CurrentUser.CreateSubKey("Software\\Thetasoft\\ArbWeb");

            string []rgs = rk.GetSubKeyNames();

            foreach(string s in rgs)
                {
                m_cbxProfile.Items.Add(s);
                }
            m_rgreheProfile = new[]
                {
                    new Settings.SettingsElt("Login", Settings.Type.Str, m_ebUserID, ""),
                    new Settings.SettingsElt("Password", Settings.Type.Str, m_ebPassword, ""),
                    new Settings.SettingsElt("GameFile", Settings.Type.Str, m_ebGameFile, ""),
                    new Settings.SettingsElt("Roster", Settings.Type.Str, m_ebRoster, ""),
                    new Settings.SettingsElt("GameFileCopy", Settings.Type.Str, m_ebGameCopy, ""),
                    new Settings.SettingsElt("RosterCopy", Settings.Type.Str, m_ebRosterWorking, ""),
                    new Settings.SettingsElt("GameOutput", Settings.Type.Str, m_ebGameOutput, ""),
                    new Settings.SettingsElt("OutputFile", Settings.Type.Str, m_ebOutputFile, ""),
                    new Settings.SettingsElt("IncludeCanceled", Settings.Type.Bool, m_cbIncludeCanceled, 0),
                    new Settings.SettingsElt("ShowBrowser", Settings.Type.Bool, m_cbShowBrowser, 0),
                    new Settings.SettingsElt("LastSlotStartDate", Settings.Type.Dttm, m_dtpStart, ""),
                    new Settings.SettingsElt("LastSlotEndDate", Settings.Type.Dttm, m_dtpEnd, ""),
                    new Settings.SettingsElt("LastOpenSlotDetail", Settings.Type.Bool, m_cbOpenSlotDetail, 0),
                    new Settings.SettingsElt("LastGroupTimeSlots", Settings.Type.Bool, m_cbFuzzyTimes, 0),
                    new Settings.SettingsElt("LastTestEmail", Settings.Type.Bool, m_cbTestEmail, 0),
                    new Settings.SettingsElt("AddOfficialsOnly", Settings.Type.Bool, m_cbAddOfficialsOnly, 0),
                    new Settings.SettingsElt("AfiliationIndex", Settings.Type.Int, m_ebAffiliationIndex, 0),
                    new Settings.SettingsElt("LastSplitSports", Settings.Type.Bool, m_cbSplitSports, 0),
                    new Settings.SettingsElt("LastPivotDate", Settings.Type.Bool, m_cbDatePivot, 0),
                    new Settings.SettingsElt("LastLogToFile", Settings.Type.Bool, m_cbLogToFile, 0),
                    new Settings.SettingsElt("FilterMailMergeByRank", Settings.Type.Bool, m_cbFilterRank, 0),
                    new Settings.SettingsElt("DownloadOnlyFutureGames", Settings.Type.Bool, m_cbFutureOnly, 0),
                    new Settings.SettingsElt("LaunchMailMergeDoc", Settings.Type.Bool, m_cbLaunch, 0),
                    new Settings.SettingsElt("SetArbiterAnnouncement", Settings.Type.Bool, m_cbSetArbiterAnnounce, 0),
                };

            m_rgrehe = new []
                {
                    new Settings.SettingsElt("LastProfile", Settings.Type.Str, m_cbxProfile, "")
                };

            SetupLogToFile();

            m_reh = new Settings(m_rgrehe, "Software\\Thetasoft\\ArbWeb", "root");
            m_reh.Load();

            m_rehProfile = new Settings(m_rgreheProfile, String.Format("Software\\Thetasoft\\ArbWeb\\{0}", m_cbxProfile.Text), m_cbxProfile.Text);

            // load MRU from registry
            m_rehProfile.Load();
            m_fDontUpdateProfile = false;
            EnableControls();

            if (m_cbShowBrowser.Checked)
                m_awc.Show();

            CmdLineConfig clcfg = new CmdLineConfig(new CmdLineSwitch[]
                {
                new CmdLineSwitch("H", true /*fToggle*/, false /*fReq*/, "Update arbiter HELP NEEDED (includes downloading games, calculating slots). Requires -DS and -DE.", "help announce", null),
                new CmdLineSwitch("DS", false /*fToggle*/, false /*fReq*/, "Start date for slot calculation (required if -H specified)", "date start", null),
                new CmdLineSwitch("DE", false /*fToggle*/, false /*fReq*/, "End date for slot calculation (required if -H specified)", "date end", null),
                new CmdLineSwitch("F", false /*fToggle*/, false /*fReq*/, "Check this item in the Game/Slot filter", "Sport filter", null),
                new CmdLineSwitch("f", true /*fToggle*/, false /*fReq*/, "Force the games download to only download future games", "Future Games Only", null),
                });

            CmdLine cl = new CmdLine(clcfg);
            string sError = null;

            if (rgsCmdLine != null && rgsCmdLine.Length > 0)
                m_srpt.AddMessage(String.Format("Commandline args: {0} {1}", rgsCmdLine.Length, rgsCmdLine[0]));

            if (!cl.FParse(rgsCmdLine, this, null, out sError) || (m_fAutomateUpdateHelp && (m_sAutomateDateEnd == null || m_sAutomateDateStart == null)))
                {
                m_sbUsage = new StringBuilder();

                cl.Usage(AppendUsageString);
                MessageBox.Show(String.Format("Command Line error: {0}\n{1}", sError, m_sbUsage.ToString()), "ArbWeb");
                m_fAutomating = true;
                Close();
                }

            if (rgsCmdLine != null && rgsCmdLine.Length > 0)
                {
                m_fAutomating = true;

                if (m_fAutomateUpdateHelp)
                    {
                    DateTime dttmStart = DateTime.Parse(m_sAutomateDateStart);
                    DateTime dttmEnd = DateTime.Parse(m_sAutomateDateEnd);

                    m_cbLaunch.Checked = false;
                    m_cbSetArbiterAnnounce.Checked = true;
                    m_dtpStart.Value = dttmStart;
                    m_dtpEnd.Value = dttmEnd;
                    if (m_fForceFutureGames)
                        m_cbFutureOnly.Checked = true;

                    QueueUIOp(new DelayedUIOpDel(DoDownloadGames), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(CalcOpenSlots), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(DoCheckSportListboxes), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(GenMailMergeMail), new object[]{null, null});
                    QueueUIOp(new DelayedUIOpDel(DoExitApp), new object[]{null, null});

                    DoPendingQueueUIOp();
                    }
            }
        }