PageRenderTime 45ms CodeModel.GetById 6ms RepoModel.GetById 1ms app.codeStats 0ms

/IDE/main.cs

https://bitbucket.org/AdamMil/boaold
C# | 63 lines | 32 code | 9 blank | 22 comment | 2 complexity | 66df919fc3e12a4e09b0f5528e759921 MD5 | raw file
Possible License(s): GPL-2.0
  1. /*
  2. Boaide is a simple IDE for working with the Boa language.
  3. Boa is the reference implementation for a language similar to Python,
  4. also called Boa. This implementation is both interpreted and compiled,
  5. targetting the Microsoft .NET Framework.
  6. http://www.adammil.net/
  7. Copyright (C) 2004 Adam Milazzo
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. */
  20. using System;
  21. using System.Collections;
  22. using System.IO;
  23. using System.Windows.Forms;
  24. namespace Boa.IDE
  25. {
  26. class App
  27. { public static readonly MainForm MainForm = new MainForm();
  28. public static string[] GetRawLines(TextBoxBase box)
  29. { ArrayList list = new ArrayList();
  30. string text = box.Text;
  31. int pos=0;
  32. while(pos<text.Length)
  33. { int index = text.IndexOf('\n', pos);
  34. if(index==-1) { list.Add(text.Substring(pos)); break; }
  35. else { list.Add(text.Substring(pos, index-pos+1)); pos=index+1; }
  36. }
  37. return (string[])list.ToArray(typeof(string));
  38. }
  39. [STAThread]
  40. static void Main()
  41. { Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
  42. Runtime.Importer.ImportStandardModules();
  43. Modules.sys.path[0] = "";
  44. Application.Run(MainForm);
  45. }
  46. static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
  47. { ExceptionForm form = new ExceptionForm(e.Exception);
  48. form.ShowDialog();
  49. }
  50. }
  51. } // namespace Boa.IDE