コード例 #1
0
        public void GetById()
        {
            UL      user  = new UL();
            UserDtl user1 = user.GetDetails(1);

            Assert.IsNotNull(user1);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string        filename = "D://Users//jlloyd1//source//repos//Lab9_4//String.html";
            Header        header   = new Header();
            UL            list     = new UL();
            StringBuilder sb       = new StringBuilder();

            Console.WriteLine("Enter text for HTML header.");
            string headerElement = header.CreateHeader(Console.ReadLine());

            string[] listItems = new string[3];

            for (int i = 0; i < listItems.Length; i++)
            {
                Console.WriteLine("Add another item to the list.");
                listItems[i] = list.CreateListItem(Console.ReadLine());
            }

            StringBuilder listElement = list.CreateList(listItems);

            sb.Append(headerElement);
            sb.Append(listElement.ToString());

            File.AppendAllText(filename, sb.ToString());
        }
コード例 #3
0
ファイル: TestUL.cs プロジェクト: swagataIt/Backend-mod-API
        public void GetAll()
        {
            UL uL = new UL();
            IList <UserDtl> user = uL.GetAll();

            Assert.IsNotNull(user);
        }
コード例 #4
0
        public void GetAllUser()
        {
            UL user           = new UL();
            IList <UserDtl> p = user.GetAll();

            Assert.IsNotNull(p);
        }
コード例 #5
0
        private void MouseEvents_OnMousePress(Point p)
        {
            foreach (Tile t in Game1.getCurrentList())
            {
                if (t.getRecHit().Contains(MouseEvents.getMousePos()))
                {
                    setSelected(t);
                }
            }
            if (selected == null)
            {
                return;
            }

            if (UL.Contains(p))
            {
                ULDrag     = true;
                pressPoint = p;
                recBefore  = selected.getRecHit();
            }
            else if (DR.Contains(p))
            {
                DRDrag     = true;
                pressPoint = p;
                recBefore  = selected.getRecHit();
            }
            else if (selected.getRecHit().Contains(p))
            {
                Move       = true;
                pressPoint = p;
                recBefore  = selected.getRecHit();
            }
        }
コード例 #6
0
        private IEnumerable <object> getNavLinks(SpinneretPage page)
        {
            IEnumerable <NavLink> temp;
            List <NavLink>        links = new List <NavLink>();

            links.AddRange(Interface.NavLinksPages);
            temp = Interface.NavLinksUser;
            if (temp != null)
            {
                links.AddRange(temp);
            }
            temp = page.NavLinks;
            if (temp != null)
            {
                links.AddRange(temp);
            }

            bool[] done = new bool[links.Count];

            while (true)
            {
                bool   anyUndone  = false;
                string curSection = null;
                UL     list       = null;

                for (int i = 0; i < links.Count; i++)
                {
                    if (curSection == null && !done[i])
                    {
                        curSection = links[i].Section;
                        yield return(new H2(curSection));

                        list = new UL();
                    }

                    if (curSection != null)
                    {
                        if (links[i].Section != curSection)
                        {
                            anyUndone = true;
                        }
                        else
                        {
                            list.Add(new LI(new A(links[i].Text)
                            {
                                href = links[i].Href
                            }));
                            done[i] = true;
                        }
                    }
                }

                yield return(list);

                if (!anyUndone)
                {
                    break;
                }
            }
        }
コード例 #7
0
        public string CallPostUL(string section)
        {
            if (inShow)
            {
                // we are in a show, users can't join anymore.
                return(null);
            }

            Guid g            = Guid.NewGuid();
            UL   userLocation = new UL();

            userLocation.userSeat = new userSeat();
            // Generate unique id and save result for EJ.
            userLocation.userKey          = g.ToString();
            userLocation.userSeat.level   = "floor1";
            userLocation.userSeat.section = section;
            //userLocation.userSeat.section = "101";
            userLocation.userSeat.row = currentRow.ToString();
            //userLocation.userSeat.row = "1";
            userLocation.userSeat.seat = DateTime.Now.Ticks.ToString(); // currentSeat.ToString();
            //userLocation.userSeat.seat = "1";   // currentSeat.ToString();
            currentRow++;
            currentSeat++;

            // PROD
            return(MakeWebCall("api/events/57f4856cc15516d90fe4e5e1/user_locations", true, userLocation));

            // Local
            //return MakeWebCall("api/events/55f4ba853451c8bc227664ff/user_locations", true, userLocation);
        }
コード例 #8
0
        public void Delete()
        {
            UL user = new UL();

            user.DeleteEmployee(3);
            SkillDtl user2 = user.skillById1(3);

            Assert.IsNull(user2);
        }
コード例 #9
0
        public static CheckIP.Tree FromDalToBl(UL tree)
        {
            var obj = new Tree
            {
                FID_NP = tree.FID_NP,
                UL_ID  = tree.UL_ID,
                OGRN   = tree.OGRN,
                C_data = tree.C_data,
            };

            return(obj);
        }
コード例 #10
0
ファイル: SyntaxAnalyst.cs プロジェクト: HakamFostok/Compiler
 private object ReadOneInstruction()
 {
     if (UL == TypeSymbol.U_Var || UL == TypeSymbol.U_UnKown)
     {
         return(HandleAssign());
     }
     else if (UL == TypeSymbol.U_If)
     {
         return(HandleIf());
     }
     else if (UL == TypeSymbol.U_While)
     {
         return(HandleWhile());
     }
     else if (UL == TypeSymbol.U_For)
     {
         return(HandleFor());
     }
     else if (UL == TypeSymbol.U_Repeat)
     {
         return(HandleRepeatUntil());
     }
     else if (UL == TypeSymbol.U_Do)
     {
         return(HandleDoWhile());
     }
     else if (UL == TypeSymbol.U_Call)
     {
         return(HandleCall());
     }
     else if (UL == TypeSymbol.U_Write || UL == TypeSymbol.U_WriteLn)
     {
         return(HandleWrite());
     }
     else if (UL == TypeSymbol.U_Read)
     {
         return(HandleRead());
     }
     else if (UL == TypeSymbol.U_Return)
     {
         return(HandleReturn());
     }
     else if (UL == TypeSymbol.U_Break || UL == TypeSymbol.U_Halt || UL == TypeSymbol.U_Exit)
     {
         return(HandleBreadHaltExit());
     }
     else
     {
         GetSyntaxError(SyntaxMessagesError.InvalidToken, UL.ToString());
     }
     return(null);
 }
コード例 #11
0
 public override VR CreateVR(string str, Rule rule, int length)
 {
     {
         VR vr = null;
         if (str == "SS")
         {
             vr = new SS(rule, length);
         }
         else if (str == "US")
         {
             vr = new US(rule, length);
         }
         else if (str == "UL")
         {
             vr = new UL(rule, length);
         }
         else if (str == "SL")
         {
             vr = new SL(rule, length);
         }
         else if (str == "IS")
         {
             vr = new IS(rule, length);
         }
         else if (str == "FS")
         {
             vr = new FS(rule, length);
         }
         else if (str == "AS")
         {
             vr = new AS(rule, length);
         }
         else if (str == "DA")
         {
             vr = new DA(rule, length);
         }
         else if (str == "UI")
         {
             vr = new TX(rule, length);
         }
         return(vr);
     }
 }
コード例 #12
0
        public void Register()
        {
            UL      user  = new UL();
            UserDtl user1 = new UserDtl()
            {
                firstName     = "Dhananjay",
                lastName      = "Yadav",
                userName      = "******",
                password      = "******",
                email         = "*****@*****.**",
                contactNumber = 9876350744,
                active        = true,
                role          = 1,
            };

            user.SignUp(user1);
            UserDtl user2 = user.GetDetails(4);

            Assert.IsNotNull(user2);
        }
コード例 #13
0
        public void Update()
        {
            UL         user  = new UL();
            PaymentDtl user1 = new PaymentDtl()
            {
                remarks             = "",
                amount              = 500,
                mentorId            = 3,
                mentorName          = "arvind",
                trainingId          = 1,
                skillName           = "Java",
                totalAmountToMentor = 400,
                commision           = 100
                                      //
            };

            user.UpdatePayment(4, user1);
            PaymentDtl user2 = user.GetPaymentDetails(4);

            Assert.IsTrue(user1.amount == user2.amount && user1.mentorName == user2.mentorName);
        }
コード例 #14
0
ファイル: TestUL.cs プロジェクト: swagataIt/Backend-mod-API
        public void Register()
        {
            UL      user  = new UL();
            UserDtl user1 = new UserDtl()
            {
                firstName        = "Ritikh",
                lastName         = "Jaiswal",
                userName         = "******",
                password         = "******",
                email            = "*****@*****.**",
                contactNumber    = 9851324109,
                linkdinUrl       = "",
                yearOfExperience = null,
                training         = null,
                active           = true,
                role             = 1,
            };

            user.SignUp(user1);
            UserDtl user2 = user.GetDetails(11);

            Assert.IsNotNull(user2);
        }
コード例 #15
0
        private void Match(UL ul)
        {
            measures = FileUtils.ReadCSV <Measure>();

            if (measures != null && entries != null)
            {
                foreach (Entry entry in entries)
                {
                    DateTime timeEntry = DateTime.Parse(entry.Time);

                    List <Measure> canditates = new List <Measure>();

                    foreach (Measure measure in measures)
                    {
                        DateTime timeMeasure = DateTime.Parse(measure.time);

                        if (timeMeasure.Year == timeEntry.Year &&
                            timeMeasure.Month == timeEntry.Month &&
                            timeMeasure.Day == timeEntry.Day &&
                            timeMeasure.Hour == timeEntry.Hour &&
                            (timeMeasure.Minute >= timeEntry.Minute - 2 || timeMeasure.Minute <= timeEntry.Minute + 2) &&
                            measure.devUplinkCounter == (ul == UL.One ? entry.UL1 : entry.UL2) % 256)
                        {
                            canditates.Add(measure);
                        }
                    }

                    foreach (Measure canditate in canditates)
                    {
                        entry.Measures.Add(canditate);
                    }
                }

                FileUtils.WriteJSON(entries);
            }
        }
コード例 #16
0
ファイル: SharedPage.cs プロジェクト: wildbunny/metaexchange
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ctx"></param>
        /// <param name="stream"></param>
        /// <param name="authObj"></param>
        /// <returns></returns>
        public override Task Render(RequestContext ctx, StringWriter stream, IDummy authObj)
        {
                        #if !MONO
            foreach (string name in m_sharedJsFilenames)
            {
                AddResource(new JsResource(Constants.kWebRoot, name, true));
            }
                        #endif

            AddResource(new CssResource(Constants.kWebRoot, "/css/site.css", true));
            AddResource(new CssResource(Constants.kWebRoot, "/css/bootstrap.min.css", true));
            AddResource(new FavIconResource(Constants.kWebRoot, "/images/favicon.ico"));
            AddResource(new TitleResource("Metaexchange"));
            AddResource(new MetaResource("viewport", "width=device-width, initial-scale=1"));

            ImgResource brand = new ImgResource(Constants.kWebRoot, "/images/brandTitle.png", "", false);
            AddResource(brand);

            // render head
            base.Render(ctx, stream, authObj);

            m_stream.WriteLine("<!-- Just for debugging purposes. Don't actually copy this line! -->		<!--[if lt IE 9]><script src=\"../../assets/js/ie8-responsive-file-warning.js\"></script><![endif]-->		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->		<!--[if lt IE 9]>		<script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>	<script src=\"https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js\"></script><![endif]-->");

            // begin body
            m_stream.WriteLine("<body>");

            using (new DivContainer(m_stream, HtmlAttributes.@class, "navbar navbar-default navbar-fixed-top"))
            {
                using (new DivContainer(m_stream, HtmlAttributes.@class, "container"))
                {
                    using (new DivContainer(m_stream, HtmlAttributes.@class, "navbar-header"))
                    {
                        using (new Link(m_stream, HtmlAttributes.@class, "navbar-brand", HtmlAttributes.href, "/"))
                        {
                            brand.Write(m_stream);
                            m_stream.Write(" metaexchange");
                        }
                    }
                    using (new DivContainer(m_stream, HtmlAttributes.@class, "navbar-collapse collapse"))
                    {
                        string page = ctx.Request.Url.LocalPath.Split('/').Last();

                        IEnumerable <MarketRow> allMarkets = authObj.m_database.GetAllMarkets().Where(m => m.visible);

                        using (var ul = new UL(stream, "nav navbar-nav pull-left"))
                        {
                            using (var li = new LI(stream, "dropdown"))
                            {
                                Href(stream, "Markets <span class=\"caret\">", HtmlAttributes.href, "/",
                                     HtmlAttributes.@class, "disabled",
                                     "data-toggle", "dropdown",
                                     "role", "button",
                                     "aria-expanded", "false");

                                using (new UL(stream, HtmlAttributes.@class, "dropdown-menu",
                                              "role", "menu"))
                                {
                                    foreach (MarketRow m in allMarkets.Where(m => !m.flipped))
                                    {
                                        WriteLiHref(stream, CurrencyHelpers.RenameSymbolPair(m.symbol_pair), "", "", HtmlAttributes.href, "/markets/" + CurrencyHelpers.RenameSymbolPair(m.symbol_pair));
                                    }
                                }
                            }

                            //WriteLiHref(stream, "Home", GetLiClass(page, ""), "", HtmlAttributes.href, "/");

                            WriteLiHref(stream, "Api", GetLiClass(page, "apiDocs"), "", HtmlAttributes.href, "/apiDocs");
                            WriteLiHref(stream, "Faq", GetLiClass(page, "faq"), "", HtmlAttributes.href, "/faq");
                        }
                    }
                }
            }

            return(null);
        }
コード例 #17
0
ファイル: VR.cs プロジェクト: zhaolian1998/dicom-decode
    public VR GetVR(string key)
    {
        //如果对象存在,则直接从享元池获取
        if (VRs.ContainsKey(key))
        {
            return((VR)VRs[key]);
        }
        //如果对象不存在,先创建一个新的对象添加到享元池中,然后返回
        else
        {
            VR fw = null;
            switch (key)
            {
            case "SS": fw = new SS(isBE, false); break;

            case "US": fw = new US(isBE); break;

            case "SL": fw = new SL(isBE, false); break;

            case "UL": fw = new UL(isBE, false); break;

            case "FL": fw = new FL(isBE, false); break;

            case "FD": fw = new FD(isBE, false); break;

            case "DA": fw = new DA(isBE, false); break;

            case "TM": fw = new TM(isBE, false); break;

            case "DT": fw = new DT(isBE, false); break;

            case "AS": fw = new AS(isBE, false); break;

            case "OB": fw = new OB(isBE); break;

            case "OF": fw = new OF(isBE, true); break;

            case "OW": fw = new OW(isBE); break;

            case "SQ": fw = new SQ(isBE, true); break;

            case "LO": fw = new LO(isBE, true); break;

            case "UI": fw = new UI(isBE, true); break;

            case "SH": fw = new SH(isBE, true); break;

            case "AE": fw = new AE(isBE, true); break;

            case "CS": fw = new CS(isBE, true); break;

            case "PN": fw = new PN(isBE, true); break;

            case "DS": fw = new DS(isBE); break;

            case "IS": fw = new IS(isBE, true); break;
                //default for text
                //default: fw = new ST(isBE, false); break;
            }
            VRs.Add(key, fw);
            return(fw);
        }
    }
コード例 #18
0
 protected override void When()
 {
     list = Document.Navigation.GetCurrentPage <HomeIndex>().NestedList;
 }
コード例 #19
0
 protected override void When()
 {
     list = Document.Navigation.GetCurrentPage <GenericElementPage>().Document.List(ListId);
 }
コード例 #20
0
ファイル: SharedPage.cs プロジェクト: sfinder/metaexchange
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ctx"></param>
        /// <param name="stream"></param>
        /// <param name="authObj"></param>
        /// <returns></returns>
        public override Task Render(RequestContext ctx, StringWriter stream, IDummy authObj)
        {
            #if !MONO
            foreach (string name in m_sharedJsFilenames)
            {
                AddResource(new JsResource(Constants.kWebRoot, name, true));
            }
            #endif

            AddResource(new CssResource(Constants.kWebRoot, "/css/site.css", true));
            AddResource(new CssResource(Constants.kWebRoot, "/css/bootstrap.min.css", true));
            AddResource(new FavIconResource(Constants.kWebRoot, "/images/favicon.ico"));
            AddResource(new TitleResource("Metaexchange"));
            AddResource(new MetaResource("viewport", "width=device-width, initial-scale=1"));

            ImgResource brand = new ImgResource(Constants.kWebRoot, "/images/brandTitle.png", "", false);
            AddResource(brand);

            // render head
            base.Render(ctx, stream, authObj);

            m_stream.WriteLine("<!-- Just for debugging purposes. Don't actually copy this line! -->		<!--[if lt IE 9]><script src=\"../../assets/js/ie8-responsive-file-warning.js\"></script><![endif]-->		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->		<!--[if lt IE 9]>		<script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>	<script src=\"https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js\"></script><![endif]-->");

            // begin body
            m_stream.WriteLine("<body>");

            using (new DivContainer(m_stream, HtmlAttributes.@class, "navbar navbar-default navbar-fixed-top"))
            {
                using (new DivContainer(m_stream, HtmlAttributes.@class, "container"))
                {
                    using (new DivContainer(m_stream, HtmlAttributes.@class, "navbar-header"))
                    {
                        using (new Link(m_stream, HtmlAttributes.@class, "navbar-brand", HtmlAttributes.href, "/"))
                        {
                            brand.Write(m_stream);
                            m_stream.Write(" metaexchange");
                        }
                    }
                    using (new DivContainer(m_stream, HtmlAttributes.@class, "navbar-collapse collapse"))
                    {
                        string page = ctx.Request.Url.LocalPath.Split('/').Last();

                        IEnumerable<MarketRow> allMarkets = authObj.m_database.GetAllMarkets().Where(m=>m.visible);

                        using (var ul = new UL(stream, "nav navbar-nav pull-left"))
                        {
                            using (var li = new LI(stream, "dropdown"))
                            {
                                Href(stream, "Markets <span class=\"caret\">", HtmlAttributes.href, "/",
                                                                                HtmlAttributes.@class, "disabled",
                                                                                "data-toggle", "dropdown",
                                                                                "role", "button",
                                                                                "aria-expanded", "false");

                                using (new UL(stream,	HtmlAttributes.@class, "dropdown-menu",
                                                        "role","menu"))
                                {
                                    foreach (MarketRow m in allMarkets.Where(m=>!m.flipped))
                                    {
                                        WriteLiHref(stream, CurrencyHelpers.RenameSymbolPair(m.symbol_pair), "", "", HtmlAttributes.href, "/markets/" + CurrencyHelpers.RenameSymbolPair(m.symbol_pair));
                                    }
                                }
                            }

                            //WriteLiHref(stream, "Home", GetLiClass(page, ""), "", HtmlAttributes.href, "/");

                            WriteLiHref(stream, "Api", GetLiClass(page, "apiDocs"), "", HtmlAttributes.href, "/apiDocs");
                            WriteLiHref(stream, "Faq", GetLiClass(page, "faq"), "", HtmlAttributes.href, "/faq");
                        }
                    }
                }
            }

            return null;
        }
コード例 #21
0
ファイル: SyntaxAnalyst.cs プロジェクト: HakamFostok/Compiler
        private TExpression ReadFact(ref TExpression last)
        {
            if (UL == TypeSymbol.U_Cst_Int || UL == TypeSymbol.U_Cst_Real || UL == TypeSymbol.U_Cst_Str ||
                UL == TypeSymbol.U_True || UL == TypeSymbol.U_False)
            {
                TExpression expNew = new TExpression();
                expNew.UL = UL;
                if (UL == TypeSymbol.U_Cst_Str)
                {
                    expNew.ValStr = G_curr_Str;
                }
                else if (UL == TypeSymbol.U_Cst_Int || UL == TypeSymbol.U_Cst_Real) // the if statment i added after notce the true false.
                {
                    expNew.ValNB = G_curr_Num;
                }

                // by default
                expNew.Next = null;
                expNew.Prev = null;

                last = expNew;
                UL   = LexicalUnit();
                return(expNew);
            }
            else if (UL == TypeSymbol.U_OpenParanthese)
            {
                UL = LexicalUnit();
                TExpression expNew = ReadCondition(ref last);
                if (UL != TypeSymbol.U_ClosedParanthese)
                {
                    GetSyntaxError(WordMessagesError.NotFound, ")");
                }
                UL = LexicalUnit();
                return(expNew);
            }
            else if (UL == TypeSymbol.U_Var || UL == TypeSymbol.U_VarDefine ||
                     UL == TypeSymbol.U_VarProcedure || UL == TypeSymbol.U_UnKown)
            {
                TExpression expNew = new TExpression();

                // By Default
                expNew.Next = null;
                expNew.Prev = null;

                TVar varAux = null;
                ProcedureInstruction procAux = null;
                TypeSymbol           ulAux;

                if (UL == TypeSymbol.U_VarDefine)   // if the variable define
                {
                    DefineInstruction defAux = (DefineInstruction)G_curr_ID;
                    expNew.UL     = defAux.UL;
                    expNew.ValNB  = defAux.ValNB;
                    expNew.ValStr = defAux.ValStr;
                    ulAux         = defAux.UL;
                    UL            = LexicalUnit();
                }
                else if (UL == TypeSymbol.U_UnKown) // if the variblae unknown procedure , unknown variable
                {
                    string buffer = G_curr_Str;
                    UL = LexicalUnit();

                    if (UL == TypeSymbol.U_OpenParanthese)  // if the variblae unknown procedure
                    {
                        IdentifierInstruction.AddIdentifier(buffer, ref Locals.gproc);
                        procAux      = gProc;
                        gProc.IsFunc = true;
                        //gProc.IsDefined = false;
                        //gProc.PIN = null;
                        //gProc.POut = null;
                        //gproc.LVar = null;
                        //gProc.Linst = null;
                        ulAux = TypeSymbol.U_VarProcedure;
                    }
                    else                    // if the variblae unknown procedure , unknownvariable
                    {
                        IdentifierInstruction.AddIdentifier(buffer, ref Locals.gvar);
                        varAux = gVar;
                        ulAux  = TypeSymbol.U_Var;
                    }
                }
                else    // if the variable known
                {
                    // this statment i am not sure about it
                    ulAux = UL;
                    if (ulAux == TypeSymbol.U_Var)      // if the vairable known var
                    {
                        varAux = (TVar)G_curr_ID;
                    }
                    else                                // if the variable known procedure
                    {
                        procAux = (ProcedureInstruction)G_curr_ID;
                    }

                    UL = LexicalUnit();
                }

                expNew.UL = ulAux;
                last      = expNew;
                if (ulAux == TypeSymbol.U_VarProcedure)
                {
                    expNew.ValCall = ReadCall(procAux);
                }
                else if (ulAux == TypeSymbol.U_Var)
                {
                    expNew.ValVar = varAux;
                    if (UL == TypeSymbol.U_OpenBracket)
                    {
                        UL           = LexicalUnit();
                        expNew.Index = ReadExpression();
                        if (UL != TypeSymbol.U_ClosedBracket)
                        {
                            GetSyntaxError(WordMessagesError.NotFound, "]");
                        }

                        UL = LexicalUnit();
                    }
                    else
                    {
                        expNew.Index = null;
                    }
                }

                return(expNew);
            }
            else if (new TypeSymbol[] { TypeSymbol.U_Sin, TypeSymbol.U_Cos, TypeSymbol.U_Tg,
                                        TypeSymbol.U_Ln, TypeSymbol.U_Log, TypeSymbol.U_Exp, TypeSymbol.U_Sqr, TypeSymbol.U_Sqrt,
                                        TypeSymbol.U_Length, TypeSymbol.U_IntToStr, TypeSymbol.U_StrToInt, TypeSymbol.U_IntToHex, }.Contains(UL))
            {
                TExpression expNew = new TExpression();
                expNew.UL = UL;
                UL        = LexicalUnit();
                if (UL != TypeSymbol.U_OpenParanthese)
                {
                    GetSyntaxError(WordMessagesError.NotFound, "(");
                }

                UL = LexicalUnit();
                TExpression exp0 = ReadExpression(ref last);
                last.Next   = expNew;
                expNew.Prev = last;
                last        = expNew;

                if (UL != TypeSymbol.U_ClosedParanthese)
                {
                    GetSyntaxError(WordMessagesError.NotFound, ")");
                }

                UL = LexicalUnit();
                return(exp0);
            }
            else if (UL == TypeSymbol.U_Pluse || UL == TypeSymbol.U_Minus || UL == TypeSymbol.U_Not || UL == TypeSymbol.U_Complement)
            {
                TExpression expNew = new TExpression();

                if (UL == TypeSymbol.U_Pluse)
                {
                    expNew.UL = TypeSymbol.U_UnaryPluse;
                }
                else if (UL == TypeSymbol.U_Minus)
                {
                    expNew.UL = TypeSymbol.U_UnaryMinuse;
                }
                else if (UL == TypeSymbol.U_Not)
                {
                    expNew.UL = TypeSymbol.U_Not;
                }
                else
                {
                    expNew.UL = TypeSymbol.U_Complement;
                }

                UL = LexicalUnit();
                TExpression exp0 = ReadFact(ref last);
                last.Next   = expNew;
                expNew.Prev = last;
                last        = expNew; // this statment i added to solve the problem that unary pluse and unary minus.

                return(exp0);
            }
            else
            {
                GetSyntaxError(SyntaxMessagesError.InvalidToken, UL.ToString());
            }

            // this statment will never execute
            // just for elminate compile time error.
            return(null);
        }
コード例 #22
0
        static string MakeWebCall(string url, bool isPost = false, UL userLocationToRegister = null, EJ eventJoin = null, int index = 0)
        {
            try
            {
                using (var client = new WebClient())
                {
                    // New code:
                    //client.BaseAddress = new Uri("http://main-1156949061.us-west-2.elb.amazonaws.com/");
                    client.BaseAddress = "http://www.litewaveinc.com/";
                    //client.BaseAddress = "http://127.0.0.1:3000/";
                    //client.Headers.Add("Accept: application/json");
                    client.Headers.Add("Content-Type", "application/json");

                    string response = null;
                    if (isPost)
                    {
                        MemoryStream ms = new MemoryStream();
                        DataContractJsonSerializer jsonSer;
                        if (userLocationToRegister != null)
                        {
                            //Create a Json Serializer for our type
                            jsonSer = new DataContractJsonSerializer(typeof(UL));

                            // use the serializer to write the object to a MemoryStream
                            jsonSer.WriteObject(ms, userLocationToRegister);
                        }
                        else if (eventJoin != null)
                        {
                            //Create a Json Serializer for our type
                            jsonSer = new DataContractJsonSerializer(typeof(EJ));

                            // use the serializer to write the object to a MemoryStream
                            jsonSer.WriteObject(ms, eventJoin);
                        }
                        ms.Position = 0;

                        // use a Stream reader to construct the StringContent (Json)
                        StreamReader sr = new StreamReader(ms);
                        //StringContent theContent = new StringContent(sr.ReadToEnd(), System.Text.Encoding.UTF8, "application/json");

                        string data          = sr.ReadToEnd();
                        byte[] postArray     = Encoding.ASCII.GetBytes(data);
                        byte[] responseArray = client.UploadData(url, "POST", postArray);
                        response = Encoding.ASCII.GetString(responseArray);
                    }
                    else
                    {
                        Stream       data   = client.OpenRead(url);
                        StreamReader reader = new StreamReader(data);
                        response = reader.ReadToEnd();
                    }

                    if (response != null)
                    {
                        if (isPost && userLocationToRegister != null)
                        {
                            ULResult ulResult = new ULResult();
                            DataContractJsonSerializer jsonSer;
                            jsonSer = new DataContractJsonSerializer(typeof(ULResult));

                            byte[]       byteArray = Encoding.ASCII.GetBytes(response);
                            MemoryStream stream    = new MemoryStream(byteArray);
                            ulResult         = (ULResult)jsonSer.ReadObject(stream);
                            ulStack[ULCount] = ulResult._id;
                            ULCount++;
                        }
                        else if (isPost && eventJoin != null)
                        {
                            EventJoin ej = new EventJoin();
                            DataContractJsonSerializer jsonSer;
                            jsonSer = new DataContractJsonSerializer(typeof(EventJoin));

                            byte[]       byteArray = Encoding.ASCII.GetBytes(response);
                            MemoryStream stream    = new MemoryStream(byteArray);
                            ej = (EventJoin)jsonSer.ReadObject(stream);
                            commandsStack[index] = ej;
                            EJCount++;
                        }

                        return(response);
                    }
                }
            }
            catch (WebException webEx)
            {
                HttpWebResponse response = (System.Net.HttpWebResponse)webEx.Response;
                if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    System.Diagnostics.Debug.WriteLine("Not found!");
                }
            }

            return(null);
        }