Exemplo n.º 1
0
    public void SwapOver()
    {
        if (FindObjectOfType <T5>())
        {
            mapScript = FindObjectOfType <T5>();
            mapScript.ChangeMap();
        }

        int i;

        for (i = players.Count - 1; i > -1; i--)
        {
            if (i != 0)
            {
                if (players[i - 1].playerController.gameObject.GetComponent <SeekerScript>())
                {
                    SpawnSeeker(players[i]);
                    continue;
                }
            }
            SpawnHider(players[i]);
        }

        for (i = players.Count - 1; i > -1; i--)
        {
            if (players[i].playerController.gameObject.GetComponent <SeekerScript>())
            {
                break;
            }
            if (i == 0)
            {
                SpawnSeeker(players[i]);
            }
        }
    }
        public void Test9()
        {
            IServiceCollection sc = new ServiceCollection()
                                    .AddLightweightMapper();

            IServiceProvider sp       = sc.BuildServiceProvider();
            IMapperProvider  provider = sp.GetRequiredService <IMapperProvider>();

            S5 s5 = new S5()
            {
                S1 = new S1()
                {
                    A = 10
                }
            };

            s5.Self = s5;

            T5 t5 = provider.Convert <S5, T5>(s5);

            Assert.Equal(t5.Self, t5);
            Assert.Equal(10, t5.T1.A);

            // List
            List <S5> list = new List <S5>();

            list.Add(s5);
            list.Add(s5);
            list.Add(s5);

            List <T5> t5List = provider.ConvertList <S5, T5>(list);

            Assert.NotNull(t5List);
            Assert.Equal(3, t5List.Count);
            Assert.Equal(t5List[0], t5List[1]);
            Assert.Equal(t5List[0], t5List[2]);

            Dictionary <S5, S5> dic = new Dictionary <S5, S5>()
            {
                { s5, s5 },
                { new S5()
                  {
                      S1 = new S1 {
                          A = 11
                      }
                  }, s5 }
            };

            var targetDic = provider.Convert <Dictionary <S5, S5>, Dictionary <T5, T5> >(dic);

            Assert.NotNull(targetDic);
            Assert.Equal(2, targetDic.Count);
            var item1 = dic.First();
            var item2 = dic.Last();

            Assert.Equal(item1.Value, item2.Value);
            Assert.Equal(item1.Key, item1.Value);
            Assert.Equal(11, item2.Key.S1.A);
        }
Exemplo n.º 3
0
        public ActionResult Index(BasePagerModel pager)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new { controller = "Login", action = "LogOut" }));
            }
            int uid = PageValidate.FilterParam(User.Identity.Name);

            if (!RoleCheck.CheckHasAuthority(uid, db, "用户管理"))
            {
                return(RedirectToRoute(new { controller = "Error", action = "Index", err = "没有权限。" }));
            }
            if (pager == null)
            {
                pager = new BasePagerModel();
            }
            ViewData["search"] = pager;
            var list = (from user in db.User_Info
                        join uvr in db.User_vs_Role
                        on user.user_id equals uvr.uvr_user_id into T1
                        from t1 in T1.DefaultIfEmpty()
                        join role in db.Dic_Role
                        on t1.uvr_role_id equals role.role_id into T2
                        from t2 in T2.DefaultIfEmpty()
                        join ue in db.User_Extend
                        on user.user_id equals ue.user_id into T3
                        from t3 in T3.DefaultIfEmpty()
                        join dept in db.Dic_Department
                        on t3.user_dept_id equals dept.dept_id into T4
                        from t4 in T4.DefaultIfEmpty()
                        join post in db.Dic_Post
                        on t3.user_post_id equals post.post_id into T5
                        from t5 in T5.DefaultIfEmpty()
                        orderby user.user_id ascending
                        select new UserListModel
            {
                id = user.user_id,
                name = user.user_name,
                roleName = t2.role_name == null?"":t2.role_name,
                stateTxt = user.user_state == 1 ? "正常" : (user.user_state == 2 ? "锁定" : (user.user_state == 0 ? "未启用" : "未知")),
                realName = user.real_name,
                times = user.user_login_times,
                deptName = t4.dept_name == null?"":t4.dept_name,
                postName = t5.post_name == null?"":t5.post_name,
                picture = t3.user_picture == null?"default.jpg":t3.user_picture,
                loginTimes = user.user_login_times
            }).Skip((pager.PageIndex - 1) * pager.PageSize).Take(pager.PageSize).ToList();

            foreach (var item in list)
            {
                item.realName = Common.DEncrypt.AESEncrypt.Decrypt(item.realName);
            }
            return(View(list));
        }
Exemplo n.º 4
0
                /// <summary>
                /// Method invoked when delegate is executed
                /// </summary>
                /// <param name="arg1"></param>
                /// <param name="arg2"></param>
                /// <param name="arg3"></param>
                /// <param name="arg4"></param>
                /// <param name="arg5"></param>
                /// <returns></returns>
                public TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
                {
                    var newContext = _context?.Clone() ?? _injectionContextCreator.CreateContext(null);

                    newContext.SetExtraData(_arg1Id, arg1);
                    newContext.SetExtraData(_arg2Id, arg2);
                    newContext.SetExtraData(_arg3Id, arg3);
                    newContext.SetExtraData(_arg4Id, arg4);
                    newContext.SetExtraData(_arg5Id, arg5);

                    return((TResult)_action(_scope, _disposalScope, newContext));
                }
Exemplo n.º 5
0
        public void SendMessage(object clientSocket)
        {
            // while (true)
            // {
            Socket  myClientSocket = (Socket)clientSocket;
            Message c = DealMsg7(Encoding.Unicode.GetString(result));

            //MessageBox.Show(c.type);
            if (c.type == "05")
            {
                //Message b = new Message();
                c.msg5_Au_TS5 = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                //this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText(c.msg2_TS2); }));
                this.Dispatcher.Invoke(new Action(() => { T3.AppendText(c.MMessage5(c)); }));
                DateTime ssmg = DateTime.Parse(c.msg5_Au_TS5).AddSeconds(1);
                this.Dispatcher.Invoke(new Action(() => { T5.AppendText(ssmg.ToString("yyyy/MM/dd HH:mm:ss")); }));
                // this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText(ssmg.Length.ToString()); }));
                string Cssmg;
                Cssmg = ssMessage(c);
                this.Dispatcher.Invoke(new Action(() => { T4.AppendText(Cssmg); }));
                Byte[] ssmg1 = new byte[1024];
                ssmg1 = Encoding.ASCII.GetBytes(Cssmg);
                //int num1 = myClientSocket.Send(ssmg1);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
                // Thread sendThread = new Thread(SendMessage);
                // sendThread.Start(myClientSocket);
                // myClientSocket.Close();
            }
            if (c.type == "09")
            {
                // MessageBox.Show(c.msg1_IDc);
                string ssmg;
                ssmg = ssMessage12(c);
                //MessageBox.Show(ssmg);
                Byte[] ssmg1 = new byte[1024];
                ssmg1 = Encoding.Unicode.GetBytes(ssmg);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
                // myClientSocket.Close();
            }
            if (c.type == "07")
            {
                string ssmg;
                ssmg = ssMessage8(c);
                //MessageBox.Show(ssmg);
                Byte[] ssmg1 = new byte[2048];
                ssmg1 = Encoding.Unicode.GetBytes(ssmg);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
                //myClientSocket.Close();
            }
            // myClientSocket.Close();
            //}
        }
Exemplo n.º 6
0
        static T5 ParsingT5(string sBit)
        {
            //Console.WriteLine ("len: {1}, sBit: {0}", sBit, sBit.Length);
            T5 stt = new T5();

            stt.type      = Convert.ToUInt16(bin2int(sBit.Substring(0, 6)));
            stt.repeat    = Convert.ToUInt16(bin2int(sBit.Substring(6, 2)));
            stt.mmsi      = Convert.ToUInt32(bin2int(sBit.Substring(8, 30)));
            stt.ais_v     = Convert.ToUInt16(bin2int(sBit.Substring(38, 2)));
            stt.imo       = Convert.ToUInt32(bin2int(sBit.Substring(40, 30)));
            stt.callsign  = str6bit(sBit.Substring(70, 42));
            stt.vessel    = str6bit(sBit.Substring(112, 120));
            stt.shiptype  = Convert.ToUInt16(bin2int(sBit.Substring(232, 8)));
            stt.bow       = Convert.ToUInt16(bin2int(sBit.Substring(240, 9)));
            stt.stern     = Convert.ToUInt16(bin2int(sBit.Substring(249, 9)));
            stt.port      = Convert.ToUInt16(bin2int(sBit.Substring(258, 6)));
            stt.starboard = Convert.ToUInt16(bin2int(sBit.Substring(264, 6)));
            stt.epfd      = Convert.ToUInt16(bin2int(sBit.Substring(270, 4)));
            stt.month     = Convert.ToUInt16(bin2int(sBit.Substring(274, 4)));
            stt.day       = Convert.ToUInt16(bin2int(sBit.Substring(278, 5)));
            stt.hour      = Convert.ToUInt16(bin2int(sBit.Substring(283, 5)));
            stt.minute    = Convert.ToUInt16(bin2int(sBit.Substring(288, 6)));
            stt.draught   = (float)((bin2int(sBit.Substring(294, 8))) / 10.0);
            stt.dest      = str6bit(sBit.Substring(302, 120));
            stt.dte       = Convert.ToBoolean(bin2int(sBit.Substring(422, 1)));

                        #if DISP_DEBUG
            Console.WriteLine("tip: {0}", stt.type);
            Console.WriteLine("rep: {0}", stt.repeat);
            Console.WriteLine("mms: {0} ", stt.mmsi);
            Console.WriteLine("ais: {0}", stt.ais_v);
            Console.WriteLine("imo: {0}", stt.imo);
            Console.WriteLine("cls: {0}", stt.callsign);
            Console.WriteLine("vsl: {0}", stt.vessel);
            Console.WriteLine("sty: {0}", stt.shiptype);
            Console.WriteLine("bow: {0}", stt.bow);
            Console.WriteLine("ste: {0}", stt.stern);
            Console.WriteLine("por: {0}", stt.port);
            Console.WriteLine("stb: {0}", stt.starboard);
            Console.WriteLine("epf: {0}", stt.epfd);
            Console.WriteLine("mon: {0}", stt.month);
            Console.WriteLine("mon: {0}", stt.month);
            Console.WriteLine("day: {0}", stt.day);
            Console.WriteLine("hou: {0}", stt.hour);
            Console.WriteLine("min: {0}", stt.minute);
            Console.WriteLine("dra: {0}", stt.draught);
            Console.WriteLine("des: {0}", stt.dest);
            Console.WriteLine("dte: {0}", stt.dte);
                        #endif

            return(stt);
        }
Exemplo n.º 7
0
        public override int GetHashCode()
        {
            var hashCode = 2018318558;

            hashCode = hashCode * -1521134295 + T1.GetHashCode();
            hashCode = hashCode * -1521134295 + T2.GetHashCode();
            hashCode = hashCode * -1521134295 + T3.GetHashCode();
            hashCode = hashCode * -1521134295 + T4.GetHashCode();
            hashCode = hashCode * -1521134295 + T5.GetHashCode();
            hashCode = hashCode * -1521134295 + P1.GetHashCode();
            hashCode = hashCode * -1521134295 + P2.GetHashCode();
            hashCode = hashCode * -1521134295 + P3.GetHashCode();
            hashCode = hashCode * -1521134295 + P4.GetHashCode();
            hashCode = hashCode * -1521134295 + P5.GetHashCode();
            hashCode = hashCode * -1521134295 + JunctionIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + NearestJunctionIndex.GetHashCode();
            return(hashCode);
        }
        public override int GetHashCode()
        {
            var hashCode = -1044093539;

            hashCode = hashCode * -1521134295 + T1.GetHashCode();
            hashCode = hashCode * -1521134295 + T2.GetHashCode();
            hashCode = hashCode * -1521134295 + T3.GetHashCode();
            hashCode = hashCode * -1521134295 + T4.GetHashCode();
            hashCode = hashCode * -1521134295 + T5.GetHashCode();
            hashCode = hashCode * -1521134295 + P1.GetHashCode();
            hashCode = hashCode * -1521134295 + P2.GetHashCode();
            hashCode = hashCode * -1521134295 + P3.GetHashCode();
            hashCode = hashCode * -1521134295 + P4.GetHashCode();
            hashCode = hashCode * -1521134295 + P5.GetHashCode();
            hashCode = hashCode * -1521134295 + JunctionIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + NearestJunctionIndex.GetHashCode();
            hashCode = hashCode * -1521134295 + Length.GetHashCode();
            hashCode = hashCode * -1521134295 + Lock.GetHashCode();
            return(hashCode);
        }
Exemplo n.º 9
0
 private void Clear(object sender, RoutedEventArgs e)
 {
     T1.Clear();
     T2.Clear();
     T3.Clear();
     T4.Clear();
     T5.Clear();
     T6.Clear();
     T7.Clear();
     T8.Clear();
     T9.Clear();
     T10.Clear();
     T11.Clear();
     T12.Clear();
     T13.Clear();
     T14.Clear();
     T15.Clear();
     T16.Clear();
     T17.Clear();
 }
Exemplo n.º 10
0
    public override void OnServerAddPlayer(NetworkConnection conn, AddPlayerMessage extraMessage)
    {
        if (FindObjectOfType <Seeker>())
        {
            first = false;
        }
        base.OnServerAddPlayer(conn, extraMessage);
        if (first)
        {
            SpawnSeeker(conn);
            first = false;
        }
        else
        {
            SpawnHider(conn);
        }

        players.Add(conn);
        mapScript = FindObjectOfType <T5>();
        mapScript.CmdSendMap();
    }
Exemplo n.º 11
0
        private String Step(T5 s, String inp)
        {
            Char c;

            try
            {
                c = PreStep(ref inp);
            }
            catch (EndOfStringException)
            {
                return("");
            }

            if (DECIMAL.Contains(c))
            {
                _state = States.T5;
                return(c.ToString() + Step(new T5(), inp));
            }

            throw new CannotParseException();
        }
Exemplo n.º 12
0
        private Dictionary <Tuple <T1, T2, T3, T4, T5, T6>, int> CollectKeys6 <T1, T2, T3, T4, T5, T6>()
        {
            Debug.Assert(_keyColumns.Length == 6);

            var column1  = _dataMap[_keyColumns[0]].UnderlyingList;
            var column2  = _dataMap[_keyColumns[1]].UnderlyingList;
            var column3  = _dataMap[_keyColumns[2]].UnderlyingList;
            var column4  = _dataMap[_keyColumns[3]].UnderlyingList;
            var column5  = _dataMap[_keyColumns[4]].UnderlyingList;
            var column6  = _dataMap[_keyColumns[5]].UnderlyingList;
            var rowCount = _dataMap.MaxRowCount;
            var result   = new Dictionary <Tuple <T1, T2, T3, T4, T5, T6>, int>(rowCount);

            for (var i = 0; i < rowCount; ++i)
            {
                T1 k1 = i >= column1.Count ? TypeTrait <T1> .GetNaN() : (T1)column1[i];

                T2 k2 = i >= column2.Count ? TypeTrait <T2> .GetNaN() : (T2)column2[i];

                T3 k3 = i >= column3.Count ? TypeTrait <T3> .GetNaN() : (T3)column3[i];

                T4 k4 = i >= column4.Count ? TypeTrait <T4> .GetNaN() : (T4)column4[i];

                T5 k5 = i >= column5.Count ? TypeTrait <T5> .GetNaN() : (T5)column5[i];

                T6 k6 = i >= column6.Count ? TypeTrait <T6> .GetNaN() : (T6)column6[i];

                var key = Tuple.Create(k1, k2, k3, k4, k5, k6);
                try
                {
                    result.Add(key, i);
                }
                catch (ArgumentException ex)
                {
                    throw new ArgumentException($"Duplicate key values: {key}", ex);
                }
            }

            return(result);
        }
Exemplo n.º 13
0
        public static float EaseEvaluate(float time, int mode)
        {
            if (time >= 1.0)
            {
                return(1.0f);
            }
            else if (time <= 0.0)
            {
                return(0.0f);
            }
            switch (mode)
            {
            case 1: return(T1.Evaluate(time));

            case 2: return(T2.Evaluate(time));

            case 3: return(T3.Evaluate(time));

            case 4: return(T4.Evaluate(time));

            case 5: return(T5.Evaluate(time));

            case 6: return(T6.Evaluate(time));

            case 7: return(T7.Evaluate(time));

            case 8: return(T8.Evaluate(time));

            case 9: return(T9.Evaluate(time));

            case 10: return(T10.Evaluate(time));

            case 11: return(T11.Evaluate(time));

            case 12: return(T12.Evaluate(time));

            default: return(time);
            }
        }
Exemplo n.º 14
0
        public MainGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.Window.Title    = "XNA";
            this.IsFixedTimeStep = false;
            this.IsMouseVisible  = true;

            graphics.SynchronizeWithVerticalRetrace = true;

            this.SetScreenMode();

            this.previousKeyboard = Keyboard.GetState();

            this.tryb1 = new T1(this);
            Components.Add(this.tryb1);

            this.tryb2 = new T2(this);
            Components.Add(this.tryb2);

            this.tryb3 = new T3(this);
            Components.Add(this.tryb3);

            this.tryb4 = new T4(this);
            Components.Add(this.tryb4);

            this.tryb5 = new T5(this);
            Components.Add(this.tryb5);

            this.textField = new TextArea(this);
            Components.Add(this.textField);

            FPS  = new FpsCounter();
            TIME = new TimeCounter();

            sw = new Stopwatch();
        }
 protected void ImageButton5_Click(object sender, ImageClickEventArgs e)
 {
     T.Text = "";
     T.Focus();
     T1.Text = "";
     T1.Focus();
     T2.Text = "";
     T2.Focus();
     T3.Text = "";
     T3.Focus();
     T4.Text = "";
     T4.Focus();
     T5.Text = "";
     T5.Focus();
     T6.Text = "";
     T6.Focus();
     T7.Text = "";
     T7.Focus();
     T8.Text = "";
     T8.Focus();
     T9.Text = "";
     T9.Focus();
 }
Exemplo n.º 16
0
        public void SequenceAdd()
        {
            var particle = new CompositeParticle.Builder(ParticleType.Sequence, 0, 1)
            {
                new ElementParticle(typeof(T1), 0, 1),
                new ElementParticle(typeof(T2), 0, 1),
                new ElementParticle(typeof(T3), 0, 1),
                new ElementParticle(typeof(T4), 0, 1),
                new ElementParticle(typeof(T5), 0, 1),
                new ElementParticle(typeof(T6), 0, 1),
            }.Compile();

            var data = new TestOpenXmlCompositeElement();
            var t1   = new T1();
            var t3   = new T3();
            var t5   = new T5();

            Assert.Empty(data);

            particle.GetCollection <T1>(data).Add(t1);
            Assert.Collection(
                data,
                e => Assert.Same(e, t1));

            particle.GetCollection <T3>(data).Add(t3);
            Assert.Collection(
                data,
                e => Assert.Same(e, t1),
                e => Assert.Same(e, t3));

            particle.GetCollection <T5>(data).Add(t5);
            Assert.Collection(
                data,
                e => Assert.Same(e, t1),
                e => Assert.Same(e, t3),
                e => Assert.Same(e, t5));
        }
Exemplo n.º 17
0
        private void StageRev(int page)
        {
            WagoIO.Instance.SetListTC(lst, page);

            T1.StageRev("АВАРИЯ^НОСИТЕЛЯ", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T2.StageRev("", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T3.StageRev("Р по^ПАДАЕТ", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T4.StageRev("СРАБОТАЛ^ТД", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T5.StageRev("", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T6.StageRev("ОТКАЗ^БВС", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T7.StageRev("Pса^ПАДАЕТ", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T8.StageRev("РАЗГЕРМ^СА", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T9.StageRev("РАЗГЕРМ^КЖО", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T10.StageRev("Р400^мм рт ст", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T11.StageRev("СОСТАВ^ВОЗДУХА", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T12.StageRev("РАЗГЕРМ^КНР", new SolidColorBrush(Colors.Red), new SolidColorBrush(Colors.Silver));
            T13.StageRev("PАЗГЕРМ^ПОДГОТ", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
            T14.StageRev("РАЗДЕЛЕН^по ГЦ", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
            T15.StageRev("ОТКРЫТ^КСД БО", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
            T16.StageRev("АВАРИЯ^ЦВМ", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
            T17.StageRev("ПРОГР^РАЗДЕЛЕН", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
            T18.StageRev("ТД^ПОДКЛ", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
            T19.StageRev("ПРИЗНАК^СПУСК", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
            T20.StageRev("СГ^РАЗАРР", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
            T21.StageRev("РАБОТА^ДПО", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
            T22.StageRev("СПУСК^ПО ГЦ", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
            T23.StageRev("ВЫБОР^ДПО", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
            T24.StageRev("РАБОТА^СКД", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
            Block1 = "TC-1";
            Block2 = "TC-2";
            Block3 = "TC-3";
            Block4 = "TC-4";

            if (page == 2)
            {
                T1.StageRev("БС", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T2.StageRev("БСР", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T3.StageRev("закрутка^СА", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T4.StageRev("ВЫЗОВ НА^СВЯЗЬ", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T5.StageRev("разреш^РРСТ", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T6.StageRev("U мало", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));

                T7.StageRev("ввод^ЗСП", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T8.StageRev("отказ^очист СА", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T9.StageRev("ПОСАДКА", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T10.StageRev("РБ^подкл", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T11.StageRev("отказ^очист БО", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));
                T12.StageRev("останов^КС-020", new SolidColorBrush(Colors.Yellow), new SolidColorBrush(Colors.Silver));

                T13.StageRev("БВC^готов", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T14.StageRev("ОСК", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T15.StageRev("ГСО", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T16.StageRev("2 СЕКЦИЯ^НАДДУВА", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T17.StageRev("2 СЕКЦИЯ^КДУ", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T18.StageRev("СА-БО^люк откр", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));

                T19.StageRev("РО АК", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T20.StageRev("ввод^ОСП", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T21.StageRev("подача^O2", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T22.StageRev("РУД", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T23.StageRev("УКВ^передача", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));
                T24.StageRev("МЕХАН^СОЕДИН", new SolidColorBrush(Colors.Green), new SolidColorBrush(Colors.Silver));

                Block1 = "TC-5";
                Block2 = "TC-6";
                Block3 = "TC-7";
                Block4 = "TC-8";
            }
        }
Exemplo n.º 18
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (Running == true)
            {
                //Lauf ist wurde beendet
                if (Run == "stopped")
                {
                    Run = "inactiv";

                    Console.WriteLine("Run had been finished");
                    log.Items.Insert(0, "Lauf beendet");
                    logTime.Items.Insert(0, "--:--");
                    logTime2.Items.Insert(0, "---");

                    Console.WriteLine("==========================");
                    log.Items.Insert(0, "=====================");
                    logTime.Items.Insert(0, "==:==");
                    logTime2.Items.Insert(0, "===");

                    //Abfrage von streamdata.php
                    WebClient wc         = new WebClient();
                    string    livetiming = wc.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/streamdata.php");
                    Console.WriteLine(livetiming);

                    //streamdata auswerten
                    string[] words         = livetiming.Split('?');
                    string   lane          = "0";
                    string   lane_1_meters = "0";
                    string   lane_2_meters = "0";
                    string   lane_3_meters = "0";
                    string   lane_4_meters = "0";
                    string   lane_1_time   = "0";
                    string   lane_2_time   = "0";
                    string   lane_3_time   = "0";
                    string   lane_4_time   = "0";
                    foreach (string word in words)
                    {
                        string[] words2 = word.Split('#');
                        foreach (string word2 in words2)
                        {
                            if (word2 == "1")
                            {
                                lane = "1";
                            }
                            if (word2 == "2")
                            {
                                lane = "2";
                            }
                            if (word2 == "3")
                            {
                                lane = "3";
                            }
                            if (word2 == "4")
                            {
                                lane = "4";
                            }
                            if (word2 == "50" || word2 == "100" || word2 == "200")
                            {
                                if (lane == "1")
                                {
                                    lane_1_meters = word2;
                                }
                                if (lane == "2")
                                {
                                    lane_2_meters = word2;
                                }
                                if (lane == "3")
                                {
                                    lane_3_meters = word2;
                                }
                                if (lane == "4")
                                {
                                    lane_4_meters = word2;
                                }
                            }

                            if (lane != "0" || word2 != "1" || word2 != "2" || word2 != "3" || word2 != "4" || word2 != "50" || word2 != "100" || word2 != "200")
                            {
                                if (lane == "1")
                                {
                                    lane_1_time = word2;
                                }
                                if (lane == "2")
                                {
                                    lane_2_time = word2;
                                }
                                if (lane == "3")
                                {
                                    lane_3_time = word2;
                                }
                                if (lane == "4")
                                {
                                    lane_4_time = word2;
                                }
                            }
                        }
                    }

                    Console.WriteLine("=====================");
                    Console.WriteLine("Run before:");
                    Console.WriteLine("=====================");
                    Console.WriteLine("Lane 1:");
                    Console.WriteLine("Meters: " + lane_1_meters);
                    Console.WriteLine("Time:   " + lane_1_time);
                    Console.WriteLine("=====================");
                    Console.WriteLine("Lane 2:");
                    Console.WriteLine("Meters: " + lane_2_meters);
                    Console.WriteLine("Time:   " + lane_2_time);
                    Console.WriteLine("=====================");
                    Console.WriteLine("Lane 3:");
                    Console.WriteLine("Meters: " + lane_3_meters);
                    Console.WriteLine("Time:   " + lane_3_time);
                    Console.WriteLine("=====================");
                    Console.WriteLine("Lane 4:");
                    Console.WriteLine("Meters: " + lane_4_meters);
                    Console.WriteLine("Time:   " + lane_4_time);
                    Console.WriteLine("=====================");

                    //streamdata auswerten
                    string[] words3 = livetiming.Split('#');
                    Wk_l   = "0";
                    Meters = "0";
                    int forcount = 0;
                    foreach (string word3 in words3)
                    {
                        forcount++;
                        if (forcount == 1)
                        {
                            Wk_l = word3;
                        }
                        if (forcount == 2)
                        {
                            int      forcount2 = 0;
                            string[] words4    = word3.Split('m');
                            foreach (string word4 in words4)
                            {
                                forcount2++;
                                if (forcount2 == 1)
                                {
                                    Meters = word4;
                                }
                            }
                        }
                    }

                    Console.WriteLine("");
                    Console.WriteLine("WK:      " + Wk_l);
                    Console.WriteLine("Strecke: " + Meters + "m");
                    Console.WriteLine("");
                    Console.WriteLine("=====================");

                    //Zeiten mit richtigen Metern in Array
                    string StrRuntimes = "";

                    if (lane_1_meters == Meters)
                    {
                        StrRuntimes = StrRuntimes + "#" + lane_1_time;
                        Console.WriteLine(StrRuntimes);
                    }

                    if (lane_2_meters == Meters)
                    {
                        StrRuntimes = StrRuntimes + "#" + lane_2_time;
                        Console.WriteLine(StrRuntimes);
                    }

                    if (lane_3_meters == Meters)
                    {
                        StrRuntimes = StrRuntimes + "#" + lane_3_time;
                        Console.WriteLine(StrRuntimes);
                    }

                    if (lane_4_meters == Meters)
                    {
                        StrRuntimes = StrRuntimes + "#" + lane_4_time;
                        Console.WriteLine(StrRuntimes);
                    }

                    string[] Runtimes = StrRuntimes.Split('#');

                    int TimeFast = 10000000;

                    foreach (string Time in Runtimes)
                    {
                        if (!String.IsNullOrEmpty(Time))
                        {
                            Console.WriteLine("Zeit:");
                            Console.WriteLine(Time);

                            //Sekunden berechnen
                            string Time_min_str = Time.Substring(0, 2);
                            string Time_sek_str = Time.Substring(3, 2);

                            int Time_min = Int32.Parse(Time_min_str);
                            int Time_sek = Int32.Parse(Time_sek_str);

                            if (Time_min == 1)
                            {
                                Time_sek = Time_sek + 60;
                            }

                            if (Time_min == 02)
                            {
                                Time_sek = Time_sek + 120;
                            }

                            if (Time_min == 03)
                            {
                                Time_sek = Time_sek + 180;
                            }

                            if (Time_sek <= TimeFast)
                            {
                                TimeFast = Time_sek;
                            }
                        }
                    }

                    Run_sek = TimeFast;
                }
                //während keinem Lauf
                if (Run == "inactiv")
                {
                    //Abfrage, ob Lauf wieder gestartet
                    WebClient wc2         = new WebClient();
                    string    livetimingD = wc2.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/livetime2.php");
                    if (livetimingD.Contains("Bahn"))
                    {
                        Run = "started";
                    }
                }

                //wenn Lauf gestartet:
                if (Run == "started")
                {
                    Run = "activ";
                    //Abfrage welche Strecke geschwommen wird
                    WebClient wc3         = new WebClient();
                    string    livetimingD = wc3.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/streamdata.php");
                    Console.WriteLine(livetimingD);
                    Console.WriteLine("Run has been started!");
                    Console.WriteLine("");

                    log.Items.Insert(0, "Lauf wurde gestartet");
                    logTime.Items.Insert(0, "00:00");
                    logTime2.Items.Insert(0, "0");

                    //Werte aktueller Lauf
                    string distance = Meters;

                    //Szenenwechsel berechnen

                    //für 50m Stecken
                    if (distance == "50")
                    {
                        T1         = Math.Round(Run_sek * 0.3);
                        T2         = Math.Round(Run_sek * 0.7);
                        Time1.Text = T1.ToString();
                        Time2.Text = T2.ToString();
                        Time3.Text = " ";
                        Time4.Text = " ";
                        Time5.Text = " ";
                        Time6.Text = " ";
                        Time7.Text = " ";
                        Time8.Text = " ";
                    }
                    if (distance == "100")
                    {
                        T1         = Math.Round(Run_sek * 0.15);
                        T2         = Math.Round(Run_sek * 0.35);
                        T3         = Math.Round(Run_sek * 0.65);
                        T4         = Math.Round(Run_sek * 0.85);
                        Time1.Text = T1.ToString();
                        Time2.Text = T2.ToString();
                        Time3.Text = T3.ToString();
                        Time4.Text = T4.ToString();
                        Time5.Text = " ";
                        Time6.Text = " ";
                        Time7.Text = " ";
                        Time8.Text = " ";
                    }
                    if (distance == "200")
                    {
                        T1         = Math.Round(Run_sek * 0.075);
                        T2         = Math.Round(Run_sek * 0.175);
                        T3         = Math.Round(Run_sek * 0.325);
                        T4         = Math.Round(Run_sek * 0.425);
                        T5         = Math.Round(Run_sek * 0.575);
                        T6         = Math.Round(Run_sek * 0.675);
                        T7         = Math.Round(Run_sek * 0.825);
                        T8         = Math.Round(Run_sek * 0.925);
                        Time1.Text = T1.ToString();
                        Time2.Text = T2.ToString();
                        Time3.Text = T3.ToString();
                        Time4.Text = T4.ToString();
                        Time5.Text = T5.ToString();
                        Time6.Text = T6.ToString();
                        Time7.Text = T7.ToString();
                        Time8.Text = T8.ToString();
                    }


                    Console.WriteLine(Run_sek);
                    log.Items.Insert(0, "Sekunden: " + Run_sek);
                    logTime.Items.Insert(0, "00:00");
                    logTime2.Items.Insert(0, "0");

                    progressBar.Maximum = Run_sek;

                    TimeCount  = 0;
                    Count      = 0;
                    Count2     = 0;
                    clock.Text = "00:00";

                    //Auslesen streamdata.php für WK
                    WebClient wc         = new WebClient();
                    string    livetiming = wc.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/streamdata.php");

                    //WK ermitteln
                    string[] words3 = livetiming.Split('#');
                    Wk_c   = "0";
                    Meters = "0";
                    int forcount = 0;
                    foreach (string word3 in words3)
                    {
                        forcount++;
                        if (forcount == 1)
                        {
                            Wk_c = word3;
                        }

                        if (forcount == 2)
                        {
                            int      forcount2 = 0;
                            string[] words4    = word3.Split('m');
                            foreach (string word4 in words4)
                            {
                                forcount2++;
                                if (forcount2 == 1)
                                {
                                    Meters_c = word4;
                                }
                            }
                        }
                    }
                    Console.WriteLine("WK:      " + Wk_c);
                    Console.WriteLine("WK (l):  " + Wk_l);

                    WkBox.Text = Wk_c;

                    DistanceBox.Text = Meters_c + "m";
                }

                //während des Laufes:
                if (Run == "activ")
                {
                    //timer hochzählen
                    TimeCount = TimeCount + 1;
                    Console.WriteLine(TimeCount);
                    Count = Count + 1;
                    string display;
                    string display2;
                    if (Count >= 60)
                    {
                        Count = 0;
                        Count2++;
                    }

                    if (Count < 10)
                    {
                        display = "0" + Count.ToString();
                    }
                    else
                    {
                        display = Count.ToString();
                    }

                    if (Count2 < 10)
                    {
                        display2 = "0" + Count2.ToString();
                    }
                    else
                    {
                        display2 = Count2.ToString();
                    }

                    string output = display2 + ":" + display;
                    clock.Text   = output;
                    TimeBox.Text = "" + TimeCount;



                    //wenn stichzeiten gleich aktueller Zeit Kamera wechseln
                    if (Wk_c == Wk_l)
                    {
                        if (TimeCount == T1)
                        {
                            Console.WriteLine("Change Scene to webcam 2");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 2");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^M");

                            T1 = 0;
                        }
                        if (TimeCount == T2)
                        {
                            Console.WriteLine("Change Scene to webcam 1");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 1");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^N");

                            T2 = 0;
                        }
                        if (TimeCount == T3)
                        {
                            Console.WriteLine("Change Scene to webcam 2");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 2");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^M");

                            T3 = 0;
                        }
                        if (TimeCount == T4)
                        {
                            Console.WriteLine("Change Scene to webcam 1");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 1");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^N");

                            T4 = 0;
                        }
                        if (TimeCount == T5)
                        {
                            Console.WriteLine("Change Scene to webcam 2");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 2");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^M");

                            T5 = 0;
                        }
                        if (TimeCount == T6)
                        {
                            Console.WriteLine("Change Scene to webcam 1");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 1");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^N");

                            T6 = 0;
                        }
                        if (TimeCount == T7)
                        {
                            Console.WriteLine("Change Scene to webcam 2");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 2");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^M");

                            T7 = 0;
                        }
                        if (TimeCount == T8)
                        {
                            Console.WriteLine("Change Scene to webcam 1");
                            log.Items.Insert(0, "Wechsle Szene zu Webcam 1");
                            logTime.Items.Insert(0, output);
                            logTime2.Items.Insert(0, TimeCount);

                            //OBS Anweisungen
                            SendKeys.Send("^N");

                            T8 = 0;
                        }
                    }
                    //Lauffortschritt in Progressbar
                    if (TimeCount <= Run_sek)
                    {
                        progressBar.Value = TimeCount;
                    }

                    //Abfrage, ob Lauf beendet
                    WebClient wc2         = new WebClient();
                    string    livetimingD = wc2.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/livetime2.php");
                    if (!livetimingD.Contains("Bahn"))
                    {
                        Run = "stopped";
                    }
                }
            }
            else
            {
                textBox1.Text = "angehalten";
            }
        }
Exemplo n.º 19
0
        List <CourseModel> SearchCourse(PageInfo pageInfo)
        {
            CreateSelect();
            var courses = (from c in db.Course_Infos
                           join r in db.Sys_ClassRooms
                           on c.c_room equals r.room_id into T1
                           from t1 in T1.DefaultIfEmpty()
                           join s in db.Sys_Schools
                           on t1.room_school_id equals s.sys_school_id into T2
                           from t2 in T2.DefaultIfEmpty()
                           join ty in db.Dic_Course_Types
                           on c.c_type_id equals ty.ct_id into T3
                           from t3 in T3.DefaultIfEmpty()
                           join tea in db.User_Infos
                           on c.c_teacher_id equals tea.user_id into T4
                           from t4 in T4.DefaultIfEmpty()
                           join ass in db.User_Infos
                           on c.c_assistant_id equals ass.user_id into T5
                           from t5 in T5.DefaultIfEmpty()
                           join season in db.Course_Seasons
                           on c.c_cs_id equals season.c_season_id into T6
                           from t6 in T6.DefaultIfEmpty()
                           join sub in db.Dic_Subjects
                           on c.c_sub_id equals sub.sub_id into T7
                           from t7 in T7.DefaultIfEmpty()
                           where t1.room_school_id == (pageInfo.school == 0 ? t1.room_school_id : pageInfo.school)
                           orderby new { c.c_cs_id, c.c_sub_id, c.course_name }
                           select new CourseModel
            {
                id = c.course_id,
                assistantName = t5.user_name,
                cost = c.course_cost,
                introduce = c.course_introduce,
                max = c.course_max_num,
                name = c.course_name,
                room = c.c_room,
                roomName = t1.room_id == 0 ? "" : t2.sys_school_name + t1.room_name,
                season = c.c_cs_id,
                seasonName = t6.c_season_name,
                subject = c.c_sub_id,
                subjectName = t7.sub_name,
                teacher = c.c_teacher_id,
                teacherName = t4.user_name,
                type = c.c_type_id,
                typeName = t3.ct_name,
                timeInfo = c.c_time_info
            });               //.Skip(pagesize*(pageindex-1)).Take(pagesize).ToList();

            if (pageInfo.room != 0)
            {
                courses = courses.Where(x => x.room == pageInfo.room);
            }
            if (pageInfo.season != 0)
            {
                courses = courses.Where(x => x.season == pageInfo.season);
            }
            if (pageInfo.subject != 0)
            {
                courses = courses.Where(x => x.subject == pageInfo.subject);
            }
            if (pageInfo.teacher != 0)
            {
                courses = courses.Where(x => x.teacher == pageInfo.teacher);
            }
            if (pageInfo.type != 0)
            {
                courses = courses.Where(x => x.type == pageInfo.type);
            }
            if (!string.IsNullOrEmpty(pageInfo.keyword))
            {
                courses = courses.Where(x => x.name.Contains(pageInfo.keyword));
            }
            pageInfo.count = courses.Count();
            if (pageInfo.pagesize == 0)
            {
                pageInfo.pagesize = 10;
            }
            if (pageInfo.pageindex == 0)
            {
                pageInfo.pageindex = 1;
            }
            pageInfo.pages     = (int)Math.Ceiling((decimal)pageInfo.count / pageInfo.pagesize);
            ViewData["search"] = pageInfo;
            var list = courses.Skip(pageInfo.pagesize * (pageInfo.pageindex - 1)).Take(pageInfo.pagesize).ToList();

            foreach (var course in list)
            {
                var time = (from cvt in db.Course_vs_Times
                            where cvt.cvt_course_id == course.id
                            orderby cvt.cvt_time ascending
                            select cvt.cvt_time
                            ).FirstOrDefault();
                course.beginDate = time;
            }
            return(list);
        }
 Public Shared Function Create(Of T1, T2, T3, T4, T5, T6, T7, T8)(item1 As T1, item2 As T2, item3 As T3, item4 As T4, item5 As T5, item6 As T6, item7 As T7, item8 As T8) As (T1, T2, T3, T4, T5, T6, T7, T8)
 Public Shared Function Create(Of T1, T2, T3, T4, T5, T6)(item1 As T1, item2 As T2, item3 As T3, item4 As T4, item5 As T5, item6 As T6) As (T1, T2, T3, T4, T5, T6)
Exemplo n.º 22
0
 public T4(T5 p1, string p2)
 {
     P1 = p1;
     P2 = p2;
 }
Exemplo n.º 23
0
        static bool TestTypeCheckKept_3()
        {
            object array = new T5[0];

            return(array is T5[]);            // Has to be true
        }
Exemplo n.º 24
0
        public void CalculatePerformance(double pressure, double temperature, double velocity, double commandedThrottle)
        {
            if (Tt7 == 0)
            {
                mainThrottle = commandedThrottle;
            }
            else
            {
                mainThrottle = Math.Min(commandedThrottle * 1.5, 1.0);
                abThrottle   = Math.Max(commandedThrottle - 0.667, 0);
            }

            p0 = pressure * 1000;          //freestream
            t0 = temperature;

            gamma_c = CalculateGamma(t0, 0);
            Cp_c    = CalculateCp(t0, 0);
            Cv_c    = Cp_c / gamma_c;
            R_c     = Cv_c * (gamma_c - 1);


            M0 = velocity / Math.Sqrt(gamma_c * R_c * t0);

            T1 = t0 * (1 + 0.5 * (gamma_c - 1) * M0 * M0);      //inlet
            P1 = p0 * Math.Pow(T1 / t0, gamma_c / (gamma_c - 1)) * TPR;

            double prat3 = CPR;
            double prat2 = FPR;
            double k     = FPR / CPR;
            double p     = Math.Pow(k, (gamma_c - 1) / eta_c / gamma_c);

            for (int i = 0; i < 20; i++)    //use iteration to calculate CPR
            {
                P2 = prat2 * P1;
                P3 = prat3 * P1;
                T2 = T1 * Math.Pow(prat2, (gamma_c - 1) / gamma_c / eta_c); //fan
                T3 = T1 * Math.Pow(prat3, (gamma_c - 1) / gamma_c / eta_c); //compressor

                T4 = (Tt4 - T3) * mainThrottle + T3;                        //burner
                P4 = P3;
                ff = Cp_c * (T4 - T3) / (Cp_c * (T4 - T3) + h_f);           //fuel fraction

                Cp_t = CalculateCp(T4, ff);

                T5 = T4 * TTR;      //turbine
                double x = prat3;

                prat3  = (1 + ff) * Cp_t * (T4 - T5) / T1 / Cp_c + 1 + BPR;
                prat3 /= 1 + BPR * p;
                prat3  = Math.Pow(prat3, eta_c * gamma_c / (gamma_c - 1));
                prat2  = k * prat3;

                if (Math.Abs(x - prat3) < 0.01)
                {
                    break;
                }
            }

            gamma_t = CalculateGamma(T5, ff);//gas parameters
            Cp_t    = CalculateCp(T5, ff);
            Cv_t    = Cp_t / gamma_t;
            R_t     = Cv_t * (gamma_t - 1);

            P5 = P4 * Math.Pow((1 - 1 / eta_t * (1 - TTR)), gamma_t / (gamma_t - 1));

            if (exhaustMixer && BPR > 0)                      //exhaust mixer
            {
                double Cp6 = (Cp_c * BPR + Cp_t) / (1 + BPR); //Cp of mixed flow -- kind of
                T6      = T5 * Cp_t / Cp6 * (1 + BPR * Cp_c * T2 / Cp_t / T5) / (1 + BPR);
                P6      = (P5 + BPR * 0.98 * P2) / (1 + BPR);
                ff     /= (1 + ff + BPR);
                gamma_t = CalculateGamma(T6, ff);//gas parameters
                Cp_t    = CalculateCp(T6, ff);
                Cv_t    = Cp_t / gamma_t;
                R_t     = Cv_t * (gamma_t - 1);
            }
            else
            {
                T6 = T5;
                P6 = P5;
            }


            if (Tt7 > 0)
            {
                T7 = (Tt7 - T6) * abThrottle * 3 + T6;//afterburner
            }
            else
            {
                T7 = T6;
            }

            P7 = P6;                                                     //rayleigh loss?

            ff_ab    = ff + Cp_t * (T7 - T6) / (Cp_t * (T7 - T6) + h_f); //fuel fraction
            gamma_ab = CalculateGamma(T7, ff_ab);                        //gas parameters
            Cp_ab    = CalculateCp(T7, ff_ab);
            Cv_ab    = Cp_ab / gamma_ab;
            R_ab     = Cv_ab * (gamma_ab - 1);

            //Nozzle code is from NASA
            double P8 = P7;
            double T8 = T7;

            double p8, V8, A8;
            double epr = P8 / P1;
            double etr = T8 / T1;

            double area8max = .75 * Math.Sqrt(etr) / epr;//ratio of nozzle area to ref area

            A8 = area8max * Aref;
            if (exhaustMixer && BPR > 0)
            {
                A8 *= (1 + BPR);
            }
            double eair = P8 * Math.Sqrt(gamma_ab / R_ab / T8) *
                          Math.Pow((.5 + .5 * gamma_ab), .5 * (1 + gamma_ab) / (1 - gamma_ab));//corrected mass flow per area

            mdot = eair * A8;
            double npr  = P8 / p0;
            double fac1 = (gamma_ab - 1.0) / gamma_ab;

            V8     = Math.Sqrt(2.0 * R_c / fac1 * T8 * eta_n * (1.0 - Math.Pow(1.0 / npr, fac1))); //exit velocity
            p8     = (npr <= 1.893) ? p0 : .52828 * P8;
            thrust = V8 * mdot + (p8 - p0) * A8;

            if (BPR > 0 && FPR > 1 && exhaustMixer == false)
            {
                fac1 = (gamma_c - 1) / gamma_c; //fan thrust from NASA
                double snpr   = P2 / p0;
                double ues    = Math.Sqrt(2.0 * R_c / fac1 * T2 * eta_n * (1.0 - Math.Pow(1.0 / snpr, fac1)));
                double pfexit = (snpr <= 1.893) ? p0 : .52828 * P2; //exit pressure of fan
                thrust += BPR * ues * mdot / (1 + ff_ab) + (pfexit - p0) * BPR * Aref;
            }


            double netthrust = thrust - mdot / (1 + ff_ab) * (1 + (exhaustMixer ? 0 : BPR)) * (velocity);//ram drag

            Isp = thrust / (mdot * ff_ab * 9.81);

            debugstring  = "";
            debugstring += "TTR:\t" + TTR.ToString("F3") + "\r\n";
            debugstring += "CPR:\t" + prat3.ToString("F3") + "\r\n";
            debugstring += "M0:\t" + M0.ToString("F3") + "\r\n";
            debugstring += "p0: " + p0.ToString("F2") + "\tt0: " + t0.ToString("F2") + "\r\n";
            debugstring += "P1: " + P1.ToString("F2") + "\tT1: " + T1.ToString("F2") + "\r\n";
            debugstring += "P2: " + P2.ToString("F2") + "\tT2: " + T2.ToString("F2") + "\r\n";
            debugstring += "P3: " + P3.ToString("F2") + "\tT3: " + T3.ToString("F2") + "\r\n";
            debugstring += "P4: " + P4.ToString("F2") + "\tT4: " + T4.ToString("F2") + "\r\n";
            debugstring += "P5: " + P5.ToString("F2") + "\tT5: " + T5.ToString("F2") + "\r\n";
            debugstring += "P6: " + P6.ToString("F2") + "\tT6: " + T6.ToString("F2") + "\r\n";
            debugstring += "P7: " + P7.ToString("F2") + "\tT7: " + T7.ToString("F2") + "\r\n";
            debugstring += "EPR: " + epr.ToString("F2") + "\tETR: " + etr.ToString("F2") + "\r\n";

            debugstring += "FF: " + ff.ToString("P") + "\t";
            debugstring += "FF_AB: " + ff_ab.ToString("P") + "\r\n";
            debugstring += "V8: " + V8.ToString("F2") + "\tA8: " + A8.ToString("F2") + "\r\n";
            debugstring += "Thrust: " + (thrust / 1000).ToString("F1") + "\tmdot: " + mdot.ToString("F2") + "\r\n";
            debugstring += "NetThrust: " + (netthrust / 1000).ToString("F1") + "\tSFC: " + (3600 / Isp).ToString("F3") + "\r\n";
            //Debug.Log(debugstring);
        }
Exemplo n.º 25
0
        public void TwoSequencesInChoice()
        {
            var particle = new CompositeParticle.Builder(ParticleType.Choice, 0, 1)
            {
                new ElementParticle(typeof(T1), 0, 1),
                new CompositeParticle.Builder(ParticleType.Sequence, 0, 1)
                {
                    new ElementParticle(typeof(T2), 0, 1),
                    new ElementParticle(typeof(T3), 0, 1),
                },
                new ElementParticle(typeof(T4), 0, 1),
                new CompositeParticle.Builder(ParticleType.Sequence, 0, 1)
                {
                    new ElementParticle(typeof(T5), 0, 1),
                    new ElementParticle(typeof(T6), 0, 1),
                },
            }.Compile();
            var data = new TestOpenXmlCompositeElement();

            var t1 = new T1();
            var t2 = new T2();
            var t3 = new T3();
            var t4 = new T4();
            var t5 = new T5();
            var t6 = new T6();

            Assert.True(particle.Set(data, t1));
            Assert.Collection(
                data,
                e => Assert.Same(t1, e));

            Assert.True(particle.Set(data, t2));
            Assert.Collection(
                data,
                e => Assert.Same(t2, e));

            Assert.True(particle.Set(data, t3));
            Assert.Collection(
                data,
                e => Assert.Same(t2, e),
                e => Assert.Same(t3, e));

            Assert.True(particle.Set(data, t4));
            Assert.Collection(
                data,
                e => Assert.Same(t4, e));

            Assert.True(particle.Set(data, t5));
            Assert.Collection(
                data,
                e => Assert.Same(t5, e));

            Assert.True(particle.Set(data, t6));
            Assert.Collection(
                data,
                e => Assert.Same(t5, e),
                e => Assert.Same(t6, e));

            Assert.True(particle.Set(data, t3));
            Assert.Collection(
                data,
                e => Assert.Same(t3, e));

            Assert.True(particle.Set(data, t2));
            Assert.Collection(
                data,
                e => Assert.Same(t2, e),
                e => Assert.Same(t3, e));
        }
Exemplo n.º 26
0
        /// <summary>
        /// 解析
        /// </summary>
        /// <typeparam name="T">目标类型</typeparam>
        /// <typeparam name="T1">目标类型包含的数组第1个实体类型</typeparam>
        /// <typeparam name="T2">目标类型包含的数组第2个实体类型</typeparam>
        /// <typeparam name="T3">目标类型包含的数组第3个实体类型</typeparam>
        /// <typeparam name="T4">目标类型包含的数组第4个实体类型</typeparam>
        /// <typeparam name="T5">目标类型包含的数组第5个实体类型</typeparam>
        /// <returns></returns>
        public T Parser <T, T1, T2, T3, T4, T5>() where T : BaseEntity, new() where T1 : IHL7ArrayItem, new()
            where T2 : IHL7ArrayItem, new() where T3 : IHL7ArrayItem, new() where T4 : IHL7ArrayItem, new() where T5 : IHL7ArrayItem, new()
        {
            T    t    = new T();
            Type type = typeof(T);

            foreach (PropertyInfo p in type.GetProperties())
            {
                string path = type.GetCustomAttributeValue <HL7FiledAttribute>(x => x.XPath, p.Name);
                if (!string.IsNullOrEmpty(path))
                {
                    var attr = p.GetCustomAttribute <HL7FiledAttribute>();
                    if (!attr.IsArray)
                    {
                        path = t.Root + path;
                        string val = this.GetText(xmldoc, path.ToLower());
                        p.SetValue(t, val, null);
                    }
                    else
                    {
                        path = t.Root + path;
                        List <Dictionary <string, object> > list = this.GetTextList(xmldoc, path.ToLower());
                        if (list != null)
                        {
                            if (attr.ObjectIndex == 1)
                            {
                                Type      listItemType = typeof(T1);
                                List <T1> listo        = new List <T1>();

                                foreach (Dictionary <string, object> dictionary in list)
                                {
                                    T1 o = new T1();
                                    foreach (KeyValuePair <string, object> pair in dictionary)
                                    {
                                        foreach (PropertyInfo p1 in listItemType.GetProperties())
                                        {
                                            var attr1 = p1.GetCustomAttribute <HL7FiledAttribute>();
                                            if (t.Root + attr1.XPath == pair.Key)
                                            {
                                                p1.SetValue(o, pair.Value, null);
                                                break;
                                            }
                                        }
                                    }
                                    listo.Add(o);
                                }
                                p.SetValue(t, listo, null);
                            }
                            else if (attr.ObjectIndex == 2)
                            {
                                Type      listItemType = typeof(T2);
                                List <T2> listo        = new List <T2>();

                                foreach (Dictionary <string, object> dictionary in list)
                                {
                                    T2 o = new T2();
                                    foreach (KeyValuePair <string, object> pair in dictionary)
                                    {
                                        foreach (PropertyInfo p1 in listItemType.GetProperties())
                                        {
                                            var attr1 = p1.GetCustomAttribute <HL7FiledAttribute>();
                                            if (t.Root + attr1.XPath == pair.Key)
                                            {
                                                p1.SetValue(o, pair.Value, null);
                                                break;
                                            }
                                        }
                                    }
                                    listo.Add(o);
                                }
                                p.SetValue(t, listo, null);
                            }
                            else if (attr.ObjectIndex == 3)
                            {
                                Type      listItemType = typeof(T3);
                                List <T3> listo        = new List <T3>();
                                foreach (Dictionary <string, object> dictionary in list)
                                {
                                    T3 o = new T3();
                                    foreach (KeyValuePair <string, object> pair in dictionary)
                                    {
                                        foreach (PropertyInfo p1 in listItemType.GetProperties())
                                        {
                                            var attr1 = p1.GetCustomAttribute <HL7FiledAttribute>();
                                            if (t.Root + attr1.XPath == pair.Key)
                                            {
                                                p1.SetValue(o, pair.Value, null);
                                                break;
                                            }
                                        }
                                    }
                                    listo.Add(o);
                                }
                                p.SetValue(t, listo, null);
                            }
                            else if (attr.ObjectIndex == 4)
                            {
                                Type      listItemType = typeof(T4);
                                List <T4> listo        = new List <T4>();
                                foreach (Dictionary <string, object> dictionary in list)
                                {
                                    T4 o = new T4();
                                    foreach (KeyValuePair <string, object> pair in dictionary)
                                    {
                                        foreach (PropertyInfo p1 in listItemType.GetProperties())
                                        {
                                            var attr1 = p1.GetCustomAttribute <HL7FiledAttribute>();
                                            if (t.Root + attr1.XPath == pair.Key)
                                            {
                                                p1.SetValue(o, pair.Value, null);
                                                break;
                                            }
                                        }
                                    }
                                    listo.Add(o);
                                }
                                p.SetValue(t, listo, null);
                            }
                            else if (attr.ObjectIndex == 5)
                            {
                                Type      listItemType = typeof(T5);
                                List <T5> listo        = new List <T5>();
                                foreach (Dictionary <string, object> dictionary in list)
                                {
                                    T5 o = new T5();
                                    foreach (KeyValuePair <string, object> pair in dictionary)
                                    {
                                        foreach (PropertyInfo p1 in listItemType.GetProperties())
                                        {
                                            var attr1 = p1.GetCustomAttribute <HL7FiledAttribute>();
                                            if (t.Root + attr1.XPath == pair.Key)
                                            {
                                                p1.SetValue(o, pair.Value, null);
                                                break;
                                            }
                                        }
                                    }
                                    listo.Add(o);
                                }
                                p.SetValue(t, listo, null);
                            }
                        }
                    }
                }
            }

            return(t);
        }
Exemplo n.º 27
0
 static bool Do5(T5 t) {
   Nullable<T5> n = new Nullable<T5>(t);
   return Ensure(n.HasValue && n.Value == t);
 }