Exemple #1
0
 public static Book GetBook(string url, UriKind urikind)
 {
     Book result = new Book();
     string content = AtFile.GetContent(url, 4);
     MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(content));
     StreamReader reader = null;
     try
     {
         reader = new StreamReader(stream);
         string str2 = null;
         while ((str2 = reader.ReadLine()) != null)
         {
             string[] strArray = str2.Replace("&&", "&").Split(new char[] { '&' });
             if (strArray.Length >= 3)
             {
                 Chapter item = new Chapter();
                 item.Title = strArray[0];
                 item.FileName = strArray[1];
                 item.Size = int.Parse(strArray[2]);
                 result.Chapters.Add(item);
             }
         }
         reader.Close();
     }
     catch (NullReferenceException ex)
     {
         
     }
     return result;
 }
Exemple #2
0
        private void LoadData(int index)
        {
            int[] count = this.GetCounts(this.fontsize);
            this.chapter = this.book.Chapters[index];
            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.Pages    = chapter.Pages;
            this.chapter.PageList = chapter.PageList;
            this.chapter.PageNum  = chapter.PageNum;

            this.title2.Text = this.chapter.Title;
            this.ShowMark();
        }
        public void EnumerateFilesAsync(AtFile y, Action<string> done = null)
        {
            Console.WriteLine("EnumerateFilesAsync");


            data_FileStorage.SelectAll(
                xx =>
                {
                    long
                        ContentKey = xx.ContentKey,
                        ContentBytesLength = xx.ContentBytesLength;

                    string
                        ContentValue = xx.ContentValue,
                        ContentType = xx.ContentType;

                    Console.WriteLine(new { ContentKey, ContentValue, ContentType });


                    y(
                        ContentKey: ContentKey,
                        ContentValue: ContentValue,
                        ContentType: ContentType,
                        ContentBytesLength: ContentBytesLength
                    );
                }
            );


            this.data_FileStorageLog.SelectTransaction(
                xx =>
                {
                    long
                       ContentKey = xx.ContentKey;

                    if (done != null)
                        done("" + ContentKey);
                }
            );
        }
Exemple #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();
        }
        public static Table1_ContentKey WithEach(this Table1_ContentKey x, AtFile y)
        {
            new ApplicationWebService().EnumerateFilesAsync(
                (ContentKey, ContentBytesLength, ContentValue, Left, Top, Width, Height) =>
                {
                    y(ContentKey, ContentBytesLength, ContentValue, Left, Top, Width, Height);
                }
            );

            return x;
        }