Ejemplo n.º 1
0
        public static Blueprint LoadFromFile(string fileName)
        {
            Blueprint blueprint = new Blueprint();

            try
            {
                Scribe.InitLoading(BlueprintFiles.FilePathForSavedBlueprint(fileName));
                try
                {
                    Scribe_Deep.LookDeep(ref blueprint, "Blueprint", null);
                }
                catch (Exception e)
                {
                    Messages.Message("Error when loading blueprint", MessageSound.RejectInput);
                    Log.Error(e.ToString());
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
            finally
            {
                Scribe.mode = LoadSaveMode.Inactive;
            }
            return(blueprint);
        }
Ejemplo n.º 2
0
 public static void SaveToFile(ref Blueprint bp, string fileName)
 {
     try
     {
         Scribe.InitWriting(BlueprintFiles.FilePathForSavedBlueprint(fileName), "blueprint");
         bp.BpName = fileName;
         Scribe_Deep.LookDeep(ref bp, "Blueprint");
     }
     catch (Exception e)
     {
         Log.Error("Failed to save blueprint");
         throw e;
     }
     finally
     {
         Scribe.FinalizeWriting();
         Scribe.mode = LoadSaveMode.Inactive;
     }
 }