Inheritance: Tools.TOKEN
Ejemplo n.º 1
0
 public Instructions()
 {
     instructions["ST"]   = new ST();
     instructions["LD"]   = new LD();
     instructions["ADD"]  = new ADD();
     instructions["SUB"]  = new SUB();
     instructions["JMP"]  = new JMP();
     instructions["JN"]   = new JN();
     instructions["JP"]   = new JP();
     instructions["JZ"]   = new JZ();
     instructions["JNZ"]  = new JNZ();
     instructions["HALT"] = new HALT();
     //Second architecture functions.
     instructions["LD2"] = new LD2();
     instructions["LD3"] = new LD3();
     instructions["ST2"] = new ST2();
     instructions["ST3"] = new ST3();
     instructions["POS"] = new POS();
     instructions["PXL"] = new PXL();
     instructions["RND"] = new RND();
     instructions["CLR"] = new CLR();
     instructions["COS"] = new COS();
     instructions["SIN"] = new SIN();
     instructions["IN"]  = new IN();
 }
Ejemplo n.º 2
0
    protected ArrayList LoadRosterTableGroup(DateTime periodFromDate, DateTime periodToDate, int userID)
    {
        DBFilter subQueryFilter = new DBFilter();

        subQueryFilter.add(new Match("EmpID", userID));
        subQueryFilter.add(new Match("EmpRosterTableGroupEffFr", "<=", periodToDate));

        OR orToTerm = new OR();

        orToTerm.add(new Match("EmpRosterTableGroupEffTo", ">=", periodFromDate));
        orToTerm.add(new NullTerm("EmpRosterTableGroupEffTo"));

        subQueryFilter.add(orToTerm);

        IN inFilter = new IN("RosterTableGroupID", "SELECT RosterTableGroupID FROM EmpRosterTableGroup", subQueryFilter);

        DBFilter filter = new DBFilter();

        filter.add(inFilter);
        filter.add("RosterTableGroupCode", true);

        ArrayList rosterTableGroupInfoList = ERosterTableGroup.db.select(dbConn, filter);

        return(rosterTableGroupInfoList);
    }
        public IConstraints3ConstraintElement Create(
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            IN N,
            In n,
            IB B,
            Ie1Minus e1Minus,
            Ie1Plus e1Plus)
        {
            IConstraints3ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints3ConstraintElement(
                    sIndexElement,
                    ΛIndexElement,
                    N,
                    n,
                    B,
                    e1Minus,
                    e1Plus);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Ejemplo n.º 4
0
        private void SetReportParameter(IN ia, BindingSource source)
        {
            switch (strReport)
            {
            case "rptkhachhang.rdlc":
                REPORT.INTableAdapters.rpt_khachhangTableAdapter ct = new REPORT.INTableAdapters.rpt_khachhangTableAdapter();
                ct.ClearBeforeFill = true;
                source.DataMember  = "rpt_khachhang";
                ct.Fill(ia.rpt_khachhang);
                break;

            //case "rptnhanvien.rdlc":
            //    REPORT.INTableAdapters.rpt_nhanvienTableAdapter ct2 = new REPORT.INTableAdapters.rpt_nhanvienTableAdapter();
            //    ct2.ClearBeforeFill = true;
            //    source.DataMember = "rpt_nhanvien";
            //    ct2.Fill(ia.rpt_nhanvien);
            //    break;
            //case "rptxe.rdlc":
            //    REPORT.INTableAdapters.rpt_xeTableAdapter ct3 = new REPORT.INTableAdapters.rpt_xeTableAdapter();
            //    ct3.ClearBeforeFill = true;
            //    source.DataMember = "rpt_xe";
            //    ct3.Fill(ia.rpt_xe);
            //    break;
            //case "rpthoadon.rdlc":
            //    REPORT.INTableAdapters.rpt_hoadonTableAdapter ct4 = new REPORT.INTableAdapters.rpt_hoadonTableAdapter();
            //    ct4.ClearBeforeFill = true;
            //    source.DataMember = "rpt_hoadon";
            //    ct4.Fill(ia.rpt_hoadon);
            //    break;
            default:
                break;
            }
        }
 protected internal Arc(NODE sourceNode, NODE targetNode, IN input, OUT output)
 {
     // makes a copy of Arc a
     this.sourceNode = sourceNode;
     this.targetNode = targetNode;
     this.input      = input;
     this.output     = output;
 }
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        if (IsPostBack)
        {
            selectedItemList = WebUtils.SelectedRepeaterItemToBaseObjectList(EPaymentCode.db, Repeater, "ItemSelect");
        }

        DBFilter filter = sbinding.createFilter();

        if (info != null && info.orderby != null && !info.orderby.Equals(""))
        {
            filter.add(info.orderby, info.order);
        }

        string select = " pc.* ";
        string from   = "from  PaymentCode pc ";


        DBFilter notTaxPaymentFilter = new DBFilter();

        notTaxPaymentFilter.add(new Match("TaxFormType", "=", TaxFormType.Text));

        DBFilter nottaxPaymentMapFilter = new DBFilter();

        nottaxPaymentMapFilter.add(new Match("TaxPayID", "<>", CurID));
        nottaxPaymentMapFilter.add(new IN("TaxPayID", "Select TaxPayID from TaxPayment", notTaxPaymentFilter));

        IN       notinTerms          = new IN("NOT PaymentCodeID", "select PaymentCodeID from TaxPaymentMap", nottaxPaymentMapFilter);
        DBFilter taxPaymentMapFilter = new DBFilter();

        taxPaymentMapFilter.add(new Match("TaxPayID", CurID));
        IN inTerms = new IN("PaymentCodeID", "select PaymentCodeID from TaxPaymentMap", taxPaymentMapFilter);

        OR orTerms = new OR();

        orTerms.add(notinTerms);
        orTerms.add(inTerms);
        filter.add(orTerms);
        filter.add("PaymentCode", true);

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        view = new DataView(table);
        //if (info != null)
        //{
        //    info.loadPageList(null, PrevPage, NextPage, FirstPage, LastPage);

        //    CurPage.Value = info.page.ToString();
        //    NumPage.Value = info.numPage.ToString();
        //}
        if (repeater != null)
        {
            repeater.DataSource = table;
            repeater.DataBind();
        }

        return(view);
    }
Ejemplo n.º 7
0
 private IN[] GetData(SpaceObject[] objects)
 {
     IN[] data = new IN[objects.Length];
     for (int i = 0; i < objects.Length; i++)
     {
         data[i] = new IN(objects[i].Position, objects[i].Mass, objects[i].Volume);
     }
     return(data);
 }
Ejemplo n.º 8
0
    public DataView loadEmpData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = binding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = " e.* ";
        string from   = "from [" + db.dbclass.tableName + "] e ";

        IN inTerm = new IN("e.EmpID", "Select ep.EmpID from EmpPayroll ep, PayrollPeriod pp ", filter);

        filter.add(new MatchField("e.EmpID", "ep.EmpID"));
        filter.add(new MatchField("ep.PayperiodID", "pp.PayperiodID"));
        filter.add(new Match("ep.EmpPayStatus", "C"));

        DateTime dtPayPeriodFr;
        DateTime dtPayPeriodTo;

        if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("PayPeriodFr")).Value, out dtPayPeriodFr))
        {
            dtPayPeriodTo = dtPayPeriodFr.AddMonths(12).AddDays(-1);
            filter.add(new Match("pp.PayPeriodFr", "<=", dtPayPeriodTo));
            filter.add(new Match("pp.PayPeriodFr", ">=", dtPayPeriodFr));
        }
        filter.add("EmpNo", true);

        DBFilter resultFilter = new DBFilter();

        resultFilter.add(inTerm);

        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        resultFilter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = resultFilter.loadData(dbConn, null, select, from);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);

        view = new DataView(table);
        //if (info != null)
        //{
        //    info.loadPageList(null, PrevPage, NextPage, FirstPage, LastPage);

        //    CurPage.Value = info.page.ToString();
        //    NumPage.Value = info.numPage.ToString();
        //}
        if (repeater != null)
        {
            repeater.DataSource = table;
            repeater.DataBind();
        }

        return(view);
    }
Ejemplo n.º 9
0
 public static void Shutdown()
 {
     if (reflib_active)
     {
         Globals.re.GetKeyboardHandler().Close();
         IN.Shutdown();
         Globals.re.Shutdown();
         FreeReflib();
     }
 }
Ejemplo n.º 10
0
//    protected void Save_Click(object sender, EventArgs e)
//    {
//        EPaymentCode c = new EPaymentCode();

//        Hashtable values = new Hashtable();
//        binding.toValues(values);

//        PageErrors errors = PageErrors.getErrors(db, Page.Master);
//        errors.clear();


//        db.validate(errors, values);

//        if (!errors.isEmpty())
//            return;


//        db.parse(values, c);
//        if (!AppUtils.checkDuplicate(dbConn, db, c, errors, "PaymentCode"))
//            return;

//        WebUtils.StartFunction(Session, FUNCTION_CODE);

//        if (CurID < 0)
//        {
////            Utils.MarkCreate(Session, c);

//            db.insert(dbConn, c);
//            CurID = c.PaymentCodeID;
////            url = Utils.BuildURL(-1, CurID);
//        }
//        else
//        {
////            Utils.Mark(Session, c);
//            db.update(dbConn, c);
//        }
//        WebUtils.EndFunction(dbConn);

//        Response.Redirect(Request.Url.LocalPath+"?PaymentCodeID="+CurID);


//    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EPaymentCode obj = new EPaymentCode();

        obj.PaymentCodeID = CurID;

        db.select(dbConn, obj);

        DBFilter paymentRecordFilter = new DBFilter();

        paymentRecordFilter.add(new Match("PaymentCodeID", obj.PaymentCodeID));

        IN inTerms = new IN("EmpPayrollID", "Select EmpPayrollID From " + EPaymentRecord.db.dbclass.tableName, paymentRecordFilter);

        DBFilter empPayrollFilter = new DBFilter();

        empPayrollFilter.add(inTerms);
        empPayrollFilter.add("empid", true);
        ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);

        if (empPayrollList.Count > 0)
        {
            int lastEmpID = 0;
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Payment Code"), obj.PaymentCode }));
            foreach (EEmpPayroll empPayroll in empPayrollList)
            {
                if (lastEmpID != empPayroll.EmpID)
                {
                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = empPayroll.EmpID;
                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        lastEmpID = empPayroll.EmpID;
                    }
                    else
                    {
                        EEmpPayroll.db.delete(dbConn, empPayroll);
                    }
                }
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, obj);
            WebUtils.EndFunction(dbConn);
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "PaymentCode_List.aspx");
        }
    }
Ejemplo n.º 11
0
        static bool LoadRefresh(string name, bool fast)
        {
            if (reflib_active)
            {
                Globals.re.GetKeyboardHandler().Close();
                IN.Shutdown();
                Globals.re.Shutdown();
                FreeReflib();
            }

            Com.Printf("------- Loading " + name + " -------\\n");
            bool found = false;

            String[] driverNames = Renderer.GetDriverNames();
            for (int i = 0; i < driverNames.Length; i++)
            {
                if (driverNames[i].Equals(name))
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                Com.Printf("LoadLibrary(\\\"" + name + "\\\") failed\\n");
                return(false);
            }

            Com.Printf("LoadLibrary(\\\"" + name + "\\\")\\n");
            Globals.re = Renderer.GetDriver(name, fast);
            if (Globals.re == null)
            {
                Com.Error(Defines.ERR_FATAL, name + " can't load but registered");
            }

            if (Globals.re.ApiVersion() != Defines.API_VERSION)
            {
                FreeReflib();
                Com.Error(Defines.ERR_FATAL, name + " has incompatible api_version");
            }

            IN.Real_IN_Init();
            if (!Globals.re.Init((int)vid_xpos.value, (int)vid_ypos.value))
            {
                Globals.re.Shutdown();
                FreeReflib();
                return(false);
            }

            Globals.re.GetKeyboardHandler().Init();
            Com.Printf("------------------------------------\\n");
            reflib_active = true;
            return(true);
        }
Ejemplo n.º 12
0
        static void FreeReflib()
        {
            if (Globals.re != null)
            {
                Globals.re.GetKeyboardHandler().Close();
                IN.Shutdown();
            }

            Globals.re    = null;
            reflib_active = false;
        }
Ejemplo n.º 13
0
        protected IN <T> CreateIn(Parameter <IEnumerable <T> > value)
        {
            //List<T> valueList = value.Value.ToList();
            IN <T> i = new IN <T>()
            {
                Field = this, FieldValue = new Parameter <List <T> >()
                {
                    Name = value.Name
                }
            };

            return(i);
        }
Ejemplo n.º 14
0
        //public Type FieldType {get; set;}

        protected IN <T> CreateIn(Constant <IEnumerable <T> > value)
        {
            List <T> valueList = value.Value.ToList();
            IN <T>   i         = new IN <T>()
            {
                Field = this, FieldValue = new Constant <List <T> >()
                {
                    Value = valueList
                }
            };

            return(i);
        }
Ejemplo n.º 15
0
        public override int GetHashCode()
        {
            var hashCode = 436951639;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + Begin_Balance.GetHashCode();
            hashCode = hashCode * -1521134295 + IN.GetHashCode();
            hashCode = hashCode * -1521134295 + OUT.GetHashCode();
            hashCode = hashCode * -1521134295 + Final_Balance.GetHashCode();
            hashCode = hashCode * -1521134295 + Total_Value.GetHashCode();
            return(hashCode);
        }
    public DataView loadEmpData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = binding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = " e.* ";
        string from   = "from [" + db.dbclass.tableName + "] e ";

        IN inTerm = new IN("e.EmpID", "Select ete.EmpID from EmpTrainingEnroll ete, TrainingSeminar ts ", filter);

        filter.add(new MatchField("ete.TrainingSeminarID", "ts.TrainingSeminarID"));

        //DateTime dtTrainingSeminarFrom;
        //DateTime dtTrainingSeminarTo;
        //if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("TrainingSeminarDateFrom")).Value, out dtTrainingSeminarFrom))
        //    filter.add(new Match("ts.TrainingSeminarDateTo", ">=", dtTrainingSeminarFrom));
        //if (DateTime.TryParse(((WebDatePicker)EmployeeSearchControl1.AdditionElementControl.FindControl("TrainingSeminarDateTo")).Value, out dtTrainingSeminarTo))
        //    filter.add(new Match("ts.TrainingSeminarDateFrom", "<=", dtTrainingSeminarTo));

        DBFilter resultFilter = new DBFilter();

        resultFilter.add(inTerm);

        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        resultFilter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = resultFilter.loadData(dbConn, null, select, from);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);

        view = new DataView(table);
        //if (info != null)
        //{
        //    info.loadPageList(null, PrevPage, NextPage, FirstPage, LastPage);

        //    CurPage.Value = info.page.ToString();
        //    NumPage.Value = info.numPage.ToString();
        //}
        if (repeater != null)
        {
            repeater.DataSource = table;
            repeater.DataBind();
        }

        return(view);
    }
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = sbinding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = " c.* ";
        string from   = "from  Company c ";

        DBFilter nottaxCompanyMapFilter = new DBFilter();

        nottaxCompanyMapFilter.add(new Match("TaxCompID", "<>", CurID));
        IN       notinTerms          = new IN("NOT CompanyID", "select CompanyID from TaxCompanyMap", nottaxCompanyMapFilter);
        DBFilter taxCompanyMapFilter = new DBFilter();

        taxCompanyMapFilter.add(new Match("TaxCompID", CurID));
        IN inTerms = new IN("CompanyID", "select CompanyID from TaxCompanyMap", taxCompanyMapFilter);

        OR orTerms = new OR();

        orTerms.add(notinTerms);
        orTerms.add(inTerms);
        filter.add(orTerms);
        filter.add("CompanyCode", true);

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        //if (info != null)
        //{


        //    info.loadPageList(null, PrevPage, NextPage, FirstPage, LastPage);
        //    WebUtils.loadPageList(PrevPage, PrevPageImg, NextPage, NextPageImg, FirstPage, FirstPageImg, LastPage, LastPageImg);

        //    CurPage.Value = info.page.ToString();
        //    NumPage.Value = info.numPage.ToString();
        //}

        view = new DataView(table);

        if (repeater != null)
        {
            repeater.DataSource = table;
            repeater.DataBind();
        }

        return(view);
    }
Ejemplo n.º 18
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect");

        foreach (EHierarchyElement obj in list)
        {
            db.select(dbConn, obj);
            DBFilter hierarchyElementFilter = new DBFilter();
            hierarchyElementFilter.add(new Match("HElementID", obj.HElementID));

            IN inTerms = new IN("EmpPosID", "Select EmpPosID From " + EEmpHierarchy.db.dbclass.tableName, hierarchyElementFilter);

            DBFilter empPosFilter = new DBFilter();
            empPosFilter.add(inTerms);
            empPosFilter.add("empid", true);
            ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter);
            if (empPosList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Code"), obj.HElementCode }));
                foreach (EEmpPositionInfo empPos in empPosList)
                {
                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = empPos.EmpID;
                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                    }
                    else
                    {
                        EEmpPositionInfo.db.delete(dbConn, empPos);
                    }
                }
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            }
            else
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
        }

        loadData(info, db, Repeater);
    }
Ejemplo n.º 19
0
        //after login , front_end should call under method:
        public IN KeepIN(string user, string pass)
        {
            IN iN = new IN();

            Person person = new Person();

            using (connectingDB)
            {
                person = connectingDB.person1.Where(o => o.UserName == user && o.PassWord == pass).FirstOrDefault();
            }

            iN.ID         = Convert.ToString(person.ID);
            iN.PersonName = person.FirstName + " " + person.LastName;

            return(iN);
        }
Ejemplo n.º 20
0
        public void Should_throw_when_resolving_placeholder_service()
        {
            var c = new Container();

            c.Register <M>();
            c.RegisterPlaceholder(typeof(IN));

            var m = c.Resolve <Lazy <M> >();

            IN  n  = null;
            var ex = Assert.Throws <ContainerException>(() => n = m.Value.N);

            Assert.AreEqual(
                Error.NameOf(Error.NoImplementationForPlaceholder),
                Error.NameOf(ex.Error));
        }
Ejemplo n.º 21
0
 static void CreateCmd(usercmd_t cmd)
 {
     frame_msec = Globals.sys_frame_time - old_sys_frame_time;
     if (frame_msec < 1)
     {
         frame_msec = 1;
     }
     if (frame_msec > 200)
     {
         frame_msec = 200;
     }
     BaseMove(cmd);
     IN.Move(cmd);
     FinishMove(cmd);
     old_sys_frame_time = Globals.sys_frame_time;
 }
Ejemplo n.º 22
0
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = sbinding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = " cr.* ";
        string from   = "from  CessationReason cr ";


        DBFilter notMPFSchemeCessationReasonFilter = new DBFilter();

        notMPFSchemeCessationReasonFilter.add(new Match("MPFSchemeID", "=", MPFSchemeID.Value));

        DBFilter notMPFSchemeCessationReasonMapFilter = new DBFilter();

        notMPFSchemeCessationReasonMapFilter.add(new Match("MPFSchemeCessationReasonID", "<>", CurID));
        notMPFSchemeCessationReasonMapFilter.add(new IN("MPFSchemeCessationReasonID", "Select MPFSchemeCessationReasonID from MPFSchemeCessationReason", notMPFSchemeCessationReasonFilter));

        IN       notinTerms = new IN("NOT CessationReasonID", "select CessationReasonID from MPFSchemeCessationReasonMapping", notMPFSchemeCessationReasonMapFilter);
        DBFilter mpfSchemeCessationReasontMapFilter = new DBFilter();

        mpfSchemeCessationReasontMapFilter.add(new Match("MPFSchemeCessationReasonID", CurID));
        IN inTerms = new IN("CessationReasonID", "select CessationReasonID from MPFSchemeCessationReasonMapping", mpfSchemeCessationReasontMapFilter);

        OR orTerms = new OR();

        orTerms.add(notinTerms);
        orTerms.add(inTerms);
        filter.add(orTerms);
        filter.add("CessationReasonCode", true);

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        view = new DataView(table);

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
Ejemplo n.º 23
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(sdb, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpBankAccount o = new EEmpBankAccount();
                WebFormUtils.GetKeys(sdb, o, cb);
                list.Add(o);
            }
        }
        foreach (EEmpBankAccount obj in list)
        {
            sdb.select(dbConn, obj);
            DBFilter paymentRecordFilter = new DBFilter();
            paymentRecordFilter.add(new Match("EmpAccID", obj.EmpBankAccountID));

            IN inTerms = new IN("EmpPayrollID", "Select EmpPayrollID From " + EPaymentRecord.db.dbclass.tableName, paymentRecordFilter);

            DBFilter empPayrollFilter = new DBFilter();
            empPayrollFilter.add(inTerms);
            empPayrollFilter.add("empid", true);
            ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);
            if (empPayrollList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_IS_IN_USE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Bank Account") }));
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            }
            else
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID);
                sdb.delete(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
        }
        loadData(info, sdb, Repeater);
    }
Ejemplo n.º 24
0
 //Testen ob Schalter geschlossen ist
 public bool CheckInput(IN GPIO_Pin)
 {
     GPIOMem Input;
     switch (GPIO_Pin)
     {
         case IN.GPIO24: Input = in_gpio24;
             break;
         default:
             return false;
     }
     if (Input.Read() == PinState.High)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Ejemplo n.º 25
0
        public IN Create(
            ImmutableList <INParameterElement> value)
        {
            IN parameter = null;

            try
            {
                parameter = new N(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(parameter);
        }
Ejemplo n.º 26
0
        //Testen ob Schalter geschlossen ist
        public bool CheckInput(IN GPIO_Pin)
        {
            GPIOMem Input;

            switch (GPIO_Pin)
            {
            case IN.GPIO24: Input = in_gpio24;
                break;

            default:
                return(false);
            }
            if (Input.Read() == PinState.High)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Create all functions from functionNode.
        /// </summary>
        /// <param name="code">All the source code, therefore the list of function node.</param>
        /// <returns>List of functions ready to execute.</returns>

        public List <IFunction> PreExecut(List <FunctionNode> code)
        {
            List <IFunction> myFunctions = new List <IFunction>();

            foreach (FunctionNode function in code)
            {
                if (IsSingleFunction(myFunctions, function))    // On regarde si la fct n'as pas le même nom qu'une autre
                {
                    myFunctions.Add(function.PreExecute(this));
                }
                else
                {
                    // ON en fait rien, c'est déjà géré dans IsSingleFct
                }
            }

            // Là on a nos fct, donc on le case dans la var
            _myFct = myFunctions;

            // on parcourt toutes nos fct et on pré-exécute tous les noeuds
            foreach (Function fct in myFunctions)
            {
                _lineInstruction = 0;

                _currentfct = fct;
                foreach (InstructionNode IN in fct.Code)
                {
                    if (IN is LocalsInitNode)
                    {
                    }
                    else
                    {
                        IN.PreExecute(this);
                    }
                    _lineInstruction++;
                }
            }
            return(myFunctions);
        }
Ejemplo n.º 28
0
        private static ArrayList CreateNewJoinORSORecords(DatabaseConnection dbConn, int EmpID, DateTime ORSOJoinDate, DateTime AsOfDate)
        {
            ArrayList newJoinORSORecords = new ArrayList();

            DBFilter empPayrollFilter = new DBFilter();

            empPayrollFilter.add(new Match("EmpID", EmpID));
            IN inEmpPayrollFilter = new IN("PayPeriodID", "Select Distinct PayPeriodID from EmpPayroll ", empPayrollFilter);

            DBFilter payPeriodFilter = new DBFilter();

            payPeriodFilter.add(inEmpPayrollFilter);
            payPeriodFilter.add(new Match("PayPeriodTo", "<", AsOfDate));
            payPeriodFilter.add(new Match("PayPeriodTo", ">=", ORSOJoinDate));
            payPeriodFilter.add("PayPeriodFr", true);
            ArrayList payPeriods = EPayrollPeriod.db.select(dbConn, payPeriodFilter);

            foreach (EPayrollPeriod payrollPeriod in payPeriods)
            {
                DBFilter payPeriodFilter2 = new DBFilter();
                payPeriodFilter2.add(new Match("PayPeriodID", payrollPeriod.PayPeriodID));
                payPeriodFilter2.add(new Match("EmpID", EmpID));
                IN inEmpPayrollFilter2 = new IN("EmpPayrollID", "Select EmpPayrollID from EmpPayroll", payPeriodFilter2);

                DBFilter paymentRecordFilter = new DBFilter();
                paymentRecordFilter.add(inEmpPayrollFilter2);

                ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter);

                newJoinORSORecords.Add(CreateORSORecord(dbConn, EmpID, payrollPeriod, paymentRecords, ORSOJoinDate, ORSOJoinType.NewJoin, null));
            }

            if (newJoinORSORecords.Count == 0)
            {
                return(null);
            }
            return(newJoinORSORecords);
        }
        /// <summary>
        /// Constructs a big string representing the input list of CoreLabel,
        /// with one line per token using the following format
        /// word label feat1 feat2 ...
        /// </summary>
        /// <remarks>
        /// Constructs a big string representing the input list of CoreLabel,
        /// with one line per token using the following format
        /// word label feat1 feat2 ...
        /// (where each space is actually a tab).
        /// Assumes that CoreLabel has both TextAnnotation and AnswerAnnotation.
        /// </remarks>
        /// <param name="document">
        /// List of CoreLabel
        /// (does not have to represent a "document", just a sequence of text,
        /// like a sentence or a paragraph)
        /// </param>
        /// <returns>String representation of features</returns>
        private string GetFeatureString(IList <In> document)
        {
            int docSize = document.Count;

            if (classifier.flags.useReverse)
            {
                Java.Util.Collections.Reverse(document);
            }
            StringBuilder sb = new StringBuilder();

            for (int j = 0; j < docSize; j++)
            {
                IN token = document[j];
                sb.Append(token.Get(typeof(CoreAnnotations.TextAnnotation)));
                sb.Append(delimiter);
                sb.Append(token.Get(typeof(CoreAnnotations.AnswerAnnotation)));
                CRFDatum <IList <string>, CRFLabel> d        = classifier.MakeDatum(document, j, classifier.featureFactories);
                IList <IList <string> >             features = d.AsFeatures();
                foreach (ICollection <string> cliqueFeatures in features)
                {
                    IList <string> sortedFeatures = new List <string>(cliqueFeatures);
                    sortedFeatures.Sort();
                    foreach (string feat in sortedFeatures)
                    {
                        feat = UbPrefixFeatureString(feat);
                        sb.Append(delimiter);
                        sb.Append(feat);
                    }
                }
                sb.Append(eol);
            }
            if (classifier.flags.useReverse)
            {
                Java.Util.Collections.Reverse(document);
            }
            return(sb.ToString());
        }
Ejemplo n.º 30
0
 internal void SetValue(FilterOperationEnum operation, string value)
 {
     if (operation == FilterOperationEnum.Eq)
     {
         EQ = (T)ConvertValue(value);
     }
     else if (operation == FilterOperationEnum.Ne)
     {
         NE = (T)ConvertValue(value);
     }
     else if (operation == FilterOperationEnum.Gt)
     {
         GT = (T)ConvertValue(value);
     }
     else if (operation == FilterOperationEnum.Gte)
     {
         GTE = (T)ConvertValue(value);
     }
     else if (operation == FilterOperationEnum.Lt)
     {
         LT = (T)ConvertValue(value);
     }
     else if (operation == FilterOperationEnum.Lte)
     {
         LTE = (T)ConvertValue(value);
     }
     else if (operation == FilterOperationEnum.In)
     {
         var items = value.Split(",");
         IN.AddRange(items.Select(x => (T)ConvertValue(x.Trim(' '))));
     }
     else if (operation == FilterOperationEnum.Nin)
     {
         var items = value.Split(",");
         NIN.AddRange(items.Select(x => (T)ConvertValue(x.Trim(' '))));
     }
 }
Ejemplo n.º 31
0
    public bool Delete()
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EEmpBankAccount obj = new EEmpBankAccount();

        obj.EmpBankAccountID = EmpBankAccountID;
        db.select(dbConn, obj);
        DBFilter paymentRecordFilter = new DBFilter();

        paymentRecordFilter.add(new Match("EmpAccID", obj.EmpBankAccountID));

        IN inTerms = new IN("EmpPayrollID", "Select EmpPayrollID From " + EPaymentRecord.db.dbclass.tableName, paymentRecordFilter);

        DBFilter empPayrollFilter = new DBFilter();

        empPayrollFilter.add(inTerms);
        empPayrollFilter.add("empid", true);
        ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);

        if (empPayrollList.Count > 0)
        {
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_IS_IN_USE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Bank Account") }));
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return(false);
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID);
            db.delete(dbConn, obj);
            WebUtils.EndFunction(dbConn);
        }
        return(true);
    }
 /// <summary>Sets the buttons bitflag.</summary>
 /// <param name="buttons">Bitflag representing which buttons are "down".</param>
 public void SetButtons(IN buttons) => CallVoid(nameof(SetButtons), (int)buttons);
Ejemplo n.º 33
0
 private void in_pop()
 {
     if (this.ins.Count > 0)
     {
         this.ins.RemoveAt(this.ins.Count - 1);
     }
     if (this.ins.Count > 0)
     {
         this._in = this.ins[this.ins.Count - 1];
     }
 }
Ejemplo n.º 34
0
 private void in_push(IN where)
 {
     this.ins.Add(where);
     this._in = where;
 }
Ejemplo n.º 35
0
        public VSBlockInfo GetBLOCK(string js)
        {
            Stack<TokenInfo> stack = new Stack<TokenInfo>();
            VSBlockInfo block = new VSBlockInfo();
            TokenInfo beforToken = null;
            string str;
            this.sb = new StringBuilder();
            this.lastword = "";
            this.lasttok = TK.EOF;
            this._in = IN.BLOCK;
            this.in_push(this._in);
            int pos = 0;
            TK token = TK.UNKNOWN;
            curreTokenLine = 1;
            while (true)
            {
                str = this.get_next_token(ref js, ref pos, out token);

                switch (token)
                {
                    case TK.START_BLOCK:
                        stack.Push(new TokenInfo(str, token, pos, beforToken, curreTokenLine));
                        break;
                    case TK.END_BLOCK:
                        if (pos == js.Length)
                        {
                            if (stack.Count > 0)
                            {
                                TokenInfo startBlockToken = stack.Peek();
                                block.startBlock = startBlockToken;
                                TokenInfo startToken = startBlockToken.lastToken;

                                bool isJson = false;
                                if (startBlockToken.lastToken.token == TK.PUNCT && startBlockToken.lastToken.text == "," )
                                {
                                    if (startBlockToken.lastToken.lastToken != null && startBlockToken.lastToken.lastToken.token == TK.END_BLOCK)
                                    {
                                        isJson = true;
                                    }
                                }

                                if (startToken.token == TK.NEW_LINE)
                                {
                                    startToken = startToken.lastToken;
                                }
                                int stratLine = startToken.line;
                                block.line = stratLine;
                                startToken = startToken.lastToken;
                                while (startToken.line == stratLine)
                                {
                                    block.line = startToken.line;
                                    if (startToken.line == 0)
                                    {
                                        break;
                                    }
                                    if (startToken.lastToken == null)
                                    {
                                        break;
                                    }
                                    startToken = startToken.lastToken;
                                    block.line = startToken.line+1;
                                }

                                int lastIndex = 0;
                                int postion = startToken.pos;
                                for (int i = startToken.pos; i >= 0; i--)
                                {
                                    postion = i;
                                    if (whitespace.Contains(js[i]))
                                    {
                                        lastIndex++;
                                        if (js[i] == '\n')
                                        {
                                            break;
                                        }
                                        if (js[i] == '\r')
                                        {
                                            if (js[i + 1] == '\n')
                                            {
                                                postion = i + 1;
                                            }

                                            break;
                                        }
                                    }

                                }

                                //上一行语句的最后一个字符
                                string prevStatementLastWord = "";

                                int prevStatementPostion = postion;

                                if (postion > 0)
                                {
                                    int prevForStart = postion - 1;
                                    if (js[prevForStart] == '\r')
                                    {
                                        prevForStart = prevForStart - 1;
                                    }
                                    for (int i = prevForStart; i >= 0; i--)
                                    {
                                        prevStatementPostion = i;
                                        if (whitespace.Contains(js[i]))
                                        {
                                            lastIndex++;
                                            if (js[i] == '\n')
                                            {
                                                break;
                                            }
                                            if (js[i] == '\r')
                                            {
                                                if (js[i + 1] == '\n')
                                                {
                                                    prevStatementPostion = i + 1;
                                                }
                                                break;
                                            }
                                        }

                                    }

                                    block.prevStatementLastWord = prevStatementLastWord;
                                    for (int i = postion; i >= 0; i--)
                                    {
                                        if (!whitespace.Contains(js[i]))
                                        {
                                            if (js[i] != '\n' && js[i] != '\r')
                                            {
                                                prevStatementLastWord = js[i].ToString();
                                                block.prevStatementLastWord = prevStatementLastWord;
                                                break;
                                            }
                                        }
                                    }
                                }

                                if (postion == 0)
                                {
                                    postion = -1;
                                }
                                string result = js.Substring(postion + 1, js.Length - postion - 1);

                                int spaceCount = 0;
                                if (prevStatementPostion > 0)
                                {
                                    for (int i = prevStatementPostion + 1; i >= 0; i++)
                                    {
                                        if (js[i] == '\t')
                                        {
                                            spaceCount += 4;
                                        }
                                        else if (js[i] == ' ')
                                        {
                                            spaceCount += 1;
                                        }
                                        else
                                        {
                                            break;
                                        }
                                    }
                                }
                                int indent = spaceCount / 4;

                                string endChars = "{[";

                                if (prevStatementLastWord!=""&&endChars.IndexOf(prevStatementLastWord) >= 0)
                                {
                                    indent++;
                                }
                                //if (isJson)
                                //{
                                //    indent++;
                                //}

                                block.indent = indent;

                                block.column = lastIndex;
                                block.text = result;
                                if (startBlockToken.lastToken != null)
                                {
                                    block.befor = startToken.token.ToString();
                                }
                                return block;
                            }
                            else
                            {
                                return block;
                            }
                        }
                        else
                        {
                            if (stack.Count > 0)
                            {
                                stack.Pop();
                            }
                        }
                        break;
                }
                if (pos >= js.Length)
                {
                    break;
                }
                beforToken = new TokenInfo(str, token, pos, beforToken, curreTokenLine);
                this.lasttok = token;
                this.lastword = str.ToLower();
            }
            return block;
        }
Ejemplo n.º 36
0
        public void js_beautify(string js_source_text)
        {
            string str;
            this.sb = new StringBuilder();
            this.lastword = "";
            //this.indent = 0;
            this.lasttok = TK.EOF;
            this._in = IN.BLOCK;
            this.in_push(this._in);
            int pos = 0;

            int lastPos = 0;
            activeFormatedOffset = 0;
            isFindPos = false;

            TK uNKNOWN = TK.UNKNOWN;
            Next_token:
            str = this.get_next_token(ref js_source_text, ref pos, out uNKNOWN);

            if (activeOffset >= lastPos && activeOffset < pos)
            {
                offset = str.Length - (pos - activeOffset - 1);
                if (offset < 0)
                {
                    offset = 0;
                }
                isFindPos = true;
                this.activeFormatedOffset = sb.ToString().Length + offset;
            }
            else
            {
                isFindPos = false;
            }
            lastPos = pos;

            if (this.isDebugEnabled)
            {
                this.proto("[" + uNKNOWN.ToString() + "]>");
            }
            if (uNKNOWN == TK.EOF)
            {
                return;
            }
            if (str == null)
            {
                return;
            }
            switch (uNKNOWN)
            {
                case TK.UNKNOWN:
                    if ((str == "\n") && (this.lasttok == TK.WORD || this.lasttok == TK.START_CASE))
                    {
                        this.write(";", new string[0]);
                    }
                    this.write(str, new string[0]);
                    goto GetLastInfo;
                case TK.START_CASE:
                    if (this.lasttok != TK.START_BLOCK)
                    {
                        this.un_indent();
                    }
                    if (this.lasttok == TK.PUNCT || this.lasttok == TK.END_BLOCK)
                    {
                        this.do_indent();
                    }
                    this.nl();
                    this.write(str + " ", new string[0]);
                    this.case_push(CASE.CASE);
                    goto GetLastInfo;
                case TK.WORD:
                    {
                        if (lasttok == TK.NEW_LINE)
                        {
                            this.nl();
                        }
                        else if (lastword == ":" && _cases == CASE.CASE)
                        {
                            this.do_indent();
                            this.nl();
                        }
                        else if ((this.lasttok == TK.END_COMMAND) || (!(str.ToLower() == "break") && !(str.ToLower() == "else")))
                        {
                            if (this.lasttok == TK.END_BLOCK)
                            {
                                if (str.ToLower() != "else")
                                {
                                    //如果要在每个{}后面加一个空行,则取消掉注释
                                    //this.nl();
                                }
                                else
                                {
                                    this.write(" ", new string[0]);
                                }
                            }
                            if ((this.lasttok == TK.END_COMMAND) && (this._in == IN.BLOCK))
                            {
                                this.nl();
                            }
                            else if ((this.lasttok == TK.END_COMMAND) && (this._in == IN.EXPR))
                            {
                                this.write(" ", new string[0]);
                            }
                            else if (this.lasttok == TK.WORD)
                            {
                                this.write(" ", new string[0]);
                            }
                            else if (this.lasttok == TK.START_BLOCK || this.lasttok == TK.END_BLOCK)
                            {
                                this.nl();
                            }
                            else if (this.lasttok == TK.STRING)
                            {
                                //2008-12-1去掉该段,会影响正则表达式:if (json.match(/^\d+$/g)) {}
                                //this.write(";", new string[0]);
                                //this.nl();

                                //正则表达式
                                if (!lastword.EndsWith("/"))
                                {
                                    this.write(";", new string[0]);
                                    this.nl();
                                }
                            }
                            else if (this.lasttok == TK.END_EXPR && this.lasttok == TK.START_SWITCH)
                            {
                                if (Inners[0] == Inner.Flow)
                                {
                                    this.do_indent();
                                    this.nl();
                                    this.un_indent();
                                }
                                else
                                {
                                    this.nl();
                                }
                            }
                        }
                        else
                        {
                            if (lasttok != TK.EOF)
                            {
                                this.nl();
                            }
                        }

                        //代码着色
                        List<string> list = new List<string>();
                        list.AddRange(new string[] { "function" });
                        if (list.Contains(str))
                        {
                            this.write(str, new string[] { "color:blue;" });
                        }
                        else
                        {
                            this.write(str, new string[0]);
                        }
                        goto GetLastInfo;
                    }
                case TK.START_EXPR:
                    this.in_push(IN.EXPR);
                    if (this.lastword == "switch")
                    {
                        this.case_push(CASE.SWITCH);
                    }
                    else if (cases.Count > 0)
                    {
                        this.case_push(CASE.EXPR);
                    }
                    if (this.keyword.Contains(lastword))
                    {
                        //内部流程操作
                        this.Inners.Add(Inner.Flow);
                    }
                    else
                    {
                        //普通的运算
                        this.Inners.Add(Inner.Exp);
                    }
                    if (this.lasttok != TK.END_EXPR && this.lasttok != TK.START_SWITCH)
                    {
                        if (((this.lasttok != TK.WORD && this.lasttok != TK.START_CASE) && (this.lasttok != TK.START_EXPR)) && (this.lasttok != TK.PUNCT))
                        {
                            this.write(" ", new string[0]);
                        }
                        else if (((this.lastword == "if") || (this.lastword == "for")) || ((this.lastword == "while") || (this.lastword == "switch")))
                        {
                            if (addSpaceAfterCtrlWord)
                            {
                                this.write(" ", new string[0]);
                            }

                        }
                        break;
                    }
                    if ((str != "[") && (str != "("))
                    {
                        this.nl();
                    }
                    break;

                case TK.START_SWITCH:
                case TK.END_EXPR:
                    this.write(str, new string[0]);
                    this.in_pop();
                    if (cases.Count > 0)
                    {
                        case_pop();
                    }
                    goto GetLastInfo;

                case TK.START_BLOCK:
                    this.in_push(IN.BLOCK);
                    if (this.lasttok == TK.START_SWITCH)
                    {
                        case_push(CASE.BLOCK);
                    }
                    else if (_cases != CASE.None)
                    {
                        case_push(CASE.CASE_BLOCK);
                    }
                    //if (this.lasttok != TK.PUNCT)
                    //{
                    //    this.write(" ", new string[0]);
                    //}

                    //jrt,加入代码风格,如果是return {...}这种返回的语句,“{”不可以换到下一行
                    if (this.lastword == "return")
                    {
                        this.write(" ");
                    }
                    else if (this.lasttok == TK.PUNCT || (this.lasttok != TK.COMMENT && this.style == CodeStyle.MS))
                    {
                        this.nl();
                    }

                    this.write("{", new string[0]);
                    this.do_indent();
                    goto GetLastInfo;

                case TK.END_BLOCK:
                    //if (lasttok != TK.EOF)
                    //{
                        if (this.lasttok != TK.END_EXPR && this.lasttok != TK.START_SWITCH)
                        {
                            if (this._cases == CASE.BLOCK)
                            {
                                this.un_indent();
                                if (this.lasttok != TK.END_BLOCK)
                                {
                                    this.un_indent();
                                }
                                this.nl();
                            }
                            else if (this.lasttok == TK.END_BLOCK)
                            {
                                this.un_indent();
                                this.nl();
                            }
                            else if (this.lasttok == TK.START_BLOCK)
                            {
                                this.un_indent();
                            }
                            else
                            {
                                this.un_indent();
                                if (lasttok == TK.COMMENT)
                                {
                                    removeLastNL();
                                }
                                this.nl();
                            }
                        }
                        else
                        {
                            //jrt
                            this.un_indent();

                            this.nl();
                            //this.un_indent();

                        }
                    //}

                    this.write(str, new string[0]);
                    this.in_pop();
                    if (_cases != CASE.None)
                    {
                        case_pop();
                    }
                    goto GetLastInfo;

                case TK.END_COMMAND:
                    this.write(";", new string[0]);
                    goto GetLastInfo;

                case TK.STRING:
                    if (this.lasttok != TK.START_BLOCK)
                    {
                        if (this.lasttok == TK.WORD)
                        {
                            this.write(" ", new string[0]);
                        }
                    }
                    else
                    {
                        this.nl();
                    }
                    this.write(str, new string[] { "color:red;" });
                    goto GetLastInfo;

                case TK.BLOCK_COMMENT:
                    if (this.lasttok != TK.EOF &&
                        this.lasttok != TK.COMMENT &&
                        (this.sb.Length > 0))
                    {
                        if (!(lastword == "," && this._in == IN.BLOCK))
                        {
                            this.nl();
                        }
                    }
                    this.write(str, new string[] { "color:green;" });
                    this.nl();
                    goto GetLastInfo;

                case TK.COMMENT:

                    //if (str.StartsWith(regionPair.Key))
                    //{
                    //    this.nl();
                    //}
                    if (this.lasttok != TK.COMMENT && this.lasttok != TK.EOF)
                    {
                        if (lastword == ":" && _cases == CASE.CASE)
                        {
                            this.do_indent();
                            this.nl();
                        }
                        else if (!(lastword == "," && this._in == IN.BLOCK))
                        {
                            this.nl();
                        }

                    }

                    this.write(str, new string[] { "color:green;" });
                    this.nl();
                    //if (str.StartsWith(regionPair.Value))
                    //{
                    //    this.n();
                    //}
                    goto GetLastInfo;

                case TK.PUNCT:
                    {
                        //是否在左、右添加空格的标记
                        bool leftFlag = true;
                        bool rightFlag = true;
                        if (!(str == ","))
                        {
                            if (str == "?" && cases.Contains(CASE.CASE))
                            {
                                case_push(CASE.EXPR);
                            }

                            //case default:的情况
                            if (str == ":" && this.lasttok == TK.START_CASE)
                            {
                                leftFlag = false;
                            }
                            if (this.lasttok == TK.PUNCT)
                            {
                                leftFlag = false;
                                rightFlag = false;
                            }
                            else if (str == ".")
                            {
                                leftFlag = false;
                                rightFlag = false;
                            }
                            //else
                            //{
                            //    lasttok = this.lasttok;
                            //}

                            if (leftFlag)
                            {
                                this.write(" ", new string[0]);
                            }
                            this.write(str, new string[0]);
                            if (rightFlag)
                            {
                                this.write(" ", new string[0]);
                            }

                        }
                        //08-11-19 增加对json数据的处理
                        else if (this._in == IN.BLOCK)
                        {
                            this.write(",", new string[0]);
                            this.nl();
                        }
                        else if (this._in != IN.EXPR)
                        {
                            this.write(", ", new string[0]);
                        }
                        else
                        {
                            this.write(", ", new string[0]);
                        }

                        goto GetLastInfo;
                    }
                default:
                    goto GetLastInfo;
            }
            this.write(str, new string[0]);
            GetLastInfo:
            if (this.lasttok == TK.END_EXPR && this.lasttok == TK.START_SWITCH)
                Inners.RemoveAt(Inners.Count - 1);

            if (lastword == ":")
            {
                if (_cases == CASE.EXPR)
                {
                    case_pop();
                }
            }
            this.lasttok = uNKNOWN;
            this.lastword = str.ToLower();
            goto Next_token;
        }
 /// <summary>Returns true if the specified button(s) is pressed.</summary>
 /// <param name="key">Bitflag representing which button to check.</param>
 /// <returns>Is key down or not?</returns>
 public bool KeyDown(IN key) => CallBoolean(nameof(KeyDown), (int)key);
Ejemplo n.º 38
0
		public void A(IN n)
		{
			//...
		}
 /// <summary>Removed a key bit from the current key bitflag.</summary>
 /// <param name="button">Bitflag to be removed from the key bitflag.</param>
 public void RemoveKey(IN button) => CallVoid(nameof(RemoveKey), (int)button);