public FormSettings(Dropbox mainClass) { InitializeComponent(); this.mainClass = mainClass; groupNoDropbox.Visible = !mainClass.DropboxInstalled; if (!mainClass.DropboxInstalled) return; textPath.Text = mainClass.dbPath; textHttp.Text = mainClass.dbHttp; int selIndex = 0; switch (mainClass.imageFormat.ToLower()) { case "png": selIndex = 0; break; case "jpg": selIndex = 1; break; case "gif": selIndex = 2; break; } comboFormat.SelectedIndex = selIndex; checkUseMD5.Checked = mainClass.useMD5; checkShortMD5.Checked = mainClass.shortMD5; numLength.Value = mainClass.length; checkJpegCompression.Checked = mainClass.jpegCompression; numJpegCompressionFilesize.Value = mainClass.jpegCompressionFilesize; numJpegCompressionRate.Value = mainClass.jpegCompressionRate; { string[] parts = mainClass.shortCutDragModifiers.Split('+'); foreach (string part in parts) { switch (part) { case "Ctrl": checkDragModCtrl.Checked = true; break; case "Alt": checkDragModAlt.Checked = true; break; case "Shift": checkDragModShift.Checked = true; break; } } } { string[] parts = mainClass.shortCutAnimModifiers.Split('+'); foreach (string part in parts) { switch (part) { case "Ctrl": checkAnimModCtrl.Checked = true; break; case "Alt": checkAnimModAlt.Checked = true; break; case "Shift": checkAnimModShift.Checked = true; break; } } } { string[] parts = mainClass.shortCutPasteModifiers.Split('+'); foreach (string part in parts) { switch (part) { case "Ctrl": checkPasteModCtrl.Checked = true; break; case "Alt": checkPasteModAlt.Checked = true; break; case "Shift": checkPasteModShift.Checked = true; break; } } } mainClass.PopulateKeysCombobox(comboDragKeys); mainClass.PopulateKeysCombobox(comboPasteKeys); comboDragKeys.SelectedItem = mainClass.shortCutDragKey; comboPasteKeys.SelectedItem = mainClass.shortCutPasteKey; if (textPath.Text == "") { string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Dropbox\\host.db"; if (File.Exists(path)) { string dropboxPath = ""; try { using (StreamReader reader = new StreamReader(File.OpenRead(path))) { // new way of getting the user's dropbox path. // host.db contains a second line which is a base64 encoded string of the path. // don't ask me why, but they made config.db encrypted (config.dbx) reader.ReadLine(); // skip first line, random useless zeros dropboxPath = mainClass.base64Decode(reader.ReadLine()); } } catch { } if (dropboxPath != "") textPath.Text = dropboxPath.Replace('\\', '/') + "/Public/"; } } }