Beispiel #1
0
        /// <summary>
        /// Insert a row to valid function table
        /// </summary>
        /// <param name="lspFunc"></param>
        private void InsertValidFunc(LispFunction lspFunc)
        {
            DataRow r = ValidFunction.NewRow();

            if (lspFunc.GlobalName.Contains("c:"))
            {
                r[0] = lspFunc.GlobalName.Substring(
                    lspFunc.GlobalName.IndexOf("c:") + 2).ToUpper();
            }
            else
            {
                r[0] = lspFunc.GlobalName;
            }
            r[6] = lspFunc.FileName;
            r[7] = lspFunc.Line;
            ValidFunction.Rows.Add(r);
        }
Beispiel #2
0
        void ErrorFunction_RowChanged(object sender, DataRowChangeEventArgs e)
        {
            //throw new System.NotImplementedException();
            ValidFunction.RowChanged -= ValidFunction_RowChanged;
            ErrorFunction.RowChanged -= ErrorFunction_RowChanged;
            try
            {
                string   name = e.Row["Commands"].ToString();
                Database db   = EnesyCAD.ApplicationServices.EneApplication.EneDatabase;

                LispFunction lspFunc = new LispFunction(
                    name,
                    e.Row["Tag"].ToString(),
                    e.Row["Description"].ToString(),
                    e.Row["Author"].ToString(),
                    e.Row["Email"].ToString(),
                    e.Row["Help"].ToString(),
                    e.Row["File"].ToString(),
                    System.Convert.ToInt32(e.Row["Line"])
                    );

                // Check if lspFunc exists in databse
                if (db.CmdTableRecord.Contains(name))
                {
                    ErrorFunction.Rows.Remove(e.Row);
                    InsertErrorFunc(lspFunc, "Duplicated to database commands");
                }

                // Check if lspFunc exists in ValidFunction
                else if (CheckExist(name, ValidFunction))
                {
                    ErrorFunction.Rows.Remove(e.Row);
                    InsertErrorFunc(lspFunc, "Duplicated to valid commands");
                }

                // If it has not any duplication
                else
                {
                    ErrorFunction.Rows.Remove(e.Row);
                    InsertValidFunc(lspFunc);
                }
            }
            catch { }
            ValidFunction.RowChanged += ValidFunction_RowChanged;
            ErrorFunction.RowChanged += ErrorFunction_RowChanged;
        }
Beispiel #3
0
        /// <summary>
        /// Insert a row to error function table
        /// </summary>
        /// <param name="lspFunc"></param>
        private void InsertErrorFunc(LispFunction lspFunc, string error)
        {
            DataRow r = ErrorFunction.NewRow();

            if (lspFunc.GlobalName.Contains("c:"))
            {
                r[0] = lspFunc.GlobalName.Substring(
                    lspFunc.GlobalName.IndexOf("c:") + 2).ToUpper();
            }
            else
            {
                r[0] = lspFunc.GlobalName;
            }
            r[1] = error;
            r[7] = lspFunc.FileName;
            r[8] = lspFunc.Line;
            ErrorFunction.Rows.Add(r);
        }