Ejemplo n.º 1
0
        private void SaveToFile(string path, IPv4 ip, List <Branch> branches)
        {
            FileStream   fs = new FileStream(path, FileMode.OpenOrCreate);
            StreamWriter sw = new StreamWriter(fs);


            sw.WriteLine($"{ip.ToDecimalString()}/{ip.Suffix}");
            for (int i = 0; i < branches.Count; ++i)
            {
                sw.Write($"{branches[i].Name}:{branches[i].HostsAmount}");
                if (i != branches.Count - 1)
                {
                    sw.WriteLine();
                }
            }


            sw.Close();
            fs.Close();
        }