private void frmTemplateEditor_Load(object sender, EventArgs e) { ddlPaperSize.DataSource = Enum.GetValues(typeof(PdfSharp.PageSize)); ddlAddressTextColour.DataSource = Enum.GetValues(typeof(walletprint.LimitedColourPallete)); ddlPrivkeyTextColour.DataSource = Enum.GetValues(typeof(walletprint.LimitedColourPallete)); ddlAddressTextStyle.DataSource = Enum.GetValues(typeof(PdfSharp.Drawing.XFontStyle)); ddlPrivkeyTextStyle.DataSource = Enum.GetValues(typeof(PdfSharp.Drawing.XFontStyle)); ddlAddressTextRotation.DataSource = Enum.GetValues(typeof(walletprint.TextRotation)); ddlPrivkeyTextRotation.DataSource = Enum.GetValues(typeof(walletprint.TextRotation)); IList <string> fontNames = FontFamily.Families.Select(f => f.Name).ToList(); ddlAddressTextFont.DataSource = fontNames; // for some weird reason, the two Font dropdowns ended up kinda bound to one another. Using two distinct data source objects of the same damn contents fixes it. IList <string> fontNamesAgain = FontFamily.Families.Select(f => f.Name).ToList(); ddlPrivkeyTextFont.DataSource = fontNamesAgain; coindefs = walletprint.CoinLibrary.AllCoins(); ddlCoinSelect.DataSource = coindefs; bundle = new walletprint.WalletBundle(); }
public void LoadBundle(string filepath) { this.bundle = new walletprint.WalletBundle(filepath); LoadTemplate(this.bundle.template); LoadArtworkPixelWidth(); // because bundles won't be saved without valid Artwork, we can automatically unlock the artwork-based UI things when we load a saved bundle UpdateArtworkUI(); }
private void btnBrowseTemplate_Click(object sender, EventArgs e) { DialogResult result = ofdLoadBundle.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { txtTemplateFilePath.Text = ofdLoadBundle.FileName; FileInfo info = new FileInfo(txtTemplateFilePath.Text); // harvest some free bonus entropy from the size, filepath, and last access time of the selected template ExtraEntropy.AddExtraEntropy(info.Length.ToString() + txtTemplateFilePath.Text + info.LastAccessTimeUtc.ToLongTimeString()); // note: this is NOT the only entropy in use - it just pleases me to put some extra in there because we can try { bundle = new WalletBundle(txtTemplateFilePath.Text); } catch (Exception ex) { MessageBox.Show("Failed to load bundle file\n" + ex.ToString(), "Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txtTemplateDescription.Text = bundle.template.TemplateDescription; if (bundle.template.CoinIsWIFstupid) { lblTemplateInfo.Text = string.Format("Loaded wallet for coin '{0}', which uses Address Version {1} with WIF-stupid mode", bundle.template.CoinName, bundle.template.CoinAddressType); } else { lblTemplateInfo.Text = string.Format("Loaded wallet for coin '{0}', which uses Address Version {1}", bundle.template.CoinName, bundle.template.CoinAddressType); } btnBrowseOutput.Enabled = true; } }