AddressMatch.AddrSet.Dump C# (CSharp) Method

Dump() public method

Dump to Disk, location is default directory.
public Dump ( ) : bool
return bool
        public bool Dump()
        {
            if (DumpDirectory == "" || DumpDirectory == null)
            {
                throw new Exception("The instance is not correctly initialized");
            }

            string dumpfile = getFileNameToDump();
            Stream stream = null;
            try
            {
                stream = new FileStream(DumpDirectory + dumpfile, FileMode.Create, FileAccess.Write, FileShare.None);
                IFormatter formatter = new BinaryFormatter();
                formatter.Serialize(stream, AddrGraph);
                stream.Close();
            }
            catch (System.Exception ex)
            {
                if (stream != null)
                    stream.Close();
                throw new Exception("serialization failed! Message: " + ex.Message);
            }

            Console.WriteLine(" Graph serialize  success!");

            return true;
        }