From ad76471fcbbc89df09eea5cc2e923d1421bf0b0e Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 26 Apr 2020 21:16:52 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.Dump/Dump.cs | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/Plugins/AyaNova.Plugin.Dump/Dump.cs b/source/Plugins/AyaNova.Plugin.Dump/Dump.cs index d4ef15a..f6f87d1 100644 --- a/source/Plugins/AyaNova.Plugin.Dump/Dump.cs +++ b/source/Plugins/AyaNova.Plugin.Dump/Dump.cs @@ -612,9 +612,9 @@ namespace AyaNova.Plugin.Dump WikiPage w= WikiPage.GetItem(tid); var content= w.GetContentAsString; - var fileList = w.GetFileListContentForRI(); + AyaFileList fl = AyaFileList.GetList(tid.ID); - if (string.IsNullOrWhiteSpace(content) && fileList.Count < 1) return; + if (string.IsNullOrWhiteSpace(content) && fl.Count < 1) return; makeFolderIfNotExist(wikiOutputPath); @@ -625,18 +625,28 @@ namespace AyaNova.Plugin.Dump } //files - List fileNamesUsed = new List(); - foreach (WikiPage.WikiFileInfo i in fileList) + foreach (AyaFileList.AyaFileListInfo i in fl) { + //WikiFileInfo fi = new WikiFileInfo(); + // fi.Id = i.LT_O_AyaFile.Value.ToString(); + // fi.Name = i.LT_O_AyaFile.Display; + // fi.Size = i.LT_AyaFile_Label_FileSize; + // fi.Creator = i.LT_Common_Label_Creator.Display; + // fi.Created = i.LT_Common_Label_Created.ToString(); + // ret.Add(fi); + + + //save each file plus file info into their own folder by ayafile id this is because ayafiles can be dupe names and we need the wiki info to fixup the last created date etc var filePath = wikiOutputPath + Path.DirectorySeparatorChar + i.Id.ToString(); makeFolderIfNotExist(filePath);//output/objectype/client.f861ec01-8bde-46e1-9849-fcee9b42f05e/files/d5461ec01-8bde-46e1-9849-fcee9b42f0ff34/ - var af=AyaFile.GetItem(new Guid(i.Id)); + var af = AyaFile.GetItem(i.LT_O_AyaFile.Value); if (af == null) continue; af.WriteToDisk(filePath, af.Name); - var fileInfo = new { name = i.Name, created=i.Created, creator=i.Creator, mimetype=af.mimeType, id=i.Id, size=i.Size,ayafiletype=af.FileType, rootobjectid=af.RootObjectID, rootobjecttype=af.RootObjectType }; + var fileInfo = new { name = i.LT_O_AyaFile.Display, created = i.LT_Common_Label_Created, creator = i.LT_Common_Label_Creator.Value, + mimetype = af.mimeType, id = af.ID, size = af.FileSize, ayafiletype = af.FileType, rootobjectid = af.RootObjectID, rootobjecttype = af.RootObjectType }; JsonSerializer serializer = new JsonSerializer(); serializer.NullValueHandling = NullValueHandling.Include; @@ -648,7 +658,7 @@ namespace AyaNova.Plugin.Dump - using (StreamWriter sw = new StreamWriter(filePath+Path.DirectorySeparatorChar+".json")) + using (StreamWriter sw = new StreamWriter(filePath+Path.DirectorySeparatorChar+"meta.json")) using (JsonWriter writer = new JsonTextWriter(sw)) {