Exemplo n.º 1
0
        public static void Write()
        {
            ZNAK znak = new ZNAK();

            znak.SetData();
            using (FileStream file = new FileStream("file.json", FileMode.Append))
            {
                using (StreamWriter stream = new StreamWriter(file))
                {
                    stream.WriteLine(znak.Serrialize());
                }
            }
        }
Exemplo n.º 2
0
        public static void Read()
        {
            List <ZNAK> znaks = new List <ZNAK>();

            using (FileStream file = new FileStream("file.json", FileMode.Open))
            {
                using (StreamReader stream = new StreamReader(file))
                {
                    while (!stream.EndOfStream)
                    {
                        znaks.Add(ZNAK.Desserialize(stream.ReadLine()));
                    }
                }
            }
            while (true)
            {
                Console.Write("Month (0 to print the whole list): ");
                if (int.TryParse(Console.ReadLine(), out int month) && month >= 0 && month <= 12)
                {
                    Print(month, znaks);
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public int CompareTo(object obj)
        {
            ZNAK znak = obj as ZNAK;

            return(Sign.CompareTo(znak.Sign));
        }