Exemplo n.º 1
0
 public bool ExportToFile(string filePath)
 {
     this.shapePersistance.SetShapeTheme(Path.GetFileNameWithoutExtension(filePath));
     var dataPath = ShapePersistence.GetPersistenceDir();
     try
     {
         ZipFile.CreateFromDirectory(dataPath, filePath, CompressionLevel.Fastest, false);
     }
     catch(Exception e)
     {
         logger.Log("Exception while exporting: " + e.Message);
         return false;
     }
     logger.Log("Export successful.");
     return true;
 }
Exemplo n.º 2
0
 public bool ImportFromFile(string filePath)
 {
     try
     {
         var persistenceDir = ShapePersistence.GetPersistenceDir();
         Directory.Delete(persistenceDir, true);
         Directory.CreateDirectory(persistenceDir);
         ZipFile.ExtractToDirectory(filePath, persistenceDir);
         this.shapePersistance.InstallPersistedTheme();
         this.shapePersistance.LoadShapes();
     }
     catch(Exception e)
     {
         logger.Log("Exception while importing from file: " + e.Message);
         return false;
     }
     logger.Log("Import successful.");
     return true;
 }
Exemplo n.º 3
0
 internal StructurePersistanceListener(ShapePersistence parent, string structureFile)
 {
     this.parent        = parent;
     this.structureFile = structureFile;
 }