Exemplo n.º 1
0
 public static string StrFromTaint(TaintTypes tt)
 {
     switch (tt)
     {
         case TaintTypes.G:
             return "G";
         case TaintTypes.T:
             return "T";
         case TaintTypes.U:
             return "U";
         default:
             throw new InvalidOperationException();
     }
 }
Exemplo n.º 2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                string     fname           = tbFname.Text;
                Types      returnType      = FunctionConfig.TypeFromStr((string)comboType.SelectedItem);
                TaintTypes returnTaintType = FunctionConfig.TaintFromStr((string)comboTaint.SelectedItem);
                Taint      returnTaint     = new Taint(returnTaintType);
                if (returnTaintType == TaintTypes.G)
                {
                    string[] returnDepNames = tbReturnDeps.Text.Split(new char[] { ' ' });
                    foreach (string retDep in returnDepNames)
                    {
                        returnTaint.getDependencies().Add(retDep);
                    }
                }
                IList <FunctionConfig.Param> parameters = new List <FunctionConfig.Param>();
                foreach (DataGridViewRow row in dgParams.Rows)
                {
                    if (row.IsNewRow)
                    {
                        continue;
                    }
                    string     pName      = (string)row.Cells["Name"].Value;
                    Types      pType      = FunctionConfig.TypeFromStr((string)row.Cells["Type"].Value);
                    TaintTypes pTaintType = FunctionConfig.TaintFromStr((string)row.Cells["Taint"].Value);
                    Taint      pTaint     = new Taint(pTaintType);
                    if (pTaintType == TaintTypes.G)
                    {
                        string[] paramDepNames = ((string)row.Cells["Deps"].Value).Split(new char[] { ' ' });
                        foreach (string paramDep in paramDepNames)
                        {
                            pTaint.getDependencies().Add(paramDep);
                        }
                    }
                    FunctionConfig.Param param = new FunctionConfig.Param();
                    param.name       = pName;
                    param.paramType  = pType;
                    param.paramTaint = pTaint;
                    parameters.Add(param);
                }

                function = new FunctionConfig(fname, returnType, returnTaint, parameters);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Function cannot be added! Invalid dependencies");
                this.DialogResult = DialogResult.Cancel;
            }
        }
Exemplo n.º 3
0
        public static string StrFromTaint(TaintTypes tt)
        {
            switch (tt)
            {
            case TaintTypes.G:
                return("G");

            case TaintTypes.T:
                return("T");

            case TaintTypes.U:
                return("U");

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 4
0
 public Taint(TaintTypes tt)
 {
     taintType = tt;
 }
Exemplo n.º 5
0
 public Taint(TaintTypes tt)
 {
     taintType = tt;
 }