Наследование: MonoBehaviour
Пример #1
0
 public override void UpdateAnimate(GameTime mGameTime)
 {
     if (TIME.StopWatch(300, mGameTime))
     {
         CURRENTFRAME = (++CURRENTFRAME) % 3;
     }
 }
Пример #2
0
        public override void UpdateAnimate(GameTime mGameTime)
        {
            switch (STATUS)
            {
            case MyStatus.ACTIVE:
                if (TIME.StopWatch(100, mGameTime))
                {
                    CURRENTFRAME = (CURRENTFRAME + 1) % 3;
                }
                break;

            case MyStatus.SHOT:
                CURRENTFRAME = 0;
                break;

            case MyStatus.HURT:
                CURRENTFRAME = 2;
                PERCENT      = Rdn.Next(0, 255);
                break;

            case MyStatus.BEFORE_DEATH1:
                CURRENTFRAME = 2;
                PERCENT      = Rdn.Next(0, 255);
                scale        = new Vector2((float)Rdn.Next(3, 6) / 3, (float)Rdn.Next(3, 6) / 3);
                break;
            }
        }
Пример #3
0
    public void cadastroTime()
    {
        String        nome;
        String        historia;
        int           ano;
        int           nroTorcedores;
        int           nroTitulos;
        TIME          time;
        CadastrarTime cadastro = new CadastrarTime();

        Console.WriteLine("Insira o nome do time:");
        nome = Console.ReadLine();

        Console.WriteLine("Insira a história do time:");
        historia = Console.ReadLine();

        Console.WriteLine("Insira o ano de fundaçao do time:");
        ano = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Insira a quantidade média de torcedores");
        nroTorcedores = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Insira o número de títulos do time:");
        nroTitulos = Convert.ToInt32(Console.ReadLine());

        time = new TIME(nome, historia, ano, nroTorcedores, nroTitulos);
        cadastro.SalvarTime(time);

        Console.WriteLine("Time Cadastrado!");
    }
        /// <summary> 获取当前时间前的所有生产信息 </summary>
        public List <WELLCTRL> GetAllWellBeforeTime(BaseKey sch, DateTime time = default(DateTime))
        {
            if (time == default(DateTime))
            {
                time = DateTime.MaxValue;
            }


            // Todo :比当前时间小的所有WELL关键字
            var wells = sch.FindAll <WELLCTRL>(l =>
            {
                if (l.ParentKey != null && l.ParentKey is TIME)
                {
                    TIME t = l.ParentKey as TIME;

                    return(time.Date.Date <= time.Date);
                }
                else
                {
                    return(false);
                }
            });

            return(wells);
        }
Пример #5
0
        private void buttonConfirmar_Click(object sender, EventArgs e)
        {
            CadastrarTime cadastrarTime = new CadastrarTime();
            TIME          time          = new TIME(
                textBoxNome.Text,
                textBoxHistoria.Text,
                ((textBoxAnoFundacao.Text != "") ? (Convert.ToInt32(textBoxAnoFundacao.Text)):(0)),
                ((textBoxQtdeTorcedores.Text != "") ? (Convert.ToInt32(textBoxQtdeTorcedores.Text)) : (0)),
                ((textBoxQtdeTitulos.Text != "") ? (Convert.ToInt32(textBoxQtdeTitulos.Text)) : (0))
                );

            cadastrarTime.SalvarTime(time);

            if (time != null)
            {
                labelMensagem.Text      = "Inserido com Sucesso !";
                labelMensagem.ForeColor = Color.Green;
                LimparTela();
            }
            else
            {
                labelMensagem.Text      = "Não foi possível inserir!";
                labelMensagem.ForeColor = Color.Red;
            }
        }
Пример #6
0
 public void SalvarTime(TIME time)
 {
     using (CAMPEONATOSEntities context = new CAMPEONATOSEntities())
     {
         context.TIME.Add(time);
         context.SaveChanges();
     }
 }
    // Update is called once per frame
    void Update()
    {
        TIME tm = RTime.GetComponent <TIME> ();

        if (tm.hTime <= 0)
        {
            Application.LoadLevel(nextsceneA);
        }
    }
Пример #8
0
 public override bool Equals(object obj)
 {
     return(obj is OFFICER oFFICER &&
            NATION == oFFICER.NATION &&
            OFFICE == oFFICER.OFFICE &&
            AUTHORITY == oFFICER.AUTHORITY &&
            TIME.Equals(oFFICER.TIME) &&
            BY == oFFICER.BY &&
            ORDER == oFFICER.ORDER);
 }
Пример #9
0
 virtual public void UpdateAnimation(GameTime gameTime)
 {
     if (TIME.StopWatch(100, gameTime))
     {
         m_CurFrame++;
         if (m_CurFrame > m_EndFrame)
         {
             m_CurFrame = m_StartFrame;
         }
     }
 }
Пример #10
0
    public void ActiveTimeManager()
    {
        time = PlayerPrefs.GetFloat(saveTime, 0);
        day  = PlayerPrefs.GetInt(saveDay, 0);
        StartCoroutine(SaveTime());
        flowTime  = true;
        timestate = TIME.FLOW;
        PlayerPrefs.SetInt(saveState, (int)timestate);

        SmallTimerObject.SetActive(true);
    }
Пример #11
0
 public override void UpdateAnimate(GameTime mGameTime)
 {
     switch (STATUS)
     {
     case MyStatus.RUN:
     case MyStatus.ACTIVE:
         if (TIME.StopWatch(100, mGameTime))
         {
             CURRENTFRAME = 0;
         }
         break;
     }
 }
Пример #12
0
 public override void UpdateAnimate(GameTime mGameTime)
 {
     switch (STATUS)
     {
     case MyStatus.ACTIVE:
         if (TIME.StopWatch(100, mGameTime))
         {
             CURRENTFRAME = (CURRENTFRAME + 1) % 3;
         }
         break;
         //case MyStatus.BEFORE_DEATH1:
         //    CURRENTFRAME = 2;
         //    break;
     }
 }
Пример #13
0
        public override void UpdateAnimate(GameTime mGameTime)
        {
            switch (STATUS)
            {
            case MyStatus.ACTIVE:
                if (mGameTime.TotalGameTime.TotalMilliseconds % 600 < 100)
                {
                    CURRENTFRAME = 0;
                }
                else
                if (mGameTime.TotalGameTime.TotalMilliseconds % 600 < 200)
                {
                    CURRENTFRAME = 1;
                }
                else
                if (mGameTime.TotalGameTime.TotalMilliseconds % 600 < 300)
                {
                    CURRENTFRAME = 2;
                }
                else
                if (mGameTime.TotalGameTime.TotalMilliseconds % 600 < 400)
                {
                    CURRENTFRAME = 3;
                }
                else
                if (mGameTime.TotalGameTime.TotalMilliseconds % 600 < 500)
                {
                    CURRENTFRAME = 4;
                }
                else
                {
                    CURRENTFRAME = 5;
                }
                break;

            case MyStatus.START:
                break;

            case MyStatus.BEFORE_DEATH1:
                if (TIME.StopWatch(100, mGameTime))
                {
                    //CURRENTFRAME = (CURRENTFRAME + 1) % 6;
                    CURRENTFRAME = (CURRENTFRAME - 2) % 4 + 3;
                }
                rota += mGameTime.ElapsedGameTime.Milliseconds;
                break;
            }
        }
Пример #14
0
    private void Start()
    {
        BigRt     = BigTimerInner.GetComponent <RectTransform>();
        SmallRt   = SmallTimerInner.GetComponent <RectTransform>();
        timestate = (TIME)PlayerPrefs.GetInt(saveState, 0);
        cmd       = FindObjectOfType <CreateMapData>();

        if (timestate == TIME.FLOW)
        {
            time = PlayerPrefs.GetFloat(saveTime, 0);
            day  = PlayerPrefs.GetInt(saveDay, 1);
            StartCoroutine(SaveTime());
            flowTime = true;
            SmallTimerObject.SetActive(true);
        }
    }
Пример #15
0
        public override void UpdateAnimate(GameTime mGameTime)
        {
            switch (STATUS)
            {
            case MyStatus.ACTIVE:
                SIZE = new Vector3(26, 26, 0);
                if (TIME.StopWatch(100, mGameTime))
                {
                    CURRENTFRAME = (CURRENTFRAME + 1) % 4;
                }
                break;

            case MyStatus.BEFORE_DEATH1:
                SIZE         = new Vector3(34, 34, 0);
                CURRENTFRAME = (CURRENTFRAME - 3) % 6 + 4;
                break;
            }
        }
Пример #16
0
        private void GetGPSDate()
        {
            string   date  = Request["date"].ToString();
            DateTime dt    = Convert.ToDateTime(date);
            int      doy   = dt.DayOfYear;
            TIME     ttime = new TIME();

            ttime.wYear   = dt.Year;
            ttime.byMonth = dt.Month;
            ttime.byDay   = dt.Day;
            GPSTIME gpstime = new GPSTIME();

            time.tmTimeToGPSTime(ref ttime, ref gpstime);
            time.tmGPSTimeToTime(ref gpstime, ref ttime);
            int gpsweek   = Convert.ToInt32(gpstime.lWeek);
            int dayofweek = Convert.ToInt32(ttime.byDayOfWeek);

            Response.ContentType = "text/plain";
            Response.Write("1;" + gpsweek + ";" + dayofweek + ";" + doy);
            Response.End();
        }
Пример #17
0
        public override void UpdateAnimate(GameTime mGameTime)
        {
            switch (STATUS)
            {
            case MyStatus.ACTIVE:
                if (TIME.StopWatch(100, mGameTime))
                {
                    CURRENTFRAME = (CURRENTFRAME + 1) % 2;
                }
                break;

            case MyStatus.BEFORE_DEATH1:
            case MyStatus.STATIC:
                CURRENTFRAME = 3;
                break;

            case MyStatus.RUN:
                if (TIME.StopWatch(100, mGameTime))
                {
                    CURRENTFRAME = Math.Abs((CURRENTFRAME - 1) % 3) + 2;
                }
                break;
            }
        }
Пример #18
0
 private static PointF SchematicLocationForNode(TIME.DataTypes.NodeLinkNetwork.Node n, SchematicNetworkConfigurationPersistent schematic)
 {
     return schematic.ExistingFeatureShapeProperties.Where(shape=>shape.Feature==n).Select(shape=>shape.Location).FirstOrDefault();
 }
Пример #19
0
 public static void PauseTime(bool toggle)
 {
     TIME.PAUSE_CLOCK(toggle);
 }
Пример #20
0
        /// <summary> 将Eclipse生产数据转换成SimON生产数据 </summary>
        public SCHEDULE ConvertToSimON(SCHEDULE sch, WELL location, DateTime startTime, BaseFile history)
        {
            // Todo :保存SCH

            SCHEDULE schedule = new SCHEDULE("SCHEDULE");

            List <string> wellNames = new List <string>();

            List <WELSPECS> ws = sch.FindAll <WELSPECS>();

            // Todo :查找所有井名
            ws.ForEach(l => wellNames.AddRange(l.Items.Select(k => k.jm0)));

            List <NAME> histNames = new List <NAME>();

            // Todo :初始化名称 生产_historyproduction.dat
            wellNames.ForEach(l => histNames.Add(new NAME("NAME")
            {
                WellName = l
            }));

            histNames.ForEach(l => history.Key.Add(l));


            // Todo :初始化完井WELL数据
            List <NAME> names = new List <NAME>();

            wellNames.ForEach(l => names.Add(new NAME("NAME")
            {
                WellName = l
            }));

            names.ForEach(l => location.Add(l));

            List <DATES> ds = sch.FindAll <DATES>();

            string format = "井名:{0} ({1},{2})";

            // Todo :添加起始信息到时间步
            DATES start = new DATES("DATES", startTime);

            sch.DeleteAll <DATES>();

            start.AddRange <BaseKey>(sch.Keys);

            ds.Insert(0, start);

            List <PERF> comAllTemp = new List <PERF>();

            foreach (DATES d in ds)
            {
                // Todo :对缓存中完井井名去重复取最后一条
                var distincts = comAllTemp.GroupBy(l => l.WellName + l.I0 + l.J1 + l.K12).ToList();
                comAllTemp.Clear();
                foreach (var item in distincts)
                {
                    comAllTemp.Add(item.Last());
                }

                //  创建SimON日期
                TIME time = new TIME("TIME");
                time.Date = d.DateTime;
                schedule.Add(time);

                var wconprod = d.FindAll <WCONPROD>();
                var wconhist = d.FindAll <WCONHIST>();
                var wconinje = d.FindAll <WCONINJE>();
                var wconinjh = d.FindAll <WCONINJH>();

                //  完井数据(考虑到排序)
                List <BaseKey> compdats = d.FindAll <BaseKey>(l => l is COMPDAT || l is WELOPEN);

                List <WPIMULT> wpimult = d.FindAll <WPIMULT>();

                List <WELOPEN> welopen = d.FindAll <WELOPEN>();

                #region - 添加没有生产信息的完井 -
                //  添加完井数据
                foreach (BaseKey c in compdats)
                {
                    if (c is COMPDAT)
                    {
                        COMPDAT com = c as COMPDAT;

                        foreach (COMPDAT.Item citem in com.Items)
                        {
                            // Todo :过滤有生产数据的,用后面方法处理
                            if (wconprod.Exists(l => l.Items.Exists(k => k.jm0 == citem.jm0)))
                            {
                                continue;
                            }
                            if (wconhist.Exists(l => l.Items.Exists(k => k.wellName0 == citem.jm0)))
                            {
                                continue;
                            }
                            if (wconinje.Exists(l => l.Items.Exists(k => k.jm0 == citem.jm0)))
                            {
                                continue;
                            }
                            if (wconinjh.Exists(l => l.Items.Exists(k => k.jm0 == citem.jm0)))
                            {
                                continue;
                            }

                            WELLCTRL well = time.Find <WELLCTRL>(l => l.WellName0 == citem.jm0);

                            if (well == null)
                            {
                                // Todo :创建一个空的生产信息
                                well           = new WELLCTRL("WELLCTRL");
                                well.ProType   = SimONProductType.NA;
                                well.WellName0 = citem.jm0;
                                time.Add(well);
                            }

                            NAME name = names.Find(l => l.WellName == well.WellName0);

                            #region - SCh数据 -

                            PERF perf = new PERF("PERF");
                            perf.WellName = well.WellName0;
                            perf.I0       = citem.i1;
                            perf.J1       = citem.j2;
                            perf.K12      = citem.swg3;
                            perf.K23      = citem.xwg4;
                            perf.Kgbs4    = citem.kgbz5;
                            perf.Jzs6     = citem.ljyz7;
                            perf.WjfxX7   = citem.skfx12 == "X" ? "DX" : "0";
                            perf.WjfxY8   = citem.skfx12 == "Y" ? "DY" : "0";
                            perf.WjfxZ9   = citem.skfx12 == "Z" ? "DZ" : "0";
                            perf.Bp10     = citem.bpxs10;

                            // Todo :查找井指数乘子
                            foreach (WPIMULT wp in wpimult)
                            {
                                var v = wp.Items.Find(l => l.jm0 == well.WellName0);

                                if (v != null)
                                {
                                    perf.Jzscz5 = v.jzscz1;
                                    break;
                                }
                            }

                            // Todo :增加前先删除存在的重复数据
                            well.DeleteAll <PERF>(l => l.I0 == perf.I0 && l.J1 == perf.J1 && l.K12 == perf.K12);
                            well.Add(perf);

                            #endregion

                            #region - WELL数据 -

                            NAME.Item nameItem = new NAME.Item();
                            nameItem.i0    = citem.i1;
                            nameItem.j1    = citem.j2;
                            nameItem.k12   = citem.swg3;
                            nameItem.k23   = citem.xwg4;
                            nameItem.kgbz4 = citem.kgbz5;
                            //nameItem.wi5 = "NA";// v.Value.skin.Value.Value.ToString();
                            //nameItem.dx6 = v.Value.wellIndex.Value.GetValue(v.Value.wellIndex.GetUnitValue(_ecl)).ToString();
                            //nameItem.dy7 = v.Value.wellDirection.Value.Value == "X" ? "0" : v.Value.wellDirection.Value.Value == "Y" ? "1" : "2";
                            nameItem.bpxs9 = citem.bpxs10;
                            nameItem.jj10  = (citem.jtnj8.ToDouble() / 2).ToString();
                            name.Items.Add(nameItem);
                            #endregion

                            comAllTemp.Add(perf);
                        }
                    }
                    else if (c is WELOPEN)
                    {
                        WELOPEN wp = c as WELOPEN;

                        foreach (var v in wp.Items)
                        {
                            // Todo :过滤有生产数据的,用后面方法处理
                            if (wconprod.Exists(l => l.Items.Exists(k => k.jm0 == v.jm0)))
                            {
                                continue;
                            }
                            if (wconhist.Exists(l => l.Items.Exists(k => k.wellName0 == v.jm0)))
                            {
                                continue;
                            }
                            if (wconinje.Exists(l => l.Items.Exists(k => k.jm0 == v.jm0)))
                            {
                                continue;
                            }
                            if (wconinjh.Exists(l => l.Items.Exists(k => k.jm0 == v.jm0)))
                            {
                                continue;
                            }
                            // WELOPEN
                            //'G13' 'SHUT' 0 0 0 2 * /
                            // /

                            // Todo :查找之前所有完井
                            var coms = comAllTemp.FindAll(l => l.WellName == v.jm0);

                            Predicate <PERF> match = l => true;

                            // Todo :0 或 *表示默认值全都取
                            if (v.i2 != KeyConfiger.EclipseDefalt && v.i2 != "0")
                            {
                                match += l => l.I0 == v.i2;
                            }

                            if (v.j3 != KeyConfiger.EclipseDefalt && v.j3 != "0")
                            {
                                match += l => l.J1 == v.j3;
                            }

                            if (v.k4 != KeyConfiger.EclipseDefalt && v.k4 != "0")
                            {
                                match += l => l.K12 == v.k4;
                            }

                            var findComs = coms.FindAll(match);

                            WELLCTRL well = time.Find <WELLCTRL>(l => l.WellName0 == v.jm0);
                            if (well == null)
                            {
                                // Todo :创建一个空的生产信息
                                well           = new WELLCTRL("WELLCTRL");
                                well.ProType   = SimONProductType.NA;
                                well.WellName0 = v.jm0;
                                time.Add(well);
                            }

                            // Todo :增加WELOPEN控制的完井
                            foreach (var fitem in findComs)
                            {
                                PERF perf = fitem.Copy();
                                perf.Kgbs4 = v.jz1;
                                // Todo :增加前先删除存在的重复数据
                                well.DeleteAll <PERF>(l => l.I0 == fitem.I0 && l.J1 == fitem.J1 && l.K12 == fitem.K12);
                                well.Add(perf);
                            }
                        }
                    }

                    //this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);
                }

                #endregion


                foreach (var item in wconprod)
                {
                    foreach (WCONPROD.ItemHY it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.jm0;

                        well = this.ConvertToSimON(it, d, histNames);

                        if (well != null)
                        {
                            this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                            time.Add(well);
                        }
                    }
                }


                foreach (var item in wconhist)
                {
                    foreach (WCONHIST.Item it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.wellName0;

                        well = this.ConvertToSimON(it, d, histNames);

                        this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                        time.Add(well);
                    }
                }


                foreach (var item in wconinje)
                {
                    foreach (WCONINJE.ItemHY it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.jm0;

                        well = this.ConvertToSimON(it, d, histNames);

                        this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                        time.Add(well);
                    }
                }

                foreach (var item in wconinjh)
                {
                    foreach (WCONINJH.Item it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.jm0;

                        well = this.ConvertToSimON(it, d, histNames);

                        this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                        time.Add(well);
                    }
                }

                //// Todo :将之前的完井信息都加入到缓存中
                //foreach (var item in compdats)
                //{
                //    comAllTemp.AddRange(item.Items);
                //}
            }

            return(schedule);
        }
Пример #21
0
 public LegacyDeck()
 {
     CurrentTime = TIME.JanStart;
 }
Пример #22
0
 public static void SetTime(int hours, int minutes, int seconds)
 {
     TIME.SET_CLOCK_TIME(hours, minutes, seconds);
 }
 public static extern uint timeSetEvent(uint uDelay, uint uResolution, TimerCallback lpTimeProc, UIntPtr dwUser, TIME fuEvent);
Пример #24
0
        public override void UpdateAnimate(GameTime mGameTime)
        {
            switch (STATUS)
            {
            //case MyStatus.UP:
            //case MyStatus.DOWN:
            case MyStatus.WIN:
            case MyStatus.CHANGE:
            case MyStatus.INVI:
            case MyStatus.ACTIVE:
                if (VELOC.X != 0)
                {
                    if (ACCEL.X * VELOC.X < 0)
                    {
                        CURRENTFRAME = 4;
                    }
                    else
                    {
                        if (TIME.StopWatch(100, mGameTime))
                        {
                            CURRENTFRAME = (CURRENTFRAME + 1) % 3;
                        }
                    }
                }
                else
                {
                    CURRENTFRAME = 0;
                }
                if (VELOC.Y != 0)
                {
                    CURRENTFRAME = 3;
                }
                if (dri * VELOC.X < 0)
                {
                    dri *= -1;
                }
                if (STATUS == MyStatus.INVI || STATUS == MyStatus.CHANGE)
                {
                    PERCENT = ((Game1)Game).rnd.Next(0, 255);
                }
                //if (STATUS == MyStatus.UP || STATUS == MyStatus.DOWN)
                //{
                //    scale = new Vector2((float)((Game1)Game).rnd.Next(3, 6) / 3, (float)((Game1)Game).rnd.Next(3, 6) / 3);
                //    PERCENT = ((Game1)Game).rnd.Next(0, 255);
                //}
                break;

            case MyStatus.SHOT:
                CURRENTFRAME = 2;
                break;

            case MyStatus.BEFORE_DEATH1:
                CURRENTFRAME = 5;
                break;

            case MyStatus.UP:
            case MyStatus.DOWN:
                CURRENTFRAME = 0;
                scale        = new Vector2((float)((Game1)Game).rnd.Next(3, 6) / 3, (float)((Game1)Game).rnd.Next(3, 6) / 3);
                PERCENT      = ((Game1)Game).rnd.Next(0, 255);
                break;
            }
        }
Пример #25
0
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("LogicalType");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                if (STRING != null && __isset.@STRING)
                {
                    field.Name = "STRING";
                    field.Type = TType.Struct;
                    field.ID   = 1;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await STRING.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (MAP != null && __isset.MAP)
                {
                    field.Name = "MAP";
                    field.Type = TType.Struct;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await MAP.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (LIST != null && __isset.LIST)
                {
                    field.Name = "LIST";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await LIST.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (ENUM != null && __isset.@ENUM)
                {
                    field.Name = "ENUM";
                    field.Type = TType.Struct;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await ENUM.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (DECIMAL != null && __isset.@DECIMAL)
                {
                    field.Name = "DECIMAL";
                    field.Type = TType.Struct;
                    field.ID   = 5;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await DECIMAL.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (DATE != null && __isset.DATE)
                {
                    field.Name = "DATE";
                    field.Type = TType.Struct;
                    field.ID   = 6;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await DATE.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (TIME != null && __isset.TIME)
                {
                    field.Name = "TIME";
                    field.Type = TType.Struct;
                    field.ID   = 7;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await TIME.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (TIMESTAMP != null && __isset.TIMESTAMP)
                {
                    field.Name = "TIMESTAMP";
                    field.Type = TType.Struct;
                    field.ID   = 8;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await TIMESTAMP.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (INTEGER != null && __isset.INTEGER)
                {
                    field.Name = "INTEGER";
                    field.Type = TType.Struct;
                    field.ID   = 10;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await INTEGER.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (UNKNOWN != null && __isset.UNKNOWN)
                {
                    field.Name = "UNKNOWN";
                    field.Type = TType.Struct;
                    field.ID   = 11;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await UNKNOWN.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (JSON != null && __isset.JSON)
                {
                    field.Name = "JSON";
                    field.Type = TType.Struct;
                    field.ID   = 12;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await JSON.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (BSON != null && __isset.BSON)
                {
                    field.Name = "BSON";
                    field.Type = TType.Struct;
                    field.ID   = 13;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await BSON.WriteAsync(oprot, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
        /// <summary> 通关生产数据创建生产数据(目前只应用在FieldGoal案例重启)  </summary>
        public SCHEDULE InitRestartSchduleRestartCase(SCHEDULE sch, RestartInfoModelSimON model, string name, DateTime time, DateTime endtime, Dictionary <string, double> wellProducts, int datype)
        {
            //  创建关键字
            SCHEDULE schedule = new SCHEDULE("SCHEDULE");
            INCLUDE  include  = new INCLUDE("INCLUDE");

            include.FileName = name + "_SCH.DAT";
            include.FilePath = Path.GetDirectoryName(model.ResultFilePath) + "//" + include.FileName;
            model.SchPath    = include.FilePath;
            schedule.Add(include);

            include.Add(new USESTARTTIME("USESTARTTIME"));
            include.Add(new RECURRENT("WELLSCHED"));
            TIME start = new TIME("TIME", time);

            foreach (var item in wellProducts)
            {
                WELLCTRL well = new WELLCTRL("WELLCTRL");
                well.WellName0 = item.Key;
                well.ProType   = datype == 0 ? SimONProductType.GRAT : datype == 1? SimONProductType.ORAT: SimONProductType.LRAT;
                well.Jcyblxz2  = item.Value.ToString();
                start.Add(well);
            }

            TIME startAdd = new TIME("TIME", time.AddDays(1));

            TIME end = new TIME("TIME", endtime);

            end.Add(new RegisterKeys.SimON.STEPRST("STEPRST"));

            List <VFPINJ> Vins = sch.FindAll <VFPINJ>();

            List <VFPPROD> Vpns = sch.FindAll <VFPPROD>();

            if (Vins.Count > 0)
            {
                include.AddRange(Vins);
            }

            if (Vpns.Count > 0)
            {
                include.AddRange(Vpns);
            }

            include.Add(start);

            if (startAdd.Date < end.Date)
            {
                include.Add(startAdd);
            }

            if (end.Date.Date == start.Date.Date)
            {
                include.Add(startAdd);
            }
            else
            {
                include.Add(end);
            }



            // HTodo  :保存生产文件
            include.Save();

            return(schedule);


            // HTodo  :示例如下
            //USESTARTTIME
            //WELLSCHED
            //TIME    20140209D
            //       WELL   'PROD1'   4   9000   1500
            //       WELL   'INIJ1'   5   6000   NA

            //TIME    20140210D

            //TIME    20140309D
            //RESTART
        }
Пример #27
0
 public ScheduledEvent(VHDLBaseValue _value, TIME delay)
 {
     this._value = _value;
     this.delay  = (UInt64)delay.Value;
 }
Пример #28
0
 static public void SetTime(TIME t)
 {
     time = t;
 }
Пример #29
0
        public AdsErrorCode ReadAny(uint indexGroup, uint indexOffset, Type type, bool throwAdsException, out object value)
        {
            AdsErrorCode code;

            if (!type.IsPrimitive)
            {
                if (type == typeof(string))
                {
                    throw new ArgumentException("Use overload ReadAnyString(uint indexGroup, uint indexOffset,  Type type, int characters) for strings.", "type");
                }
                if (type.IsArray)
                {
                    throw new ArgumentException("Use overload ReadAny(uint indexGroup, uint indexOffset,  Type type, int[] args) for arrays.", "type");
                }
                if (type == typeof(TimeSpan))
                {
                    uint milliseconds = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
                    value = PlcOpenTimeConverter.MillisecondsToTimeSpan(milliseconds);
                }
                else if (type == typeof(DateTime))
                {
                    uint dateValue = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
                    value = PlcOpenDateConverterBase.ToDateTime(dateValue);
                }
                else if (type == typeof(TIME))
                {
                    uint timeValue = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
                    value = new TIME(timeValue);
                }
                else if (type == typeof(LTIME))
                {
                    ulong timeValue = base.ReadUInt64(indexGroup, indexOffset, throwAdsException, out code);
                    value = new LTIME(timeValue);
                }
                else if (type == typeof(TOD))
                {
                    uint time = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
                    value = new TOD(time);
                }
                else if (type == typeof(DATE))
                {
                    uint dateValue = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
                    value = new DATE(dateValue);
                }
                else if (type != typeof(DT))
                {
                    value = base.ReadStruct(indexGroup, indexOffset, type, throwAdsException, out code);
                }
                else
                {
                    uint dateValue = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
                    value = new DT(dateValue);
                }
            }
            else if (type == typeof(bool))
            {
                value = base.ReadBoolean(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(int))
            {
                value = base.ReadInt32(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(short))
            {
                value = base.ReadInt16(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(byte))
            {
                value = base.ReadUInt8(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(float))
            {
                value = base.ReadReal32(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(double))
            {
                value = base.ReadReal64(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(long))
            {
                value = base.ReadInt64(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(uint))
            {
                value = base.ReadUInt32(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(ushort))
            {
                value = base.ReadUInt16(indexGroup, indexOffset, throwAdsException, out code);
            }
            else if (type == typeof(ulong))
            {
                value = base.ReadUInt64(indexGroup, indexOffset, throwAdsException, out code);
            }
            else
            {
                if (type != typeof(sbyte))
                {
                    throw new ArgumentException("Unable to marshal type.", "type");
                }
                value = base.ReadInt8(indexGroup, indexOffset, throwAdsException, out code);
            }
            return(code);
        }
Пример #30
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("LogicalType(");
            bool          __first = true;

            if (STRING != null && __isset.@STRING)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("STRING: ");
                __sb.Append(STRING == null ? "<null>" : STRING.ToString());
            }
            if (MAP != null && __isset.MAP)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("MAP: ");
                __sb.Append(MAP == null ? "<null>" : MAP.ToString());
            }
            if (LIST != null && __isset.LIST)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("LIST: ");
                __sb.Append(LIST == null ? "<null>" : LIST.ToString());
            }
            if (ENUM != null && __isset.@ENUM)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("ENUM: ");
                __sb.Append(ENUM == null ? "<null>" : ENUM.ToString());
            }
            if (DECIMAL != null && __isset.@DECIMAL)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("DECIMAL: ");
                __sb.Append(DECIMAL == null ? "<null>" : DECIMAL.ToString());
            }
            if (DATE != null && __isset.DATE)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("DATE: ");
                __sb.Append(DATE == null ? "<null>" : DATE.ToString());
            }
            if (TIME != null && __isset.TIME)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("TIME: ");
                __sb.Append(TIME == null ? "<null>" : TIME.ToString());
            }
            if (TIMESTAMP != null && __isset.TIMESTAMP)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("TIMESTAMP: ");
                __sb.Append(TIMESTAMP == null ? "<null>" : TIMESTAMP.ToString());
            }
            if (INTEGER != null && __isset.INTEGER)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("INTEGER: ");
                __sb.Append(INTEGER == null ? "<null>" : INTEGER.ToString());
            }
            if (UNKNOWN != null && __isset.UNKNOWN)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("UNKNOWN: ");
                __sb.Append(UNKNOWN == null ? "<null>" : UNKNOWN.ToString());
            }
            if (JSON != null && __isset.JSON)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("JSON: ");
                __sb.Append(JSON == null ? "<null>" : JSON.ToString());
            }
            if (BSON != null && __isset.BSON)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("BSON: ");
                __sb.Append(BSON == null ? "<null>" : BSON.ToString());
            }
            if (UUID != null && __isset.UUID)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("UUID: ");
                __sb.Append(UUID == null ? "<null>" : UUID.ToString());
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
Пример #31
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("LogicalType");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (STRING != null && __isset.@STRING)
         {
             field.Name = "STRING";
             field.Type = TType.Struct;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             STRING.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (MAP != null && __isset.MAP)
         {
             field.Name = "MAP";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             MAP.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (LIST != null && __isset.LIST)
         {
             field.Name = "LIST";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             LIST.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (ENUM != null && __isset.@ENUM)
         {
             field.Name = "ENUM";
             field.Type = TType.Struct;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             ENUM.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (DECIMAL != null && __isset.@DECIMAL)
         {
             field.Name = "DECIMAL";
             field.Type = TType.Struct;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             DECIMAL.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (DATE != null && __isset.DATE)
         {
             field.Name = "DATE";
             field.Type = TType.Struct;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             DATE.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (TIME != null && __isset.TIME)
         {
             field.Name = "TIME";
             field.Type = TType.Struct;
             field.ID   = 7;
             oprot.WriteFieldBegin(field);
             TIME.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (TIMESTAMP != null && __isset.TIMESTAMP)
         {
             field.Name = "TIMESTAMP";
             field.Type = TType.Struct;
             field.ID   = 8;
             oprot.WriteFieldBegin(field);
             TIMESTAMP.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (INTEGER != null && __isset.INTEGER)
         {
             field.Name = "INTEGER";
             field.Type = TType.Struct;
             field.ID   = 10;
             oprot.WriteFieldBegin(field);
             INTEGER.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (UNKNOWN != null && __isset.UNKNOWN)
         {
             field.Name = "UNKNOWN";
             field.Type = TType.Struct;
             field.ID   = 11;
             oprot.WriteFieldBegin(field);
             UNKNOWN.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (JSON != null && __isset.JSON)
         {
             field.Name = "JSON";
             field.Type = TType.Struct;
             field.ID   = 12;
             oprot.WriteFieldBegin(field);
             JSON.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (BSON != null && __isset.BSON)
         {
             field.Name = "BSON";
             field.Type = TType.Struct;
             field.ID   = 13;
             oprot.WriteFieldBegin(field);
             BSON.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (UUID != null && __isset.UUID)
         {
             field.Name = "UUID";
             field.Type = TType.Struct;
             field.ID   = 14;
             oprot.WriteFieldBegin(field);
             UUID.Write(oprot);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }