Exemplo n.º 1
0
        public static Dictionary <string, Fic> GetFics()
        {
            var res = Liter.GetFics();

            return(res);

            // Leaving this code below temporarily

            var sd = XmlOperator.LoadFics();

            return(new Dictionary <string, Fic>(sd));
        }
Exemplo n.º 2
0
        public static void XmlToLdb()
        {
            SerializableDictionary <string, Fic> fics;
            List <string> lib = new List <string>();
            SerializableDictionary <string, string> libHash;
            SerializableDictionary <string, string> kindleFiles;

            Dictionary <string, Fic>    nDictFics    = new Dictionary <string, Fic>();
            Dictionary <string, string> nDictLibHash = new Dictionary <string, string>();
            Dictionary <string, string> nDictKindle  = new Dictionary <string, string>();

            bool success = false;

            try
            {
                fics      = XmlOperator.LoadFics();
                nDictFics = new Dictionary <string, Fic>(fics);
                success   = true;
            }
            catch (Exception)
            {
            }

            try
            {
                lib = XmlOperator.GetFolders();
            }
            catch (Exception)
            {
            }

            try
            {
                libHash      = XmlOperator.DeserializeFile <SerializableDictionary <string, string> >(Constants.LibHashList);
                nDictLibHash = new Dictionary <string, string>(libHash);
                success      = true;
            }
            catch (Exception)
            {
            }

            try
            {
                kindleFiles = XmlOperator.DeserializeFile <SerializableDictionary <string, string> >(Constants.KindleList);
                nDictKindle = new Dictionary <string, string>(kindleFiles);
                success     = true;
            }
            catch (Exception)
            {
            }

            if (success)
            {
                try
                {
                    Liter.StoreFics(nDictFics);
                }
                catch (Exception)
                {
                }

                try
                {
                    foreach (string fldrpath in lib)
                    {
                        Liter.AddLib(fldrpath);
                    }
                }
                catch (Exception)
                {
                    throw;
                }

                try
                {
                    // LibHash
                    // Not implemented
                }
                catch (Exception)
                {
                }

                try
                {
                    //Kindle
                    Liter.StoreKindleHashes(nDictKindle);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }