Example #1
0
        private void CL_DeltaEntity(Q3HuffmanReader decoder, CLSnapshot frame, int newnum, EntityState old, bool unchanged)
        {
            EntityState state;

            // save the parsed entity state into the big circular buffer so
            // it can be used as the source for a later delta

            state = Ext2 <int, EntityState> .GetOrCreate(client.parseEntities,
                                                         client.parseEntitiesNum& (Q3Const.MAX_PARSE_ENTITIES - 1));

            if (unchanged)
            {
                state.copy(old);
            }
            else
            {
                decoder.readDeltaEntity(state, newnum);
            }

            if (state.number == (Q3Const.MAX_GENTITIES - 1))
            {
                return;         // entity was delta removed
            }
            client.parseEntitiesNum++;
            frame.numEntities++;
        }
    static void Main(string[] args)
    {
        MyBaseClass ext1 = new Ext1();

        ext1.DoSomething();
        MyBaseClass ext2 = new Ext2();

        ext2.DoSomething();

        Console.ReadKey(true);
    }
Example #3
0
        private static void DetectFilesystem(BlockDevice aDevice)
        {
            #region Ext2
            if (Ext2.BlockDeviceContainsExt2(aDevice))
            {
                aDevice.Used = true;
                var xFS = new Ext2(aDevice);
                mFilesystems.Add(xFS);
            }

            #endregion
        }
Example #4
0
        private void parseGameState(Q3HuffmanReader reader)
        {
            reader.readLong();

            while (true)
            {
                byte cmd = reader.readByte();
                if (cmd == Q3_SVC.EOF)
                {
                    break;
                }

                switch (cmd)
                {
                case Q3_SVC.CONFIGSTRING:
                    short key = reader.readShort();
                    if (key < 0 || key > Q3Const.MAX_CONFIGSTRINGS)
                    {
                        return;
                    }
                    clc.configs[key] = reader.readBigString();
                    break;

                case Q3_SVC.BASELINE:
                    long newnum = reader.readNumBits(Q3Const.GENTITYNUM_BITS);
                    if (newnum < 0 || newnum >= Q3Const.MAX_GENTITIES)
                    {
                        Q3Utils.PrintDebug(clc.errors, "Baseline number out of range: {0}", newnum);
                        return;
                    }

                    EntityState es = Ext2 <long, EntityState> .GetOrCreate(clc.entityBaselines, newnum);

                    if (!reader.readDeltaEntity(es, (int)newnum))
                    {
                        Q3Utils.PrintDebug(clc.errors, "unable to parse delta-entity state");
                        return;
                    }
                    break;

                default:
                    Q3Utils.PrintDebug(clc.errors, "bad command in parseGameState");
                    return;
                }
            }

            //clc.clientNum
            clc.clientNum = reader.readLong();

            //clc.checksumFeed
            clc.checksumFeed = reader.readLong();
        }
Example #5
0
 internal static void Send_Ext2SuperBlock(Ext2.Ext2.SuperBlock aSuperBlock)
 {
     //Hardware2.DebugUtil.StartLogging();
     //Hardware2.DebugUtil.WriteSerialString("<Ext2_SuperBlock ");
     //Hardware2.DebugUtil.WriteSerialString("INodesCount=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.INodesCount, 32);
     //Hardware2.DebugUtil.WriteSerialString("\" BlocksCount=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.BlockCount, 32);
     //Hardware2.DebugUtil.WriteSerialString("\" FreeBlockCount=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.FreeBlocksCount, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" FreeINodesCount=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.FreeINodesCount, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" FirstDataBlock=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.FirstDataBlock, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" LogBlockSize=\"");
     //Hardware2.DebugUtil.WriteNumber((uint)aSuperBlock.LogBlockSize, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" LogFragSize=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.LogFragSize, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" BlocksPerGroup=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.BlocksPerGroup, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" FragsPerGroup=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.FragsPerGroup, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" INodesPerGroup=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.INodesPerGroup, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" MTime=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.MTime, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" WTime=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.WTime, 32); 
     //Hardware2.DebugUtil.WriteSerialString("\" MountCount=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.MntCount, 16); 
     //Hardware2.DebugUtil.WriteSerialString("\" MaxMountCount=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.MaxMntCount, 16);
     //Hardware2.DebugUtil.WriteSerialString("\" Magic=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.Magic, 16);
     //Hardware2.DebugUtil.WriteSerialString("\" State=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.State, 16);
     //Hardware2.DebugUtil.WriteSerialString("\" Errors=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.Errors, 16);
     //Hardware2.DebugUtil.WriteSerialString("\" MinorRevLevel=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.MinorRevLevel, 16);
     //Hardware2.DebugUtil.WriteSerialString("\" LastCheck=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.LastCheck, 32);
     //Hardware2.DebugUtil.WriteSerialString("\" CheckInterval=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.CheckInterval, 32);
     //Hardware2.DebugUtil.WriteSerialString("\" CreatorOS=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.CreatorOS, 32);
     //Hardware2.DebugUtil.WriteSerialString("\" RevLevel=\"");
     //Hardware2.DebugUtil.WriteNumber(aSuperBlock.RevLevel, 32);
     //Hardware2.DebugUtil.WriteSerialString("\"/>\r\n");
     //Hardware2.DebugUtil.EndLogging();
 }
Example #6
0
 internal static void Send_Ext2GroupDescriptors(Ext2.Ext2.GroupDescriptor[] aDescriptors) {
     //Hardware2.DebugUtil.StartLogging();
     //for(uint i = 0; i < aDescriptors.Length;i++) {
     //    Hardware2.DebugUtil.WriteSerialString("<Ext2_GroupDescriptor Index=\"");
     //    Hardware2.DebugUtil.WriteNumber(i, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\" BlockBitmap=\"");
     //    Hardware2.DebugUtil.WriteNumber(aDescriptors[i].BlockBitmap, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\" INodeBitmap=\"");
     //    Hardware2.DebugUtil.WriteNumber(aDescriptors[i].INodeBitmap, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\" INodeTable=\"");
     //    Hardware2.DebugUtil.WriteNumber(aDescriptors[i].INodeTable, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\" FreeBlocksCount=\"");
     //    Hardware2.DebugUtil.WriteNumber(aDescriptors[i].FreeBlocksCount, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\" FreeINodesCount=\"");
     //    Hardware2.DebugUtil.WriteNumber(aDescriptors[i].FreeINodesCount, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\" UsedDirsCount=\"");
     //    Hardware2.DebugUtil.WriteNumber(aDescriptors[i].UsedDirsCount, 32);
     //    Hardware2.DebugUtil.WriteSerialString("\"/>\r\n");
     //}
     //Hardware2.DebugUtil.EndLogging();
 }
Example #7
0
        public string FTP_FLMarion(string address, string assessment_id, string parcelNumber, string searchType, string orderNumber, string directParcel, string ownername)
        {
            GlobalClass.global_orderNo             = orderNumber;
            HttpContext.Current.Session["orderNo"] = orderNumber;
            GlobalClass.global_parcelNo            = parcelNumber;
            List <string> mcheck = new List <string>();

            string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = "";

            var driverService = PhantomJSDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            using (driver = new PhantomJSDriver())
            {
                //driver = new ChromeDriver();

                try
                {
                    StartTime = DateTime.Now.ToString("HH:mm:ss");

                    if (searchType == "titleflex")
                    {
                        titleaddress = address;
                        titleOwner   = ownername;
                        gc.TitleFlexSearch(orderNumber, "", ownername, titleaddress, "FL", "Marion");

                        if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes"))
                        {
                            driver.Quit();
                            return("MultiParcel");
                        }
                        else if (HttpContext.Current.Session["titleparcel"].ToString() == "")
                        {
                            HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                            driver.Quit();
                            return("No Data Found");
                        }
                        parcelNumber = HttpContext.Current.Session["titleparcel"].ToString();
                        searchType   = "parcel";
                    }

                    if (searchType == "address")
                    {
                        driver.Navigate().GoToUrl("http://www.pa.marion.fl.us/PropertySearch.aspx");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_rblSearchBy_0")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_txtParm")).SendKeys(address);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_btnWine")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Address search", driver, "FL", "Marion");
                        Thread.Sleep(2000);

                        try
                        {
                            IWebElement         MultiAddressTB = driver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody"));
                            IList <IWebElement> MultiAddressTR = MultiAddressTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiAddressTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Address search", driver, "FL", "Marion");

                            if (MultiAddressTR.Count == 1)
                            {
                                driver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody/tr/td[1]/a")).Click();
                                Thread.Sleep(4000);
                            }

                            else
                            {
                                int    AddressmaxCheck = 0;
                                string xpath           = "";
                                int    m = 1;
                                foreach (IWebElement MultiAddress in MultiAddressTR)
                                {
                                    if (AddressmaxCheck <= 25)
                                    {
                                        MultiAddressTD = MultiAddress.FindElements(By.TagName("td"));
                                        if (MultiAddressTD.Count != 0 && MultiAddress.Text.Contains(address.ToUpper()))
                                        {
                                            IWebElement Parcelno1 = MultiAddressTD[0].FindElement(By.TagName("a"));
                                            Parcelno         = Parcelno1.Text;
                                            Owner            = MultiAddressTD[1].Text;
                                            Property_Address = MultiAddressTD[2].Text;

                                            MultiAddress_details = Owner + "~" + Property_Address;
                                            gc.insert_date(orderNumber, Parcelno, 672, MultiAddress_details, 1, DateTime.Now);

                                            xpath = "//*[@id='srch']/table[1]/tbody/tr[" + m + "]/td[1]/a";
                                            mcheck.Add(MultiAddressTD[0].Text.Trim());
                                        }
                                        m++;
                                    }
                                    AddressmaxCheck++;
                                }
                                if (mcheck.Count == 1)
                                {
                                    driver.FindElement(By.XPath(xpath)).Click();
                                    Thread.Sleep(4000);
                                }
                                else
                                {
                                    if (MultiAddressTR.Count > 25)
                                    {
                                        HttpContext.Current.Session["multiParcel_FLMarion_Multicount"] = "Maximum";
                                        driver.Quit();
                                        return("Maximum");
                                    }
                                    else
                                    {
                                        HttpContext.Current.Session["multiparcel_FLMarion"] = "Yes";
                                        driver.Quit();
                                        return("MultiParcel");
                                    }
                                }
                            }
                        }
                        catch
                        { }
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.Id("srch")).Text;
                            if (nodata.Contains("0 records found. End of search reached."))
                            {
                                HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "parcel")
                    {
                        driver.Navigate().GoToUrl("http://www.pa.marion.fl.us/PropertySearch.aspx");
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_rblSearchBy_2")).Click();
                        Thread.Sleep(2000);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_txtParm")).SendKeys(parcelNumber);

                        driver.FindElement(By.Id("MCPAMaster_MCPAContent_btnWine")).SendKeys(Keys.Enter);
                        gc.CreatePdf(orderNumber, parcelNumber, "ParcelSearch", driver, "FL", "Marion");
                        Thread.Sleep(2000);

                        driver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody/tr/td[1]/a")).Click();
                        Thread.Sleep(2000);
                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.Id("srch'")).Text;
                            if (nodata.Contains("0 records found. End of search reached."))
                            {
                                HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                    }

                    if (searchType == "ownername")
                    {
                        var chromeOptions = new ChromeOptions();
                        var chDriver      = new ChromeDriver(chromeOptions);

                        chDriver.Navigate().GoToUrl("http://www.pa.marion.fl.us/PropertySearch.aspx");
                        Thread.Sleep(2000);

                        chDriver.FindElement(By.Id("MCPAMaster_MCPAContent_rblSearchBy_1")).Click();
                        Thread.Sleep(2000);

                        chDriver.FindElement(By.Id("MCPAMaster_MCPAContent_txtParm")).SendKeys(ownername);

                        chDriver.FindElement(By.Id("MCPAMaster_MCPAContent_btnWine")).SendKeys(Keys.Enter);
                        gc.CreatePdf_WOP(orderNumber, "Owner search", chDriver, "FL", "Marion");
                        Thread.Sleep(2000);

                        try
                        {
                            IWebElement         MultiOwnerTB = chDriver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody"));
                            IList <IWebElement> MultiOwnerTR = MultiOwnerTB.FindElements(By.TagName("tr"));
                            IList <IWebElement> MultiOwnerTD;
                            gc.CreatePdf_WOP(orderNumber, "Multi Owner search", chDriver, "FL", "Marion");

                            if (MultiOwnerTR.Count == 1)
                            {
                                chDriver.FindElement(By.XPath("//*[@id='srch']/table[1]/tbody/tr/td[1]/a")).Click();
                                Thread.Sleep(2000);
                            }

                            else
                            {
                                int OwnermaxCheck = 0;
                                foreach (IWebElement MultiOwner in MultiOwnerTR)
                                {
                                    if (OwnermaxCheck <= 25)
                                    {
                                        MultiOwnerTD = MultiOwner.FindElements(By.TagName("td"));
                                        if (MultiOwnerTD.Count != 0)
                                        {
                                            IWebElement Parcelno1 = MultiOwnerTD[0].FindElement(By.TagName("a"));
                                            Parcelno         = Parcelno1.Text;
                                            Owner            = MultiOwnerTD[1].Text;
                                            Property_Address = MultiOwnerTD[2].Text;

                                            MultiOwner_details = Owner + "~" + Property_Address;
                                            gc.insert_date(orderNumber, Parcelno, 672, MultiOwner_details, 1, DateTime.Now);
                                        }
                                        OwnermaxCheck++;
                                    }
                                }
                                if (MultiOwnerTR.Count > 25)
                                {
                                    HttpContext.Current.Session["multiParcel_FLMarion_Multicount"] = "Maximum";
                                }
                                else
                                {
                                    HttpContext.Current.Session["multiparcel_FLMarion"] = "Yes";
                                }
                                chDriver.Quit();

                                return("MultiParcel");
                            }
                        }
                        catch
                        { }

                        try
                        {
                            //No Data Found
                            string nodata = driver.FindElement(By.XPath("//*[@id='srch']/text()")).Text;
                            if (nodata.Contains("0 records found. End of search reached."))
                            {
                                HttpContext.Current.Session["Nodata_FLMarion"] = "Yes";
                                driver.Quit();
                                return("No Data Found");
                            }
                        }
                        catch { }
                        chDriver.Quit();
                    }

                    Thread.Sleep(3000);
                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                    Thread.Sleep(4000);

                    //Property Details
                    //try
                    //{
                    //    driver.FindElement(By.XPath("//*[@id='prc']/div/a[1]")).Click();
                    //    Thread.Sleep(6000);
                    //}
                    //catch
                    //{ }


                    try
                    {
                        ParcelID      = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/h1")).Text;
                        Primary_Key   = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[1]/tbody/tr/td[1]")).Text;
                        Primary_Key   = WebDriverTest.After(Primary_Key, "Prime Key: ");
                        Owner_Mailing = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[2]/tbody/tr/td[1]")).Text;

                        try
                        {
                            driver.FindElement(By.XPath("//*[@id='prc']/div/a[2]")).Click();
                            Thread.Sleep(2000);
                            full           = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[2]/tbody/tr/td[2]")).Text;
                            Taxes_Assments = gc.Between(full, "Taxes / Assessments:", "Map ID:");
                            try
                            {
                                assess1  = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[1]")).Text.Replace("\r\n", "~");
                                assess11 = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[2]")).Text.Replace("\r\n", "~");

                                DBconnection dbconn = new DBconnection();
                                dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assess1 + "' where Id = '" + 692 + "'");
                                gc.CreatePdf(orderNumber, ParcelID, "Assessment1 Details", driver, "FL", "Marion");
                                gc.insert_date(orderNumber, ParcelID, 692, assess11, 1, DateTime.Now);
                            }
                            catch
                            { }

                            //History Accessd Values
                            try
                            {
                                IWebElement         HistoryTB = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[4]/tbody"));
                                IList <IWebElement> HistoryTR = HistoryTB.FindElements(By.TagName("tr"));
                                IList <IWebElement> HistoryTD;

                                foreach (IWebElement History in HistoryTR)
                                {
                                    HistoryTD = History.FindElements(By.TagName("td"));
                                    if (HistoryTD.Count != 0 && HistoryTR.Count != 1)
                                    {
                                        Year        = HistoryTD[0].Text;
                                        Land_Just   = HistoryTD[1].Text;
                                        Building    = HistoryTD[2].Text;
                                        Misc_Value  = HistoryTD[3].Text;
                                        Mkt_Just    = HistoryTD[4].Text;
                                        Assed_Value = HistoryTD[5].Text;
                                        Exceptions  = HistoryTD[6].Text;
                                        Taxabl_Val  = HistoryTD[7].Text;

                                        History_details = Year + "~" + Land_Just + "~" + Building + "~" + Misc_Value + "~" + Mkt_Just + "~" + Assed_Value + "~" + Exceptions + "~" + Taxabl_Val;
                                        gc.insert_date(orderNumber, ParcelID, 693, History_details, 1, DateTime.Now);
                                    }
                                }
                            }
                            catch
                            { }
                            driver.Navigate().Back();
                            Thread.Sleep(5000);
                        }
                        catch
                        { }
                        Map_Id  = gc.Between(full, "Map ID:", "Millage:");
                        Millage = GlobalClass.After(full, "Millage:");
                        full1   = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[2]/tbody/tr/td[3]")).Text;
                        try
                        {
                            Acres = gc.Between(full1, "Acres: ", "Situs: ").Replace("More Situs", "");
                            Situs = WebDriverTest.After(full1, "Situs: ");
                        }
                        catch { }

                        Proty_Desp = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td")).Text;
                        Proty_Desp = gc.Between(Proty_Desp, "Property Description", "Land Data - Warning: Verify Zoning");
                        try
                        {
                            Improve1 = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[6]/tbody/tr/td[1]/table/tbody/tr/td[2]")).Text.Replace("\r\n", "~");

                            string[] rowarrayname1 = Improve1.Split('~');

                            Improve    = rowarrayname1[0];
                            Year_Built = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[6]/tbody/tr/td[2]")).Text;
                            Year_Built = gc.Between(Year_Built, "Year Built", "Physical Deterioration");
                        }
                        catch
                        { }

                        property = Primary_Key + "~" + Owner_Mailing + "~" + Situs + "~" + Taxes_Assments + "~" + Map_Id + "~" + Millage + "~" + Acres + "~" + Proty_Desp + "~" + Improve + "~" + Year_Built;
                        gc.CreatePdf(orderNumber, ParcelID, "Assessment11 Details", driver, "FL", "Marion");
                        gc.insert_date(orderNumber, ParcelID, 691, property, 1, DateTime.Now);
                    }
                    catch
                    { }

                    //try
                    //{
                    //    assess = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[1]")).Text.Replace("\r\n", "~");
                    //    assess1 = driver.FindElement(By.XPath("//*[@id='prc']/table/tbody/tr/td/table[3]/tbody/tr/td[2]")).Text.Replace("\r\n", "~");

                    //    DBconnection dbconn = new DBconnection();
                    //    dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assess + "' where Id = '" + 692 + "'");
                    //    gc.insert_date(orderNumber, ParcelID, 692, assess1, 1, DateTime.Now);
                    //}
                    //catch
                    //{ }

                    AssessmentTime = DateTime.Now.ToString("HH:mm:ss");

                    //Tax Details
                    driver.Navigate().GoToUrl("https://www.mariontax.com/itm/PropertySearchAccount.aspx");
                    Thread.Sleep(4000);

                    driver.FindElement(By.Id("btnAgree")).Click();
                    Thread.Sleep(4000);

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_txtAccount")).SendKeys(ParcelID);

                    gc.CreatePdf(orderNumber, ParcelID, "Tax Details", driver, "FL", "Marion");

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_btnSearch")).SendKeys(Keys.Enter);
                    Thread.Sleep(4000);

                    gc.CreatePdf(orderNumber, ParcelID, "Tax Parcels Details", driver, "FL", "Marion");

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_rptSummary__ctl0_lnkDetails1")).Click();
                    Thread.Sleep(4000);


                    //Tax Payment History
                    try
                    {
                        IWebElement         BreakdownTB = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_tblSummary']/tbody"));
                        IList <IWebElement> BreakdownTR = BreakdownTB.FindElements(By.TagName("tr"));
                        IList <IWebElement> BreakdownTD;

                        foreach (IWebElement Breakdown in BreakdownTR)
                        {
                            BreakdownTD = Breakdown.FindElements(By.TagName("td"));
                            if (BreakdownTD.Count != 0 && !Breakdown.Text.Contains("Year"))
                            {
                                Tax_Year    = BreakdownTD[0].Text;
                                Roll        = BreakdownTD[1].Text;
                                Acc_Num     = BreakdownTD[2].Text;
                                Sta         = BreakdownTD[3].Text;
                                Date_Paid   = BreakdownTD[4].Text;
                                Amount_Paid = BreakdownTD[5].Text;
                                Balnc_Due   = BreakdownTD[6].Text;

                                Payment_details = Tax_Year + "~" + Roll + "~" + Acc_Num + "~" + Sta + "~" + Date_Paid + "~" + Amount_Paid + "~" + Balnc_Due;
                                gc.insert_date(orderNumber, ParcelID, 695, Payment_details, 1, DateTime.Now);
                            }
                        }
                    }
                    catch
                    { }

                    //Tax Information
                    Acc_No = driver.FindElement(By.XPath("//*[@id='tbl1']/tbody/tr[2]/td[2]")).Text.Replace("               ", "");
                    Typ    = driver.FindElement(By.XPath("//*[@id='tbl1']/tbody/tr[2]/td[4]/table/tbody/tr/td[1]")).Text;
                    Add    = driver.FindElement(By.XPath("//*[@id='tbl1']/tbody/tr[3]/td[2]")).Text;

                    try
                    {
                        Deliquent = driver.FindElement(By.XPath("//*[@id='tbl3']/tbody/tr[4]/td")).Text;
                    }
                    catch
                    { }

                    try
                    {
                        Roll_Coment = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_tblSummary']/tbody/tr[3]/td[2]")).Text;
                    }
                    catch
                    { }
                    List <string> ParcelSearch = new List <string>();

                    try
                    {
                        IWebElement         ParcelTB = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_tblSummary']/tbody"));
                        IList <IWebElement> ParcelTR = ParcelTB.FindElements(By.TagName("tr"));
                        ParcelTR.Reverse();
                        int rows_count = ParcelTR.Count;

                        for (int row = 0; row < rows_count; row++)
                        {
                            if (row == rows_count - 1 || row == rows_count - 2 || row == rows_count - 3)
                            {
                                IList <IWebElement> Columns_row = ParcelTR[row].FindElements(By.TagName("td"));

                                int columns_count = Columns_row.Count;

                                for (int column = 0; column < columns_count; column++)
                                {
                                    if (column == columns_count - 2)
                                    {
                                        IWebElement ParcelBill_link = Columns_row[0].FindElement(By.TagName("a"));
                                        string      Parcelurl       = ParcelBill_link.GetAttribute("href");
                                        ParcelSearch.Add(Parcelurl);
                                    }
                                }
                            }
                        }
                    }
                    catch
                    { }

                    foreach (string Parcelbill in ParcelSearch)
                    {
                        driver.Navigate().GoToUrl(Parcelbill);
                        Thread.Sleep(3000);

                        Taxy = driver.FindElement(By.XPath("//*[@id='_ctl0_ContentPlaceHolder1_lblDetTaxYear']")).Text;

                        try
                        {
                            Pdes1 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[1]/td")).Text;
                            Pdes2 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[2]/td")).Text;
                            Pdes3 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[3]/td")).Text;
                            Pdes4 = driver.FindElement(By.XPath("//*[@id='Table2a']/tbody/tr[4]/td")).Text;

                            P_des = Pdes1 + " " + Pdes2 + " " + Pdes3 + " " + Pdes4;
                        }
                        catch
                        { }


                        try
                        {
                            OInfo1     = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[1]/td")).Text;
                            M_Addr1    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[2]/td")).Text;
                            M_Addr2    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[3]/td")).Text;
                            Owner_Mail = OInfo1 + " & " + M_Addr1 + " " + M_Addr2;
                        }
                        catch
                        { }

                        try
                        {
                            OInfo1     = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[1]/td")).Text;
                            OInfo2     = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[2]/td")).Text;
                            M_Addr1    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[3]/td")).Text;
                            M_Addr2    = driver.FindElement(By.XPath("//*[@id='Table2b']/tbody/tr[4]/td")).Text;
                            Owner_Mail = OInfo1 + " " + OInfo2 + " & " + M_Addr1 + " " + M_Addr2;
                        }
                        catch
                        { }

                        try
                        {
                            IWebElement         tbmulti11 = driver.FindElement(By.XPath("//*[@id='Table2c']/tbody"));
                            IList <IWebElement> TRmulti11 = tbmulti11.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti11;

                            foreach (IWebElement row in TRmulti11)
                            {
                                TDmulti11 = row.FindElements(By.TagName("td"));
                                if (TDmulti11.Count != 0)
                                {
                                    Mkt = TDmulti11[0].Text;
                                    if (Mkt.Contains("MARKET VALU"))
                                    {
                                        Markt_Value = TDmulti11[0].Text.Replace(" ", "");
                                        Markt_Value = WebDriverTest.After(Markt_Value, "MARKETVALU");
                                    }
                                    Asst = TDmulti11[0].Text;
                                    if (Asst.Contains("ASSESSMENT"))
                                    {
                                        ASSESSMENT = TDmulti11[0].Text.Replace(" ", "");
                                        ASSESSMENT = WebDriverTest.After(ASSESSMENT, "ASSESSMENT");
                                    }
                                    Txb = TDmulti11[0].Text;
                                    if (Txb.Contains("TAXABLE"))
                                    {
                                        TAXABLE = TDmulti11[0].Text.Replace(" ", "");
                                        TAXABLE = WebDriverTest.After(TAXABLE, "TAXABLE");
                                    }
                                    Ext = TDmulti11[0].Text;
                                    if (Ext.Contains("EXCD01"))
                                    {
                                        EXC = TDmulti11[0].Text.Replace(" ", "");
                                        EXC = WebDriverTest.After(EXC, "EXCD01");
                                    }
                                    Ext1 = TDmulti11[0].Text;
                                    if (Ext1.Contains("EXCD38"))
                                    {
                                        EXC1 = TDmulti11[0].Text.Replace(" ", "");
                                        EXC1 = WebDriverTest.After(EXC1, "EXCD38");
                                    }
                                    Ext2 = TDmulti11[0].Text;
                                    if (Ext2.Contains("EXCD02"))
                                    {
                                        EXC2 = TDmulti11[0].Text.Replace(" ", "");
                                        EXC2 = WebDriverTest.After(EXC2, "EXCD02");
                                    }
                                    Count_Asst = TDmulti11[0].Text;
                                    if (Count_Asst.Contains("COUNTY ASMT"))
                                    {
                                        County_ASMT = TDmulti11[0].Text.Replace(" ", "");
                                        County_ASMT = WebDriverTest.After(County_ASMT, "COUNTYASMT");
                                    }
                                    Count_txbl = TDmulti11[0].Text;
                                    if (Count_txbl.Contains("COUNTY TXBL"))
                                    {
                                        County_TXBL = TDmulti11[0].Text.Replace(" ", "");
                                        County_TXBL = WebDriverTest.After(County_TXBL, "COUNTYTXBL");
                                    }
                                    Tax_Asst = TDmulti11[0].Text;
                                    if (Tax_Asst.Contains("SCHOOL ASMT"))
                                    {
                                        Tax_ASMT = TDmulti11[0].Text.Replace(" ", "");
                                        Tax_ASMT = WebDriverTest.After(Tax_ASMT, "SCHOOLASMT");
                                    }
                                    Tax_txbl = TDmulti11[0].Text;
                                    if (Tax_txbl.Contains("SCHOOL TXBL"))
                                    {
                                        Tax_TXBL = TDmulti11[0].Text.Replace(" ", "");
                                        Tax_TXBL = WebDriverTest.After(Tax_TXBL, "SCHOOLTXBL");
                                    }
                                }
                            }

                            IWebElement         tbmulti1 = driver.FindElement(By.XPath("//*[@id='Table2d']/tbody"));
                            IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr"));
                            IList <IWebElement> TDmulti1;

                            foreach (IWebElement row in TRmulti1)
                            {
                                TDmulti1 = row.FindElements(By.TagName("td"));
                                if (TDmulti1.Count != 0)
                                {
                                    txes = TDmulti1[0].Text;
                                    if (txes.Contains("TAXES"))
                                    {
                                        TAXES = TDmulti1[0].Text.Replace(" ", "");
                                        TAXES = WebDriverTest.After(TAXES, "TAXES");
                                    }

                                    sptxs = TDmulti1[0].Text;
                                    if (sptxs.Contains("SP. ASMT"))
                                    {
                                        SP_ASMT = TDmulti1[0].Text.Replace(" ", "");
                                        SP_ASMT = WebDriverTest.After(SP_ASMT, "SP.ASMT");
                                    }

                                    intt = TDmulti1[0].Text;
                                    if (intt.Contains("INT."))
                                    {
                                        INT = TDmulti1[0].Text.Replace(" ", "");
                                        INT = WebDriverTest.After(INT, "INT.");
                                    }

                                    Salet = TDmulti1[0].Text;
                                    if (Salet.Contains("SALE 5%"))
                                    {
                                        SALE = TDmulti1[0].Text.Replace(" ", "");
                                        SALE = WebDriverTest.After(SALE, "SALE5%");
                                    }

                                    Advt = TDmulti1[0].Text;
                                    if (Advt.Contains("ADV. FEE"))
                                    {
                                        ADV = TDmulti1[0].Text.Replace(" ", "");
                                        ADV = WebDriverTest.After(ADV, "ADV.FEE");
                                    }
                                }
                            }

                            Tax_Info = Acc_No + "~" + Typ + "~" + Add + "~" + Taxy + "~" + P_des + "~" + Owner_Mail + "~" + Markt_Value + "~" + ASSESSMENT + "~" + TAXABLE + "~" + EXC + "~" + EXC1 + "~" + EXC2 + "~" + TAXES + "~" + SP_ASMT + "~" + INT + "~" + SALE + "~" + ADV + "~" + County_ASMT + "~" + County_TXBL + "~" + Tax_ASMT + "~" + Tax_TXBL;
                            gc.insert_date(orderNumber, ParcelID, 697, Tax_Info, 1, DateTime.Now);
                            Markt_Value = ""; ASSESSMENT = ""; TAXABLE = ""; EXC = ""; EXC1 = ""; EXC2 = ""; TAXES = ""; SP_ASMT = ""; INT = ""; SALE = ""; ADV = ""; County_ASMT = ""; County_TXBL = ""; Tax_ASMT = ""; Tax_TXBL = "";
                        }
                        catch
                        { }
                        gc.CreatePdf(orderNumber, ParcelID, "Tax Payment Details" + Taxy, driver, "FL", "Marion");
                        Thread.Sleep(2000);

                        //Tax Receipt
                        try
                        {
                            Receipt = driver.FindElement(By.XPath("//*[@id='tbl5']/tbody/tr[4]/td")).Text.Replace(" ", "");

                            Commonreceipt = Receipt;

                            if (Commonreceipt.Length == 58)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 9);
                                D = Receipt.Substring(38, 7);
                                E = Receipt.Substring(45, 4);
                                F = Receipt.Substring(49, 9);

                                Receipt_Details5 = A + "~" + B + "~" + "~" + C + "~" + D + "~" + E + "~" + F;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details5, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 42)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);

                                Receipt_Details1 = A + "~" + B + "~" + C + "~" + D + "~" + "" + "~" + "" + "~" + "";
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details1, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 62)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);
                                E = Receipt.Substring(42, 7);
                                F = Receipt.Substring(49, 4);
                                G = Receipt.Substring(53, 9);

                                Receipt_Details2 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details2, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 61)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 10);
                                E = Receipt.Substring(43, 6);
                                F = Receipt.Substring(49, 5);
                                G = Receipt.Substring(54, 7);

                                Receipt_Details3 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details3, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 60)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);
                                E = Receipt.Substring(42, 7);
                                F = Receipt.Substring(49, 4);
                                G = Receipt.Substring(53, 7);

                                Receipt_Details4 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details4, 1, DateTime.Now);
                            }

                            if (Commonreceipt.Length == 56)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 9);
                                D = Receipt.Substring(38, 7);
                                E = Receipt.Substring(45, 4);
                                F = Receipt.Substring(49, 7);

                                Receipt_Details4 = A + "~" + B + "~" + "" + "~" + C + "~" + D + "~" + E + "~" + F;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details4, 1, DateTime.Now);
                            }
                            if (Commonreceipt.Length == 64)
                            {
                                A = Receipt.Substring(0, 10);
                                B = Receipt.Substring(10, 19);
                                C = Receipt.Substring(29, 4);
                                D = Receipt.Substring(33, 9);
                                E = Receipt.Substring(42, 8);
                                F = Receipt.Substring(50, 4);
                                G = Receipt.Substring(54, 10);

                                Receipt_Details9 = A + "~" + B + "~" + C + "~" + D + "~" + E + "~" + F + "~" + G;
                                gc.insert_date(orderNumber, ParcelID, 698, Receipt_Details9, 1, DateTime.Now);
                            }
                        }
                        catch
                        { }

                        //driver.Navigate().Back();
                        //Thread.Sleep(2000);
                    }

                    driver.FindElement(By.Id("_ctl0_ContentPlaceHolder1_lnkAcctBill2")).Click();
                    Thread.Sleep(3000);

                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                    Thread.Sleep(4000);

                    //Ad-Valorem & Non-Ad Valorem
                    IWebElement         AdValoremTB = driver.FindElement(By.XPath("//*[@id='Table3']/tbody"));
                    IList <IWebElement> AdValoremTR = AdValoremTB.FindElements(By.TagName("tr"));
                    IList <IWebElement> AdValoremTD;

                    foreach (IWebElement AdValorem in AdValoremTR)
                    {
                        AdValoremTD = AdValorem.FindElements(By.TagName("td"));
                        if (AdValoremTD.Count != 0 && !AdValorem.Text.Contains("TAXING AUTHORITY") && AdValoremTD[0].Text != "" && !AdValorem.Text.Contains("*** PAID *** PAID *** PAID ***") && !AdValorem.Text.Contains("PERIOD"))
                        {
                            //if (AdValorem.Text.Contains("COMBINED TAXES & ASSESSMENTS TOTAL:"))
                            //{
                            //    break;
                            //}
                            string Output = AdValoremTD[0].Text;
                            Output = Regex.Replace(Output, @"\s+", " ").TrimStart();
                            Output = Output.Replace(" ", "~");
                            string[]      rowarrayname1 = Output.Split('~');
                            List <string> listname      = new List <string>();
                            listname.AddRange(rowarrayname1);
                            int    count = listname.Count();
                            string name = "", millege = "", assessed = "", exemptions = "", taxable = "", taxes = "";
                            int    k = 0;
                            if (count == 2 && listname[0].Any(Char.IsDigit))
                            {
                                Advalorem_details1 = "Total Millege" + "~" + listname[0] + "~" + "" + "~" + "" + "~" + "Total Ad Valorem Taxes" + "~" + listname[1];
                                gc.CreatePdf(orderNumber, ParcelID, "Ad-Valorem & Non-Ad Valorem Taxs Details" + Taxy, driver, "FL", "Marion");
                                gc.insert_date(orderNumber, ParcelID, 700, Advalorem_details1, 1, DateTime.Now);
                            }
                            else
                            {
                                for (int i = 0; i < count; i++)
                                {
                                    if (!listname[i].Any(Char.IsDigit))
                                    {
                                        name = name + " " + listname[i];
                                    }
                                    else
                                    {
                                        if (listname[i].Any(Char.IsDigit) && (k == 0))
                                        {
                                            millege = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 1))
                                        {
                                            assessed = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 2))
                                        {
                                            exemptions = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 3))
                                        {
                                            taxable = listname[i];
                                        }
                                        if (listname[i].Any(Char.IsDigit) && (k == 4))
                                        {
                                            taxes = listname[i];
                                        }
                                        k++;
                                    }
                                }
                            }
                            Advalorem_details = name + "~" + millege + "~" + assessed + "~" + exemptions + "~" + taxable + "~" + taxes;
                            gc.CreatePdf(orderNumber, ParcelID, "Ad-Valorem & Non-Ad Valorem Taxs Details" + Taxy, driver, "FL", "Marion");
                            gc.insert_date(orderNumber, ParcelID, 700, Advalorem_details, 1, DateTime.Now);
                        }
                    }

                    //Taxing Authority
                    driver.Navigate().GoToUrl("https://www.mariontax.com/itm.asp");
                    Thread.Sleep(2000);
                    Deliquent_Comments = "";
                    CER_Comments       = "";
                    try
                    {
                        Taxing_Authority = driver.FindElement(By.XPath("//*[@id='ss-block-container-1']/div/address[2]")).Text.Replace("\r\n", " ");
                    }
                    catch { }

                    if (Deliquent == "DELINQUENT TAXES DUE          ")
                    {
                        Deliquent_Comments = "For prior tax amount due, you must call the tax Collector's Office.";
                    }

                    if (Roll_Coment == "CER")
                    {
                        CER_Comments = "Tax Sale in property. Need to contact Tax Collector";
                    }
                    Taxauthority_Details = Taxing_Authority + "~" + Deliquent_Comments + "~" + CER_Comments;
                    gc.CreatePdf(orderNumber, ParcelID, "Tax Authority", driver, "FL", "Marion");
                    gc.insert_date(orderNumber, ParcelID, 704, Taxauthority_Details, 1, DateTime.Now);

                    TaxTime = DateTime.Now.ToString("HH:mm:ss");

                    LastEndTime = DateTime.Now.ToString("HH:mm:ss");
                    gc.insert_TakenTime(orderNumber, "FL", "Marion", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime);

                    driver.Quit();
                    gc.mergpdf(orderNumber, "FL", "Marion");
                    return("Data Inserted Successfully");
                }
                catch (Exception ex)
                {
                    driver.Quit();
                    GlobalClass.LogError(ex, orderNumber);
                    throw;
                }
            }
        }
Example #8
0
        private void parsePacketEntities(Q3HuffmanReader decoder, CLSnapshot oldframe, CLSnapshot newframe)
        {
            newframe.parseEntitiesNum = client.parseEntitiesNum;
            newframe.numEntities      = 0;
            int         newnum   = 0;
            int         oldindex = 0;
            int         oldnum   = 0;
            EntityState oldstate = null;

            if (oldframe == null)
            {
                oldnum = 99999;
            }
            else
            {
                if (oldindex >= oldframe.numEntities)
                {
                    oldnum = 99999;
                }
                else
                {
                    oldstate = Ext2 <int, EntityState> .GetOrCreate(client.parseEntities, (oldframe.parseEntitiesNum + oldindex)& (Q3Const.MAX_PARSE_ENTITIES - 1));

                    oldnum = oldstate.number;
                }
            }

            while (true)
            {
                newnum = (int)decoder.readNumBits(Q3Const.GENTITYNUM_BITS);

                if (newnum == (Q3Const.MAX_GENTITIES - 1))
                {
                    break;
                }

                if (decoder.isEOD())
                {
                    Q3Utils.PrintDebug(clc.errors, "ERR_DROP, CL_ParsePacketEntities: end of message");
                    return;
                }

                while (oldnum < newnum)
                {
                    // one or more entities from the old packet are unchanged
                    CL_DeltaEntity(decoder, newframe, oldnum, oldstate, true);

                    oldindex++;

                    if (oldindex >= oldframe.numEntities)
                    {
                        oldnum = 99999;
                    }
                    else
                    {
                        oldstate = Ext2 <int, EntityState> .GetOrCreate(client.parseEntities,
                                                                        (oldframe.parseEntitiesNum + oldindex)& (Q3Const.MAX_PARSE_ENTITIES - 1));

                        oldnum = oldstate.number;
                    }
                }

                if (oldnum == newnum)
                {
                    // delta from previous state
                    CL_DeltaEntity(decoder, newframe, newnum, oldstate, false);

                    oldindex++;

                    if (oldindex >= oldframe.numEntities)
                    {
                        oldnum = 99999;
                    }
                    else
                    {
                        oldstate = Ext2 <int, EntityState> .GetOrCreate(client.parseEntities,
                                                                        (oldframe.parseEntitiesNum + oldindex)& (Q3Const.MAX_PARSE_ENTITIES - 1));

                        oldnum = oldstate.number;
                    }
                    continue;
                }

                if (oldnum > newnum)
                {
                    // delta from baseline
                    EntityState es = Ext2 <int, EntityState> .GetOrCreate(client.entityBaselines, newnum);

                    CL_DeltaEntity(decoder, newframe, newnum, es, false);
                    continue;
                }
            }

            // any remaining entities in the old frame are copied over
            while (oldnum != 99999)
            {
                // one or more entities from the old packet are unchanged
                CL_DeltaEntity(decoder, newframe, oldnum, oldstate, true);

                oldindex++;

                if (oldindex >= oldframe.numEntities)
                {
                    oldnum = 99999;
                }
                else
                {
                    oldstate = Ext2 <int, EntityState> .GetOrCreate(client.parseEntities,
                                                                    (oldframe.parseEntitiesNum + oldindex)& (Q3Const.MAX_PARSE_ENTITIES - 1));

                    oldnum = oldstate.number;
                }
            }
        }
Example #9
0
        private void parseSnapshot(Q3HuffmanReader decoder)
        {
            if (client.clientConfig == null)
            {
                client.clientConfig = new Dictionary <string, string>();

                if (clc.configs.ContainsKey(Q3Const.Q3_DEMO_CFG_FIELD_GAME))
                {
                    var gameConfig = Q3Utils.split_config(clc.configs[Q3Const.Q3_DEMO_CFG_FIELD_GAME]);
                    client.isCheatsOn = Ext.GetOrZero(gameConfig, "sv_cheats") > 0;
                }
                if (clc.configs.ContainsKey(Q3Const.Q3_DEMO_CFG_FIELD_CLIENT))
                {
                    client.clientConfig    = Q3Utils.split_config(clc.configs[Q3Const.Q3_DEMO_CFG_FIELD_CLIENT]);
                    client.dfvers          = Ext.GetOrZero(client.clientConfig, "defrag_vers");
                    client.mapname         = Ext.GetOrNull(client.clientConfig, "mapname");
                    client.mapNameChecksum = getMapNameChecksum(client.mapname);
                    client.isOnline        = Ext.GetOrZero(client.clientConfig, "defrag_gametype") > 4;
                }
            }

            CLSnapshot newSnap = new CLSnapshot();
            CLSnapshot old     = null;

            newSnap.serverCommandNum = clc.serverCommandSequence;
            newSnap.serverTime       = decoder.readLong();
            newSnap.messageNum       = clc.serverMessageSequence;

            int deltaNum = decoder.readByte();

            if (deltaNum == 0)
            {
                newSnap.deltaNum = -1;
            }
            else
            {
                newSnap.deltaNum = newSnap.messageNum - deltaNum;
            }
            newSnap.snapFlags = decoder.readByte();
            // If the frame is delta compressed from data that we
            // no longer have available, we must suck up the rest of
            // the frame, but not use it, then ask for a non-compressed
            // message
            if (newSnap.deltaNum <= 0)
            {
                newSnap.valid   = true;        // uncompressed frame
                old             = null;
                clc.demowaiting = false;       // we can start recording now
            }
            else
            {
                old = Ext2 <int, CLSnapshot> .GetOrCreate(client.snapshots, newSnap.deltaNum& Q3Const.PACKET_MASK);

                if (old == null || !old.valid)
                {
                    // should never happen
                    Q3Utils.PrintDebug(clc.errors, "Delta from invalid frame (not supposed to happen!)");
                }
                else if (old.messageNum != newSnap.deltaNum)
                {
                    // The frame that the server did the delta from
                    // is too old, so we can't reconstruct it properly.
                    Q3Utils.PrintDebug(clc.errors, "Delta frame too old.");
                }
                else if ((client.parseEntitiesNum - old.parseEntitiesNum) > (Q3Const.MAX_PARSE_ENTITIES - 128))
                {
                    Q3Utils.PrintDebug(clc.errors, "Delta parseEntitiesNum too old");
                }
                else
                {
                    newSnap.valid = true;  // valid delta parse
                }
            }

            int len = decoder.readByte();

            if (len > newSnap.areamask.Length)
            {
                Q3Utils.PrintDebug(clc.errors, "CL_ParseSnapshot: Invalid size {0} for areamask", len);
                return;
            }
            decoder.readData(newSnap.areamask, len);
            if (old != null)
            {
                newSnap.ps.copy(old.ps);
            }
            decoder.readDeltaPlayerState(newSnap.ps);
            parsePacketEntities(decoder, old, newSnap);

            // if not valid, dump the entire thing now that it has
            // been properly read
            if (!newSnap.valid)
            {
                return;
            }

            // clear the valid flags of any snapshots between the last
            // received and this one, so if there was a dropped packet
            // it won't look like something valid to delta from next
            // time we wrap around in the buffer
            int oldMessageNum = client.snap.messageNum + 1;

            if (newSnap.messageNum - oldMessageNum >= Q3Const.PACKET_BACKUP)
            {
                oldMessageNum = newSnap.messageNum - (Q3Const.PACKET_BACKUP - 1);
            }
            for (; oldMessageNum < newSnap.messageNum; oldMessageNum++)
            {
                CLSnapshot s;
                if (client.snapshots.TryGetValue(oldMessageNum & Q3Const.PACKET_MASK, out s))
                {
                    if (s != null)
                    {
                        s.valid = false;
                    }
                }
            }

            // copy to the current good spot
            client.snap = newSnap;

            // skip ping calculations
            client.snap.ping = 0;

            // save the frame off in the backup array for later delta comparisons
            client.snapshots[client.snap.messageNum & Q3Const.PACKET_MASK] = client.snap;

            client.newSnapshots = true;

            updateClientEvents(newSnap);
        }