Ejemplo n.º 1
0
        private void _gridListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (null == _gridListView)
            {
                return;
            }
            if (null == _gridListView.SelectedItems)
            {
                return;
            }
            if (0 >= _gridListView.SelectedItems.Count)
            {
                return;
            }

            ListViewItem selectedItem = _gridListView.SelectedItems[0];

            if (null == selectedItem)
            {
                return;
            }
            if (null == selectedItem.Tag)
            {
                return;
            }

            try
            {
                FFXIVItemGridF gridF = selectedItem.Tag as FFXIVItemGridF;
                DisplayGridDetails(gridF);
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        private void DisplayGridDetails(FFXIVItemGridF iGrid)
        {
            _itemLabel.Text   = "";
            _statusLabel.Text = "";
            _infoTextBox.Text = "";
            _nodeListView.Items.Clear();
            _aetheryteListView.Items.Clear();
            _closestLabel.Text             = "";
            _computedDescriptionLabel.Text = "";
            _validationLabel.Text          = "";
            if (null == iGrid)
            {
                return;
            }


            _itemLabel.Text                = iGrid.ItemName;
            _statusLabel.Text              = iGrid.Status;
            _infoTextBox.Text              = iGrid.Description;
            _closestLabel.Text             = "Closest Gathering Node : " + iGrid.ClosestNode;
            _computedDescriptionLabel.Text = "Computed Description : " + iGrid.ComputedDescription;
            _validationLabel.Text          = "Validation Status : " + iGrid.IsValid;

            foreach (FFXIVAetheryte aetheryte in iGrid.ZoneAetherytes)
            {
                ListViewItem item = new ListViewItem();
                item.Text = aetheryte.ToString();
                item.SubItems.Add(aetheryte.Zone);
                try
                {
                    item.SubItems.Add(iGrid.ZoneAetherytesDistance[iGrid.ZoneAetherytes.IndexOf(aetheryte)].ToString());
                }
                catch
                {
                    item.SubItems.Add("-");
                }
                _aetheryteListView.Items.Add(item);
            }

            foreach (FFXIVGatheringNode node in iGrid.AllNodes)
            {
                ListViewItem item = new ListViewItem();
                item.Text = node.ToString();
                item.SubItems.Add(node.Zone);
                try
                {
                    item.SubItems.Add(iGrid.AllNodesDistance[iGrid.AllNodes.IndexOf(node)].ToString());
                }
                catch
                {
                    item.SubItems.Add("-");
                }
                _nodeListView.Items.Add(item);
            }
        }
Ejemplo n.º 4
0
        private void _displayGridButton_Click(object sender, EventArgs e)
        {
            if (null == _gridListView)
            {
                return;
            }
            if (null == _gridListView.SelectedItems)
            {
                return;
            }
            if (0 >= _gridListView.SelectedItems.Count)
            {
                return;
            }

            ListViewItem selectedItem = _gridListView.SelectedItems[0];

            if (null == selectedItem)
            {
                return;
            }
            if (null == selectedItem.Tag)
            {
                return;
            }

            try
            {
                FFXIVItemGridF gridF = selectedItem.Tag as FFXIVItemGridF;
                gridF.BuildPicture();
                Form form = new Form();
                form.Text = "Grid Bitmap";

                PictureBox pictureBox = new PictureBox();
                pictureBox.BackgroundImageLayout = ImageLayout.Zoom;
                pictureBox.Dock            = DockStyle.Fill;
                pictureBox.BackgroundImage = gridF.Picture;

                form.Controls.Add(pictureBox);
                form.Show();
                form.WindowState = FormWindowState.Maximized;
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
        }
Ejemplo n.º 5
0
        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);
                }
            }
        }
Ejemplo n.º 6
0
        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);
                }
            }
        }