示例#1
0
        // in its own thread..
        public static Task <bool> DownloadMaps(IDiscoveryController discoveryform, Func <bool> cancelRequested, Action <string> logLine, Action <string> logError)          // ASYNC process
        {
            try
            {
                string mapsdir = Path.Combine(EDDOptions.Instance.AppDataDirectory, "Maps");
                if (!Directory.Exists(mapsdir))
                {
                    Directory.CreateDirectory(mapsdir);
                }

                logLine("Checking for new EDDiscovery maps");

                BaseUtils.GitHubClass github = new BaseUtils.GitHubClass(EDDiscovery.Properties.Resources.URLGithubDataDownload, discoveryform.LogLine);

                var files = github.ReadDirectory("Maps/V1");
                return(Task.Factory.StartNew(() => github.DownloadFiles(files, mapsdir)));
            }
            catch (Exception ex)
            {
                logError("DownloadImages exception: " + ex.Message);
                var tcs = new TaskCompletionSource <bool>();
                tcs.SetException(ex);
                return(tcs.Task);
            }
        }
示例#2
0
        public static Task <bool> DownloadMaps(IDiscoveryController discoveryform, Func <bool> cancelRequested, Action <string> logLine, Action <string> logError)          // ASYNC process
        {
            try
            {
                string mapsdir = Path.Combine(EDDConfig.Options.AppDataDirectory, "Maps");
                if (!Directory.Exists(mapsdir))
                {
                    Directory.CreateDirectory(mapsdir);
                }

                logLine("Checking for new EDDiscovery maps");

                BaseUtils.GitHubClass github = new BaseUtils.GitHubClass(discoveryform.LogLine);

                var files = github.GetDataFiles("Maps/V1");
                return(Task.Factory.StartNew(() => github.DownloadFiles(files, mapsdir)));

                /*
                 * DeleteMapFile("DW4.png", logLine);
                 * DeleteMapFile("SC-00.jpg", logLine);
                 * return DownloadMapFiles(new[]
                 * {
                 *  "SC-01.jpg",
                 *  "SC-02.jpg",
                 *  "SC-03.jpg",
                 *  "SC-04.jpg",
                 *  "SC-L4.jpg",
                 *  "SC-U4.jpg",
                 *  "SC-00.png",
                 *  "SC-00.json",
                 *  "Galaxy_L.jpg",
                 *  "Galaxy_L.json",
                 *  "Galaxy_L_Grid.jpg",
                 *  "Galaxy_L_Grid.json",
                 *  "DW1.jpg",
                 *  "DW1.json",
                 *  "DW2.jpg",
                 *  "DW2.json",
                 *  "DW3.jpg",
                 *  "DW3.json",
                 *  "DW4.jpg",
                 *  "DW4.json",
                 *  "Formidine.png",
                 *  "Formidine.json",
                 *  "Formidine trans.png",
                 *  "Formidine trans.json"
                 * },
                 * (s) => logLine("Map check complete."),
                 * cancelRequested,
                 * logLine);
                 */
            }
            catch (Exception ex)
            {
                logError("DownloadImages exception: " + ex.Message);
                var tcs = new TaskCompletionSource <bool>();
                tcs.SetException(ex);
                return(tcs.Task);
            }
        }
示例#3
0
        public ScreenshotDirectoryWatcher(IDiscoveryController controller, Action <Action <ImageConverter> > paramscallback)
        {
            this.paramscallback = paramscallback;
            this._discoveryForm = controller;
            string ScreenshotsDirdefault = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Frontier Developments", "Elite Dangerous");
            string OutputDirdefault      = Path.Combine(ScreenshotsDirdefault, "Converted");

            this.EDPicturesDir = ScreenshotsDirdefault;
            _discoveryForm.OnNewJournalEntry += NewJournalEntry;
        }
示例#4
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            double MaxLy = Double.Parse(comboBoxMaxLy.SelectedItem.ToString());

            IDiscoveryController edfrm = this.Owner as IDiscoveryController;

            HistoryEntry hi = edfrm.history.First <HistoryEntry>();


            List <ISystem> distlist;

            distlist = SystemClass.GetSystemDistancesFrom(hi.System.x, hi.System.y, hi.System.z, 1000, MaxLy);
        }
示例#5
0
        public static bool SendEDDNEvents(IDiscoveryController frm, IEnumerable <HistoryEntry> helist)
        {
            foreach (HistoryEntry he in helist)
            {
                hlscanunsyncedlist.Enqueue(he);
            }

            hlscanevent.Set();

            // Start the sync thread if it's not already running
            if (Interlocked.CompareExchange(ref _running, 1, 0) == 0)
            {
                Exit                        = false;
                mainForm                    = frm;
                ThreadEDDNSync              = new System.Threading.Thread(new System.Threading.ThreadStart(SyncThread));
                ThreadEDDNSync.Name         = "EDDN Sync";
                ThreadEDDNSync.IsBackground = true;
                ThreadEDDNSync.Start();
            }

            return(true);
        }
示例#6
0
 public EDSMSync(IDiscoveryController frm)
 {
     mainForm = frm;
 }
示例#7
0
 public static bool SendEDDNEvents(IDiscoveryController frm, params HistoryEntry[] helist)
 {
     return(SendEDDNEvents(frm, (IEnumerable <HistoryEntry>)helist));
 }
示例#8
0
 public static bool SendEDDNEvent(IDiscoveryController frm, HistoryEntry helist)
 {
     return(SendEDDNEvents(frm, new[] { helist }));
 }
示例#9
0
 public NetLogClass(IDiscoveryController ds)
 {
 }