Beispiel #1
0
 private void lstStructureFilter_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (lstStructureFilter.SelectedIndex >= 0)
     {
         ComboValuePair comboValue = (ComboValuePair)lstStructureFilter.Items[e.Index];
         if (e.NewValue == CheckState.Checked)
         {
             if (!currentExclusions.Contains(comboValue.Key))
             {
                 currentExclusions.Add(comboValue.Key);
             }
         }
         else
         {
             if (currentExclusions.Contains(comboValue.Key))
             {
                 currentExclusions.Remove(comboValue.Key);
             }
         }
     }
 }
Beispiel #2
0
        private void PopulateStructureInventory()
        {
            //item, category, container, lat, lon, qty
            lvwStorageInventory.Items.Clear();
            ComboValuePair selectedItem       = (ComboValuePair)cboStorageType.SelectedItem;
            string         selectedClass      = selectedItem.Key;
            var            selectedContainers = tribeStructureList.Where(t => t.ClassName == selectedClass || selectedClass.Length == 0).Distinct();

            List <string> unmappedItemClassList = new List <string>();

            ConcurrentBag <ListViewItem> listItems = new ConcurrentBag <ListViewItem>();

            Parallel.ForEach(selectedContainers, container =>
            {
                if (container.Inventory != null && container.Inventory.Count() > 0)
                {
                    foreach (var invItem in container.Inventory)
                    {
                        string itemName      = invItem.ClassName;
                        string categoryName  = "Misc.";
                        string containerName = container.ClassName;

                        var classMap = ARKViewer.Program.ProgramConfig.StructureMap.FirstOrDefault <StructureClassMap>(d => d.ClassName == container.ClassName);
                        if (classMap != null)
                        {
                            containerName = classMap.FriendlyName;
                        }

                        int itemIcon = 0;

                        if (ARKViewer.Program.ProgramConfig.ItemMap != null)
                        {
                            var itemMap = ARKViewer.Program.ProgramConfig.ItemMap.Where(i => i.ClassName == invItem.ClassName).FirstOrDefault <ItemClassMap>();
                            if (itemMap != null && itemMap.FriendlyName != null)
                            {
                                itemName     = itemMap.FriendlyName;
                                categoryName = itemMap.Category;
                                itemIcon     = itemMap.Icon;
                            }
                        }


                        if (categoryName.ToLower().Contains(txtStorageFilter.Text.ToLower()) || itemName.ToLower().Contains(txtStorageFilter.Text.ToLower()))
                        {
                            if (!invItem.IsEngram)
                            {
                                string qualityName = "";
                                Color backColor    = SystemColors.Window;
                                Color foreColor    = SystemColors.WindowText;

                                if (invItem.Rating > 0 && invItem.Rating < 1.25)
                                {
                                    qualityName = "Primitive";
                                    backColor   = Color.FromArgb(90, ColorTranslator.FromHtml("#C0C0C0"));

                                    foreColor = Color.Black;
                                }
                                if (invItem.Rating >= 1.25 && invItem.Rating < 2.5)
                                {
                                    qualityName = "Ramshackle";
                                    backColor   = ColorTranslator.FromHtml("#93FFA0");
                                    foreColor   = Color.Black;
                                }
                                else if (invItem.Rating >= 2.5 && invItem.Rating < 4.5)
                                {
                                    qualityName = "Apprentice";
                                    backColor   = ColorTranslator.FromHtml("#6088FF");
                                    foreColor   = Color.Black;
                                }
                                else if (invItem.Rating >= 4.5 && invItem.Rating < 7)
                                {
                                    qualityName = "Journeyman";
                                    backColor   = ColorTranslator.FromHtml("#E2AAFF");

                                    foreColor = Color.Black;
                                }
                                else if (invItem.Rating >= 7 && invItem.Rating < 10)
                                {
                                    qualityName = "Mastercraft";
                                    backColor   = ColorTranslator.FromHtml("#FFF991");

                                    foreColor = Color.Black;
                                }
                                else if (invItem.Rating >= 10)
                                {
                                    qualityName = "Ascendant";
                                    backColor   = ColorTranslator.FromHtml("#8EFFFD");


                                    foreColor = Color.Black;
                                }

                                string craftedBy = "";
                                if (invItem.CraftedPlayerName != null && invItem.CraftedPlayerName.Length > 0)
                                {
                                    craftedBy = $"{invItem.CraftedPlayerName} ({invItem.CraftedTribeName})";
                                }


                                ListViewItem newItem = new ListViewItem(itemName);
                                newItem.BackColor    = backColor;
                                newItem.ForeColor    = foreColor;

                                newItem.SubItems.Add(categoryName);
                                newItem.SubItems.Add(qualityName);
                                newItem.SubItems.Add(craftedBy);
                                newItem.SubItems.Add(containerName);
                                newItem.SubItems.Add(container?.Location.Latitude.GetValueOrDefault(0).ToString("0.00"));
                                newItem.SubItems.Add(container?.Location.Longitude.GetValueOrDefault(0).ToString("0.00"));
                                newItem.SubItems.Add(invItem.Quantity.ToString());
                                newItem.ImageIndex = itemIcon - 1;
                                newItem.Tag        = invItem;

                                listItems.Add(newItem);
                            }
                        }
                    }
                }
            });

            lvwStorageInventory.Items.AddRange(listItems.ToArray());
        }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (optPlayerCommandsPrefixNone.Checked)
            {
                SavedConfig.CommandPrefix = 0;
            }
            else if (optPlayerCommandsPrefixAdmincheat.Checked)
            {
                SavedConfig.CommandPrefix = 1;
            }
            else
            {
                SavedConfig.CommandPrefix = 2;
            }


            SavedConfig.HideNoTames              = optPlayerTameHide.Checked;
            SavedConfig.HideNoStructures         = optPlayerStructureHide.Checked;
            SavedConfig.HideNoBody               = optPlayerBodyHide.Checked;
            SavedConfig.FtpDownloadMode          = optFTPSync.Checked ? 0 : 1;
            SavedConfig.SortCommandLineExport    = optExportSort.Checked;
            SavedConfig.UpdateNotificationFile   = chkUpdateNotificationFile.Checked;
            SavedConfig.UpdateNotificationSingle = chkUpdateNotificationSingle.Checked;

            //update server list
            if (optSinglePlayer.Checked)
            {
                if (cboMapSinglePlayer.SelectedItem != null)
                {
                    SavedConfig.Mode = ViewerModes.Mode_SinglePlayer;
                    ComboValuePair selectedMapPair = (ComboValuePair)cboMapSinglePlayer.SelectedItem;
                    SavedConfig.SelectedFile = selectedMapPair.Key;
                }
            }

            if (optOffline.Checked)
            {
                if (txtFilename.TextLength == 0)
                {
                    MessageBox.Show("Please select a file for offline mode.", "Offline Mode", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;
                }

                if (!File.Exists(txtFilename.Text))
                {
                    MessageBox.Show("Unable to find the selected file.\n\nPlease check the file exists and try again.", "Offline Mode", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;
                }


                SavedConfig.Mode         = ViewerModes.Mode_Offline;
                SavedConfig.SelectedFile = txtFilename.Text;
            }

            if (optServer.Checked)
            {
                SavedConfig.Mode = ViewerModes.Mode_Ftp;

                if (cboFTPServer.SelectedItem != null)
                {
                    ServerConfiguration selectedConfig = (ServerConfiguration)cboFTPServer.SelectedItem;
                    SavedConfig.SelectedServer = selectedConfig.Name;
                    SavedConfig.SelectedFile   = selectedConfig.Map;

                    if (txtServerName.Visible)
                    {
                        selectedConfig.Name = txtServerName.Text;
                    }

                    if (txtFTPAddress.Text.Contains(@"\"))
                    {
                        txtFTPAddress.Text = txtFTPAddress.Text.Replace(@"\", @"/");
                    }
                    if (txtFTPAddress.Text.EndsWith(@"/"))
                    {
                        txtFTPAddress.Text = txtFTPAddress.Text.Substring(0, txtFTPAddress.TextLength - 1);
                    }
                    if (txtFTPFilePath.Text.Contains(@"\"))
                    {
                        txtFTPFilePath.Text = txtFTPFilePath.Text.Replace(@"\", @"/");
                    }
                    if (!txtFTPFilePath.Text.StartsWith(@"/"))
                    {
                        txtFTPFilePath.Text = "/" + txtFTPFilePath.Text;
                    }

                    selectedConfig.Address      = txtFTPAddress.Text;
                    selectedConfig.SaveGamePath = txtFTPFilePath.Text;
                    selectedConfig.Port         = (int)udFTPPort.Value;
                    selectedConfig.Username     = txtFTPUsername.Text;
                    selectedConfig.Password     = txtFTPPassword.Text;

                    cboFTPServer.Items[cboFTPServer.SelectedIndex] = selectedConfig;
                }
            }

            SavedConfig.ServerList.Clear();
            foreach (var item in cboFTPServer.Items)
            {
                if (item is ServerConfiguration)
                {
                    ServerConfiguration serverConfig = (ServerConfiguration)item;
                    SavedConfig.ServerList.Add(serverConfig);
                }
            }



            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Beispiel #4
0
        private void DisplayServerSettings()
        {
            txtFTPAddress.Text     = "";
            txtFTPAddress.Enabled  = false;
            udFTPPort.Value        = 8821;
            udFTPPort.Enabled      = false;
            txtFTPFilePath.Text    = "";
            txtFTPFilePath.Enabled = false;
            txtFTPUsername.Text    = "";
            txtFTPUsername.Enabled = false;
            txtFTPPassword.Text    = "";
            txtFTPPassword.Enabled = false;
            cboFtpMap.Enabled      = false;
            optFtpModeFtp.Enabled  = false;
            optFtpModeSftp.Enabled = false;

            chkPasswordVisibility.Visible = txtServerName.Visible;
            chkPasswordVisibility.Checked = false;

            if (cboFTPServer.SelectedItem == null || cboFTPServer.Visible == false)
            {
                return;
            }


            ServerConfiguration selectedServer = (ServerConfiguration)cboFTPServer.SelectedItem;

            txtServerName.Text = selectedServer.Name;

            txtFTPAddress.Text     = selectedServer.Address;
            txtFTPAddress.Enabled  = cboFTPServer.Visible == false;
            udFTPPort.Value        = selectedServer.Port;
            udFTPPort.Enabled      = cboFTPServer.Visible == false;
            txtFTPFilePath.Text    = selectedServer.SaveGamePath;
            txtFTPFilePath.Enabled = cboFTPServer.Visible == false;
            txtFTPUsername.Text    = selectedServer.Username;
            txtFTPUsername.Enabled = cboFTPServer.Visible == false;
            txtFTPPassword.Text    = selectedServer.Password;
            txtFTPPassword.Enabled = cboFTPServer.Visible == false;
            optFtpModeFtp.Enabled  = cboFTPServer.Visible == false;
            optFtpModeSftp.Enabled = cboFTPServer.Visible == false;

            if (selectedServer.Mode == 0)
            {
                optFtpModeFtp.Checked = true;
            }
            else
            {
                optFtpModeSftp.Checked = true;
            }

            ComboValuePair selectedMapItem = cboFtpMap.Items.Cast <ComboValuePair>().FirstOrDefault(i => i.Key.ToLower() == selectedServer.Map.ToLower());

            if (selectedMapItem != null)
            {
                cboFtpMap.SelectedItem = selectedMapItem;
            }
            cboFtpMap.Enabled           = cboFTPServer.Visible == false;
            txtFTPUsername.PasswordChar = cboFTPServer.Visible? '●':'\0';

            if (cboFTPServer.Visible)
            {
                btnAddServer.Image = ARKViewer.Properties.Resources.button_add;
                btnSave.Enabled    = true;
            }

            chkPasswordVisibility.Visible = false;
            chkPasswordVisibility.Checked = false;
        }
Beispiel #5
0
        private void frmSettings_Load(object sender, EventArgs e)
        {
            PopulateColours();
            PopulateDinoClassMap("");
            PopulateStructureClassMap("");
            PopulateItemClassMap("");

            var mapFilenameMap = new Dictionary <string, string>
            {
                { "theisland.ark", "The Island" },
                { "thecenter.ark", "The Center" },
                { "scorchedearth_p.ark", "Scorched Earth" },
                { "aberration_p.ark", "Aberration" },
                { "extinction.ark", "Extinction" },
                { "ragnarok.ark", "Ragnarok" },
                { "valguero_p.ark", "Valguero" },
                { "crystalisles.ark", "Crystal Isles" },
                { "genesis.ark", "Genesis" },
                { "astralark.ark", "AstralARK" },
                { "hope.ark", "Hope" },
                { "tunguska_p.ark", "Tunguska" },
                { "caballus_p.ark", "Caballus" }
            };

            chkUpdateNotificationFile.Checked   = SavedConfig.UpdateNotificationFile;
            chkUpdateNotificationSingle.Checked = SavedConfig.UpdateNotificationSingle;


            optPlayerStructureHide.Checked = SavedConfig.HideNoStructures;
            optPlayerStructureShow.Checked = !SavedConfig.HideNoStructures;

            optPlayerTameHide.Checked = SavedConfig.HideNoTames;
            optPlayerTameShow.Checked = !SavedConfig.HideNoTames;

            optPlayerBodyHide.Checked = SavedConfig.HideNoBody;
            optPlayerBodyShow.Checked = !SavedConfig.HideNoBody;
            optFTPSync.Checked        = SavedConfig.FtpDownloadMode == 0;
            optFTPClean.Checked       = SavedConfig.FtpDownloadMode == 1;
            optExportNoSort.Checked   = !SavedConfig.SortCommandLineExport;
            optExportSort.Checked     = SavedConfig.SortCommandLineExport;

            switch (SavedConfig.CommandPrefix)
            {
            case 0:
                optPlayerCommandsPrefixNone.Checked = true;
                break;

            case 1:
                optPlayerCommandsPrefixAdmincheat.Checked = true;
                break;

            case 2:
                optPlayerCommandsPrefixCheat.Checked = true;
                break;

            default:

                break;
            }

            //get registry path for steam apps
            string steamRoot = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\Valve\Steam", "SteamPath", "").ToString();

            if (steamRoot != null && steamRoot.Length > 0)
            {
                steamRoot = steamRoot.Replace(@"/", @"\");
                steamRoot = Path.Combine(steamRoot, @"steamapps\libraryfolders.vdf");
                if (File.Exists(steamRoot))
                {
                    string fileText = File.ReadAllText(steamRoot).Replace("\"LibraryFolders\"", "");

                    foreach (string line in fileText.Split('\n'))
                    {
                        if (line.Contains("\t"))
                        {
                            string[] lineContent = line.Split('\t');
                            if (lineContent.Length == 4)
                            {
                                //check 4th param as a path
                                string directoryCheck = lineContent[3].ToString().Replace("\"", "").Replace(@"\\", @"\") + @"\SteamApps\Common\ARK\ShooterGame\Saved\";
                                if (Directory.Exists(directoryCheck))
                                {
                                    var saveFiles = Directory.GetFiles(directoryCheck, "*.ark", SearchOption.AllDirectories);
                                    foreach (string saveFilename in saveFiles)
                                    {
                                        string fileName = Path.GetFileName(saveFilename);
                                        if (mapFilenameMap.ContainsKey(fileName.ToLower()))
                                        {
                                            string knownMapName = mapFilenameMap[fileName.ToLower()];
                                            if (knownMapName.Length > 0)
                                            {
                                                ComboValuePair comboValue = new ComboValuePair(saveFilename, knownMapName);
                                                int            newIndex   = cboMapSinglePlayer.Items.Add(comboValue);

                                                if (SavedConfig.Mode == ViewerModes.Mode_SinglePlayer)
                                                {
                                                    if (SavedConfig.SelectedFile == saveFilename)
                                                    {
                                                        cboMapSinglePlayer.SelectedIndex = newIndex;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            optSinglePlayer.Enabled = cboMapSinglePlayer.Items.Count > 0;

            switch (SavedConfig.Mode)
            {
            case ViewerModes.Mode_SinglePlayer:

                if (cboMapSinglePlayer.Items.Count > 0)
                {
                    optSinglePlayer.Checked = true;
                }

                break;

            case ViewerModes.Mode_Offline:
                optOffline.Checked = true;

                break;

            case ViewerModes.Mode_Ftp:
                optServer.Checked = true;

                break;

            default:
                break;
            }


            //offline mode?
            if (SavedConfig.Mode == ViewerModes.Mode_Offline)
            {
                txtFilename.Text = SavedConfig.SelectedFile;
            }

            cboFtpMap.Items.Clear();
            var orderedMap = mapFilenameMap.OrderBy(o => o.Value);

            foreach (var knownMap in orderedMap)
            {
                ComboValuePair comboValue = new ComboValuePair(knownMap.Key, knownMap.Value);
                int            newIndex   = cboFtpMap.Items.Add(comboValue);
            }

            //ftp servers?
            if (SavedConfig.ServerList.Count() > 0)
            {
                cboFTPServer.Items.Clear();

                foreach (var serverConfig in SavedConfig.ServerList)
                {
                    int newIndex = cboFTPServer.Items.Add(serverConfig);

                    if (serverConfig.Name == SavedConfig.SelectedServer)
                    {
                        cboFTPServer.SelectedIndex = newIndex;
                    }
                }
            }

            UpdateDisplay();
        }