コード例 #1
0
ファイル: AnimeInfo.cs プロジェクト: coolxye/animetidy
        private void ma_FormClosed(object sender, FormClosedEventArgs e)
        {
            ModAnime ma = sender as ModAnime;

            if (ma.DialogResult == DialogResult.OK)
            {
                if (ma.IsModified)
                {
                    long lsize = ma.Ani.Size;
                    if (ma.Ani.Path == String.Empty)
                    {
                        ma.Ani.Size = 0L;
                    }
                    // up
                    else if (Directory.Exists(ma.Ani.Path))
                    {
                        ma.Ani.Size = Anime.GetSize(ma.Ani.Path);
                    }
                    this.Space += ma.Ani.Size - lsize;

                    ma.ListView.RefreshObject(ma.Ani);
                    if (ma.ListView.SelectedObject == ma.Ani)
                    {
                        Form.tsslSelSpace.Text = String.Format("Selected Size: {0}", FormatAnimeSize(ma.Ani.Size));
                        this.OnRemarkChanged();
                    }

                    // undo push, modify eanime = org's copy, organime = list's anime
                    this.AniStack.Push(new AnimeStack(EditType.Modify, ma.OriAni, ma.Ani));

                    base.ModifyInfo(ma.ListView);
                }
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
ファイル: AnimeInfo.cs プロジェクト: coolxye/animetidy
        public override void RefreshInfo(ObjectListView olv)
        {
            if (this.StoreDrive.Capacity == 0)
            {
                return;
            }

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

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

                if (!Directory.Exists(a.Path))
                {
                    continue;
                }

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

                    lSpace += lSize - a.Size;
                    a.Size  = lSize;
                    olv.RefreshObject(a);
                }
                lSelSize += a.Size;
            }

            if (bCheck)
            {
                base.RefreshInfo(olv);
            }

            this.Space = lSpace;

            // Form SelSize update
            Form.tsslSelSpace.Text = String.Format("Selected Size: {0}", FormatAnimeSize(lSelSize));
        }
コード例 #4
0
ファイル: AddAnime.cs プロジェクト: coolxye/animetidy
 protected override void Manipulate()
 {
     Ani.Name       = this.tbName.Text;
     Ani.Title      = this.tbTitle.Text;
     Ani.Year       = this.dtpAirDate.Value.Year;
     Ani.Month      = this.dtpAirDate.Value.Month;
     Ani.Type       = (MediaType)this.cboType.SelectedItem;
     Ani.Format     = (MergeFormat)this.cboFormat.SelectedItem;
     Ani.SubTeam    = this.cboSubTeam.Text;
     Ani.SubStyle   = (SubStyle)this.cboSubStyle.SelectedItem;
     Ani.Path       = this.tbPath.Text;
     Ani.Size       = Anime.GetSize(Ani.Path);
     Ani.Store      = (StoreState)this.cboStore.SelectedIndex;
     Ani.Enjoy      = (EnjoyState)this.cboEnjoy.SelectedIndex;
     Ani.Grade      = Int32.Parse(this.cboGrade.Text);
     Ani.CreateTime = DateTime.Now;
     Ani.UpdateTime = DateTime.Now;
     Ani.Kana       = this.tbKana.Text;
     Ani.Episode    = this.tbEpisode.Text;
     Ani.Inc        = this.tbInc.Text;
     Ani.Note       = this.rtbNote.Text.Replace('\n', '\u0002');
 }
コード例 #5
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();
        }
コード例 #6
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;
            //    }
            //}

            //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

            _anime.Title      = this.tbTitle.Text;
            _anime.Name       = this.tbName.Text;
            _anime.Year       = UInt32.Parse(this.cboYear.Text);
            _anime.Season     = (PlaySeason)this.cboSeason.SelectedItem;
            _anime.Type       = (MediaType)this.cboType.SelectedItem;
            _anime.Format     = (MergeFormat)this.cboFormat.SelectedItem;
            _anime.SubTeam    = this.cboPublisher.Text;
            _anime.SubStyle   = (SubStyles)this.cboSubStyle.SelectedItem;
            _anime.Path       = this.tbStoreIndex.Text;
            _anime.Size       = Anime.GetSize(_anime.Path);
            _anime.Store      = (this.cboGather.SelectedIndex == 1) ? true : false;
            _anime.Enjoy      = (this.cboView.SelectedIndex == 1) ? true : false;
            _anime.Grade      = Int32.Parse(this.cboRate.Text);
            _anime.CreateTime = DateTime.Now;
            _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');

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #7
0
ファイル: AnimeInfo.cs プロジェクト: coolxye/animetidy
        public override void RefreshInfo(ObjectListView olv, TidyConst.RefreshType key)
        {
            if (this.StoreDrive.Capacity == 0)
            {
                return;
            }

            long lSpace = this.Space;
            int  iFresh = 0;

            foreach (Anime a in olv.Objects)
            {
                if (a.Path.Length == 0)
                {
                    continue;
                }

                bool bPathUp = false;
                bool bSizeUp = false;

                if (Directory.Exists(a.Path))
                {
                    long lSize = Anime.GetSize(a.Path);
                    if (a.Size != lSize)
                    {
                        bSizeUp = true;

                        lSpace += lSize - a.Size;
                        a.Size  = lSize;
                    }
                }
                else
                {
                    string srelative = a.Path.Substring(a.Path.IndexOf('\\') + 1);
                    foreach (string drive in this.StoreDrive)
                    {
                        if (Directory.Exists(drive + srelative))
                        {
                            a.Path  = drive + srelative;
                            bPathUp = true;

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

                                lSpace += lSize - a.Size;
                                a.Size  = lSize;
                            }

                            break;
                        }
                    }
                }

                if (bPathUp || bSizeUp)
                {
                    olv.RefreshObject(a);
                    iFresh++;
                }
            }

            this.Space = lSpace;

            if (iFresh > 0)
            {
                base.RefreshInfo(olv, key);
            }
        }