This commit is contained in:
2020-04-26 20:36:50 +00:00
parent 2d79390b4c
commit 0b8a3a9724

View File

@@ -606,6 +606,7 @@ namespace AyaNova.Plugin.Dump
private void DumpWikiPageAndAttachments(TypeAndID tid, string wikiOutputPath)
{
//may not exist
if (!WikiPage.HasWiki(tid.ID)) return;
@@ -622,9 +623,38 @@ namespace AyaNova.Plugin.Dump
//write out the html wiki page
File.WriteAllText(wikiOutputPath + Path.DirectorySeparatorChar + "w.html", content);
}
//files
List<string> fileNamesUsed = new List<string>();
foreach (WikiPage.WikiFileInfo i in fileList)
{
//save out each file to that path with a uniquification prepended
//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));
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 };
JsonSerializer serializer = new JsonSerializer();
serializer.NullValueHandling = NullValueHandling.Include;
#if(DEBUG)
serializer.Formatting = Formatting.Indented;
#endif
JObject jo = JObject.FromObject(fileInfo, serializer);
using (StreamWriter sw = new StreamWriter(filePath+Path.DirectorySeparatorChar+".json"))
using (JsonWriter writer = new JsonTextWriter(sw))
{
// serializer.Serialize(writer, o);
serializer.Serialize(writer, jo);
}
}
}