Ejemplo n.º 1
0
        private static void Save()
        {
            // save file
            string document = "";

            try
            {
                for (int i = 0; i < Lines.Count; i++)
                {
                    document += Lines[i] + "\n";
                }
                PMFAT.WriteAllText(CurrentFile, document);
                TextGraphics.DrawLineH(0, StartY, Width, ' ', Color.White, Color.Black);
                TextGraphics.DrawString(0, StartY, "Successfully saved \"" + CurrentFile + "\"", Color.Green, Color.Black);
            }
            catch (Exception ex)
            {
                TextGraphics.DrawLineH(0, StartY, Width, ' ', Color.White, Color.Black);
                TextGraphics.DrawString(0, StartY, "Unable to save file \"" + CurrentFile + "\"", Color.Red, Color.Black);
            }

            // finish
            Kernel.Delay(500);
            Draw();
        }
Ejemplo n.º 2
0
        private static void SaveAs()
        {
            // draw
            Draw();
            TextGraphics.DrawLineH(0, StartY, Width, ' ', Color.White, Color.Black);
            TextGraphics.DrawString(0, StartY, "FILENAME: ", Color.White, Color.Black);
            CLI.SetCursorPos(10, StartY);

            // get file
            string file = Console.ReadLine();

            // format filename
            if (!file.StartsWith(@"0:\"))
            {
                file = @"0:\" + file;
            }

            // save file
            string document = "";

            try
            {
                for (int i = 0; i < Lines.Count; i++)
                {
                    document += Lines[i] + "\n";
                }
                PMFAT.WriteAllText(file, document);
                TextGraphics.DrawLineH(0, StartY, Width, ' ', Color.White, Color.Black);
                TextGraphics.DrawString(0, StartY, "Successfully saved \"" + file + "\"", Color.Green, Color.Black);
            }
            catch (Exception ex)
            {
                TextGraphics.DrawLineH(0, StartY, Width, ' ', Color.White, Color.Black);
                TextGraphics.DrawString(0, StartY, "Unable to save file \"" + file + "\"", Color.Red, Color.Black);
            }

            // finish
            CurrentFile = file;
            Kernel.Delay(500);
            Draw();
        }