Ejemplo n.º 1
0
        private string GetFilePath(StorageFileEnum file)
        {
            switch (file)
            {
            case StorageFileEnum.CatalogHierarchy:
                return(GetCatalogHierarchyPath());

            case StorageFileEnum.CatalogReference:
                return(GetCatalogReferencePath());

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 2
0
        protected bool TryParseContent <T>(StorageFileEnum file, out T ret)
        {
            ret = default(T);

            string filePath = null, json = null;

            try
            {
                filePath = GetFilePath(file);

                if (string.IsNullOrWhiteSpace(filePath))
                {
                    return(false);
                }

                if (!TryGetContent(filePath, out json))
                {
                    return(false);
                }

                if (string.IsNullOrWhiteSpace(json))
                {
                    return(false);
                }

                return(TryParseJson <T>(json, out ret));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                filePath = null;
                json     = null;
            }
        }