Exemplo n.º 1
0
        private void tsBtnRefresh_Click(object sender, EventArgs e)
        {
            if (!AnimeInfo.IsStorageReady())
            {
                return;
            }

            long lSize    = 0L;
            long lSelSize = 0L;
            long lSpace   = _ai.Space;
            bool bCheck   = false;

            foreach (Anime a in this.folvAnime.SelectedObjects)
            {
                if (a.Path.Length == 0)
                {
                    continue;
                }

                lSize = Anime.GetSize(a.Path);
                if (a.Size != lSize)
                {
                    bCheck = true;

                    lSpace += lSize - a.Size;
                    a.Size  = lSize;
                    this.folvAnime.RefreshItem(this.folvAnime.ModelToItem(a));
                }
                lSelSize += a.Size;
            }

            if (bCheck)
            {
                _ai.IsSaved = false;
            }

            if (lSpace != _ai.Space)
            {
                _ai.Space = lSpace;

                this.tsslSelSpace.Text = (lSelSize == 0L) ? "Selected Size: -" :
                                         (lSelSize >= 1000000000L) ? String.Format("Selected Size: {0:#,##0.#0} GB", lSelSize / 1073741824D) :
                                         String.Format("Selected Size: {0:#,##0.#0} MB", lSelSize / 1048576D);
                this.tsslSpace.Text = String.Format("Total Size: {0:#,##0.#0} GB", _ai.Space / 1073741824D);
            }
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            // edit 13/1/13 for fun3
            //if (this.tbTitle.Text == "")
            //{
            //    MessageBox.Show("The title is a null value!", "Title error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    this.tbTitle.Focus();

            //    return;
            //}

            //Regex rx = new Regex(@"^(?!0000)[0-9]{4}$");

            //if (!rx.IsMatch(this.cboYear.Text))
            //{
            //    MessageBox.Show("The Year is wrong!", "Year error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    this.cboYear.ResetText();
            //    this.cboYear.Focus();

            //    return;
            //}

            //if (this.tbStoreIndex.Text != "")
            //{
            //    rx = new Regex(@"^[a-zA-Z]:(\\[^\s\.\\/:\*\?\x22<>\|][^\\/:\*\?\x22<>\|]*[^\s\.\\/:\*\?\x22<>\|])+$");

            //    if (!rx.IsMatch(this.tbStoreIndex.Text))
            //    {
            //        MessageBox.Show("The Path do not match!", "Path error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //        this.tbStoreIndex.ResetText();
            //        this.tbStoreIndex.Focus();

            //        return;
            //    }

            //    if (Directory.Exists(this.tbStoreIndex.Text))
            //        _anime.Size = AnimeSpace.GetSpace(this.tbStoreIndex.Text);
            //}
            //else _anime.Size = 0L;

            //bool btitle, byear, bstoreindex;

            //btitle = MatchTitle();
            //byear = MatchYear();
            //bstoreindex = MatchStoreIndex();

            //if (!btitle)
            //{
            //	this.tbTitle.Focus();
            //	return;
            //}
            //else if (!byear)
            //{
            //	this.cboYear.Text = String.Empty;
            //	this.cboYear.Focus();
            //	return;
            //}
            //else if (!bstoreindex)
            //{
            //	this.tbStoreIndex.Text = String.Empty;
            //	this.tbStoreIndex.Focus();
            //	return;
            //}
            // edit fin

            if (this.tbStoreIndex.Text.Length == 0)
            {
                _anime.Size = 0L;
            }
            else if (AnimeInfo.IsStorageReady())
            {
                _anime.Size = Anime.GetSize(this.tbStoreIndex.Text);
            }

            _anime.Title  = this.tbTitle.Text;
            _anime.Year   = UInt32.Parse(this.cboYear.Text);
            _anime.Season = (PlaySeason)this.cboSeason.SelectedItem;
            _anime.Path   = this.tbStoreIndex.Text;

            _anime.Format   = (MergeFormat)this.cboFormat.SelectedItem;
            _anime.SubStyle = (SubStyles)this.cboSubStyle.SelectedItem;

            _anime.UpdateTime = DateTime.Now;
            _anime.Kana       = this.tbKana.Text;
            _anime.Episode    = this.tbEpisode.Text;
            _anime.Inc        = this.tbInc.Text;
            _anime.Note       = this.rtbNote.Text.Replace('\n', '\u0002');

            lsize = _anime.Size - lsize;

            this.Close();
        }