Ejemplo n.º 1
0
        private void BtnOk_Click(object sender, EventArgs e)
        {
            bool   error;
            string pName   = TxtProfile.Text;
            long   pSize   = 0;
            double dblSize = 0;

            double.TryParse(TxtSize.Text, out dblSize);
            pSize = (long)(dblSize * Math.Pow(1024, CmbUnit.SelectedIndex));

            if (pSize > (long)Math.Pow(1024, 5))
            {
                MessageBox.Show("Invalid size, Part size is too large.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            error = CheckErrors();

            if (!error)
            {
                if (!editMode)
                {
                    if (Ini.KeyExists("profiles", pName))
                    {
                        MessageBox.Show("Profile name '" + pName + "' is already existed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    Ini.WriteValue("profiles", pName, IoTools.ParseSize(pSize));
                }

                Ini.WriteValue(pName, "name", TxtProfile.Text);
                Ini.WriteValue(pName, "size", pSize.ToString());
                Ini.WriteValue(pName, "index", CmbUnit.SelectedIndex);
                Ini.WriteValue(pName, "description", TxtDesc.Text);

                this.Close();
            }
        }
Ejemplo n.º 2
0
        public static void UpdatePartsInfo()
        {
            long pSize = 0;

            if (File.Exists(txtFileName.Text))
            {
                pSize                = GetPartSize();
                Splitter.FileName    = txtFileName.Text;
                Splitter.SegmentSize = pSize;

                if (pSize > 0)
                {
                    lPartsNumber.Text = "Parts Number: " + Splitter.Info.Segments.ToString();
                    lPartSize.Text    = "Part Size: " + IoTools.ParseSize(Splitter.SegmentSize);
                }
            }
            else
            {
                lPartsNumber.Text = "Parts Number: N/A";
                lPartSize.Text    = "Part Size: N/A";
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Return size as string
 /// </summary>
 /// <returns></returns>
 public string GetSize()
 {
     return(IoTools.ParseSize(size));
 }