private void ShowSelectedImage() { string str = toolStripComboBox1.SelectedItem.ToString(); FGEImage img = fgeimages.FirstOrDefault(i => i.FileName == str); ShowImage(img); }
private void BackgroundInit() { StarScan.LoadBodyDesignationMap(); MaterialCommodityDB.SetUpInitialTable(); if (!EDDOptions.Instance.NoSystemsLoad) { downloadMapsTask = FGEImage.DownloadMaps(this, () => PendingClose, LogLine, LogLineHighlight); CheckSystems(() => PendingClose, (p, s) => ReportProgress(p, s)); } SystemNoteClass.GetAllSystemNotes(); // fill up memory with notes, bookmarks, galactic mapping BookmarkClass.GetAllBookmarks(); ReportProgress(-1, ""); InvokeAsyncOnUiThread(() => OnInitialSyncComplete?.Invoke()); if (PendingClose) { return; } if (EliteDangerousCore.EDDN.EDDNClass.CheckforEDMC()) // EDMC is running { if (EDCommander.Current.SyncToEddn) // Both EDD and EDMC should not sync to EDDN. { LogLineHighlight("EDDiscovery and EDMarketConnector should not both sync to EDDN. Stop EDMC or uncheck 'send to EDDN' in settings tab!"); } } if (PendingClose) { return; } LogLine("Reading travel history"); if (!EDDOptions.Instance.NoLoad) { DoRefreshHistory(new RefreshWorkerArgs { CurrentCommander = EDCommander.CurrentCmdrID }); } if (PendingClose) { return; } if (syncstate.performeddbsync || syncstate.performedsmsync) { string databases = (syncstate.performedsmsync && syncstate.performeddbsync) ? "EDSM and EDDB" : ((syncstate.performedsmsync) ? "EDSM" : "EDDB"); LogLine("ED Discovery will now synchronise to the " + databases + " databases to obtain star information." + Environment.NewLine + "This will take a while, up to 15 minutes, please be patient." + Environment.NewLine + "Please continue running ED Discovery until refresh is complete."); } InvokeAsyncOnUiThread(() => OnInitialisationComplete?.Invoke()); }
private void AddImages() { fgeimages = new List <FGEImage>(); string datapath = Path.Combine(EDDOptions.Instance.AppDataDirectory, "Maps"); if (Directory.Exists(datapath)) { fgeimages = FGEImage.LoadImages(datapath); fgeimages.AddRange(FGEImage.LoadFixedImages(datapath)); } }
private void AddImages() { fgeimages = new List <FGEImage>(); string datapath = Path.Combine(Tools.GetAppDataDirectory(), "Maps"); if (Directory.Exists(datapath)) { fgeimages = FGEImage.LoadImages(datapath); fgeimages.AddRange(FGEImage.LoadFixedImages(datapath)); } }
private bool AddImages() { fgeimages = new List <FGEImage>(); string datapath = Path.Combine(EDDOptions.Instance.AppDataDirectory, "Maps"); if (Directory.Exists(datapath)) { fgeimages = FGEImage.LoadImages(datapath); fgeimages.AddRange(FGEImage.LoadFixedImages(datapath)); return(fgeimages.Count > 0); } else { return(false); } }
private void ShowImage(FGEImage fgeimg) { //currentImage = (Bitmap)Image.FromFile(fgeimg.Name, true); if (fgeimg != null && initdone) { imageViewer1.Image?.Dispose(); //panel1.BackgroundImage = new Bitmap(fgeimg.FilePath); imageViewer1.Image = new Bitmap(fgeimg.FilePath); imageViewer1.ZoomToFit(); currentFGEImage = fgeimg; if (toolStripButtonStars.Checked) { DrawStars(); } DrawTravelHistory(); } }
public static List <FGEImage> LoadImages(string datapath) { List <FGEImage> fgeimages = new List <FGEImage>(); DirectoryInfo dirInfo = new DirectoryInfo(datapath); FileInfo[] allFiles = null; try { allFiles = dirInfo.GetFiles("*.json"); } catch { } if (allFiles != null) { foreach (FileInfo fi in allFiles) { JObject pfile = null; string json = BaseUtils.FileHelpers.TryReadAllTextFromFile(fi.FullName); if (json != null) { FGEImage fgeimg; try { pfile = (JObject)JObject.Parse(json); } catch { continue; } if (File.Exists(fi.FullName.Replace(".json", ".png"))) { fgeimg = new FGEImage(fi.FullName.Replace(".json", ".png")); } else { fgeimg = new FGEImage(fi.FullName.Replace(".json", ".jpg")); } fgeimg.TopLeft = new Point(pfile["x1"].Int(), pfile["y1"].Int()); fgeimg.pxTopLeft = new Point(pfile["px1"].Int(), pfile["py1"].Int()); fgeimg.TopRight = new Point(pfile["x2"].Int(), pfile["y1"].Int()); fgeimg.pxTopRight = new Point(pfile["px2"].Int(), pfile["py1"].Int()); fgeimg.BottomLeft = new Point(pfile["x1"].Int(), pfile["y2"].Int()); fgeimg.pxBottomLeft = new Point(pfile["px1"].Int(), pfile["py2"].Int()); fgeimg.BottomRight = new Point(pfile["x2"].Int(), pfile["y2"].Int()); fgeimg.pxBottomRight = new Point(pfile["px2"].Int(), pfile["py2"].Int()); fgeimg.Area = (double)(fgeimg.TopRight.X - fgeimg.TopLeft.X) * (double)(fgeimg.TopLeft.Y - fgeimg.BottomRight.Y); //Console.WriteLine("img {0} {1}", fgeimg.FileName, fgeimg.Area); fgeimages.Add(fgeimg); } } fgeimages.Sort(delegate(FGEImage p1, FGEImage p2) // biggest first.. name if same.. { if (p1.Area == p2.Area) { return(p1.FileName.CompareTo(p2.FileName)); } else if (p1.Area < p2.Area) { return(1); } else { return(-1); } } ); } return(fgeimages); }