public static List <BalancedNumber> LoadBalancedNumberList()
        {
            if (!Directory.Exists(basePath))
            {
                Directory.CreateDirectory(basePath);
            }
            List <BalancedNumber> result = new List <BalancedNumber>();

            try
            {
                using (BinaryReader reader = new BinaryReader(File.Open(basePath + "BalancedNumberList.savedata", FileMode.Open)))
                {
                    ushort length = reader.ReadUInt16();
                    if (length == 0)
                    {
                        return(new List <BalancedNumber>());
                    }
                    for (int i = 0; i < length; i++)
                    {
                        BalancedNumber bn = Read(reader);
                        result.Add(bn);
                    }
                }
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Error loading list");
                return(new List <BalancedNumber>());
            }
            return(result);
        }
 public static BalancedNumber Read(string denominator)
 {
     using (BinaryReader reader = new BinaryReader(File.Open(basePath + denominator + ".savedata", FileMode.Open)))
     {
         return(BalancedNumber.CreateFromBinaryStream(reader));
     }
 }
 public static void Write(BalancedNumber data, string denominator)
 {
     if (!Directory.Exists(basePath))
     {
         Directory.CreateDirectory(basePath);
     }
     using (BinaryWriter writer = new BinaryWriter(File.Open(basePath + denominator + ".savedata", FileMode.Create)))
     {
         data.WriteToBinaryStream(writer);
     }
 }
 public static void Write(BalancedNumber data, BinaryWriter writer)
 {
     data.WriteToBinaryStream(writer);
 }
 public static BalancedNumber Read(BinaryReader reader)
 {
     return(BalancedNumber.CreateFromBinaryStream(reader));
 }