Пример #1
0
        public void Init(int dn, bool showexcel, EDDiscoveryForm disc)
        {
            displaynumber            = dn;
            discoveryform            = disc;
            numberBoxMinRadius.Value = SQLiteConnectionUser.GetSettingDouble(DbRadiusMin, 0);
            numberBoxMaxRadius.Value = SQLiteConnectionUser.GetSettingDouble(DbRadiusMax, 20);
            textBoxSystemName.Text   = SQLiteConnectionUser.GetSettingString(DbStar, "");
            numberBoxDoubleX.Value   = SQLiteConnectionUser.GetSettingDouble(DbX, 0);
            numberBoxDoubleY.Value   = SQLiteConnectionUser.GetSettingDouble(DbY, 0);
            numberBoxDoubleZ.Value   = SQLiteConnectionUser.GetSettingDouble(DbZ, 0);

            if (textBoxSystemName.Text.Length > 0)
            {
                SetXYZ();
            }

            ValidateEnable();

            textBoxSystemName.SetAutoCompletor(SystemClassDB.ReturnSystemListForAutoComplete);

            this.numberBoxMinRadius.TextChanged += new System.EventHandler(this.textBoxSystemName_RadiusChanged);
            this.numberBoxMaxRadius.TextChanged += new System.EventHandler(this.textBoxSystemName_RadiusChanged);
            this.textBoxSystemName.TextChanged  += new System.EventHandler(this.textBoxSystemName_TextChanged);

            this.numberBoxDoubleX.ValidityChanged += ValidityNumberBox;
            this.numberBoxDoubleY.ValidityChanged += ValidityNumberBox;
            this.numberBoxDoubleZ.ValidityChanged += ValidityNumberBox;

            numberBoxMinRadius.SetComparitor(numberBoxMaxRadius, -2);     // need to do this after values are set
            numberBoxMaxRadius.SetComparitor(numberBoxMinRadius, 2);

            buttonExtExcel.Visible = showexcel;

            ValidateEnable();
        }
Пример #2
0
        public bool EditPack(string name)            // edit pack name
        {
            ActionPackEditPackForm frm = new ActionPackEditPackForm();

            frm.AdditionalNames      += Frm_onAdditionalNames;
            frm.CreateActionPackEdit += SetPackEditorAndCondition;
            ActionFile f = actionfiles.Get(name);

            if (f != null)
            {
                string collapsestate = SQLiteConnectionUser.GetSettingString("ActionEditorCollapseState_" + name, "");  // get any collapsed state info for this pack

                frm.Init("Edit pack " + name, this.Icon, this, EDDOptions.Instance.ActionsAppDirectory(), f, ActionEventEDList.EventList(), collapsestate);

                frm.ShowDialog(discoveryform);                                                                    // don't care about the result, the form does all the saving

                SQLiteConnectionUser.PutSettingString("ActionEditorCollapseState_" + name, frm.CollapsedState()); // get any collapsed state info for this pack

                ActionConfigureKeys();                                                                            // kick it to load in case its changed
                VoiceLoadEvents();

                lasteditedpack = name;
                SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        public void Update(bool write = true, SQLiteConnectionUser conn = null)     // call at start to populate above
        {
            try
            {
                useNotifyIcon           = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn);
                orderrowsinverted       = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn);
                minimizeToNotifyIcon    = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn);
                keepOnTop               = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn);
                displayUTC              = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn);
                defaultvoicedevice      = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn);
                defaultwavedevice       = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn);
                clickthrukey            = (System.Windows.Forms.Keys)SQLiteConnectionUser.GetSettingInt("ClickThruKey", (int)System.Windows.Forms.Keys.ShiftKey, conn);
                edsmeddbdownload        = SQLiteConnectionUser.GetSettingBool("EDSMEDDBDownloadData", true, conn); // this goes with the USER on purpose, so its kept over a system db delete
                edsmgridids             = SQLiteConnectionSystem.GetSettingString("EDSMGridIDs", "Not Set");       // from system database, not user, to keep setting with system data
                fullhistoryloaddaylimit = SQLiteConnectionUser.GetSettingInt("FullHistoryLoadDayLimit", 0);
                language           = SQLiteConnectionUser.GetSettingString("DefaultLanguage", "Auto");
                drawduringresize   = SQLiteConnectionUser.GetSettingBool("DrawDuringResizeWindow", true);
                sortpanelsalpha    = SQLiteConnectionUser.GetSettingBool("PanelsSortedByName", false);
                essentialeventtype = SQLiteConnectionUser.GetSettingString("EssentialEventType", "Default");
                coriolisURL        = SQLiteConnectionUser.GetSettingString("CorolisURL", Properties.Resources.URLCoriolis);
                eddshipyardURL     = SQLiteConnectionUser.GetSettingString("EDDShipyardURL", Properties.Resources.URLEDShipyard);
                edsmfullsystemsurl = SQLiteConnectionUser.GetSettingString("EDSMFullSystemsURL", "Default");
                eddbsystemsurl     = SQLiteConnectionUser.GetSettingString("EDDBSystemsURL", "Default");
                CaptainsLogTags    = SQLiteConnectionUser.GetSettingString("CaptainsLogPanelTagNames", "Expedition=Journal.FSDJump;Died=Journal.Died");
                webserverport      = SQLiteConnectionUser.GetSettingInt("WebServerPort", 0);

                EliteDangerousCore.EDCommander.Load(write, conn);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message);
                System.Diagnostics.Trace.WriteLine(ex.StackTrace);
            }
        }
Пример #4
0
 public void Update(bool write = true, SQLiteConnectionUser conn = null)     // call at start to populate above
 {
     try
     {
         useNotifyIcon           = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn);
         orderrowsinverted       = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn);
         minimizeToNotifyIcon    = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn);
         keepOnTop               = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn);
         displayUTC              = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn);
         clearCommodities        = SQLiteConnectionUser.GetSettingBool("ClearCommodities", false, conn);
         clearMaterials          = SQLiteConnectionUser.GetSettingBool("ClearMaterials", false, conn);
         defaultvoicedevice      = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn);
         defaultwavedevice       = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn);
         showuievents            = SQLiteConnectionUser.GetSettingBool("ShowUIEvents", false, conn);
         clickthrukey            = (System.Windows.Forms.Keys)SQLiteConnectionUser.GetSettingInt("ClickThruKey", (int)System.Windows.Forms.Keys.ShiftKey, conn);
         edsmeddbdownload        = SQLiteConnectionUser.GetSettingBool("EDSMEDDBDownloadData", true, conn); // this goes with the USER on purpose, so its kept over a system db delete
         edsmgridids             = SQLiteConnectionSystem.GetSettingString("EDSMGridIDs", "All");           // from system database, not user, to keep setting with system data
         fullhistoryloaddaylimit = SQLiteConnectionUser.GetSettingInt("FullHistoryLoadDayLimit", 0);
         language         = SQLiteConnectionUser.GetSettingString("DefaultLanguage", "Auto");
         drawduringresize = SQLiteConnectionUser.GetSettingBool("DrawDuringResizeWindow", true);
         sortpanelsalpha  = SQLiteConnectionUser.GetSettingBool("PanelsSortedByName", false);
         EliteDangerousCore.EDCommander.Load(write, conn);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message);
         System.Diagnostics.Trace.WriteLine(ex.StackTrace);
     }
 }
        List <Tuple <string, Point, Size, int> > GetSavedSettings()
        {
            string[] names = SQLiteConnectionUser.GetSettingString(DBWindowNames, "").Split(',');
            int[]    positions;
            int[]    zorder;
            string   pos = SQLiteConnectionUser.GetSettingString(DbPositionSize, "");
            string   zo  = SQLiteConnectionUser.GetSettingString(DbZOrder, "");

            if (pos.RestoreArrayFromString(out positions) && zo.RestoreArrayFromString(out zorder, 0, names.Length - 1) &&
                names.Length == zorder.Length && positions.Length == 4 * names.Length)
            {
                List <Tuple <string, Point, Size, int> > ret = new List <Tuple <string, Point, Size, int> >();
                for (int i = 0; i < names.Length; i++)
                {
                    int ppos = i * 4;
                    ret.Add(new Tuple <string, Point, Size, int>(names[i], new Point(positions[ppos++], positions[ppos++]),
                                                                 new Size(positions[ppos++], positions[ppos++]), zorder[i]));
                }
                return(ret);
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        public ActionController(EDDiscoveryForm frm, EDDiscoveryController ctrl) : base(frm.AudioQueueSpeech, frm.AudioQueueWave, frm.SpeechSynthesizer, frm)
        {
            discoveryform       = frm;
            discoverycontroller = ctrl;

            ConditionFunctions.GetCFH = DefaultGetCFH;

            persistentglobalvariables.FromString(SQLiteConnectionUser.GetSettingString("UserGlobalActionVars", ""), ConditionVariables.FromMode.MultiEntryComma);

            lasteditedpack = SQLiteConnectionUser.GetSettingString("ActionPackLastFile", "");

            ActionBase.AddCommand("Commodities", typeof(ActionCommodities), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("EliteBindings", typeof(ActionEliteBindings), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Event", typeof(ActionEvent), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Historytab", typeof(ActionHistoryTab), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Ledger", typeof(ActionLedger), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Materials", typeof(ActionMaterials), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Perform", typeof(ActionPerform), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Play", typeof(ActionPlay), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Popout", typeof(ActionPopout), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("ProgramWindow", typeof(ActionProgramwindow), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Scan", typeof(ActionScan), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Ship", typeof(ActionShip), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Star", typeof(ActionStar), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Timer", typeof(ActionTimer), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("MenuItem", typeof(ActionMenuItem), ActionBase.ActionType.Cmd);

            ReLoad();
        }
Пример #7
0
        public override void Init()
        {
            string        filter    = SQLiteConnectionUser.GetSettingString(DbSave + "Campaign", "");
            List <string> filtarray = BaseUtils.StringParser.ParseWordList(filter);

            savedfilterentries = new List <FilterEntry>();

            for (int i = 0; i < filtarray.Count / 5; i++)
            {
                FilterEntry f = new FilterEntry(filtarray, i * 5);
                if (f.Type != FilterEntry.EntryType.Invalid)
                {
                    savedfilterentries.Add(f);
                }
            }

            buttonExtEditCampaign.Enabled  = false;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;
            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;

            checkBoxCustomGridOn.Checked = SQLiteConnectionUser.GetSettingBool(DbSave + "Gridshow", false);
            checkBoxCustomGridOn.Visible = IsFloatingWindow;

            transparentfont = EDDTheme.Instance.GetFont;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(contextMenuStrip, this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            labelTarget.Size = new Size(1280, 24);
            labelTarget.Text = "No Target".T(EDTx.UserControlCombatPanel_NT);
        }
Пример #8
0
        protected override bool VerifyProcessAllowed(string proc, string cmdline)
        {
            string actionprocessperms = SQLiteConnectionUser.GetSettingString("ActionProcessPerms", "");

            if (!actionprocessperms.Contains("!" + proc + ";"))
            {
                bool ok = ExtendedControls.MessageBoxTheme.Show("Warning - This program is attempting to run the following process" + Environment.NewLine + Environment.NewLine +
                                                                proc + Environment.NewLine + Environment.NewLine +
                                                                "!!! Verify you are happy for the process to run now, and in the future!!!",
                                                                "WARNING - PROCESS WANTS TO RUN",
                                                                System.Windows.Forms.MessageBoxButtons.YesNo,
                                                                System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes;

                if (ok)
                {
                    SQLiteConnectionUser.PutSettingString("ActionProcessPerms", actionprocessperms + "!" + proc + ";");
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
Пример #9
0
        public override void LoadLayout()                   // cursor now set up, initial setup complete..
        {
            ucursor_history = uctg;                         // record base one
            ucursor_inuse   = FindTHC() ?? ucursor_history; // if we have a THC, use it, else use the history one
            string splitctrl = SQLiteConnectionUser.GetSettingString(DbWindows, "");

            //System.Diagnostics.Debug.WriteLine("Layout loading " + displaynumber + " " + splitctrl);
            //panelPlayfield.Controls[0].DumpTree(0);

            RunActionOnSplitterTree((p, c, uccb) =>     // now, at load layout, do the rest of the UCCB contract.
            {
                uccb.SetCursor(ucursor_inuse);
                uccb.LoadLayout();
                uccb.InitialDisplay();
            });

            Invalidate(true);
            Update();                                 // need this to FORCE a full refresh in case there are lots of windows

            UserControlTravelGrid tg = GetTravelGrid; // if travel grid, link up

            if (tg != null)
            {
                tg.OnKeyDownInCell += Tg_OnKeyDownInCell;
            }
        }
Пример #10
0
        public void Update(bool write = true, SQLiteConnectionUser conn = null)     // call at start to populate above
        {
            try
            {
                _useNotifyIcon        = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn);
                _EDSMLog              = SQLiteConnectionUser.GetSettingBool("EDSMLog", false, conn);
                _orderrowsinverted    = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn);
                _minimizeToNotifyIcon = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn);
                _focusOnNewSystem     = SQLiteConnectionUser.GetSettingBool("FocusOnNewSystem", false, conn);
                _keepOnTop            = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn);
                _displayUTC           = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn);
                _clearCommodities     = SQLiteConnectionUser.GetSettingBool("ClearCommodities", false, conn);
                _clearMaterials       = SQLiteConnectionUser.GetSettingBool("ClearMaterials", false, conn);
                _autoLoadPopouts      = SQLiteConnectionUser.GetSettingBool("AutoLoadPopouts", false, conn);
                _autoSavePopouts      = SQLiteConnectionUser.GetSettingBool("AutoSavePopouts", false, conn);
                _defaultvoicedevice   = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn);
                _defaultwavedevice    = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn);

                EDCommander.Load(write, conn);
                UserPaths.Load(conn);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message);
                System.Diagnostics.Trace.WriteLine(ex.StackTrace);
            }
        }
Пример #11
0
            /// <summary>
            /// Loads the paths from the database and from UserPaths.json
            /// </summary>
            /// <param name="conn">Optional connection from which to load settings</param>
            public void Load(SQLiteConnectionUser conn = null)
            {
                EDDirectory                = SQLiteConnectionUser.GetSettingString("EDDirectory", "", conn);
                ImageHandlerOutputDir      = SQLiteConnectionUser.GetSettingString("ImageHandlerOutputDir", null, conn);
                ImageHandlerScreenshotsDir = SQLiteConnectionUser.GetSettingString("ImageHandlerScreenshotsDir", null, conn);

                if (File.Exists(Path.Combine(EDDConfig.Options.AppDataDirectory, "UserPaths.json")))
                {
                    JObject jo;

                    using (FileStream stream = File.OpenRead(Path.Combine(EDDConfig.Options.AppDataDirectory, "UserPaths.json")))
                    {
                        using (StreamReader rdr = new StreamReader(stream))
                        {
                            using (JsonTextReader jrdr = new JsonTextReader(rdr))
                            {
                                jo = JObject.Load(jrdr);
                            }
                        }
                    }

                    EDDirectory                = jo["EDDirectory"].Str(EDDirectory);
                    ImageHandlerOutputDir      = jo["ImageHandlerOutputDir"].Str(ImageHandlerOutputDir);
                    ImageHandlerScreenshotsDir = jo["ImageHandlerScreenshotsDir"].Str(ImageHandlerScreenshotsDir);
                }
            }
Пример #12
0
        // no cursor..
        // Since splitter is used as the primary history window, we need to be more careful due to this being used as the primary cursor
        // so we by design don't have a cursor at Init on any UCCB.  So we must create everything here for the primary, then we have a cursor, and
        // then load layout can finish the job

        public override void Init()
        {
            TabListSortAlpha = EDDConfig.Instance.SortPanelsByName; // held constant, because we store in each tab splitter the implicit order, can't change it half way thru

            string defaultview = "H(0.50, U'0,-1', U'1,-1')";       // default is a splitter without any selected panels

            string splitctrl = SQLiteConnectionUser.GetSettingString(DbWindows, defaultview);

            SuspendLayout();

            // try and make the configured splitter tree
            SplitContainer sp = ControlHelpersStaticFunc.SplitterTreeMakeFromCtrlString(new BaseUtils.StringParser(splitctrl), MakeSplitContainer, MakeNode, 0);

            if (sp == null)       // string is screwed, nothing was returned.  Lets set the default up
            {
                sp = ControlHelpersStaticFunc.SplitterTreeMakeFromCtrlString(new BaseUtils.StringParser(defaultview), MakeSplitContainer, MakeNode, 0);
            }

            panelPlayfield.Controls.Add(sp);

            //panelPlayfield.Controls[0].DumpTree(0);

            ResumeLayout();

            BaseUtils.Translator.Instance.Translate(contextMenuStripSplitter, this);
        }
Пример #13
0
        public override void Init()
        {
            string        filter    = SQLiteConnectionUser.GetSettingString(DbSave + "Campaign", "");
            List <string> filtarray = BaseUtils.StringParser.ParseOptionallyQuotedStringList(filter);

            savedfilterentries = new List <FilterEntry>();

            for (int i = 0; i < filtarray.Count / 5; i++)
            {
                FilterEntry f = new FilterEntry(filtarray, i * 5);
                if (f.Type != FilterEntry.EntryType.Invalid)
                {
                    savedfilterentries.Add(f);
                }
            }

            buttonExtEditCampaign.Enabled  = false;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;
            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;

            checkBoxCustomGridOn.Checked = SQLiteConnectionUser.GetSettingBool(DbSave + "Gridshow", false);
            checkBoxCustomGridOn.Visible = IsFloatingWindow;

            transparentfont = EDDTheme.Instance.GetFontAtSize(12);
        }
Пример #14
0
        // no cursor..
        // Since splitter is used as the primary history window, we need to be more careful due to this being used as the primary cursor
        // so we by design don't have a cursor at Init on any UCCB.  So we must create everything here for the primary, then we have a cursor, and
        // then load layout can finish the job

        public override void Init()
        {
            TabListSortAlpha = EDDConfig.Instance.SortPanelsByName; // held constant, because we store in each tab splitter the implicit order, can't change it half way thru

            string defaultview = "H(0.50, U'0,-1', U'1,-1')";       // default is a splitter without any selected panels

            string splitctrl = SQLiteConnectionUser.GetSettingString(DbWindows, defaultview);

            SuspendLayout();

            // try and make the configured splitter tree
            SplitContainer sp = ControlHelpersStaticFunc.SplitterTreeMakeFromCtrlString(new BaseUtils.StringParser(splitctrl), MakeSplitContainer, MakeNode, 0);

            if (sp == null)       // string is screwed, nothing was returned.  Lets set the default up
            {
                sp = ControlHelpersStaticFunc.SplitterTreeMakeFromCtrlString(new BaseUtils.StringParser(defaultview), MakeSplitContainer, MakeNode, 0);
            }

            panelPlayfield.Controls.Add(sp);

            //panelPlayfield.Controls[0].DumpTree(0);

            ResumeLayout();

            BaseUtils.Translator.Instance.Translate(contextMenuStripSplitter, this);

            RunActionOnSplitterTree((p, c, uccb) =>
            {
                int tagid         = (int)c.Tag;
                int displaynumber = DisplayNumberOfSplitter(tagid);                         // tab strip - use tag to remember display id which helps us save context.
                System.Diagnostics.Trace.WriteLine("SP:Make UCCB " + uccb.GetType().Name + " tag " + tagid + " dno " + displaynumber);

                uccb.Init(discoveryform, displaynumber);
            });
        }
Пример #15
0
        protected override bool VerifyFileAction(string action, string file)
        {
            string folder            = Path.GetDirectoryName(file);
            string actionfolderperms = SQLiteConnectionUser.GetSettingString("ActionFolderPerms", "");

            if (!actionfolderperms.Contains(folder + ";"))
            {
                bool ok = ExtendedControls.MessageBoxTheme.Show("Warning - This program is attempting to " + action + " folder" + Environment.NewLine + Environment.NewLine +
                                                                folder + Environment.NewLine + Environment.NewLine +
                                                                "with file " + Path.GetFileName(file) + Environment.NewLine + Environment.NewLine +
                                                                "!!! Verify you are happy for the program to perform this action and access ANY files in that folder!!!",
                                                                "WARNING - ACCESS REQUESTED",
                                                                System.Windows.Forms.MessageBoxButtons.YesNo,
                                                                System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes;

                if (ok)
                {
                    SQLiteConnectionUser.PutSettingString("ActionFolderPerms", actionfolderperms + folder + ";");
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
Пример #16
0
        public override void Init()
        {
            textMinRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "PlotMin", 0);
            textMaxRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "PlotMax", defaultmaximumradarradius);
            textMinRadius.SetComparitor(textMaxRadius, -2);     // need to do this after values are set
            textMaxRadius.SetComparitor(textMinRadius, 2);

            comboBoxView.Enabled = false;
            comboBoxView.Items.Add("Top".Tx(this));
            comboBoxView.Items.Add("Front".Tx(this));
            comboBoxView.Items.Add("Side".Tx(this));
            comboBoxView.Items.Add("Grid".Tx(this));
            comboBoxView.Items.Add("Report".Tx(this));

            var sel = SQLiteConnectionUser.GetSettingString(DbSave + "PlotOrientation", "!!");

            if (comboBoxView.Items.Contains(sel))
            {
                comboBoxView.SelectedItem = sel;
            }
            else
            {
                comboBoxView.SelectedIndex = 0;
            }

            comboBoxView.Enabled = true;

            computer = new StarDistanceComputer();

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(menuStrip, this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            SelectView();
        }
Пример #17
0
        public void Update(bool write = true, SQLiteConnectionUser conn = null)     // call at start to populate above
        {
            try
            {
                _useNotifyIcon        = SQLiteConnectionUser.GetSettingBool("UseNotifyIcon", false, conn);
                _EDSMLog              = SQLiteConnectionUser.GetSettingBool("EDSMLog", false, conn);
                _orderrowsinverted    = SQLiteConnectionUser.GetSettingBool("OrderRowsInverted", false, conn);
                _minimizeToNotifyIcon = SQLiteConnectionUser.GetSettingBool("MinimizeToNotifyIcon", false, conn);
                _keepOnTop            = SQLiteConnectionUser.GetSettingBool("KeepOnTop", false, conn);
                _displayUTC           = SQLiteConnectionUser.GetSettingBool("DisplayUTC", false, conn);
                _clearCommodities     = SQLiteConnectionUser.GetSettingBool("ClearCommodities", false, conn);
                _clearMaterials       = SQLiteConnectionUser.GetSettingBool("ClearMaterials", false, conn);
                _autoLoadPopouts      = SQLiteConnectionUser.GetSettingBool("AutoLoadPopouts", false, conn);
                _autoSavePopouts      = SQLiteConnectionUser.GetSettingBool("AutoSavePopouts", false, conn);
                _defaultvoicedevice   = SQLiteConnectionUser.GetSettingString("VoiceAudioDevice", "Default", conn);
                _defaultwavedevice    = SQLiteConnectionUser.GetSettingString("WaveAudioDevice", "Default", conn);
                _showuievents         = SQLiteConnectionUser.GetSettingBool("ShowUIEvents", false, conn);
                _clickthrukey         = (System.Windows.Forms.Keys)SQLiteConnectionUser.GetSettingInt("ClickThruKey", (int)System.Windows.Forms.Keys.ShiftKey, conn);
                _EDSMEDDBDownload     = SQLiteConnectionUser.GetSettingBool("EDSMEDDBDownloadData", true, conn); // this goes with the USER on purpose, so its kept over a system db delete
                _EDSMGridIDs          = SQLiteConnectionSystem.GetSettingString("EDSMGridIDs", "All");           // from system database, not user, to keep setting with system data

                EliteDangerousCore.EDCommander.Load(write, conn);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("EDDConfig.Update()" + ":" + ex.Message);
                System.Diagnostics.Trace.WriteLine(ex.StackTrace);
            }
        }
Пример #18
0
        public void LoadProfiles()
        {
            string     profiles    = SQLiteConnectionUser.GetSettingString("ProfileIDs", "0");
            List <int> profileints = profiles.RestoreIntListFromString(1, 0); // default is length 1, value 0

            foreach (int profileid in profileints)
            {
                StringParser sp = new StringParser(SQLiteConnectionUser.GetSettingString(ProfilePrefix(profileid) + "Settings", ""));

                string name          = sp.NextQuotedWordComma();
                string tripcondition = sp.NextQuotedWordComma();
                string backcondition = sp.NextQuotedWord();

                if (name != null && tripcondition != null && backcondition != null)
                {
                    Profile p = new Profile(profileid, name, tripcondition, backcondition);
                    System.Diagnostics.Debug.WriteLine("Profile {0} {1} {2}", name, tripcondition, backcondition);
                    ProfileList.Add(p);
                }
            }

            if (ProfileList.Count == 0)
            {
                ProfileList.Add(new Profile(DefaultId, "Default", "Condition AlwaysFalse", "Condition AlwaysFalse"));
            }

            int curid = SQLiteConnectionUser.GetSettingInt("ProfilePowerOnID", DefaultId);

            PowerOn = Current = ProfileList.Find(x => x.Id == curid) ?? ProfileList[0];
            History.Push(Current.Id);
        }
Пример #19
0
        public override void Init()
        {
            dataGridView.CheckEDSM = false; // for this, only our data is shown
            dataGridView.MakeDoubleBuffered();
            dataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridView.RowTemplate.Height        = 26;
            dataGridView.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx

            BaseUtils.Translator.Instance.Translate(this, new Control[] { });
            BaseUtils.Translator.Instance.Translate(toolTip, this);
            //BaseUtils.Translator.Instance.Translate(dataGridViewEDSM.ContextMenu, this);

            List <string> classnames = BaseUtils.TypeHelpers.GetPropertyFieldNames(typeof(JournalScan), bf: System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly);

            classnames.Add("EventTimeUTC");     // add on a few from the base class..
            classnames.Add("EventTimeLocal");
            classnames.Add("SyncedEDSM");

            string query = SQLiteConnectionUser.GetSettingString(DbQuerySave, "");

            conditionFilterUC.InitConditionList(classnames, new BaseUtils.ConditionLists(query));   // will ignore if query is bad and return empty query

            dataGridView.Init(discoveryform);

            comboBoxSearches.Items.AddRange(Queries.Instance.Searches.Select(x => x.Item1));
            comboBoxSearches.Text = "Select".Tx(this);
            comboBoxSearches.SelectedIndexChanged += ComboBoxSearches_SelectedIndexChanged;
        }
Пример #20
0
        //EDDiscovery Init calls this
        public void CreateTabs(EDDiscoveryForm edf, bool resettabs, string resetsettings)
        {
            eddiscovery = edf;

            int[] panelids;
            int[] displaynumbers;
            int   restoretab = 0;

            string majortabs = SQLiteConnectionUser.GetSettingString("MajorTabControlList", "");

            string[] majortabnames = SQLiteConnectionUser.GetSettingString("MajorTabControlName", "").Replace("!error!", "+").Split(';');       // if its okay, load the name list

            while (true)
            {
                int[] rawtabctrl;
                majortabs.RestoreArrayFromString(out rawtabctrl);

                panelids       = rawtabctrl.Where((value, index) => index % 2 != 0).ToArray();
                displaynumbers = rawtabctrl.Where((value, index) => index > 0 && index % 2 == 0).ToArray();

                if (resettabs || panelids.Length == 0 || panelids.Length != displaynumbers.Length || !panelids.Contains(-1) || !panelids.Contains((int)PanelInformation.PanelIDs.PanelSelector))
                {
                    majortabs     = resetsettings;
                    majortabnames = null;
                    resettabs     = false;
                }
                else
                {
                    if (rawtabctrl[0] > 0 && rawtabctrl[0] < panelids.Length)
                    {
                        restoretab = rawtabctrl[0];
                    }
                    break;
                }
            }

            for (int i = 0; i < panelids.Length; i++)
            {
                string name = majortabnames != null && i < majortabnames.Length && majortabnames[i].Length > 0 ? majortabnames[i] : null;

                try
                {
                    if (panelids[i] == -1)
                    {
                        TabPage p = CreateTab(PanelInformation.PanelIDs.SplitterControl, name ?? "History", displaynumbers[i], TabPages.Count, false); // no need the theme, will be themed as part of overall load
                        p.Tag = true;                                                                                                                  // this marks it as the primary tab..
                    }
                    else
                    {
                        PanelInformation.PanelIDs p = (PanelInformation.PanelIDs)panelids[i];
                        CreateTab(p, name, displaynumbers[i], TabPages.Count, false);      // no need the theme, will be themed as part of overall load
                    }
                }
                catch { }   // paranoia in case something crashes it, unlikely, but we want maximum chance the history tab will show
            }

            SelectedIndex = restoretab;
        }
Пример #21
0
            private char splitmarker = (char)0x2b1c; // horrible but i can't be bothered to do a better implementation at this point

            private Queries()
            {
                StandardSearches = Searches.Count();
                string[] userqueries = SQLiteConnectionUser.GetSettingString(DbUserQueries, "").Split(new char[] { splitmarker });

                for (int i = 0; i + 1 < userqueries.Length; i += 2)
                {
                    Searches.Add(new Tuple <string, string>(userqueries[i], userqueries[i + 1]));
                }
            }
Пример #22
0
        bool checkmulticall = false;      // debug for now

        public override void LoadLayout() // unlike splitter, we don't need to be so careful about the cursor.  We can load in load layout
        {
            ucursor_history = ucursor_inuse = uctg;

            System.Diagnostics.Debug.Assert(checkmulticall == false);
            checkmulticall = true;      // examples seen of multi call, lets trap it

            //System.Diagnostics.Debug.WriteLine("Grid Restore from " + DbWindows);

            string[] names = SQLiteConnectionUser.GetSettingString(DbWindows, "").Split(',');
            int[]    positions;
            int[]    zorder;

            string pos = SQLiteConnectionUser.GetSettingString(DbPositions, "");
            string zo  = SQLiteConnectionUser.GetSettingString(DbZOrder, "");

            SuspendLayout();

            if (pos.RestoreArrayFromString(out positions) && zo.RestoreArrayFromString(out zorder, 0, names.Length - 1) &&
                names.Length == zorder.Length && positions.Length == 4 * names.Length)
            {
                int ppos = 0;
                foreach (string n in names)
                {
                    Type t = Type.GetType("EDDiscovery.UserControls." + n);
                    if (t != null)
                    {
                        UserControlCommonBase uccb = (UserControlCommonBase)Activator.CreateInstance(t);
                        CreatePanel(uccb, new Point(positions[ppos++], positions[ppos++]), new Size(positions[ppos++], positions[ppos++]));
                    }
                }

                ppos = 0;

                foreach (int item in zorder)
                {
                    if (item >= 0 && item < uccrlist.Count)
                    {
                        UserControlContainerResizable uccr = uccrlist[item];
                        panelPlayfield.Controls.SetChildIndex(uccr, ppos++);
                    }
                }
            }

            ResumeLayout();
            Invalidate(true);
            Update();        // need this to FORCE a full refresh in case there are lots of windows
            //System.Diagnostics.Debug.WriteLine("----- Grid Restore END " + DbWindows);

            UpdateButtons();

            AssignTHC();
        }
Пример #23
0
        public override void Init()
        {
            dataGridViewEDSM.MakeDoubleBuffered();
            dataGridViewEDSM.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridViewEDSM.RowTemplate.Height        = 26;
            dataGridViewEDSM.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx

            textBoxRadius.Text     = SQLiteConnectionUser.GetSettingString(DbRadius, "20");
            textBoxSystemName.Text = SQLiteConnectionUser.GetSettingString(DbStar, "");

            this.textBoxRadius.TextChanged     += new System.EventHandler(this.textBoxFilter_TextChanged);
            this.textBoxSystemName.TextChanged += new System.EventHandler(this.textBoxFilter_TextChanged);

            ValidateEnable();
        }
Пример #24
0
        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewEDSM.MakeDoubleBuffered();
            dataGridViewEDSM.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridViewEDSM.RowTemplate.Height        = 26;
            dataGridViewEDSM.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx

            textBoxRadius.Text     = SQLiteConnectionUser.GetSettingString(DbRadius, "20");
            textBoxSystemName.Text = SQLiteConnectionUser.GetSettingString(DbStar, "");

            this.textBoxRadius.TextChanged     += new System.EventHandler(this.textBoxFilter_TextChanged);
            this.textBoxSystemName.TextChanged += new System.EventHandler(this.textBoxFilter_TextChanged);

            ValidateEnable();
        }
Пример #25
0
        public override void Init()
        {
            textMinRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "PlotMin", 0);
            textMaxRadius.ValueNoChange = SQLiteConnectionUser.GetSettingDouble(DbSave + "PlotMax", defaultmaximumradarradius);
            textMinRadius.SetComparitor(textMaxRadius, -2);     // need to do this after values are set
            textMaxRadius.SetComparitor(textMinRadius, 2);

            comboBoxView.Enabled = false;
            comboBoxView.Items.Add("Top");
            comboBoxView.Items.Add("Front");
            comboBoxView.Items.Add("Side");
            comboBoxView.Items.Add("Grid");
            comboBoxView.Items.DefaultIfEmpty("Top");
            comboBoxView.SelectedItem = SQLiteConnectionUser.GetSettingString(DbSave + "PlotOrientation", "Top");
            comboBoxView.Enabled      = true;

            computer = new StarDistanceComputer();
        }
Пример #26
0
        public ActionController(EDDiscoveryForm frm, EDDiscoveryController ctrl)
        {
            discoveryform       = frm;
            discoverycontroller = ctrl;

            persistentglobalvariables = new ConditionVariables();
            persistentglobalvariables.FromString(SQLiteConnectionUser.GetSettingString("UserGlobalActionVars", ""), ConditionVariables.FromMode.MultiEntryComma);

            globalvariables = new ConditionVariables(persistentglobalvariables);        // copy existing user ones into to shared buffer..

            programrunglobalvariables = new ConditionVariables();

            SetInternalGlobal("CurrentCulture", System.Threading.Thread.CurrentThread.CurrentCulture.Name);
            SetInternalGlobal("CurrentCultureInEnglish", System.Threading.Thread.CurrentThread.CurrentCulture.EnglishName);
            SetInternalGlobal("CurrentCultureISO", System.Threading.Thread.CurrentThread.CurrentCulture.ThreeLetterISOLanguageName);

            ReLoad();
        }
Пример #27
0
        void LoadTags()
        {
            tags = new Dictionary <string, Image>();

            string taglist = SQLiteConnectionUser.GetSettingString(DbSaveTags, "Expedition=Journal.FSDJump;Died=Journal.Died");

            string[] tagdefs = taglist.Split(';');
            foreach (var s in tagdefs)
            {
                string[] parts = s.Split('=');
                // valid number, valid length, image exists
                if (parts.Length == 2 && parts[0].Length > 0 && parts[1].Length > 0 && EDDiscovery.Icons.IconSet.Icons.ContainsKey(parts[1]))
                {
                    Image img = EDDiscovery.Icons.IconSet.Icons[parts[1]];      // image.tag has name - defined by icon system
                    tags[parts[0]] = img;
                }
            }
        }
Пример #28
0
        public bool EditPack(string name)            // edit pack name
        {
            List <string> jevents = JournalEntry.GetListOfEventsWithOptMethod(towords: false);

            jevents.Sort();
            List <ActionEvent> eventlist = ActionEventEDList.EventsFromNames(jevents, "Journal");

            List <string> uievents = Enum.GetNames(typeof(UITypeEnum)).ToList();

            uievents.Sort();
            eventlist.AddRange(ActionEventEDList.EventsFromNames(uievents, "UIEvents"));

            eventlist.AddRange(ActionEventEDList.events); // our ED events
            eventlist.AddRange(ActionEvent.events);       // core events

            ActionPackEditorForm frm = new ActionPackEditorForm();

            frm.AdditionalNames      += Frm_onAdditionalNames;
            frm.CreateActionPackEdit += SetPackEditorAndCondition;
            ActionFile f = actionfiles.Get(name);

            if (f != null)
            {
                string collapsestate = SQLiteConnectionUser.GetSettingString("ActionEditorCollapseState_" + name, "");  // get any collapsed state info for this pack

                frm.Init("Edit pack " + name, this.Icon, this, AppFolder, f, eventlist, collapsestate);

                frm.ShowDialog(discoveryform);                                                                    // don't care about the result, the form does all the saving

                SQLiteConnectionUser.PutSettingString("ActionEditorCollapseState_" + name, frm.CollapsedState()); // get any collapsed state info for this pack

                ActionConfigureKeys();                                                                            // kick it to load in case its changed
                VoiceLoadEvents();

                lasteditedpack = name;
                SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #29
0
        public static void CheckPrimarySplitterControlSettings(string defaultname)
        {
            string primarycontrolname = EDDProfiles.Instance.UserControlsPrefix + "SplitterControlWindows";                   // primary name for first splitter

            string splitctrl = SQLiteConnectionUser.GetSettingString(primarycontrolname, "");

            if (splitctrl == "" || !splitctrl.Contains("'0,1006'"))   // never set, or wiped, or does not have TG in it, reset.. if previous system had the IDs, use them, else use defaults
            {
                int enum_bottom      = SQLiteDBClass.GetSettingInt(defaultname + "BottomTab", (int)(PanelInformation.PanelIDs.Scan));
                int enum_bottomright = SQLiteDBClass.GetSettingInt(defaultname + "BottomRightTab", (int)(PanelInformation.PanelIDs.Log));
                int enum_middleright = SQLiteDBClass.GetSettingInt(defaultname + "MiddleRightTab", (int)(PanelInformation.PanelIDs.StarDistance));
                int enum_topright    = SQLiteDBClass.GetSettingInt(defaultname + "TopRightTab", (int)(PanelInformation.PanelIDs.SystemInformation));

                string ctrl = "V(0.75, H(0.6, U'0,1006',U'1," + enum_bottom.ToStringInvariant() + "')," +
                              "H(0.5, U'2," + enum_topright.ToStringInvariant() + "', " +
                              "H(0.25,U'3," + enum_middleright.ToStringInvariant() + "',U'4," + enum_bottomright + "')) )";

                SQLiteConnectionUser.PutSettingString(primarycontrolname, ctrl);
            }
        }
Пример #30
0
        public void Init(int dn, string ucn, bool showexcel, EDDiscoveryForm disc)
        {
            ucdbname                   = ucn;
            displaynumber              = dn;
            discoveryform              = disc;
            numberBoxMinRadius.Value   = SQLiteConnectionUser.GetSettingDouble(DbRadiusMin, 0);
            numberBoxMaxRadius.Value   = SQLiteConnectionUser.GetSettingDouble(DbRadiusMax, 20);
            textBoxSystemName.Text     = SQLiteConnectionUser.GetSettingString(DbStar, "");
            numberBoxDoubleX.Value     = SQLiteConnectionUser.GetSettingDouble(DbX, 0);
            numberBoxDoubleY.Value     = SQLiteConnectionUser.GetSettingDouble(DbY, 0);
            numberBoxDoubleZ.Value     = SQLiteConnectionUser.GetSettingDouble(DbZ, 0);
            checkBoxCustomCube.Checked = SQLiteConnectionUser.GetSettingBool(DbCube, false);
            extCheckBoxExcludeVisitedSystems.Checked = SQLiteConnectionUser.GetSettingBool(DbEVS, false);

            if (textBoxSystemName.Text.Length > 0)
            {
                SetXYZ();
            }

            ValidateEnable();

            textBoxSystemName.SetAutoCompletor(SystemCache.ReturnSystemAutoCompleteList, true);

            this.numberBoxMinRadius.TextChanged += new System.EventHandler(this.textBoxSystemName_RadiusChanged);
            this.numberBoxMaxRadius.TextChanged += new System.EventHandler(this.textBoxSystemName_RadiusChanged);
            this.textBoxSystemName.TextChanged  += new System.EventHandler(this.textBoxSystemName_TextChanged);

            this.numberBoxDoubleX.ValidityChanged += ValidityNumberBox;
            this.numberBoxDoubleY.ValidityChanged += ValidityNumberBox;
            this.numberBoxDoubleZ.ValidityChanged += ValidityNumberBox;

            numberBoxMinRadius.SetComparitor(numberBoxMaxRadius, -2);     // need to do this after values are set
            numberBoxMaxRadius.SetComparitor(numberBoxMinRadius, 2);

            buttonExtExcel.Visible = showexcel;

            ValidateEnable();

            BaseUtils.Translator.Instance.Translate(this, new Control[] { labelX, labelY, labelZ });
        }