public ImportDialog(MainForm mainForm, string steamPathWithUser, ConfigFile configFile, List<SteamShortcut> steamShortcuts)
        {
            try
            {
                this.mainForm = mainForm;

                InitializeComponent();

                this.steamPathWithUser = steamPathWithUser;
                this.configFile = configFile;

                steamGameGroupBox.Visible = true;

                SteamShortcut emptyShortcut = new SteamShortcut();
                emptyShortcut.Name = "Select a shortcut";
                if (steamShortcuts.Count == 0)
                {
                    emptyShortcut.Name = "No shortcuts found";
                }
                shortcutsComboBox.Items.Add(emptyShortcut);
                shortcutsComboBox.Items.AddRange(steamShortcuts.ToArray());
                shortcutsComboBox.SelectedIndex = 0;

                foreach (SteamShortcut ss in shortcutsComboBox.Items)
                {
                    if (ss.Name.ToUpper().Trim() == configFile.GameName.ToUpper().Trim())
                    {
                        shortcutsComboBox.SelectedItem = ss;
                        break;
                    }
                }

                if (configFile.SteamAppId == null || configFile.SteamAppId <= 0)
                {
                    steamGameGroupBox.Visible = false;
                }
            }
            catch(Exception ex)
            {
                mainForm.GenericErrorHandler(ex);
            }
        }
        private void LoadShortcuts()
        {
            steamShortcuts = new List<SteamShortcut>();
            if (!ValidateSteamLocation(steamLocationTextBox.Text) || !ValidateSteamUser(steamLocationTextBox.Text, ((SteamPlayer)steamUserComboBox.SelectedItem).id3))
            {
                return;
            }

            Debug("Attempting to load shortcuts");
            string pathToFile = Path.Combine(steamLocationTextBox.Text, "userdata" + Path.DirectorySeparatorChar + ((SteamPlayer)steamUserComboBox.SelectedItem).id3 + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar + "shortcuts.vdf");
            Debug("\tPath to shortcuts file is " + pathToFile);

            if (!File.Exists(pathToFile))
            {
                Debug("\tNo shortcuts file exists");
                return;
            }

            Debug("\tOpening shortcuts file");
            using (FileStream fs = File.OpenRead(pathToFile))
            {
                byte[] allBytes = new byte[fs.Length];
                fs.Read(allBytes, 0, allBytes.Length);
                Debug("\tRead " + allBytes.Length + " bytes");

                int position = 0;
                for (int i = 0; i < allBytes.Length; i++)
                {
                    //We're looking for the first place where there are two 0's in a row
                    if (i == 0) continue;

                    if (allBytes[i] == 0 && allBytes[i - 1] == 0)
                    {
                        position = i;
                        break;
                    }
                }

                //Each entry is delimited by two 8's in a row
                List<byte[]> entries = new List<byte[]>();
                List<byte> thisEntry = new List<byte>();
                for (int i = position; i < allBytes.Length; i++)
                {
                    thisEntry.Add(allBytes[i]);
                    if (allBytes[i] == 8 && allBytes[i - 1] == 8)
                    {
                        if (thisEntry.Count > 2)
                        {
                            //The file itself is delimited with two 8's
                            entries.Add(thisEntry.ToArray());
                            thisEntry = new List<byte>();
                        }
                    }
                }

                Dictionary<string, Dictionary<string, string>> apps = new Dictionary<string, Dictionary<string, string>>();
                foreach (byte[] entry in entries)
                {
                    //Each field is delimited by 0 followed by 1, and the fields are strings
                    List<byte[]> fields = new List<byte[]>();
                    List<byte> thisField = new List<byte>();
                    position = 0;
                    while (entry[position] == 0) position++;

                    for (int i = position; i < entry.Length; i++)
                    {
                        if (entry[i] == 0 && entry[i + 1] == 1)
                        {
                            i = i + 1;
                            fields.Add(thisField.ToArray());
                            thisField = new List<byte>();
                        }
                        else
                        {
                            thisField.Add(entry[i]);
                        }
                    }

                    Dictionary<string, string> parsedFields = new Dictionary<string, string>();
                    foreach (byte[] field in fields)
                    {
                        string s = ASCIIEncoding.ASCII.GetString(field);
                        string[] parts = s.Split('\0');
                        if (parts.Length == 2)
                        {
                            parsedFields.Add(parts[0].ToLower(), parts[1]);
                        }
                    }

                    if (!parsedFields.ContainsKey("exe")) continue;

                    string exe = parsedFields["exe"];
                    string sha1Hash = CalculateSHA1(exe, Encoding.ASCII);
                    parsedFields.Add("sha1", sha1Hash.ToLower());

                    if (parsedFields.ContainsKey("appname"))
                    {
                        string key = parsedFields["appname"];
                        if(parsedFields.ContainsKey("exe"))
                        {
                            key += " (" + parsedFields["exe"] + ")";
                        }
                        if (!apps.ContainsKey(key))
                        {
                            apps.Add(key, parsedFields);
                        }
                    }
                }

                foreach (string key in apps.Keys)
                {
                    SteamShortcut shortcut = new SteamShortcut();
                    shortcut.Name = key;
                    shortcut.Path = apps[key]["exe"];
                    shortcut.SHA1 = apps[key]["sha1"];
                    steamShortcuts.Add(shortcut);
                }

                Debug("Found the following shortcuts:");
                foreach (var shortcut in steamShortcuts)
                {
                    Debug("\t" + shortcut.Name + ": " + shortcut.Path + " (" + shortcut.SHA1 + ")");
                }
            }
        }