Ejemplo n.º 1
0
        /// <summary>
        /// saves per-image settings to the settings hashtable
        /// </summary>
        /// <param name="i"></param>
        void save_image_settings(pf.byte_image i)
        {
            StringBuilder description = new StringBuilder();

            description.Append(string.Format("{0}|{1}|", cbStartPos.SelectedIndex, util.encode(txtStartPos.Text)));
            if (cbDig.Checked)
            {
                description.Append(string.Format("#dig {0}|", util.encode(txtCommentDig.Text)));
            }
            if (cbBuild.Checked)
            {
                description.Append(string.Format("#build {0}|", util.encode(txtCommentBuild.Text)));
            }
            if (cbPlace.Checked)
            {
                description.Append(string.Format("#place {0}|", util.encode(txtCommentPlace.Text)));
            }
            if (cbQuery.Checked)
            {
                description.Append(string.Format("#query {0}|", util.encode(txtCommentQuery.Text)));
            }

            //save image metadata to settings in memory
            pf.image_settings value = new pf.image_settings(i.image_hash, description.ToString());
            value.load_image_data(i);
            pf.set_setting(i.image_hash, value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads various UI elements with last saved image values.
        /// </summary>
        /// <param name="selected">selected image</param>
        void load_settings(pf.byte_image selected)
        {
            if (selected == null)
            {
                return;
            }
            Debug.Log("Loading image settings...");

            //load up UI elements with settings
            lblSelectedPicture.Text = selected.image_file;

            string key = selected.image_hash;

            if (pf.settings[key] == null)
            {
                return;
            }

            pf.image_settings s = new pf.image_settings(key, pf.settings[key].ToString());

            //save image metadata to settings in memory
            s.load_image_data(selected);
            pf.set_setting(key, s);

            cbStartPos.SelectedIndex = s.StartPosIndex;
            txtStartPos.Text         = s.StartString;

            cbDig.Checked   = s.dig;
            cbBuild.Checked = s.build;
            cbPlace.Checked = s.place;
            cbQuery.Checked = s.query;

            txtCommentDig.Text   = s.digComment;
            txtCommentBuild.Text = s.buildComment;
            txtCommentPlace.Text = s.placeComment;
            txtCommentQuery.Text = s.queryComment;

            txtOutPath.Text = selected.out_path;

            if (pf.settings[setting.file_format] != null)
            {
                txtOutputFormat.Text = pf.settings[setting.file_format].ToString();
            }
        }