Bloom.Book.BookStarter.SetLineageAndId C# (CSharp) Method

SetLineageAndId() private method

private SetLineageAndId ( BookStorage storage, string sourceFolderPath ) : void
storage BookStorage
sourceFolderPath string
return void
        private void SetLineageAndId(BookStorage storage, string sourceFolderPath)
        {
            string parentId = null;
            string lineage = null;
            if (RobustFile.Exists(Path.Combine(sourceFolderPath, BookInfo.MetaDataFileName)))
            {
                var sourceMetaData = new BookInfo(sourceFolderPath, false);
                parentId = sourceMetaData.Id;
                lineage = sourceMetaData.BookLineage;
            }
            else
            {
                // No parent meta.json, try for legacy embedded metadata in html
                parentId = GetMetaValue(storage.Dom.RawDom, "bloomBookId", "");
                lineage = GetMetaValue(storage.Dom.RawDom, "bloomBookLineage", "");
                if (string.IsNullOrEmpty(lineage))
                {
                    lineage = GetMetaValue(storage.Dom.RawDom, "bookLineage", ""); //try the old name for this value
                }
            }

            if (!string.IsNullOrEmpty(lineage))
                lineage += ",";
            if (!string.IsNullOrEmpty(parentId))
            {
                storage.MetaData.BookLineage = lineage + parentId;
            }
            storage.MetaData.Id = Guid.NewGuid().ToString();
            storage.Dom.RemoveMetaElement("bloomBookLineage"); //old metadata
            storage.Dom.RemoveMetaElement("bookLineage"); // even older name
        }