FromString() public static méthode

public static FromString ( string input ) : BookMetaData
input string
Résultat BookMetaData
Exemple #1
0
        private static string GetMetaJsonModfiedForTemplate(string path)
        {
            var meta = BookMetaData.FromString(RobustFile.ReadAllText(path));

            meta.IsSuitableForMakingShells = true;
            return(meta.Json);
        }
Exemple #2
0
        public BookInfo(string folderPath, bool isEditable)
        {
            IsSuitableForVernacularLibrary = true;             // default
            FolderPath = folderPath;
            Id         = Guid.NewGuid().ToString();
            CoverColor = NextBookColor();

            var jsonPath = MetaDataPath;

            if (File.Exists(jsonPath))
            {
                _metadata = BookMetaData.FromString(File.ReadAllText(jsonPath));                 // Enhance: error handling?
            }
            else
            {
                // Look for old tags files not yet migrated
                var oldTagsPath = Path.Combine(folderPath, "tags.txt");
                if (File.Exists(oldTagsPath))
                {
                    Book.ConvertTagsToMetaData(oldTagsPath, this);
                }
            }

            // should the accordion be enabled?
            if ((_metadata != null) && (_metadata.Tools != null))
            {
                if (!_metadata.ReaderToolsAvailable)
                {
                    if (_metadata.Tools.Any(t => t.Enabled))
                    {
                        _metadata.ReaderToolsAvailable = true;
                    }
                }
            }

            //TODO
            Type       = Book.BookType.Publication;
            IsEditable = isEditable;

            FixDefaultsIfAppropriate();
        }