예제 #1
0
 //0=primary, 1 = first windowed version, etc
 public override void Init( EDDiscoveryForm ed, int vn)
 {
     discoveryform = ed;
     travelhistorycontrol = ed.TravelControl;
     displaynumber = vn;
     discoveryform.OnNewEntry += AddNewEntry;
     travelhistorycontrol.OnTravelSelectionChanged += SelectionChanged;
 }
예제 #2
0
        public override bool GetData(EDDiscoveryForm _discoveryForm)
        {
            var filter = _discoveryForm.TravelControl.GetPrimaryFilter;

            List<HistoryEntry> result = filter.Filter(_discoveryForm.history);

            scans = new List<JournalEntry>();

            scans = JournalEntry.GetByEventType(JournalTypeEnum.FSDJump, EDDiscoveryForm.EDDConfig.CurrentCmdrID, _discoveryForm.history.GetMinDate, _discoveryForm.history.GetMaxDate);

            return true;
        }
예제 #3
0
        public void InitForm(EDDiscoveryForm discoveryForm)
        {
            _discoveryForm = discoveryForm;
            comboBox_TextBorder.DataSource  = EDDTheme.TextboxBorderStyles;
            comboBox_ButtonStyle.DataSource = EDDTheme.ButtonStyles;

            SetPanel(panel_theme1, "Form Back Colour", EDDTheme.Settings.CI.form);                  // using tag, and tool tips, hook up patches to enum
            SetPanel(panel_theme2, "Text box Back Colour", EDDTheme.Settings.CI.textbox_back);
            SetPanel(panel_theme3, "Text box Text Colour", EDDTheme.Settings.CI.textbox_fore);
            SetPanel(panel_theme4, "Text box Highlight Colour", EDDTheme.Settings.CI.textbox_highlight);
            SetPanel(panel_theme15, "Text box Success Colour", EDDTheme.Settings.CI.textbox_success);
            SetPanel(panel_theme5, "Button Back Colour", EDDTheme.Settings.CI.button_back);
            SetPanel(panel_theme6, "Button Text Colour", EDDTheme.Settings.CI.button_text);
            SetPanel(panel_theme7, "Grid Border Back Colour", EDDTheme.Settings.CI.grid_borderback);
            SetPanel(panel_theme8, "Grid Border Text Colour", EDDTheme.Settings.CI.grid_bordertext);
            SetPanel(panel_theme9, "Grid Cell Back Colour", EDDTheme.Settings.CI.grid_cellbackground);
            SetPanel(panel_theme10, "Grid Cell Text Colour", EDDTheme.Settings.CI.grid_celltext);
            SetPanel(panel_theme11, "Menu Back Colour", EDDTheme.Settings.CI.menu_back);
            SetPanel(panel_theme12, "Menu Text Colour", EDDTheme.Settings.CI.menu_fore);
            SetPanel(panel_theme13, "Visited system without known position", EDDTheme.Settings.CI.travelgrid_nonvisted);
            SetPanel(panel_theme14, "Visited system with coordinates", EDDTheme.Settings.CI.travelgrid_visited);
            SetPanel(panel_theme16, "Check Box Text Colour", EDDTheme.Settings.CI.checkbox);
            SetPanel(panel_theme17, "Label Text Colour", EDDTheme.Settings.CI.label);
            SetPanel(panel_theme18, "Group box Back Colour", EDDTheme.Settings.CI.group_back);
            SetPanel(panel_theme19, "Group box Text Colour", EDDTheme.Settings.CI.group_text);
            SetPanel(panel_theme30, "Text Box Border Colour", EDDTheme.Settings.CI.textbox_border);
            SetPanel(panel_theme31, "Button Border Colour", EDDTheme.Settings.CI.button_border);
            SetPanel(panel_theme32, "Grid Border Line Colour", EDDTheme.Settings.CI.grid_borderlines);
            SetPanel(panel_theme33, "Group box Border Line Colour", EDDTheme.Settings.CI.group_borderlines);
            SetPanel(panel_theme35, "Tab Control Border Line Colour", EDDTheme.Settings.CI.tabcontrol_borderlines);
            SetPanel(panel_theme40, "Text Box Scroll Bar Slider Colour", EDDTheme.Settings.CI.textbox_sliderback);
            SetPanel(panel_theme41, "Text Box Scroll Bar Arrow Colour", EDDTheme.Settings.CI.textbox_scrollarrow);
            SetPanel(panel_theme42, "Text Box Scroll Bar Button Colour", EDDTheme.Settings.CI.textbox_scrollbutton);
            SetPanel(panel_theme43, "Grid Scroll Bar Slider Colour", EDDTheme.Settings.CI.grid_sliderback);
            SetPanel(panel_theme44, "Grid Scroll Bar Arrow Colour", EDDTheme.Settings.CI.grid_scrollarrow);
            SetPanel(panel_theme45, "Grid Scroll Bar Button Colour", EDDTheme.Settings.CI.grid_scrollbutton);
            SetPanel(panel_theme50, "Menu Dropdown Back Colour", EDDTheme.Settings.CI.menu_dropdownback);
            SetPanel(panel_theme51, "Menu Dropdown Text Colour", EDDTheme.Settings.CI.menu_dropdownfore);
            SetPanel(panel_theme60, "Tool Strip Back Colour", EDDTheme.Settings.CI.toolstrip_back);
            SetPanel(panel_theme61, "Tool Strip Border Colour", EDDTheme.Settings.CI.toolstrip_border);
            SetPanel(panel_theme62, "Tool Strip Checked Colour", EDDTheme.Settings.CI.toolstrip_buttonchecked);
            SetPanel(panel_theme70, "Check Box Tick Color", EDDTheme.Settings.CI.checkbox_tick);
            SetPanel(panel_theme71, "S-Panel Text Colour", EDDTheme.Settings.CI.s_panel);

            UpdatePatchesEtc();

            trackBar_theme_opacity.Value      = (int)_discoveryForm.theme.Opacity;
            comboBox_TextBorder.SelectedItem  = _discoveryForm.theme.TextBlockBorderStyle;
            comboBox_ButtonStyle.SelectedItem = _discoveryForm.theme.ButtonStyle;
        }
예제 #4
0
        public override bool ConfigurationMenu(Form parent, EDDiscoveryForm discoveryform, List <string> eventvars)
        {
            List <string> l = FromString(userdata);
            List <string> r = Forms.PromptMultiLine.ShowDialog(parent, "Configure Dialog",
                                                               new string[] { "Logical Name", "Caption", "Size", "Var Prefix" }, l?.ToArray(),
                                                               false, new string[] { "Handle name of menu", "Enter title of menu", "Size, as w,h (200,300)", "Variable Prefix" });

            if (r != null)
            {
                userdata = r.ToStringCommaList(2);
            }

            return(r != null);
        }
예제 #5
0
        public override bool ConfigurationMenu(Form parent, EDDiscoveryForm discoveryform, List <string> eventvars)
        {
            List <string> l = FromString(userdata);
            List <string> r = Forms.PromptMultiLine.ShowDialog(parent, "Configure InputBox Dialog",
                                                               new string[] { "Caption", "Prompt List", "Default List", "Features", "ToolTips" }, l?.ToArray(),
                                                               false, new string[] { "Enter name of menu", "List of entries, semicolon separated", "Default list, semicolon separated", "Feature list: Multiline", "List of tool tips, semocolon separated" });

            if (r != null)
            {
                userdata = r.ToStringCommaList(2);
            }

            return(r != null);
        }
예제 #6
0
        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            config = (Configuration)SQLiteDBClass.GetSettingInt(DbSave + "Config", (int)config);

            discoveryform = ed;
            uctg          = thc;
            displaynumber = vn;

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;
            uctg.OnTravelSelectionChanged += DisplaySelected;

            displayfont = discoveryform.theme.GetFont;
        }
예제 #7
0
        public void InitControl(EDDiscoveryForm discoveryForm)
        {
            _discoveryForm = discoveryForm;
            db             = new SQLiteDBClass();

            string ScreenshotsDirdefault = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\Frontier Developments\\Elite Dangerous";
            string OutputDirdefault      = ScreenshotsDirdefault + "\\Converted";

            comboBoxFormat.SelectedIndex = db.GetSettingInt("ImageHandlerFormatNr", 0);

            checkBoxAutoConvert.Checked = db.GetSettingBool("ImageHandlerAutoconvert", false);
            textBoxOutputDir.Text       = db.GetSettingString("ImageHandlerOutputDir", OutputDirdefault);
            textBoxScreenshotsDir.Text  = db.GetSettingString("ImageHandlerScreenshotsDir", ScreenshotsDirdefault);
            StartWatcher();
        }
예제 #8
0
        public override void Init(EDDiscoveryForm ed, int vn)  //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewModules.MakeDoubleBuffered();
            dataGridViewModules.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewModules.RowTemplate.Height        = 26;

            discoveryform.OnHistoryChange             += Discoveryform_OnHistoryChange;;
            discoveryform.OnNewEntry                  += Discoveryform_OnNewEntry;
            ed.TravelControl.OnTravelSelectionChanged += Display;

            buttonExtCoriolis.Visible = false;
        }
예제 #9
0
        public static Boolean showDialog(EDDiscoveryForm discoveryForm, out string systemName, out double radius)
        {
            ImportSphere prompt = new ImportSphere(discoveryForm);
            var          res    = prompt.ShowDialog(discoveryForm);

            systemName = prompt.txtExportVisited.Text;
            bool worked = Double.TryParse(prompt.txtsphereRadius.Text, out radius);

            if (!worked)
            {
                Forms.MessageBoxTheme.Show("Radius in wrong format", "Spehere error");
            }

            return(res == DialogResult.OK && worked);
        }
        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            _discoveryForm = ed;
            uctg           = thc;
            uctg.OnTravelSelectionChanged += Uctg_OnTravelSelectionChanged;

            computer = new StarDistanceComputer();

            HistoryEntry he = uctg.GetCurrentHistoryEntry;      // does our UCTG have a system selected?

            if (he != null)
            {
                //System.Diagnostics.Debug.WriteLine("Star grid started, uctg selected, ask");
                computer.CalculateClosestSystems(he.System, (s, d) => BeginInvoke((MethodInvoker) delegate { NewStarListComputed(s, d); }));     // hook here, force closes system update
            }
        }
예제 #11
0
        public override void Init(EDDiscoveryForm ed, int vn)  //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewMarketData.MakeDoubleBuffered();
            dataGridViewMarketData.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewMarketData.RowTemplate.Height        = 26;

            discoveryform.OnNewEntry += OnChanged;
            ed.TravelControl.OnTravelSelectionChanged += OnChanged;

            checkBoxBuyOnly.Enabled = false;
            checkBoxBuyOnly.Checked = DB.SQLiteDBClass.GetSettingBool(DbBuyOnly, false);
            checkBoxBuyOnly.Enabled = true;
        }
예제 #12
0
        public bool ConfigurationMenu(Form parent, EDDiscoveryForm discoveryform, List <string> eventvars, ref ConditionLists jf)
        {
            EDDiscovery.ConditionFilterForm frm = new EDDiscovery.ConditionFilterForm();
            frm.InitCondition("Define condition", eventvars, discoveryform, jf);

            frm.TopMost = parent.FindForm().TopMost;
            if (frm.ShowDialog(parent.FindForm()) == DialogResult.OK)
            {
                jf = frm.result;
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #13
0
        public SetNoteForm(HistoryEntry he, EDDiscoveryForm parent)
        {
            InitializeComponent();
            this.Owner               = parent;
            this._discoveryForm      = parent;
            this.HistoryEntry        = he;
            this.NoteText            = he.snc?.Note;
            this.textBoxNote.Text    = this.NoteText ?? "";
            this.labelTimestamp.Text = he.EventTimeLocal.ToString();
            this.labelSystem.Text    = he.System.name;
            this.labelSummary.Text   = he.EventSummary;
            this.labelDetails.Text   = he.EventDescription;

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            theme.ApplyToForm(this);
        }
예제 #14
0
        //0=primary, 1 = first windowed version, etc
        public override void Init(EDDiscoveryForm ed, int vn)
        {
            discoveryform = ed;
            travelhistorycontrol = ed.TravelControl;
            displaynumber = vn;
            travelhistorycontrol.OnTravelSelectionChanged += Display;
            discoveryform.OnNewEntry += NewEntry;

            checkBoxMaterials.Checked = SQLiteDBClass.GetSettingBool(DbSave+"Materials", true);
            checkBoxMaterialsRare.Checked = SQLiteDBClass.GetSettingBool(DbSave+"MaterialsRare", false);
            checkBoxMoons.Checked = SQLiteDBClass.GetSettingBool(DbSave+"Moons", true);
            int size = SQLiteDBClass.GetSettingInt(DbSave+"Size", 64);
            SetSizeCheckBoxes(size);

            imagebox.ClickElement += ClickElement;
        }
예제 #15
0
        public override void Init(EDDiscoveryForm ed, int vn)  //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewLedger.MakeDoubleBuffered();
            dataGridViewLedger.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewLedger.RowTemplate.Height        = 26;

            cfs.ConfigureThirdOption("Cash Transactions", string.Join(";", EliteDangerous.JournalEntry.GetListOfEventsWithOptMethod(true, "Ledger")));

            cfs.Changed += EventFilterChanged;
            TravelHistoryFilter.InitaliseComboBox(comboBoxHistoryWindow, DbHistorySave);

            discoveryform.OnHistoryChange += Redisplay;
            discoveryform.OnNewEntry      += NewEntry;
        }
예제 #16
0
        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            //Can use display number for it, because their names for db save are unique between engineering and synthesis.
            userControlEngineering.isEmbedded = true;
            userControlEngineering.Init(ed, thc, displaynumber);

            userControlSynthesis.isEmbedded = true;
            userControlSynthesis.Init(ed, thc, displaynumber);

            // so the way it works, if the panels ever re-display (for whatever reason) they tell us, and we redisplay

            userControlSynthesis.OnDisplayComplete   += Synthesis_OnWantedChange;
            userControlEngineering.OnDisplayComplete += Engineering_OnWantedChange;
        }
예제 #17
0
        public override void Init(EDDiscoveryForm ed, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform        = ed;
            travelhistorycontrol = ed.TravelControl;
            displaynumber        = vn;
            travelhistorycontrol.OnTravelSelectionChanged += Display;
            discoveryform.OnNewEntry += NewEntry;

            checkBoxMaterials.Checked     = SQLiteDBClass.GetSettingBool(DbSave + "Materials", true);
            checkBoxMaterialsRare.Checked = SQLiteDBClass.GetSettingBool(DbSave + "MaterialsRare", false);
            checkBoxMoons.Checked         = SQLiteDBClass.GetSettingBool(DbSave + "Moons", true);
            int size = SQLiteDBClass.GetSettingInt(DbSave + "Size", 64);

            SetSizeCheckBoxes(size);

            imagebox.ClickElement += ClickElement;
        }
예제 #18
0
        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn)  //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            uctg          = thc;
            displaynumber = vn;

            dataGridViewMarketData.MakeDoubleBuffered();
            dataGridViewMarketData.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewMarketData.RowTemplate.Height        = 26;

            discoveryform.OnNewEntry      += OnChanged;
            uctg.OnTravelSelectionChanged += OnChanged;

            checkBoxBuyOnly.Checked              = SQLiteDBClass.GetSettingBool(DbBuyOnly, false);
            this.checkBoxBuyOnly.CheckedChanged += new System.EventHandler(this.checkBoxBuyOnly_CheckedChanged);
            checkBoxAutoSwap.Checked             = SQLiteDBClass.GetSettingBool(DbAutoSwap, false);
        }
예제 #19
0
        public static Boolean showDialog(EDDiscoveryForm discoveryForm, out string systemName, out double radius, Form owner)
        {
            owner = owner ?? discoveryForm;

            ImportSphere prompt = new ImportSphere(discoveryForm);

            prompt.Icon = owner.Icon;

            EDDTheme.Instance.ApplyToFormStandardFontSize(prompt);

            var res = prompt.ShowDialog(owner);

            systemName = prompt.txtExportVisited.Text;
            radius     = prompt.txtsphereRadius.Value;

            return(res == DialogResult.OK);
        }
예제 #20
0
        public void Init(string t, EDDiscoveryForm form,
                         List <string> vbs,                                  // list any variables you want in condition statements - passed to config menu, passed back up to condition, not null
                         string pfilesetname,                                // file set name
                         ActionProgram prog   = null,                        // give the program to display
                         string[] defprogs    = null,                        // list any default program names
                         string suggestedname = null, bool edittext = false) // give a suggested name, if prog is null
        {
            discoveryform = form;

            startvarlist   = vbs;
            currentvarlist = new List <string>(startvarlist);

            bool winborder = discoveryform.theme.ApplyToForm(this, SystemFonts.DefaultFont);

            statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder;
            this.Text = label_index.Text = t;

            filesetname   = pfilesetname;
            labelSet.Text = filesetname + "::";
            textBoxBorderName.Location = new Point(labelSet.Location.X + labelSet.Width + 8, textBoxBorderName.Location.Y);

            if (defprogs != null)
            {
                definedprograms = defprogs;
            }

            if (suggestedname != null)
            {
                textBoxBorderName.Text = suggestedname;
            }

            if (prog != null)
            {
                LoadProgram(prog);
            }

            panelVScroll.ContextMenuStrip = contextMenuStrip1;
            panelVScroll.MouseDown       += panelVScroll_MouseDown;

            editastextimmediately = edittext;

#if !DEBUG
            buttonExtDisk.Visible = false;
#endif
        }
예제 #21
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();
        }
예제 #22
0
        public override void Init(EDDiscoveryForm ed, int vn)  //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewJournal.MakeDoubleBuffered();
            dataGridViewJournal.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridViewJournal.RowTemplate.Height        = 26;
            dataGridViewJournal.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx
            cfs.ConfigureThirdOption("Travel", "Docked;FSD Jump;Undocked;");
            cfs.Changed += EventFilterChanged;
            TravelHistoryFilter.InitaliseComboBox(comboBoxJournalWindow, DbHistorySave);

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += AddNewEntry;

            buttonRefresh.Visible = false;
        }
예제 #23
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();
        }
예제 #24
0
        public override bool ConfigurationMenu(Form parent, EDDiscoveryForm discoveryform, List <string> eventvars)
        {
            ConditionLists cond;
            string         errmsg;

            FromString(userdata, out cond, out errmsg);

            if (base.ConfigurationMenu(parent, discoveryform, eventvars, ref cond))
            {
                string promptValue = Forms.PromptSingleLine.ShowDialog(parent, "Error to display", errmsg, "Configure ErrorIf Command");
                if (promptValue != null)
                {
                    userdata = ToString(cond, promptValue);
                    return(true);
                }
            }

            return(false);
        }
예제 #25
0
        public SetNoteForm(HistoryEntry he, EDDiscoveryForm parent)
        {
            InitializeComponent();
            this.Owner               = parent;
            this._discoveryForm      = parent;
            this.HistoryEntry        = he;
            this.NoteText            = he.snc?.Note;
            this.textBoxNote.Text    = this.NoteText ?? "";
            this.labelTimestamp.Text = he.EventTimeLocal.ToString();
            this.labelSystem.Text    = he.System.Name;

            he.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);

            this.labelSummary.Text = he.EventSummary;
            this.labelDetails.Text = EventDescription;

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            theme.ApplyToFormStandardFontSize(this);
        }
예제 #26
0
        public override void Init(EDDiscoveryForm ed, UserControlCursorType tg, int vn) // TG is not used.
        {
            discoveryform = ed;
            displaynumber = vn;
            TravelHistoryFilter.InitaliseComboBox(comboBoxHistoryWindow, DbHistorySave);

            checkBoxMoveToTop.Checked = SQLiteConnectionUser.GetSettingBool(DbAutoTop, true);

            discoveryform.OnHistoryChange += HistoryChanged;
            discoveryform.OnNewEntry      += AddNewEntry;

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

            checkBoxEDSM.Checked = SQLiteDBClass.GetSettingBool(DbEDSM, false);
        }
예제 #27
0
        public void InitControl(EDDiscoveryForm discoveryForm)
        {
            _discoveryForm = discoveryForm;

            string ScreenshotsDirdefault = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Frontier Developments", "Elite Dangerous");
            string OutputDirdefault      = Path.Combine(ScreenshotsDirdefault, "Converted");

            try
            {
                comboBoxFormat.SelectedIndex = SQLiteDBClass.GetSettingInt("ImageHandlerFormatNr", 0);
            }
            catch { }

            try
            {
                comboBoxFileNameFormat.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxFileNameFormat", 0);
            }
            catch { }

            try
            {
                comboBoxScanFor.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxScanFor", 0);
            }
            catch { }

            checkBoxAutoConvert.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerAutoconvert", false);
            checkBoxRemove.Checked      = SQLiteDBClass.GetSettingBool("checkBoxRemove", false);
            checkBoxHires.Checked       = SQLiteDBClass.GetSettingBool("checkBoxHires", false);

            textBoxOutputDir.Text      = SQLiteDBClass.GetSettingString("ImageHandlerOutputDir", OutputDirdefault);
            textBoxScreenshotsDir.Text = SQLiteDBClass.GetSettingString("ImageHandlerScreenshotsDir", ScreenshotsDirdefault);

            checkBoxPreview.Checked   = SQLiteDBClass.GetSettingBool("ImageHandlerPreview", false);
            checkBoxCropImage.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerCropImage", false);      // fires the checked handler which sets the readonly mode of the controls
            numericUpDownTop.Value    = SQLiteDBClass.GetSettingInt("ImageHandlerCropTop", 0);
            numericUpDownLeft.Value   = SQLiteDBClass.GetSettingInt("ImageHandlerCropLeft", 0);
            numericUpDownWidth.Value  = SQLiteDBClass.GetSettingInt("ImageHandlerCropWidth", 0);
            numericUpDownHeight.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropHeight", 0);

            textBoxFileNameExample.Text = CreateFileName("Sol", "HighResScreenshot_0000.bmp", comboBoxFileNameFormat.SelectedIndex, checkBoxHires.Checked);

            numericUpDownTop.Enabled = numericUpDownWidth.Enabled = numericUpDownLeft.Enabled = numericUpDownHeight.Enabled = checkBoxCropImage.Checked;
        }
예제 #28
0
        public override void Init(EDDiscoveryForm ed, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;
            discoveryform.OnNewTarget     += NewTarget;

            displayfont = discoveryform.theme.GetFont;

            autoCopyWPToolStripMenuItem.Checked    = SQLiteDBClass.GetSettingBool(DbSave + "autoCopyWP", false);
            autoSetTargetToolStripMenuItem.Checked = SQLiteDBClass.GetSettingBool(DbSave + "autoSetTarget", false);

            String selRoute = SQLiteDBClass.GetSettingString(DbSave + "SelectedRoute", "-1");
            long   id       = long.Parse(selRoute);

            _currentRoute = SavedRouteClass.GetAllSavedRoutes().Find(r => r.Id.Equals(id));
            updateScreen();
        }
예제 #29
0
        public void Init(UserControlCommonBase.DBSettingsSaver db, bool showexcel, EDDiscoveryForm disc)
        {
            dbsaver                    = db;
            discoveryform              = disc;
            numberBoxMinRadius.Value   = dbsaver.GetSetting(dbRadiusMin, 0.0);
            numberBoxMaxRadius.Value   = dbsaver.GetSetting(dbRadiusMax, 20.0);
            textBoxSystemName.Text     = dbsaver.GetSetting(dbStar, "");
            numberBoxDoubleX.Value     = dbsaver.GetSetting(dbX, 0.0);
            numberBoxDoubleY.Value     = dbsaver.GetSetting(dbY, 0.0);
            numberBoxDoubleZ.Value     = dbsaver.GetSetting(dbZ, 0.0);
            checkBoxCustomCube.Checked = dbsaver.GetSetting(dbCube, false);
            extCheckBoxExcludeVisitedSystems.Checked = dbsaver.GetSetting(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();

            var enumlist = new Enum[] { EDTx.FindSystemsUserControl_extCheckBoxExcludeVisitedSystems, EDTx.FindSystemsUserControl_checkBoxCustomCube, EDTx.FindSystemsUserControl_buttonExtNames, EDTx.FindSystemsUserControl_buttonExtVisited, EDTx.FindSystemsUserControl_buttonExtDB, EDTx.FindSystemsUserControl_buttonExtEDSM, EDTx.FindSystemsUserControl_labelRadMax, EDTx.FindSystemsUserControl_labelRadMin, EDTx.FindSystemsUserControl_labelFilter };

            BaseUtils.Translator.Instance.TranslateControls(this, enumlist, new Control[] { labelX, labelY, labelZ });
        }
예제 #30
0
        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            uctg          = thc;
            displaynumber = vn;
            uctg.OnTravelSelectionChanged += Display;
            discoveryform.OnNewEntry      += NewEntry;

            progchange = true;
            checkBoxMaterials.Checked     = SQLiteDBClass.GetSettingBool(DbSave + "Materials", true);
            checkBoxMaterialsRare.Checked = SQLiteDBClass.GetSettingBool(DbSave + "MaterialsRare", false);
            checkBoxMoons.Checked         = SQLiteDBClass.GetSettingBool(DbSave + "Moons", true);
            checkBoxEDSM.Checked          = SQLiteDBClass.GetSettingBool(DbSave + "EDSM", false);
            progchange = false;

            int size = SQLiteDBClass.GetSettingInt(DbSave + "Size", 64);

            SetSizeCheckBoxes(size);

            imagebox.ClickElement += ClickElement;
        }
예제 #31
0
        public bool ConfigurationMenu(Form parent, EDDiscoveryForm discoveryform, List <string> eventvars, bool allowaddv, bool allownoexpandv)
        {
            ConditionVariables          av;
            Dictionary <string, string> operations;

            FromString(userdata, out av, out operations);

            ConditionVariablesForm avf = new ConditionVariablesForm();

            avf.Init("Variable list:", discoveryform.theme, av, showone: true, allowadd: allowaddv, allownoexpand: allownoexpandv, altops: operations);

            if (avf.ShowDialog(parent.FindForm()) == DialogResult.OK)
            {
                userdata = ToString(avf.result, avf.result_altops);
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #32
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 });
        }
예제 #33
0
        public override bool GetData(EDDiscoveryForm _discoveryForm)
        {
            bool datepicked = false;
            var  picker     = new DateTimePicker();

            if (this.datepopup)
            {
                Button button1 = new Button();
                button1.Text         = "OK";
                button1.DialogResult = DialogResult.OK;
                Form             f   = new Form();
                TableLayoutPanel tlp = new TableLayoutPanel();
                tlp.ColumnCount  = 2;
                tlp.RowCount     = 2;
                tlp.Dock         = DockStyle.Fill;
                tlp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                tlp.AutoSize     = true;
                f.Name           = TITLE;
                tlp.Controls.Add(picker, 0, 0);
                tlp.Controls.Add(button1, 1, 1);
                f.Controls.Add(tlp);
                f.AutoSize = true;
                var result = f.ShowDialog();
                if (result == DialogResult.OK)
                {
                    datepicked = true;
                }
            }

            int count = 0;

            data = HistoryList.FilterByJournalEvent(_discoveryForm.history.ToList(), "Sell Exploration Data", out count);

            scans = HistoryList.FilterByJournalEvent(_discoveryForm.history.ToList(), "Scan", out count);
            if (datepicked)
            {
                data = (from he in data where he.EventTimeUTC >= picker.Value.Date.ToUniversalTime() orderby he.EventTimeUTC descending select he).ToList();
            }
            return(true);
        }
예제 #34
0
        public override bool GetData(EDDiscoveryForm _discoveryForm)
        {
            bool datepicked = false;
            var picker = new DateTimePicker();
            if (this.datepopup)
            {
                Button button1 = new Button();
                button1.Text = "OK";
                button1.DialogResult = DialogResult.OK;
                Form f = new Form();
                TableLayoutPanel tlp = new TableLayoutPanel();
                tlp.ColumnCount = 2;
                tlp.RowCount = 2;
                tlp.Dock = DockStyle.Fill;
                tlp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                tlp.AutoSize = true;
                f.Name = TITLE;
                tlp.Controls.Add(picker, 0, 0);
                tlp.Controls.Add(button1, 1, 1);
                f.Controls.Add(tlp);
                f.AutoSize = true;
                var result = f.ShowDialog();
                if (result == DialogResult.OK)
                {
                    datepicked = true;
                }
            }

            int count = 0;
            data = HistoryList.FilterByJournalEvent(_discoveryForm.history.ToList(), "Sell Exploration Data", out count);

            scans = HistoryList.FilterByJournalEvent(_discoveryForm.history.ToList(), "Scan", out count);
            if (datepicked)
            {
                data = (from he in data where he.EventTimeUTC >= picker.Value.Date.ToUniversalTime() orderby he.EventTimeUTC descending select he).ToList();
            }
            return true;
        }
예제 #35
0
        public override bool GetData(EDDiscoveryForm _discoveryForm)
        {
            if(_discoveryForm.RouteControl.RouteSystems==null
                || _discoveryForm.RouteControl.RouteSystems.Count==0)
            {

                MessageBox.Show(String.Format("Please create a route on the route tab"), TITLE);
                return false;
            }

            Point3D last = null;
            foreach (SystemClass s in _discoveryForm.RouteControl.RouteSystems)
            {
               Point3D pos = new Point3D(s.x, s.y, s.z);
                double dist = 0;
                if (last != null)
                {
                    dist = Point3D.DistanceBetween(pos, last);
                }
                last = pos;
                data.Add(new KeyValuePair<String, double>(s.name, dist));
            }
            return true;
        }
예제 #36
0
 public virtual void Init( EDDiscoveryForm ed, int displayno)
 {
 }
예제 #37
0
 private static long ParseEDSMUpdateSystemsReader(JsonTextReader jr, ref string date, ref bool outoforder, bool removenonedsmids, EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress, bool useCache = true, bool useTempSystems = false)
 {
     using (SQLiteConnectionSystem cn = new SQLiteConnectionSystem())  // open the db
     {
         return DoParseEDSMUpdateSystemsReader(jr, ref date, ref outoforder, cn, discoveryform, cancelRequested, reportProgress, useCache, useTempSystems);
     }
 }
예제 #38
0
        private static long DoParseEDSMUpdateSystemsReader(JsonTextReader jr, ref string date, ref bool outoforder, SQLiteConnectionSystem cn, EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress, bool useCache = true, bool useTempSystems = false)
        {
            DateTime maxdate;

            if (!DateTime.TryParse(date, CultureInfo.InvariantCulture, DateTimeStyles.None, out maxdate))
            {
                maxdate = new DateTime(2010, 1, 1);
            }

            Dictionary<long, EDDiscovery2.DB.InMemory.SystemClassBase> systemsByEdsmId = useCache ? GetEdsmSystemsLite(cn) : new Dictionary<long, EDDiscovery2.DB.InMemory.SystemClassBase>();
            int count = 0;
            int updatecount = 0;
            int insertcount = 0;
            Random rnd = new Random();
            int[] histogramsystems = new int[50000];
            string sysnamesTableName = useTempSystems ? "SystemNames_temp" : "SystemNames";
            string edsmsysTableName = useTempSystems ? "EdsmSystems_temp" : "EdsmSystems";
            Stopwatch sw = Stopwatch.StartNew();

            while (!cancelRequested())
            {
                bool jr_eof = false;
                List<JObject> objs = new List<JObject>();

                while (!cancelRequested())
                {
                    if (jr.Read())
                    {
                        if (jr.TokenType == JsonToken.StartObject)
                        {
                            objs.Add(JObject.Load(jr));

                            if (objs.Count >= 10000)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        jr_eof = true;
                        break;
                    }
                }

                using (DbTransaction txn = cn.BeginTransaction())
                {
                    DbCommand updateNameCmd = null;
                    DbCommand updateSysCmd = null;
                    DbCommand insertNameCmd = null;
                    DbCommand insertSysCmd = null;
                    DbCommand selectSysCmd = null;
                    DbCommand selectNameCmd = null;

                    try
                    {
                        updateNameCmd = cn.CreateCommand("UPDATE SystemNames SET Name=@Name WHERE EdsmId=@EdsmId", txn);
                        updateNameCmd.AddParameter("@Name", DbType.String);
                        updateNameCmd.AddParameter("@EdsmId", DbType.Int64);

                        updateSysCmd = cn.CreateCommand("UPDATE EdsmSystems SET X=@X, Y=@Y, Z=@Z, UpdateTimestamp=@UpdateTimestamp, VersionTimestamp=@VersionTimestamp, GridId=@GridId, RandomId=@RandomId WHERE EdsmId=@EdsmId", txn);
                        updateSysCmd.AddParameter("@X", DbType.Int64);
                        updateSysCmd.AddParameter("@Y", DbType.Int64);
                        updateSysCmd.AddParameter("@Z", DbType.Int64);
                        updateSysCmd.AddParameter("@UpdateTimestamp", DbType.Int64);
                        updateSysCmd.AddParameter("@VersionTimestamp", DbType.Int64);
                        updateSysCmd.AddParameter("@GridId", DbType.Int64);
                        updateSysCmd.AddParameter("@RandomId", DbType.Int64);
                        updateSysCmd.AddParameter("@EdsmId", DbType.Int64);

                        insertNameCmd = cn.CreateCommand("INSERT INTO " + sysnamesTableName + " (Name, EdsmId) VALUES (@Name, @EdsmId)", txn);
                        insertNameCmd.AddParameter("@Name", DbType.String);
                        insertNameCmd.AddParameter("@EdsmId", DbType.Int64);

                        insertSysCmd = cn.CreateCommand("INSERT INTO " + edsmsysTableName + " (EdsmId, X, Y, Z, CreateTimestamp, UpdateTimestamp, VersionTimestamp, GridId, RandomId) VALUES (@EdsmId, @X, @Y, @Z, @CreateTimestamp, @UpdateTimestamp, @VersionTimestamp, @GridId, @RandomId)", txn);
                        insertSysCmd.AddParameter("@EdsmId", DbType.Int64);
                        insertSysCmd.AddParameter("@X", DbType.Int64);
                        insertSysCmd.AddParameter("@Y", DbType.Int64);
                        insertSysCmd.AddParameter("@Z", DbType.Int64);
                        insertSysCmd.AddParameter("@CreateTimestamp", DbType.Int64);
                        insertSysCmd.AddParameter("@UpdateTimestamp", DbType.Int64);
                        insertSysCmd.AddParameter("@VersionTimestamp", DbType.Int64);
                        insertSysCmd.AddParameter("@GridId", DbType.Int64);
                        insertSysCmd.AddParameter("@RandomId", DbType.Int64);

                        selectSysCmd = cn.CreateCommand("SELECT Id, X, Y, Z, GridId, RandomId FROM EdsmSystems WHERE EdsmId=@EdsmId");
                        selectSysCmd.AddParameter("@EdsmId", DbType.Int64);

                        selectNameCmd = cn.CreateCommand("SELECT Name FROM SystemNames WHERE EdsmId = @EdsmId");
                        selectNameCmd.AddParameter("@EdsmId", DbType.Int64);

                        IEnumerator<JObject> jo_enum = objs.GetEnumerator();

                        while (!cancelRequested())
                        {
                            if (!jo_enum.MoveNext())
                            {
                                reportProgress(-1, $"Syncing EDSM systems: {count} processed, {insertcount} new systems, {updatecount} updated systems");
                                txn.Commit();

                                if (jr_eof)
                                {
                                    date = maxdate.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);

                                    Console.WriteLine($"Import took {sw.ElapsedMilliseconds}ms");

                                    for (int id = 0; id < histogramsystems.Length; id++)
                                    {
                                        if (histogramsystems[id] != 0)
                                            Console.WriteLine("Id " + id + " count " + histogramsystems[id]);
                                    }

                                    return updatecount + insertcount;
                                }

                                break;
                            }

                            JObject jo = jo_enum.Current;

                            JObject coords = (JObject)jo["coords"];

                            if (coords != null && (coords["x"].Type == JTokenType.Float || coords["x"].Type == JTokenType.Integer))
                            {
                                double x = coords["x"].Value<double>();
                                double y = coords["y"].Value<double>();
                                double z = coords["z"].Value<double>();
                                long edsmid = jo["id"].Value<long>();
                                string name = jo["name"].Value<string>();
                                int gridid = GridId.Id(x, z);
                                int randomid = rnd.Next(0, 99);
                                DateTime updatedate = jo["date"].Value<DateTime>();
                                histogramsystems[gridid]++;

                                if (updatedate > maxdate)
                                    maxdate = updatedate;
                                else if (updatedate < maxdate - TimeSpan.FromHours(1))
                                    outoforder = true;

                                EDDiscovery2.DB.InMemory.SystemClassBase dbsys = null;

                                if (!useTempSystems)
                                {
                                    if (useCache && systemsByEdsmId.ContainsKey(edsmid))
                                        dbsys = systemsByEdsmId[edsmid];

                                    if (!useCache)
                                    {
                                        selectSysCmd.Parameters["@EdsmId"].Value = edsmid;
                                        using (DbDataReader reader = selectSysCmd.ExecuteReader())
                                        {
                                            if (reader.Read())
                                            {
                                                dbsys = new EDDiscovery2.DB.InMemory.SystemClassBase
                                                {
                                                    id = (long)reader["id"],
                                                    id_edsm = edsmid
                                                };

                                                if (System.DBNull.Value == reader["x"])
                                                {
                                                    dbsys.x = double.NaN;
                                                    dbsys.y = double.NaN;
                                                    dbsys.z = double.NaN;
                                                }
                                                else
                                                {
                                                    dbsys.x = ((double)(long)reader["X"]) / XYZScalar;
                                                    dbsys.y = ((double)(long)reader["Y"]) / XYZScalar;
                                                    dbsys.z = ((double)(long)reader["Z"]) / XYZScalar;
                                                }

                                                dbsys.id_edsm = edsmid;
                                                dbsys.gridid = reader["GridId"] == DBNull.Value ? 0 : (int)((long)reader["GridId"]);
                                                dbsys.randomid = reader["RandomId"] == DBNull.Value ? 0 : (int)((long)reader["RandomId"]);
                                            }
                                        }

                                        if (dbsys != null)
                                        {
                                            selectNameCmd.Parameters["@EdsmId"].Value = edsmid;
                                            using (DbDataReader reader = selectNameCmd.ExecuteReader())
                                            {
                                                if (reader.Read())
                                                {
                                                    dbsys.name = (string)reader["Name"];
                                                }
                                            }
                                        }
                                    }
                                }

                                if (dbsys != null)
                                {
                                    // see if EDSM data changed..
                                    if (!dbsys.name.Equals(name))
                                    {
                                        updateNameCmd.Parameters["@Name"].Value = name;
                                        updateNameCmd.Parameters["@EdsmId"].Value = edsmid;
                                        updateNameCmd.ExecuteNonQuery();
                                    }

                                    if (Math.Abs(dbsys.x - x) > 0.01 ||
                                        Math.Abs(dbsys.y - y) > 0.01 ||
                                        Math.Abs(dbsys.z - z) > 0.01 ||
                                        dbsys.gridid != gridid)  // position changed
                                    {
                                        updateSysCmd.Parameters["@X"].Value = (long)(x * XYZScalar);
                                        updateSysCmd.Parameters["@Y"].Value = (long)(y * XYZScalar);
                                        updateSysCmd.Parameters["@Z"].Value = (long)(z * XYZScalar);
                                        updateSysCmd.Parameters["@UpdateTimestamp"].Value = updatedate.Subtract(new DateTime(2015, 1, 1)).TotalSeconds;
                                        updateSysCmd.Parameters["@VersionTimestamp"].Value = DateTime.UtcNow.Subtract(new DateTime(2015, 1, 1)).TotalSeconds;
                                        updateSysCmd.Parameters["@GridId"].Value = gridid;
                                        updateSysCmd.Parameters["@RandomId"].Value = randomid;
                                        updateSysCmd.Parameters["@EdsmId"].Value = edsmid;
                                        updateSysCmd.ExecuteNonQuery();
                                        updatecount++;
                                    }
                                }
                                else                                                                  // not in database..
                                {
                                    insertNameCmd.Parameters["@Name"].Value = name;
                                    insertNameCmd.Parameters["@EdsmId"].Value = edsmid;
                                    insertNameCmd.ExecuteNonQuery();
                                    insertSysCmd.Parameters["@EdsmId"].Value = edsmid;
                                    insertSysCmd.Parameters["@X"].Value = (long)(x * XYZScalar);
                                    insertSysCmd.Parameters["@Y"].Value = (long)(y * XYZScalar);
                                    insertSysCmd.Parameters["@Z"].Value = (long)(z * XYZScalar);
                                    insertSysCmd.Parameters["@CreateTimestamp"].Value = updatedate.Subtract(new DateTime(2015, 1, 1)).TotalSeconds;
                                    insertSysCmd.Parameters["@UpdateTimestamp"].Value = updatedate.Subtract(new DateTime(2015, 1, 1)).TotalSeconds;
                                    insertSysCmd.Parameters["@VersionTimestamp"].Value = DateTime.UtcNow.Subtract(new DateTime(2015, 1, 1)).TotalSeconds;
                                    insertSysCmd.Parameters["@GridId"].Value = gridid;
                                    insertSysCmd.Parameters["@RandomId"].Value = randomid;
                                    insertSysCmd.ExecuteNonQuery();
                                    insertcount++;
                                }
                            }

                            count++;
                        }
                    }
                    finally
                    {
                        if (updateNameCmd != null) updateNameCmd.Dispose();
                        if (updateSysCmd != null) updateSysCmd.Dispose();
                        if (insertNameCmd != null) insertNameCmd.Dispose();
                        if (insertSysCmd != null) insertSysCmd.Dispose();
                        if (selectSysCmd != null) selectSysCmd.Dispose();
                    }
                }
            }

            if (cancelRequested())
            {
                throw new OperationCanceledException();
            }

            return updatecount + insertcount;
        }
예제 #39
0
 public static long ParseEDSMUpdateSystemsString(string json, ref string date, ref bool outoforder, bool removenonedsmids, EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress, bool useCache = true)
 {
     using (StringReader sr = new StringReader(json))
         return ParseEDSMUpdateSystemsStream(sr, ref date, ref outoforder, removenonedsmids, discoveryform, cancelRequested, reportProgress, useCache);
 }
예제 #40
0
 public static long ParseEDSMUpdateSystemsStream(TextReader sr, ref string date, ref bool outoforder, bool removenonedsmids, EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress, bool useCache = true, bool useTempSystems = false)
 {
     using (JsonTextReader jr = new JsonTextReader(sr))
         return ParseEDSMUpdateSystemsReader(jr, ref date, ref outoforder, removenonedsmids, discoveryform, cancelRequested, reportProgress, useCache, useTempSystems);
 }
예제 #41
0
 public static long ParseEDSMUpdateSystemsFile(string filename, ref string date, ref bool outoforder, bool removenonedsmids, EDDiscoveryForm discoveryform, Func<bool> cancelRequested, Action<int, string> reportProgress, bool useCache = true)
 {
     using (StreamReader sr = new StreamReader(filename))         // read directly from file..
         return ParseEDSMUpdateSystemsStream(sr, ref date, ref outoforder, removenonedsmids, discoveryform, cancelRequested, reportProgress, useCache);
 }
예제 #42
0
 public override void Init( EDDiscoveryForm ed, int displayno)
 {
     discoveryform = ed;
     discoveryform.OnNewLogEntry += AppendText;
 }
예제 #43
0
        //0=primary, 1 = first windowed version, etc
        public override void Init(EDDiscoveryForm ed, int vn)
        {
            discoveryform = ed;
            travelhistorycontrol = ed.TravelControl;
            displaynumber = vn;
            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry += NewEntry;
            discoveryform.OnNewTarget += NewTarget;

            config = (Configuration)SQLiteDBClass.GetSettingInt(DbSave + "Config", (int)config);
            toolStripMenuItemTargetLine.Checked = Config(Configuration.showTargetLine);
            toolStripMenuItemTime.Checked = Config(Configuration.showTime);
            EDSMButtonToolStripMenuItem.Checked = Config(Configuration.showEDSMButton);
            showTargetToolStripMenuItem.Checked = Config(Configuration.showDistancePerStar);
            showNotesToolStripMenuItem.Checked = Config(Configuration.showNotes);
            showXYZToolStripMenuItem.Checked = Config(Configuration.showXYZ);
            showDescriptionToolStripMenuItem.Checked = Config(Configuration.showDescription);
            showInformationToolStripMenuItem.Checked = Config(Configuration.showInformation);
            blackBoxAroundTextToolStripMenuItem.Checked = Config(Configuration.showBlackBoxAroundText);
            showDistancesOnFSDJumpsOnlyToolStripMenuItem.Checked = Config(Configuration.showDistancesOnFSDJumpsOnly);
            expandTextOverEmptyColumnsToolStripMenuItem.Checked = Config(Configuration.showExpandOverColumns);
            showNothingWhenDockedtoolStripMenuItem.Checked = Config(Configuration.showNothingWhenDocked);

            SetSurfaceScanBehaviour(null);
            SetScanPosition(null);
            SetLayoutOrder(SQLiteDBClass.GetSettingInt(DbSave + "Layout", layoutorder),false);  // also resets the tab order

            scanhide.Tick += HideScanData;

            dividercheck.Tick += DividerCheck;
            dividercheck.Interval = 500;

            string tabs = SQLiteDBClass.GetSettingString(DbSave + "PanelTabs", "");
            try
            {
                List<int> tablist = tabs.Split(',').Select(int.Parse).ToList();

                for (int i = 0; i < tablist.Count && i < columnpos.Count; i++)      // for what we have, and not more than pre-populated, fill
                    columnpos[i] = tablist[i];
            }
            catch { }

            displayfont = discoveryform.theme.GetFont;

            pictureBox.ContextMenuStrip = contextMenuStripConfig;

            string filter = SQLiteDBClass.GetSettingString(DbFieldFilter, "");
            if (filter.Length > 0)
                fieldfilter.FromJSON(filter);        // load filter

            cfs.ConfigureThirdOption("Travel", "Docked;FSD Jump;Undocked;");
            cfs.Changed += EventFilterChanged;

            dividers = new ButtonExt[] { buttonExt0, buttonExt1, buttonExt2, buttonExt3, buttonExt4, buttonExt5, buttonExt6, buttonExt7, buttonExt8, buttonExt9, buttonExt10 };

            #if TH
            travelhistorycontrol.OnTravelSelectionChanged += Travelhistorycontrol_OnTravelSelectionChanged;
            #endif
        }
        //0=primary, 1 = first windowed version, etc
        public override void Init( EDDiscoveryForm ed, int vn)
        {
            discoveryform = ed;
            travelhistorycontrol = ed.TravelControl;
            displaynumber = vn;

            dataGridViewMC.MakeDoubleBuffered();
            dataGridViewMC.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewMC.RowTemplate.Height = 26;

            if (materials)
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[5]);       // to give name,shortname abv,category,type,number
            else
            {
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[1]);       //shortname
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[1]);       //then category to give name,type,number, avg price
            }

            namecol = 0;
            abvcol = (materials) ? 1 : -1;
            catcol = (materials) ? 2 : -1;
            typecol = (materials) ? 3 : 1;
            numcol = (materials) ? 4 : 2;
            pricecol = (materials) ? -1 : 3;

            travelhistorycontrol.OnTravelSelectionChanged += Display;

            SetCheckBoxes();
        }
예제 #45
0
        //0=primary, 1 = first windowed version, etc
        public override void Init( EDDiscoveryForm ed, int vn)
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewLedger.MakeDoubleBuffered();
            dataGridViewLedger.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewLedger.RowTemplate.Height = 26;

            cfs.ConfigureThirdOption("Cash Transactions", string.Join(";", EliteDangerous.JournalEntry.GetListOfEventsWithOptMethod(true, "Ledger")));

            cfs.Changed += EventFilterChanged;
            TravelHistoryFilter.InitaliseComboBox(comboBoxHistoryWindow, DbHistorySave);

            discoveryform.OnHistoryChange += Redisplay;
            discoveryform.OnNewEntry += NewEntry;
        }
예제 #46
0
        //0=primary, 1 = first windowed version, etc
        public override void Init( EDDiscoveryForm ed, int vn)
        {
            discoveryform = ed;
            displaynumber = vn;

            dataGridViewJournal.MakeDoubleBuffered();
            dataGridViewJournal.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridViewJournal.RowTemplate.Height = 26;
            dataGridViewJournal.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;     // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx
            cfs.ConfigureThirdOption("Travel", "Docked;FSD Jump;Undocked;");
            cfs.Changed += EventFilterChanged;
            TravelHistoryFilter.InitaliseComboBox(comboBoxJournalWindow, DbHistorySave);

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry += AddNewEntry;

            buttonRefresh.Visible = false;

            string filter = SQLiteDBClass.GetSettingString(DbFieldFilter, "");
            if (filter.Length > 0)
                fieldfilter.FromJSON(filter);        // load filter
        }
예제 #47
0
 //0=primary, 1 = first windowed version, etc
 public override void Init( EDDiscoveryForm ed, int vn)
 {
     discoveryform = ed;
     displaynumber = vn;
     discoveryform.ImageHandler.OnScreenShot += ScreenShot;
 }
예제 #48
0
 public abstract bool GetData(EDDiscoveryForm _discoveryForm);