Esempio n. 1
0
 private void ChangeMarkContent()
 {
     if (this.index != this.progress.Page)
     {
         for (int i = 0; i < this.mark.Marks.Count; i++)
         {
             if ((this.mark.Marks[i].ChapterNo == this.currentChapter) && (this.mark.Marks[i].Current == this.progress.Page))
             {
                 this.mark.Marks[i].Current = this.index;
                 for (int j = 0; j < this.chapter.Mark.Marks.Count; j++)
                 {
                     if (this.chapter.Mark.Marks[j].Current == this.progress.Page)
                     {
                         this.chapter.Mark.Marks[j].Current = this.index;
                         OKr.MXReader.Client.Core.Data.Page page = this.chapter.Pages[this.index];
                         this.chapter.Mark.Marks[j].Content = page.Row[0];
                         this.mark.Marks[i].Content         = page.Row[0];
                         break;
                     }
                 }
                 break;
             }
         }
         IsolatedStorageSettings.ApplicationSettings["marks"]    = this.mark;
         IsolatedStorageSettings.ApplicationSettings["bookinfo"] = this.book;
     }
 }
Esempio n. 2
0
        private void OnMarkManipulationStarted(object o, ManipulationStartedEventArgs e)
        {
            Mark m = this.chapter.Mark;

            if (m == null)
            {
                m = new Mark();
                this.chapter.Mark = m;
            }

            ChapterMark item = m.Marks.FirstOrDefault(x => x.Current == this.index);

            if (item == null)
            {
                item           = new ChapterMark();
                item.ChapterNo = this.currentChapter;
                item.Title     = this.book.Chapters[this.currentChapter].Title;
                item.Date      = DateTime.Now.ToString("yyyy/mm/dd hh:MM:ss");
                item.Current   = this.index;
                item.Percent   = ((double)this.index) / ((double)this.chapter.PageNum);
                OKr.MXReader.Client.Core.Data.Page setting = this.chapter.Pages[this.index];
                item.Content = setting.Row[0].Trim() + setting.Row[1].Trim();
                this.mark.Marks.Add(item);
                m.Marks.Add(item);
            }
            else
            {
                int chapterNo           = item.ChapterNo;
                List <ChapterMark> list = new List <ChapterMark>();
                for (int i = 0; i < this.mark.Marks.Count; i++)
                {
                    if ((this.mark.Marks[i].ChapterNo != chapterNo) || (this.mark.Marks[i].Current != this.index))
                    {
                        list.Add(this.mark.Marks[i]);
                    }
                }
                this.mark.Marks.Clear();
                this.mark.Marks = list;
                List <ChapterMark> list2 = new List <ChapterMark>();
                for (int j = 0; j < m.Marks.Count; j++)
                {
                    if (m.Marks[j].Current != this.index)
                    {
                        list2.Add(m.Marks[j]);
                    }
                }
                this.chapter.Mark.Marks.Clear();
                this.chapter.Mark.Marks = list2;
            }

            IsolatedStorageSettings.ApplicationSettings["marks"]    = this.mark;
            IsolatedStorageSettings.ApplicationSettings["bookinfo"] = this.book;

            this.ShowMark();
        }
Esempio n. 3
0
 private void ChangePage()
 {
     OKr.MXReader.Client.Core.Data.Page page = this.chapter.Pages[this.index];
     this.text_text1.Text = this.text_text2.Text;
     this.text_text2.Text = "";
     for (int i = 0; i < page.Row.Count; i++)
     {
         if (Regex.IsMatch(page.Row[i], @"[\r\n]"))
         {
             this.text_text2.Text = this.text_text2.Text + page.Row[i];
         }
         else
         {
             this.text_text2.Text = this.text_text2.Text + page.Row[i] + "\n";
         }
     }
 }
Esempio n. 4
0
        private void LoadData()
        {
            int[] count = this.GetCounts(this.fontsize);
            this.chapter           = this.book.Chapters[this.currentChapter];
            this.chapter.PageCount = count[0];
            string  content = AtFile.GetContent(OkrBookContext.Current.Config.Data + "/" + this.chapter.FileName + ".txt", 4);
            Chapter chapter = null;

            if (content != null)
            {
                chapter = TextParser.GetChapter(content, count);
            }
            this.chapter.PageList = chapter.PageList;
            this.chapter.PageNum  = chapter.PageNum;
            this.chapter.Pages    = chapter.Pages;
            this.GetThisPage();
            this.ChangeMarkContent();
            this.title1.Text = this.chapter.Title;
            this.title2.Text = this.chapter.Title;
            OKr.MXReader.Client.Core.Data.Page page = this.chapter.Pages[this.index];
            this.text_text1.Text = "";
            this.text_text2.Text = "";
            for (int i = 0; i < page.Row.Count; i++)
            {
                if (Regex.IsMatch(page.Row[i], @"[\r\n]"))
                {
                    this.text_text1.Text = this.text_text1.Text + page.Row[i];
                    this.text_text2.Text = this.text_text2.Text + page.Row[i];
                }
                else
                {
                    this.text_text1.Text = this.text_text1.Text + page.Row[i] + "\n";
                    this.text_text2.Text = this.text_text2.Text + page.Row[i] + "\n";
                }
            }
            this.pageno1.Text = string.Concat(new object[] { this.index + 1, "/", this.chapter.PageNum, OkrConstant.PAGE });
            this.pageno2.Text = string.Concat(new object[] { this.index + 1, "/", this.chapter.PageNum, OkrConstant.PAGE });
            this.ShowMark();
        }
Esempio n. 5
0
 public static Chapter GetChapter(string context, int[] count)
 {
     Chapter bean = new Chapter();
     List<string> list = new List<string>();
     byte[] bytes = Encoding.GetEncoding("utf-8").GetBytes(context);
     int start = 0;
     int num2 = 0;
     while (start < bytes.Length)
     {
         OKr.MXReader.Client.Core.Data.Page item = GetOnePage(context, start, count);
         start += item.CharNum;
         list.Add(item.Result);
         bean.Pages.Add(item);
         if (start >= context.Length)
         {
             num2++;
             break;
         }
         num2++;
     }
     bean.PageList = list;
     bean.PageNum = num2;
     return bean;
 }
Esempio n. 6
0
 public static OKr.MXReader.Client.Core.Data.Page GetOnePage(string str, int start, int[] count)
 {
     OKr.MXReader.Client.Core.Data.Page result = new OKr.MXReader.Client.Core.Data.Page();
     int num = 1;
     int num2 = 0;
     int num3 = 0;
     int length = 0;
     int startIndex = start;
     int num6 = 0;
     for (int i = start; i < str.Length; i++)
     {
         if (Regex.IsMatch(str.Substring(i, 1), @"[\r\n]"))
         {
             num2 = 0;
             length++;
             num3++;
             num6++;
             if (num6 == 1)
             {
                 num++;
                 result.Row.Add(str.Substring(startIndex, length));
             }
             length = 0;
             startIndex = i + 1;
             if (num != count[0])
             {
                 continue;
             }
             break;
         }
         num6 = 0;
         string s = str.Substring(i, 1);
         byte[] bytes = Encoding.GetEncoding("utf-8").GetBytes(s);
         if (bytes.Length == 3)
         {
             if (((count[1] * 2) - num2) >= 3)
             {
                 num2 += 3;
             }
             else
             {
                 num++;
                 result.Row.Add(str.Substring(startIndex, length));
                 length = 0;
                 startIndex = i;
                 num2 = 3;
                 if (num == count[0])
                 {
                     break;
                 }
             }
         }
         else if (bytes.Length != 2)
         {
             if (((count[1] * 2) - num2) >= 1)
             {
                 num2++;
             }
             else
             {
                 num++;
                 result.Row.Add(str.Substring(startIndex, length));
                 length = 0;
                 startIndex = i;
                 num2 = 1;
                 if (num == count[0])
                 {
                     break;
                 }
             }
         }
         num3++;
         length++;
     }
     result.CharNum = num3;
     return result;
 }
Esempio n. 7
0
 public static OKr.MXReader.Client.Core.Data.Page GetOnePage(string str, int start, int[] count)
 {
     OKr.MXReader.Client.Core.Data.Page result = new OKr.MXReader.Client.Core.Data.Page();
     int num = 1;
     int num2 = 0;
     int num3 = 0;
     int length = 0;
     int startIndex = start;
     int num6 = 0;
     for (int i = start; i < str.Length; i++)
     {
         if (Regex.IsMatch(str.Substring(i, 1), @"[\r\n]"))
         {
             num2 = 0;
             length++;
             num3++;
             num6++;
             if (num6 == 1)
             {
                 num++;
                 result.Row.Add(str.Substring(startIndex, length));
             }
             length = 0;
             startIndex = i + 1;
             if (num != count[0])
             {
                 continue;
             }
             break;
         }
         num6 = 0;
         string s = str.Substring(i, 1);
         byte[] bytes = Encoding.GetEncoding("utf-8").GetBytes(s);
         if (bytes.Length == 3)
         {
             if (((count[1] * 2) - num2) >= 3)
             {
                 num2 += 3;
             }
             else
             {
                 num++;
                 result.Row.Add(str.Substring(startIndex, length));
                 length = 0;
                 startIndex = i;
                 num2 = 3;
                 if (num == count[0])
                 {
                     break;
                 }
             }
         }
         else if (bytes.Length != 2)
         {
             if (((count[1] * 2) - num2) >= 1)
             {
                 num2++;
             }
             else
             {
                 num++;
                 result.Row.Add(str.Substring(startIndex, length));
                 length = 0;
                 startIndex = i;
                 num2 = 1;
                 if (num == count[0])
                 {
                     break;
                 }
             }
         }
         num3++;
         length++;
     }
     result.CharNum = num3;
     return result;
 }