Beispiel #1
0
 private bool _ResumeFromDisk()
 {
     if (!File.Exists(DiskFilePath))
     {
         throw new IOException("there's no data file is found in " + DiskFilePath);
     }
     Stream stream = null;
     try
     {
         stream = new FileStream(DiskFilePath, FileMode.Open, FileAccess.Read, FileShare.None);
         BinaryFormatter formatter = new BinaryFormatter();
         AddrGraph = (Graph)formatter.Deserialize(stream);
         stream.Close();
     }
     catch (System.Exception ex)
     {
         if (stream != null)
             stream.Close();
         throw new Exception("Deserialization failed! Message: " + ex.Message);
     }
     if (AddrGraph != null && AddrGraph.NodeTable != null && AddrGraph.root != null)
     {
         return true;
     }
     else
     {
         return false;
     }
 }