Exemple #1
0
        private static bool GetFilePath(BookProfile profile, ref List <DbFileDescription> dbPretendents)
        {
            DriveInfo[]      allDrives  = DriveInfo.GetDrives();
            List <DriveInfo> pretendent = new List <DriveInfo>();

            foreach (var d in allDrives)
            {
                if (File.Exists(Path.Combine(d.RootDirectory.FullName, profile.BookDbPath)))
                {
                    pretendent.Add(d);
                }
            }

            if (pretendent.Count != 0)
            {
                foreach (var p in pretendent)
                {
                    dbPretendents.Add(new DbFileDescription
                    {
                        Drive    = p,
                        FilePath = Path.Combine(p.RootDirectory.FullName, profile.BookDbPath)
                    });
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public static BookProfile GetProfile()
        {
            BookProfile result = new BookProfile();

            result.BookDbPath       = @"Sony_Reader\database\books.db";
            result.ReaderDriveLabel = "READER";
            return(result);
        }
Exemple #3
0
        private static List <string> ImportLogic(BookProfile profile, List <LionWord> words)
        {
            List <AnnotationItem> annotationItems = TBookConnector.GetAnnotations(profile);
            List <string>         exWord          = File.ReadLines(@"C:/AllHarry/exWord.txt").ToList();
            List <string>         result          = AnnotationImporter.Import(annotationItems, words, ref exWord);

            File.WriteAllLines(@"C:\AllHarry\exWord.txt", exWord);
            return(result);
        }
Exemple #4
0
        public static List <AnnotationItem> GetAnnotations(BookProfile profile)
        {
            string dbCardFileName;
            List <DbFileDescription> pretendents = new List <DbFileDescription>();

            WaitReaderConnection(profile, ref pretendents);

            dbCardFileName = pretendents.FirstOrDefault(p => p.Drive.VolumeLabel != profile.ReaderDriveLabel).FilePath;
            List <AnnotationItem> preAnnotationList = AnnotationReader.Read(dbCardFileName);

            return(preAnnotationList);
        }
Exemple #5
0
 private static void WaitReaderConnection(BookProfile profile, ref List <DbFileDescription> pretendents)
 {
     while (!GetFilePath(profile, ref pretendents))
     {
         Console.Clear();
         Console.WriteLine("Reader not found!");
         System.Threading.Thread.Sleep(250);
     }
     System.Threading.Thread.Sleep(250);
     Console.Clear();
     Console.WriteLine("Reader ready for work, press any key!");
     Console.ReadLine();
 }
Exemple #6
0
        static void Main(string[] args)
        {
            try
            {
                var          profile      = BookProfile.GetProfile();
                var          l            = new LionSupporter();
                OutputMaster outputMaster = new OutputMaster(@"C:\AllHarry\");

                MenuMaster mainMenu = new MenuMaster(new string[] {
                    "Get new annotation",
                    "Copy annotation to PC",
                    "Analysis annotation",
                    "Print Lingualeo Dictionary"
                });

                mainMenu.GetAnswer("", true);
                if (mainMenu.Answer == "Get new annotation")
                {
                    List <string> importResult = ImportLogic(profile, l.Words);
                    string        timeString   = DateTime.Now.ToString("dd-MM-yy_hh-mm");

                    outputMaster.Print(importResult);
                    List <string> resultData = HtmlMaster.GetHtmlList(importResult);
                    outputMaster.Save(resultData, timeString);
                }

                if (mainMenu.Answer == "Copy annotation to PC")
                {
                    MenuMaster.GetConfidentAnswer();
                }

                if (mainMenu.Answer == "Analysis annotation")
                {
                    AnalysisLogic(@"C:\AllHarry\", outputMaster);
                }

                if (mainMenu.Answer == "Print Lingualeo Dictionary")
                {
                    //int h = Console.LargestWindowHeight;
                    //int wi = Console.LargestWindowWidth;
                    //Console.BackgroundColor = ConsoleColor.Black;
                    //Console.ForegroundColor = ConsoleColor.DarkGreen;
                    //Console.SetWindowSize(wi, h);

                    //Console.Clear();
                    //Console.WriteLine("99");
                    //for (int i = 0; i < h - 3; i++)
                    //{
                    //    string temp = "";
                    //    for (int y = 0; y < wi - 4; y++)
                    //    {
                    //        temp += "-";
                    //    }
                    //    Console.WriteLine(temp);
                    //}
                    //Console.ReadLine();



                    outputMaster.Print(l.Words.Where(w => w.CleanWord.Contains(' ')).Take(10).ToList());
                    outputMaster.Save(l.Words, "dict");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + " " + ex.StackTrace);
            }
            Console.WriteLine("All done!!!!!");
            Console.ReadLine();
        }