Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     X = new BufferedGraphicsContext();
     G = new Bitmap("test.png");
     collections = new List<Collection>();
     Podcasts = new List<Podcast>();
     fCC = new frmColorChooser(this);
 }
Exemplo n.º 2
0
        private void View_CompileButtonClicked(object sender, EventArgs e)
        {
            using(CodeDomProvider provider = new Microsoft.CSharp.CSharpCodeProvider())
            {
                CompilerParameters parameters = new CompilerParameters();
                parameters.GenerateExecutable = false;
                parameters.GenerateInMemory = true;
                parameters.ReferencedAssemblies.Add("System.dll");
                parameters.ReferencedAssemblies.Add(Assembly.GetEntryAssembly().Location);

                CompilerResults results = provider.CompileAssemblyFromSource(parameters, this.view.SourceCode);

                if (results.Errors.Count == 0)
                {
                    this.view.ClearCompilerErrors();

                    this.program = null;

                    foreach (Type type in results.CompiledAssembly.GetTypes())
                    {
                        if (type.GetInterface(typeof(ITurtleGraphicsProgram).ToString(), true) != null)
                            this.program = (ITurtleGraphicsProgram)results.CompiledAssembly.CreateInstance(type.FullName);
                    }

                    if (this.program != null)
                    {
                        this.view.RedrawScene();
                    }
                    else
                    {
                        // TODO: Show error message here if no type implements ITurtleGraphicsProgram.
                    }
                }
                else
                {
                    List<CompilerError> errors = new List<CompilerError>();
                    foreach (CompilerError error in results.Errors)
                        errors.Add(error);

                    this.view.SetCompilerErrors(errors);
                }
            }
        }
Exemplo n.º 3
0
        static void loadLanguage(String Path)
        {

            Settings.StrRepository = new List(new Node(""));
            StreamReader BR = File.OpenText(Path);
            String x;
            while ((x = BR.ReadLine()) != null)
            {
                String[] f = x.Split('=');
                Settings.StrRepository.addNode(new Node(f[1], f[0]));
            }

        }
Exemplo n.º 4
0
 public static decimal XCompare(String Str1, String Str2, int spawn)
 {
     List x = new List(new Node(""));
     for (int i = 0; i < Str1.Length/spawn; i++)
     {
         x.addNode(new Node(Str1.Substring(spawn * i, spawn)));
     }
     int r = 0;
     Node f = x.Tail;
     Node g = new Node(new Node(""));
     for(int i = 0 ; i < spawn ; i++)
     {
         if (Str2.Contains(f.nodeValue.ToString()))
         {
             r++;
         }
         f = f.nextNode;
         
     }
     decimal amount = (decimal)r / (decimal)Str1.Length;
     return amount;
 }// End XCompare