private void FormViewer_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files.Count() > 0) { try { string filePath = files[0]; FileInfo file = new FileInfo(filePath); if (!file.Exists) { return; } List <MiqobotGrid> grids = Miqobot.GetAllGridsFromFile(file); if (grids.Count <= 0) { return; } string area = grids[0].Description.Split('@')[0]; if (area.Contains("[")) { area = area.Split('[')[1].Trim(); } Dictionary <string, double> dictionaryClosestAetherytes = new Dictionary <string, double>(); gridF = new FFXIVItemGridF(); gridF.GridFile = new FileInfo(file.FullName); gridF.Analyze(ListAetherytes, ListGatheringNodes, ref dictionaryClosestAetherytes); List <FFXIVAetheryte> zoneAetherytes = new List <FFXIVAetheryte>(); foreach (FFXIVAetheryte aetherythe in ListAetherytes) { if (null == aetherythe) { continue; } if (aetherythe.GetMapName().Contains(area)) { zoneAetherytes.Add(aetherythe); } } gridF.BuildPicture(zoneAetherytes); pictureBox1.BackColor = Color.White; pictureBox1.BackgroundImage = gridF.Picture; pictureBox1.BackgroundImageLayout = ImageLayout.Zoom; } catch (Exception exc) { Console.WriteLine(exc.Message); } } }
private void FormViewer_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files.Count() > 0) { try { string filePath = files[0]; FileInfo file = new FileInfo(filePath); if (!file.Exists) { return; } List <MiqobotGrid> grids = Miqobot.GetAllGridsFromFile(file); if (grids.Count <= 0) { return; } Dictionary <string, double> dictionaryClosestAetherytes = new Dictionary <string, double>(); gridF = new FFXIVItemGridF(); gridF.GridFile = new FileInfo(file.FullName); gridF.Analyze(ListAetherytes, ListGatheringNodes, ref dictionaryClosestAetherytes); gridF.BuildPicture(); pictureBox1.BackColor = Color.White; pictureBox1.BackgroundImage = gridF.Picture; pictureBox1.BackgroundImageLayout = ImageLayout.Zoom; } catch (Exception exc) { Console.WriteLine(exc.Message); } } }
private void AnalyzeGridThread() { VPThreading.ClearItems(_gridListView); DirectoryInfo exeDirectory = new DirectoryInfo(Service_Misc.GetExecutionPath()); DirectoryInfo cacheDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "CacheGrid")); DirectoryInfo analyzeDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "DownloadedGrids")); if (!analyzeDirectory.Exists) { DownloadMissingItemGrids(); } if (!analyzeDirectory.Exists) { return; } Dictionary <string, double> dictionaryClosestAetherytes = new Dictionary <string, double>(); FileInfo[] files = analyzeDirectory.GetFiles(); int index = 0; foreach (FileInfo file in files) { index++; double percentage = (double)index / (double)files.Count() * 100.0; VPThreading.SetText(_progressLabel, "Analyzing Grids..." + percentage + "%"); if (null == file) { continue; } try { string itemName = file.Name.Split(new string[] { " Grid---" }, StringSplitOptions.None)[0]; //Looking into cache directory string gridItemName = itemName + " Grid"; FileInfo cacheGridFile = new FileInfo(Path.Combine(cacheDirectory.FullName, gridItemName + ".txt")); if (cacheGridFile.Exists) { VPThreading.SetText(_progressLabel, "Item already has a grid."); continue; } FFXIVItemGridF gridF = new FFXIVItemGridF(); gridF.ItemName = itemName; gridF.GridFile = new FileInfo(file.FullName); gridF.Analyze(ListAetherytes, ListGatheringNodes, ref dictionaryClosestAetherytes); ListGridF.Add(gridF); if (gridF.IsValid) { gridF.SaveAsGrids(); } ListViewItem item = new ListViewItem(); item.Text = file.Name; item.SubItems.Add(gridF.Status); item.Tag = gridF; VPThreading.AddItem(_gridListView, item); } catch (Exception exc) { Console.WriteLine(exc.Message); } } }