示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            NieuweFunctie frm = new NieuweFunctie();

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                switch (frm.GekozenSoort)
                {
                case Functie.enFunctie_type.gui:
                    GrafischeFunctie nieuwgf = new GrafischeFunctie();
                    nieuwgf.Naam = "nieuwe functie";
                    functies.Add(nieuwgf);
                    Functies.Items.Add(nieuwgf.Naam);
                    break;

                case Functie.enFunctie_type.tekst:
                    TekstFunctie nieuwtf = new TekstFunctie();
                    nieuwtf.Parse("function nieuwefunctie()\r\n{\r\n}");
                    functies.Add(nieuwtf);
                    Functies.Items.Add("nieuwefunctie");
                    break;
                }
            }
        }
示例#2
0
        void MaakFuncties()
        {
            foreach (string bestand in Directory.GetFiles(mapnaam_func))
            {
                FileStream fs     = new FileStream(bestand, FileMode.Open);
                Rijndael   rijAlg = Rijndael.Create();
                rijAlg.Key = key;
                rijAlg.IV  = IV;
                ICryptoTransform decryptor = rijAlg.CreateDecryptor(key, IV);

                CryptoStream cs     = new CryptoStream(fs, decryptor, CryptoStreamMode.Read);
                StreamReader reader = new StreamReader(cs);

                string soort_functie = reader.ReadLine();
                switch (soort_functie)
                {
                case "gui":
                    GrafischeFunctie f1 = new GrafischeFunctie();
                    f1.Beschrijving = reader.ReadLine();
                    f1.Voorschrift  = reader.ReadLine();
                    f1.Naam         = Path.GetFileNameWithoutExtension(bestand);

                    string   tekst      = reader.ReadToEnd().Trim();
                    string[] par        = tekst.Split(new string[] { "\r\n\r\n" }, StringSplitOptions.None);
                    string   parameters = par[0];
                    string   tmp        = par.Length < 2 ? "" : par[1];

                    foreach (string paramtekst in parameters.Split(new string[] { "\r\n" }, StringSplitOptions.None))
                    {
                        Parameter p  = new Parameter();
                        string[]  it = paramtekst.Split(';');
                        p.Naam            = it[0];
                        p.Beschrijving    = it[1];
                        p.Is_Getal        = it[2] == "getal";
                        p.EnumNaam        = p.Is_Getal ? "" : it[2];
                        p.Optioneel       = it[3] == "1";
                        p.StandaardWaarde = Convert.ToDouble(it[4]);
                        f1.Parameters.Add(p);
                    }
                    if (tmp != "")
                    {
                        foreach (string tmp_var in tmp.Split(new string[] { "\r\n" }, StringSplitOptions.None))
                        {
                            Tmp_Param p  = new Tmp_Param();
                            string[]  it = tmp_var.Split(';');
                            p.Naam         = it[0];
                            p.Beschrijving = it[1];
                            p.Berekening   = it[2];
                            f1.Temp.Add(p);
                        }
                    }
                    functies.Add(f1);
                    Functies.Items.Add(f1.Naam);
                    break;

                case "tekst":
                    TekstFunctie f2 = new TekstFunctie();
                    f2.Parse(reader.ReadToEnd());
                    functies.Add(f2);
                    Functies.Items.Add(Path.GetFileNameWithoutExtension(bestand));
                    break;
                }
                reader.Close();
                fs.Close();
            }
        }