コード例 #1
0
        /** Create a packet to read multiple tags. */
        public void makeRead(S7Data[] s7s)
        {
            func = READ;
            byte cnt = (byte)s7s.Length;

            funcData    = new byte[1 + cnt * 12];
            funcData[0] = cnt; //count
            int offset = 1;

            for (byte a = 0; a < cnt; a++)
            {
                S7Data s7 = s7s[a];
                funcData[offset++] = 0x12;                       //var def
                funcData[offset++] = 10;                         //length of def
                funcData[offset++] = 0x10;                       //S7ANY
                funcData[offset++] = s7.data_type;               //INT, BYTE, etc.
                BE.setuint16(funcData, offset, 1);               //length (# of elements)
                offset += 2;
                BE.setuint16(funcData, offset, s7.block_number); //DBxx
                offset            += 2;
                funcData[offset++] = s7.block_type;              //DB, I, Q, etc.
                //BE.setuint24(data, 9, off);
                funcData[offset++] = (byte)((s7.offset & 0xff0000) >> 16);
                funcData[offset++] = (byte)((s7.offset & 0xff00) >> 8);
                funcData[offset++] = (byte)(s7.offset & 0xff);
            }
        }
コード例 #2
0
 public void write(byte[] data, int offset, short totalsize)
 {
     length         = totalsize;
     data[offset++] = version;
     data[offset++] = res;
     BE.setuint16(data, offset, length); //offset += 2;
 }
コード例 #3
0
        /** Create a packet to write data. */
        public void makeWrite(byte block_type, short block_number, byte data_type, int off /*24bit*/, short len, byte[] data)
        {
            func        = WRITE;
            funcData    = new byte[13 + 4 + data.Length];
            funcData[0] = 1;                         //count
            funcData[1] = 0x12;                      //var def
            funcData[2] = 10;                        //length of def
            funcData[3] = 0x10;                      //S7ANY
            funcData[4] = data_type;                 //INT, BYTE, etc.
            BE.setuint16(funcData, 5, 1);            //length (# of elements)
            BE.setuint16(funcData, 7, block_number); //DBxx
            funcData[9] = block_type;                //DB, I, Q, etc.
            //BE.setuint24(data, 9, off);
            funcData[10] = (byte)((off & 0xff0000) >> 16);
            funcData[11] = (byte)((off & 0xff00) >> 8);
            funcData[12] = (byte)(off & 0xff);

            funcData[13] = 0x00;                        //res
            funcData[14] = getTransportType(data_type); //transport type
            if (len > 1)
            {
                len <<= 3;         //length in bits
            }
            BE.setuint16(funcData, 15, len);
            Arrays <byte> .Copy(data, 0, funcData, 17, data.Length);
        }
コード例 #4
0
        public static ModData decodePacket(byte[] data)
        {
            ModData outData = new ModData();

            short tid   = (short)BE.getuint16(data, 0);
            short proto = (short)BE.getuint16(data, 2);
            short len   = (short)BE.getuint16(data, 4);
            byte  uid   = data[6];

            if (data.Length != 6 + len)
            {
                return(null);
            }

            byte func = data[7];

            switch (func)
            {
            case 0x01:    //returning coils
            case 0x02:    //returning inputs
                byte blen = data[8];
                outData.type = func;
                outData.data = new byte[blen];
                Arrays <byte> .Copy(data, 9, outData.data, 0, blen);

                break;
            }
            return(outData);
        }
コード例 #5
0
        /** Reads params from packet and fills in S7Data. */
        public bool read(byte[] data, int offset, S7Data[] outs)
        {
            func = data[offset++];
            byte count = data[offset++];

            for (int a = 0; a < count; a++)
            {
                S7Data outData = outs[a];
                byte   success = data[offset++];
                if (success != (byte)0xff)
                {
                    Console.WriteLine("Error:success=" + success);
                    return(false);
                }
                if (func == READ)
                {
                    byte transport_type = data[offset++];
                    int  len            = BE.getuint16(data, offset);
                    if (isBits(transport_type))
                    {
                        len = (len + 7) >> 3; //divide by 8
                    }
                    offset      += 2;
                    outData.data = new byte[len];
                    Arrays <byte> .Copy(data, offset, outData.data, 0, len);

                    offset += len;
                    if (len % 2 == 1)
                    {
                        offset++; //fill byte
                    }
                }
            }
            return(true);
        }
コード例 #6
0
ファイル: StageBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.Stage stage)
 {
     StageRepository repository = new StageRepository();
     if(stage.ID > 0)
         return repository.Update(stage);
     else
         return repository.Insert(stage);
 }
コード例 #7
0
 public int Save(BE.CustomPageCategory custompagecategory)
 {
     CustomPageCategoryRepository repository = new CustomPageCategoryRepository();
     if(custompagecategory.ID > 0)
         return repository.Update(custompagecategory);
     else
         return repository.Insert(custompagecategory);
 }
コード例 #8
0
ファイル: EngineStageBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.EngineStage enginestage)
 {
     EngineStageRepository repository = new EngineStageRepository();
     if(enginestage.ID > 0)
         return repository.Update(enginestage);
     else
         return repository.Insert(enginestage);
 }
コード例 #9
0
        public bool DecideCourse()
        {
            BE  Course   = new BE();
            var Duration = Course.GetDuration();
            var Fee      = Course.GetFee();

            return(Duration < 5 && Fee <= 3000000);
        }
コード例 #10
0
ファイル: InitialForm.cs プロジェクト: kuharan/IDS_PCA
        private void buttonPCA_Click(object sender, EventArgs e)
        {
            //
            BigInteger BE;

            BE = BigInteger.Parse("c67c18a8b9b8a265d55592b802590a2a", System.Globalization.NumberStyles.AllowHexSpecifier);
            Console.WriteLine("" + BE.ToString().Trim());
        }
コード例 #11
0
ファイル: TypeBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.Type type)
 {
     TypeRepository repository = new TypeRepository();
     if(type.ID > 0)
         return repository.Update(type);
     else
         return repository.Insert(type);
 }
コード例 #12
0
ファイル: ModelEngineBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.ModelEngine modelengine)
 {
     ModelEngineRepository repository = new ModelEngineRepository();
     if(modelengine.ID > 0)
         return repository.Update(modelengine);
     else
         return repository.Insert(modelengine);
 }
コード例 #13
0
ファイル: FuelBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.Fuel fuel)
 {
     FuelRepository repository = new FuelRepository();
     if(fuel.ID > 0)
         return repository.Update(fuel);
     else
         return repository.Insert(fuel);
 }
コード例 #14
0
ファイル: ManufacturerBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.Manufacturer manufacturer)
 {
     ManufacturerRepository repository = new ManufacturerRepository();
     if(manufacturer.ID > 0)
         return repository.Update(manufacturer);
     else
         return repository.Insert(manufacturer);
 }
コード例 #15
0
ファイル: CustomPageBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.CustomPage custompage)
 {
     CustomPageRepository repository = new CustomPageRepository();
     if (custompage.ID > 0)
     {
         repository.Update(custompage);
         return custompage.ID;
     }
     else
         return repository.Insert(custompage);
 }
コード例 #16
0
 public void write(byte[] data, int offset, short _param_length, short _data_length)
 {
     pdu_ref        = 0x500;
     param_length   = _param_length;
     data_length    = _data_length;
     data[offset++] = id;
     data[offset++] = rosctr;
     BE.setuint16(data, offset, res); offset          += 2;
     BE.setuint16(data, offset, pdu_ref); offset      += 2;
     BE.setuint16(data, offset, param_length); offset += 2;
     BE.setuint16(data, offset, data_length); offset  += 2;
 }
コード例 #17
0
        private BE GetBE(string selectedval)
        {
            // Get the package owner and package name
            string[] sep = { "." };
            string[] arr = selectedval.ToString().Split(sep, StringSplitOptions.RemoveEmptyEntries);
            // create new business entity  using owner and package
            BE dc = new BE(arr[0], arr[1]);

            dc.ConnectionString      = System.Configuration.ConfigurationManager.AppSettings["connectionString"];
            dc.StandardAbbreviations = GetAbbreviations();
            dc.InterfaceName         = System.Configuration.ConfigurationManager.AppSettings["interface"];
            return(dc);
        }
コード例 #18
0
        /** Creates a packet to write data to ModBus. */
        public static byte[] makeWritePacket(ModAddr addr)
        {
            byte[] data = new byte[12];
            BE.setuint16(data, 0, tid++); //transaction id
//        BE.setuint16(data, 2, 0);    //protocol
            BE.setuint16(data, 4, 6);     //length
//        data[6] = 0;    //unit ID

            data[7] = 5; //set single coil
            BE.setuint16(data, 8, addr.io_number - 1);
            BE.setuint16(data, 10, addr.state ? 0xff00 : 0x0000);
            return(data);
        }
コード例 #19
0
        private void CreateReportsEmp(DoWorkEventArgs e)
        {
            string a = "";

            Dispatcher.Invoke(new Action(delegate
            {
                a = cbrptbymem.SelectedValue.ToString();
            }));



            int       max   = GetMax();
            ArrayList items = GetItems();
            BE        dc    = GetBE(a);
            // this holds all generated output
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i <= GetMax() - 1; i++)
            {
                dc.CodeTypeToGenerate = Enums.CodeType.BusinessEntity;
                GenerateCSharpCode(dc, items[i].ToString(), max, sb);

                //dc.CodeTypeToGenerate = Enums.CodeType.DataAccess;
                //GenerateCSharpCode(dc, items[i].ToString(), max, sb);


                //if (ConfigurationManager.AppSettings.Get("cacheImplementation").Equals("off", StringComparison.InvariantCultureIgnoreCase))
                //{
                //    dc.CodeTypeToGenerate = Enums.CodeType.BusinessObject;
                //}
                //else
                //{
                //    dc.CodeTypeToGenerate = Enums.CodeType.BusinessObjectCached;
                //}

                //GenerateCSharpCode(dc, items[i].ToString(), max, sb);

                dc.CodeTypeToGenerate = Enums.CodeType.IServiceCallCode;
                GenerateCSharpCode(dc, items[i].ToString(), max, sb);

                dc.CodeTypeToGenerate = Enums.CodeType.ServiceCallCode;
                GenerateCSharpCode(dc, items[i].ToString(), max, sb);


                if (ConfigurationManager.AppSettings.Get("cacheImplementation").Equals("off", StringComparison.InvariantCultureIgnoreCase))
                {
                    max = 0;
                }
                //GenerateAppSettingDuration(dc, items, max, sb);
            }
        }
コード例 #20
0
 public void read(byte[] data, int offset)
 {
     id           = data[offset++];
     rosctr       = data[offset++];
     res          = (short)BE.getuint16(data, offset); offset += 2;
     pdu_ref      = (short)BE.getuint16(data, offset); offset += 2;
     param_length = (short)BE.getuint16(data, offset); offset += 2;
     data_length  = (short)BE.getuint16(data, offset); offset += 2;
     if (rosctr == 3)
     {
         //error_cls = data[offset++]
         //error_code = data[offset++]
     }
 }
コード例 #21
0
        /** Creates a packet to read data from ModBus. */
        public static byte[] makeReadPacket(ModAddr addr)
        {
            byte[] data = new byte[12];
            BE.setuint16(data, 0, tid++); //transaction id
//        BE.setuint16(data, 2, 0);    //protocol
            BE.setuint16(data, 4, 6);     //length
//        data[6] = 0;    //unit ID

            data[7] = readFunc(addr.io_type);
            BE.setuint16(data, 8, addr.io_number - 1); //starting addr
            BE.setuint16(data, 10, addr.length);       //bit count

            return(data);
        }
コード例 #22
0
        private int readuint32()
        {
            int _uint32;

            if (le)
            {
                _uint32 = LE.getuint32(data, datapos);
            }
            else
            {
                _uint32 = BE.getuint32(data, datapos);
            }
            datapos += 4;
            return(_uint32);
        }
コード例 #23
0
        private long readuint64()
        {
            long _uint64;

            if (le)
            {
                _uint64 = LE.getuint64(data, datapos);
            }
            else
            {
                _uint64 = BE.getuint64(data, datapos);
            }
            datapos += 8;
            return(_uint64);
        }
コード例 #24
0
        private short readuint16()
        {
            int _uint16;

            if (le)
            {
                _uint16 = LE.getuint16(data, datapos);
            }
            else
            {
                _uint16 = BE.getuint16(data, datapos);
            }
            datapos += 2;
            return((short)_uint16);
        }
コード例 #25
0
 public void read(byte[] data, int offset)
 {
     version = data[offset++];
     if (version != 3)
     {
         throw new Exception("TPKT : unknown version");
     }
     res = data[offset++];
     if (res != 0)
     {
         throw new Exception("TPKT : unknown res");
     }
     length  = (short)BE.getuint16(data, offset);
     offset += 2;
 }
コード例 #26
0
 /** Create a packet to read single tag. */
 public void makeRead(S7Data s7)
 {
     func        = READ;
     funcData    = new byte[13];
     funcData[0] = 1;                            //count
     funcData[1] = 0x12;                         //var def
     funcData[2] = 10;                           //length of def
     funcData[3] = 0x10;                         //S7ANY
     funcData[4] = s7.data_type;                 //INT, BYTE, etc.
     BE.setuint16(funcData, 5, s7.length);       //length (# of elements)
     BE.setuint16(funcData, 7, s7.block_number); //DBxx
     funcData[9] = s7.block_type;                //DB, I, Q, etc.
     //BE.setuint24(data, 9, off);
     funcData[10] = (byte)((s7.offset & 0xff0000) >> 16);
     funcData[11] = (byte)((s7.offset & 0xff00) >> 8);
     funcData[12] = (byte)(s7.offset & 0xff);
 }
コード例 #27
0
        private void GenerateAppSettingDuration(BE dc, ArrayList items, int max, StringBuilder allCode)
        {
            //StringBuilder sb = new StringBuilder();
            //// this holds code generated in this pass
            //string className = BO.GetClassName(dc) + "BO.";

            //for (int i = 0; i <= max; i++)
            //{
            //    dc.Package = items.i items.IndexOf(i);
            //    string methodName = BO.GetClassName(dc);
            //    sb.AppendLine("<add key=" + Strings.Chr(34) + className + methodName + ".CacheDuration" + Strings.Chr(34) + " value=" + Strings.Chr(34) + ConfigurationManager.AppSettings("defaultCacheDuration") + Strings.Chr(34) + " />");
            //    ProgressBar1.Value = i + 1;
            //}

            //WriteTheFile(ConfigurationManager.AppSettings("codeOutputFolder") + className + "config", sb);

            //allCode.Append(sb.ToString);
        }
コード例 #28
0
ファイル: Tag.cs プロジェクト: attackgithub/QSharp
        /** Queues pending data to be written on next cycle. (only valid if start() has been called). */
        public void SetValue(String value)
        {
            byte[] data = null;
            if (IsBE())
            {
                switch (Size)
                {
                case TagType.Bit: data = new byte[] { (byte)(value.Equals("0") ? 0 : 1) }; break;

                case TagType.Int8: data = new byte[] { Byte.ValueOf(value) }; break;

                case TagType.Int16: data = new byte[2]; BE.setuint16(data, 0, Int32.ValueOf(value)); break;

                case TagType.Int32: data = new byte[4]; BE.setuint32(data, 0, Int32.ValueOf(value)); break;

                case TagType.Float32: data = new byte[4]; BE.setuint32(data, 0, Float.FloatToIntBits(Float.ValueOf(value))); break;

                case TagType.Float64: data = new byte[4]; BE.setuint64(data, 0, Double.DoubleToLongBits(Double.ValueOf(value))); break;
                }
            }
            else
            {
                switch (Size)
                {
                case TagType.Bit: data = new byte[] { (byte)(value.Equals("0") ? 0 : 1) }; break;

                case TagType.Int8: data = new byte[] { Byte.ValueOf(value) }; break;

                case TagType.Int16: data = new byte[2]; LE.setuint16(data, 0, Int32.ValueOf(value)); break;

                case TagType.Int32: data = new byte[4]; LE.setuint32(data, 0, Int32.ValueOf(value)); break;

                case TagType.Float32: data = new byte[4]; LE.setuint32(data, 0, Float.FloatToIntBits(Float.ValueOf(value))); break;

                case TagType.Float64: data = new byte[4]; LE.setuint64(data, 0, Double.DoubleToLongBits(Double.ValueOf(value))); break;
                }
            }
            lock (pendingLock) {
                pending = data;
            }
        }
コード例 #29
0
        public static void GenerateCSharpCode1(BE dc, ref StringBuilder sb)
        {
            OracleConnection conn = new OracleConnection(UtilConstants.mssqldb);

            conn.Open();
            OracleCommand cmd = BO.GetOracleCommand(conn, dc);

            BO.methodName = BO.GetMethodName(dc.StoredProcedure.ToLower());
            BO.entityName = BO.GetMethodName(dc.Package) + "BE." + BO.methodName + "BE";
            switch (dc.CodeTypeToGenerate)
            {
            case Enums.CodeType.BusinessEntity:
                BO.WriteCSharpBusinessEntity(cmd, sb, dc);
                break;

            //case Enums.CodeType.BusinessObject:
            //    WriteCSharpBusinessObject(cmd, sb, dc);
            //    break;
            //case Enums.CodeType.BusinessObjectCached:
            //    WritecSharpBusinessObjectCached(cmd, sb, dc);
            //    break;
            case Enums.CodeType.IServiceCallCode:
                BO.WriteCSharpIServiceInterface(cmd, ref sb, dc);
                break;

            case Enums.CodeType.ServiceCallCode:
                BO.WriteCSharpServiceMethods(cmd, sb, dc);
                break;

            //case Enums.CodeType.DataAccess:
            //    WriteCSharpDataAccessCode(cmd, sb, dc);
            //    break;
            default:
                break;
                // forget it
            }

            conn.Close();
            //dc.CodeOutput = sb.ToString;
        }
コード例 #30
0
ファイル: PlayerOnHit.cs プロジェクト: f4sn/PastWorks
    void OnTriggerEnter(Collider o)
    {
        if (o.tag.Contains("Player") && o.tag != tag)
        {
            BulletEvent BE;
            BE               = o.GetComponent <BulletEvent>();
            slowTime         = BE.onHitSlowTime;
            slowSpeed        = BE.onHitSlowSpeed;
            slowRecoveryTime = BE.onHitRecovaryTime;
            CookieEvent(BE.GetPlayer(), BE.onHitRobPercentage);
            S_OnHit.PlayOneShot(S_OnHit.clip);
            isOnHit = true;
            counter = 0;
        }

        if (o.tag.Contains("Item"))
        {
            char[]   delimiterChars = { ':' };
            string[] item           = o.tag.Split(delimiterChars);
            GetItem(item[1]);
            //  S_GetItem.PlayOneShot(S_GetItem.clip);
            Destroy(o.gameObject);
        }
    }
コード例 #31
0
 public bool Delete(BE.CustomPageCategory custompagecategory)
 {
     return new CustomPageCategoryRepository().Delete(custompagecategory);
 }
コード例 #32
0
ファイル: EngineStageBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.EngineStage enginestage)
 {
     return new EngineStageRepository().Delete(enginestage);
 }
コード例 #33
0
ファイル: MovimientoBL.cs プロジェクト: pfizzer/papyrusten
 public void Grabar(BE.Movimiento movimiento)
 {
     new MovimientoDA().Save(movimiento);
 }
コード例 #34
0
ファイル: BL function.cs プロジェクト: chaimMili/myProject1
 public IEnumerable<IGrouping< Dish, category>> GroupDishByCategory(BE.category a)
 {
     return from item in dal_func.GetAllDish()
            where item.DishCategory == a
            group item.DishCategory by item;
 }
コード例 #35
0
        /// <summary>
        /// Validates VAT number
        /// </summary>
        /// <returns>Corrected VAT number in VatNumber object</returns>
        public static VatNumber Validate(string vat, EUCountry euCountry)
        {
            string countryCode = euCountry.ToString().ToUpper();

            vat = vat.ToUpper();

            CountryBase countryBase;

            switch (euCountry)
            {
            case EUCountry.AT:
                countryBase = new AT();
                break;

            case EUCountry.BE:
                countryBase = new BE();
                break;

            case EUCountry.BG:
                countryBase = new BG();
                break;

            case EUCountry.CY:
                countryBase = new CY();
                break;

            case EUCountry.CZ:
                countryBase = new CZ();
                break;

            case EUCountry.DE:
                countryBase = new DE();
                break;

            case EUCountry.DK:
                countryBase = new DK();
                break;

            case EUCountry.EE:
                countryBase = new EE();
                break;

            case EUCountry.EL:
                countryBase = new EL();
                break;

            case EUCountry.ES:
                countryBase = new ES();
                break;

            case EUCountry.FI:
                countryBase = new FI();
                break;

            case EUCountry.FR:
                countryBase = new FR();
                break;

            case EUCountry.GB:
                countryBase = new GB();
                break;

            case EUCountry.HR:
                countryBase = new HR();
                break;

            case EUCountry.HU:
                countryBase = new HU();
                break;

            case EUCountry.IE:
                countryBase = new IE();
                break;

            case EUCountry.IT:
                countryBase = new IT();
                break;

            case EUCountry.LT:
                countryBase = new LT();
                break;

            case EUCountry.LU:
                countryBase = new LU();
                break;

            case EUCountry.LV:
                countryBase = new LV();
                break;

            case EUCountry.MT:
                countryBase = new MT();
                break;

            case EUCountry.NL:
                countryBase = new NL();
                break;

            case EUCountry.PL:
                countryBase = new PL();
                break;

            case EUCountry.PT:
                countryBase = new PT();
                break;

            case EUCountry.RO:
                countryBase = new RO();
                break;

            case EUCountry.SE:
                countryBase = new SE();
                break;

            case EUCountry.SI:
                countryBase = new SI();
                break;

            case EUCountry.SK:
                countryBase = new SK();
                break;

            default:
                throw new InvalidCountryException();
            }

            if (countryBase.StripLetters)
            {
                return(new VatNumber(euCountry, countryBase.Validate(Strip(vat))));
            }

            return(new VatNumber(euCountry, countryBase.Validate(StripNoLetters(vat, countryCode))));
        }
コード例 #36
0
ファイル: ManufacturerBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.Manufacturer manufacturer)
 {
     return new ManufacturerRepository().Delete(manufacturer);
 }
コード例 #37
0
 public void Eliminar(BE.VentaPauta entidad)
 {
     throw new NotImplementedException();
 }
コード例 #38
0
ファイル: ModelBL.cs プロジェクト: yoorke/zrchiptuning
 public int Save(BE.Model model)
 {
     ModelRepository repository = new ModelRepository();
     if(model.ID > 0)
         return repository.Update(model);
     else
         return repository.Insert(model);
 }
コード例 #39
0
ファイル: ModelBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.Model model)
 {
     return new ModelRepository().Delete(model);
 }
コード例 #40
0
ファイル: FuelBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.Fuel fuel)
 {
     return new FuelRepository().Delete(fuel);
 }
コード例 #41
0
ファイル: CustomPageBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.CustomPage custompage)
 {
     return new CustomPageRepository().Delete(custompage);
 }
コード例 #42
0
ファイル: ModelEngineBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.ModelEngine modelengine)
 {
     return new ModelEngineRepository().Delete(modelengine);
 }
コード例 #43
0
        private void GenerateCSharpCode(BE dc, string sp_name, int spno, StringBuilder allCode)
        {
            applicationPath = System.AppDomain.CurrentDomain.BaseDirectory.Replace(@"\bin\Debug\", "");
            applicationPath = applicationPath.Replace(@"Generator\AutoCodeGenerator", "");
            applicationPath = applicationPath.Replace(@"Generator\\AutoCodeGenerator", "");
            applicationPath = applicationPath + "Projects\\";

            string foldername = "";

            if (dc.CodeTypeToGenerate.ToString() == "BusinessEntity")
            {
                foldername = "BusinessEntities";
            }
            else if (dc.CodeTypeToGenerate.ToString() == "BusinessObjects")
            {
                foldername = "BusinessObjects";
            }
            else if (dc.CodeTypeToGenerate.ToString() == "ServiceCallCode")
            {
                foldername = "BusinessEntities";
            }
            else if (dc.CodeTypeToGenerate.ToString() == "BusinessObjectCached")
            {
                foldername = "BusinessObjects";
            }
            else if (dc.CodeTypeToGenerate.ToString() == "DataAccess")
            {
                foldername = "DataAccessLayer";
            }
            else if (dc.CodeTypeToGenerate.ToString() == "IServiceCallCode")
            {
                foldername = "BusinessEntities";
            }
            //applicationPath = applicationPath + foldername + "\\";


            string[] arr = sp_name.Split('_');
            dc.Package = sp_name;//"EzRide_RDR";//arr[1];
            //dc.CodeTypeToGenerate = Enums.CodeType.BusinessEntity;

            StringBuilder sb            = new StringBuilder(); // this holds code generated in this pass
            string        classBaseName = BO.GetClassName(dc);
            string        className     = "";

            //sb.Append("//************************************************************");
            //sb.Append("//*                New Code Block                            *");
            //sb.Append("//************************************************************");

            switch (dc.CodeTypeToGenerate)
            {
            //case Enums.CodeType.BusinessObject:
            //    AddAWholeFile(applicationPath + @"\CsharpBOImports.txt", ref sb);
            //    className = classBaseName + "BO";
            //    sb.AppendLine("public class " + className);
            //    sb.AppendLine("{");
            //    break;
            //case Enums.CodeType.BusinessObjectCached:
            //    AddAWholeFile(applicationPath + @"\CsharpBOImports.txt", ref sb);
            //    className = classBaseName + "BO";
            //    sb.AppendLine("public class " + className);
            //    sb.AppendLine("{");
            //    break;
            //case Enums.CodeType.DataAccess:
            //    AddAWholeFile(applicationPath + @"\CsharpBOImports.txt", ref sb);
            //    className = classBaseName + "DO";
            //    sb.AppendLine("");
            //    sb.AppendLine("public class " + className);
            //    sb.AppendLine("{");
            //    break;
            case Enums.CodeType.IServiceCallCode:
                className = "I" + classBaseName + "DataService";
                sb.AppendLine("using System.ServiceModel;");
                sb.AppendLine("[ServiceContract()]");
                sb.AppendLine("public interface " + className + dc.InterfaceName);
                sb.AppendLine("{");
                sb.AppendLine("#region " + className + " Methods");
                break;

            case Enums.CodeType.ServiceCallCode:
                className = classBaseName + "DataService";
                sb.AppendLine("using System;");
                //sb.AppendLine("using PA.DPW.PACSES.Utilities;");
                sb.AppendLine("public class " + className + "DataService");
                sb.Append(": " + " I" + className + dc.InterfaceName);
                sb.AppendLine("{");
                sb.AppendLine("#region " + className + " Methods");
                break;

            case Enums.CodeType.BusinessEntity:
                sb.AppendLine("using System.Runtime.Serialization;");
                sb.AppendLine("using System;");
                sb.AppendLine("using System.Data;");
                className = classBaseName + "BE";
                sb.AppendLine("namespace " + className);
                sb.AppendLine("{");
                break;

            default:
                className = "UnknownCodeType";
                break;
            }

            //for (int i = 0; i <= max; i++)
            //{
            dc.StoredProcedure = dc.Package;
            GenerateCSharpCode1(dc, ref sb);
            //    ProgressBar1.Value = i + 1;
            //    _with1.Append(dc.CodeOutput);
            //}

            switch (dc.CodeTypeToGenerate)
            {
            case Enums.CodeType.IServiceCallCode:
                sb.AppendLine("#endregion");
                sb.AppendLine("}");
                break;

            //case Enums.CodeType.DataAccess:
            //    AddAWholeFile(applicationPath + "\\CsharpparameterConversionFunctions.txt", ref sb);
            //    sb.AppendLine("}");
            //    break;
            //case Enums.CodeType.BusinessObject:
            //    sb.AppendLine("}");
            //    break;
            //case Enums.CodeType.BusinessObjectCached:
            //    AddAWholeFile(applicationPath + "\\CsharpcacheKeyHelper.txt", ref sb);
            //    sb.AppendLine("}");
            //    break;
            case Enums.CodeType.ServiceCallCode:
                sb.AppendLine("#endregion");
                sb.AppendLine("}");
                break;

            case Enums.CodeType.BusinessEntity:
                sb.AppendLine("}");
                break;

            default:
                break;
            }



            //applicationPath = path.Replace(@"\bin\Debug\", "");
            //applicationPath = applicationPath.Replace(@"Generator\AutoCodeGenerator", "");
            //applicationPath = applicationPath.Replace(@"Generator\\AutoCodeGenerator", "");
            //applicationPath = applicationPath + "Projects\\" + foldername + "\\";

            applicationPath = applicationPath + foldername + "\\";
            FileInfo fileInfo = new FileInfo(applicationPath + className + ".cs");

            if (!fileInfo.Exists)
            {
                // Create the file.
                using (FileStream fs = File.Create(applicationPath + className + ".cs"))
                {
                }
            }

            WriteTheFile(applicationPath + "" + className + ".cs", sb);

            //allCode.Append(sb.ToString);
        }
コード例 #44
0
 public BE.Radio Modificar(BE.Radio entidad)
 {
     throw new NotImplementedException();
 }
コード例 #45
0
 public void Eliminar(BE.Radio entidad)
 {
     throw new NotImplementedException();
 }
コード例 #46
0
ファイル: Tag.cs プロジェクト: attackgithub/QSharp
            public void run()
            {
                try {
                    String lastValue = tag.value;
                    if (tag.parent == null)
                    {
                        if (!tag.c.IsConnected())
                        {
                            if (!tag.Connect())
                            {
                                return;
                            }
                        }
                    }
                    data = tag.Read();
                    if (data == null)
                    {
                        Console.WriteLine("Error:" + DateTime.GetMilliSecondsSinceEpoch() + ":data==null:host=" + tag.Host + ":tag=" + tag.Name);
                        return;
                    }
                    if (tag.IsBE())
                    {
                        switch (tag.Size)
                        {
                        case TagType.Bit: tag.value = data[0] == 0 ? "0" : "1"; break;

                        case TagType.Int8: tag.value = Byte.ToString(data[0]); break;

                        case TagType.Int16: tag.value = Int32.ToString(BE.getuint16(data, 0)); break;

                        case TagType.Int32: tag.value = Int32.ToString(BE.getuint32(data, 0)); break;

                        case TagType.Float32: tag.value = Float.ToString(Float.IntBitsToFloat(BE.getuint32(data, 0))); break;

                        case TagType.Float64: tag.value = Double.ToString(Double.LongBitsToDouble(BE.getuint64(data, 0))); break;
                        }
                    }
                    else
                    {
                        switch (tag.Size)
                        {
                        case TagType.Bit: tag.value = data[0] == 0 ? "0" : "1"; break;

                        case TagType.Int8: tag.value = Byte.ToString(data[0]); break;

                        case TagType.Int16: tag.value = Int32.ToString((short)LE.getuint16(data, 0)); break;

                        case TagType.Int32: tag.value = Int32.ToString(LE.getuint32(data, 0)); break;

                        case TagType.Float32: tag.value = Float.ToString(Float.IntBitsToFloat(LE.getuint32(data, 0))); break;

                        case TagType.Float64: tag.value = Double.ToString(Double.LongBitsToDouble(LE.getuint64(data, 0))); break;
                        }
                    }
                    lock (tag.pendingLock) {
                        if (tag.pending != null)
                        {
                            tag.Write(tag.pending);
                        }
                    }
                    if (tag.listener == null)
                    {
                        return;
                    }
                    if (lastValue == null || !tag.value.Equals(lastValue))
                    {
                        tag.listener.TagChanged(tag, tag.value);
                    }
                } catch (Exception e) {
                    Console.WriteLine(e.ToString());
                }
            }
コード例 #47
0
ファイル: TypeBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.Type type)
 {
     return new TypeRepository().Delete(type);
 }
コード例 #48
0
ファイル: StageBL.cs プロジェクト: yoorke/zrchiptuning
 public bool Delete(BE.Stage stage)
 {
     return new StageRepository().Delete(stage);
 }