public static void Execute(string scriptname) { if (scriptname.EndsWith(".cscript")) { foreach (string line in File.ReadLines(@"C:/Users/azama/Desktop/" + scriptname)) { Cocoashell.SendCMD(line); } } else { Console.WriteLine("Not a valid Cocoascript file."); } Cocoashell.isscript = false; }
public static void Execute(string scriptname) { if (scriptname.EndsWith(".ccs")) { string[] lines = File.ReadAllLines(Terminal.current_directory + scriptname); foreach (string line in lines) { Cocoashell.SendCMD(line); } } else { Console.WriteLine("Not a valid Cocoascript file."); } Cocoashell.isscript = false; }
public static void Run(string file) { Console.WriteLine("--|:Welcome to Cocoapad Editor:|--"); Console.WriteLine("Cocoapad is a multi line text editor you can use to create many files."); Console.WriteLine("Once you have finished you can type 'save' to save your file or 'end' to close without saving."); Console.WriteLine("Filenames can only have 3 letter extensions."); text = ""; string line; var num = 1; while (true) { Console.Write(num + ":"); num = num + 1; line = Console.ReadLine(); if (line == "end") { Console.WriteLine("Would you like to save first?"); string notsaved = Console.ReadLine(); if (notsaved == "y") { File.WriteAllText(Terminal.current_directory + file, text); savedtext = text; Cocoashell.Run(); } else if (notsaved == "n") { Cocoashell.Run(); } else { } } if (line == "save") { File.CreateText(Terminal.current_directory + @"\" + file); File.WriteAllText(Terminal.current_directory + @"\" + file, text); cpedit.savedtext = cpedit.text; Cocoashell.Run(); } cpedit.text = cpedit.text + (Environment.NewLine + line); } }