예제 #1
0
 internal void SaveDataDocument(string fileName)
 {
     try
     {
         JsonTransfer.SerializeObject(fileName, this);
         ((IUpdateModified)this).SuccessfullySaved();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        internal static DataDocument GetDataDocument(string fileName)
        {
            // do not initialize since the document will probably have similiar entries
            var tempPrepopulateFlag = PrePopulating;

            // turn off prepopulating
            PrePopulating = false;
            SerializedObject.Serializing = true;
            DataDocument document;

            try
            {
                document = JsonTransfer.DeserializeFileContents <DataDocument>(fileName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            // restore prepopulating
            PrePopulating = tempPrepopulateFlag;
            SerializedObject.Serializing = false;
            document.RelinkElements();
            return(document);
        }