Ejemplo n.º 1
0
        private void btnSearch_Click_1(object sender, EventArgs e)
        {
            //_searchFields[0] = ChequeReplyEntity.FIELD_RECIEPTBILLNUMBER;
            //_searchFields[1] = ChequeReplyEntity.FIELD_ISSUEDATE;
            //_searchFields[2] = ChequeReplyEntity.FIELD_PRICE;
            //_searchFields[3] = ChequeReplyEntity.FIELD_DESCRIPTION;

            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (_searchPanels[0].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeReplyEntity.FIELD_RECIEPTBILLNUMBER, txtRecieptBillNumber.Text, "");
            }
            else if (_searchPanels[1].Visible)
            {
                cond = searchTools.getDateFldCond(ChequeReplyEntity.FIELD_ISSUEDATE, txtIssueDate.Text, txtTo.Text, cmbCompareIssueDate, "");
            }
            else if (_searchPanels[2].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeReplyEntity.FIELD_PRICE, txtPrice2.Text, "");
            }
            else if (_searchPanels[3].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeReplyEntity.FIELD_DESCRIPTION, txtDescription2.Text, "");
            }
            fillGrid(cond);
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "TopicID,Topic1,TopicURL,Search,Tags,CategoryID,UserId,TimeStamp")] Topic topic)
        {
            if (ModelState.IsValid)
            {
                // If user is logged in, get UserID. To get to this point, user must be logged in.
                if (User.Identity.IsAuthenticated)
                {
                    var      userName = User.Identity.Name;
                    Identity ident    = new Identity();

                    topic.UserId = ident.GetUserID(userName);
                }
                else
                {
                    topic.UserId = 0;
                }

                SearchTools st = new SearchTools();

                topic.TopicURL  = st.CreateSearchURL(topic.Topic1);
                topic.TimeStamp = DateTime.Now;

                entVote.Topics.Add(topic);
                entVote.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryID = new SelectList(entVote.CategoryLists, "CategoryID", "Category", topic.CategoryID);
            return(View(topic));
        }
Ejemplo n.º 3
0
        public AdvanceSearchForm(int letterType)
        {
            _letterType  = letterType;
            _searchTools = new SearchTools();

            InitializeComponent();
        }
Ejemplo n.º 4
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (_searchPanels[0].Visible)
            {
                cond = searchTools.getStringFldCond(AgentEntity.FIELD_Agent_NAME, txtAgentName.Text, "");
            }
            else if (_searchPanels[1].Visible)
            {
                cond = searchTools.getStringFldCond(AgentEntity.FIELD_AGENTCODE, txtAgentCode.Text, "");
            }
            else if (_searchPanels[2].Visible)
            {
                cond = searchTools.getStringFldCond(AgentEntity.FIELD_TELEPHONE, txtTelephone.Text, "");
            }
            else if (_searchPanels[3].Visible)
            {
                cond = searchTools.getStringFldCond(AgentEntity.FIELD_MOBILE, txtMobile.Text, "");
            }
            else if (_searchPanels[4].Visible)
            {
                cond = searchTools.getStringFldCond(AgentEntity.FIELD_FAX, txtFax.Text, "");
            }
            else if (_searchPanels[5].Visible)
            {
                cond = searchTools.getStringFldCond(AgentEntity.FIELD_ADDRESS, txtAddress.Text, "");
            }
            fillGrid(cond);
        }
Ejemplo n.º 5
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (_searchPanels[0].Visible)
            {
                cond = searchTools.getStringFldCond(CompanyEntity.FIELD_COMPANY_NAME, txtCompanyName.Text, "");
            }
            else if (_searchPanels[1].Visible)
            {
                cond = searchTools.getStringFldCond(CompanyEntity.FIELD_OFFICER, txtOfficer.Text, "");
            }
            else if (_searchPanels[2].Visible)
            {
                cond = searchTools.getCombofldCond(cmbSemat, CompanyEntity.FIELD_SEMAT, "");
            }
            else if (_searchPanels[3].Visible)
            {
                cond = searchTools.getStringFldCond(CompanyEntity.FIELD_TEL, txtTel.Text, "");
            }
            else if (_searchPanels[4].Visible)
            {
                cond = searchTools.getStringFldCond(CompanyEntity.FIELD_FAX, txtFax.Text, "");
            }
            else if (_searchPanels[5].Visible)
            {
                cond = searchTools.getStringFldCond(CompanyEntity.FIELD_ADDRESS, txtAddress.Text, "");
            }
            else if (_searchPanels[6].Visible)
            {
                cond = searchTools.getStringFldCond(CompanyEntity.FIELD_DESCRIPTION, txtDescription.Text, "");
            }
            fillGrid(cond);
        }
Ejemplo n.º 6
0
        public static InsolvenceSearchResult SimpleSearch(InsolvenceSearchResult search, bool withHighlighting = false)
        {
            var client = Manager.GetESClient_Insolvence();
            var page   = search.Page - 1 < 0 ? 0 : search.Page - 1;

            var sw = new StopWatchEx();

            sw.Start();

            search.Q = SearchTools.FixInvalidQuery(search.Q ?? "", queryShorcuts, queryOperators);


            ISearchResponse <Rizeni> res = null;

            try
            {
                res = client
                      .Search <Rizeni>(s => s
                                       .Size(search.PageSize)
                                       .ExpandWildcards(Elasticsearch.Net.ExpandWildcards.All)
                                       .From(page * search.PageSize)
                                       .Source(sr => sr.Excludes(r => r.Fields("dokumenty.plainText")))
                                       .Query(q => GetSimpleQuery(search))
                                       .Sort(ss => new SortDescriptor <Rizeni>().Field(m => m.Field(f => f.PosledniZmena).Descending()))
                                       .Highlight(h => Lib.ES.SearchTools.GetHighlight <Rizeni>(withHighlighting))
                                       );
            }
            catch (Exception e)
            {
                if (res != null && res.ServerError != null)
                {
                    Manager.LogQueryError <Rizeni>(res, "Exception, Orig query:"
                                                   + search.OrigQuery + "   query:"
                                                   + search.Q
                                                   + "\n\n res:" + search.Result.ToString()
                                                   , ex: e);
                }
                else
                {
                    HlidacStatu.Util.Consts.Logger.Error("", e);
                }
                throw;
            }
            sw.Stop();

            if (res.IsValid == false)
            {
                Manager.LogQueryError <Rizeni>(res, "Exception, Orig query:"
                                               + search.OrigQuery + "   query:"
                                               + search.Q
                                               + "\n\n res:" + search.Result?.ToString()
                                               );
            }

            search.Total          = res?.Total ?? 0;
            search.IsValid        = res?.IsValid ?? false;
            search.ElasticResults = res;
            search.ElapsedTime    = sw.Elapsed;
            return(search);
        }
Ejemplo n.º 7
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (_searchPanels[0].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeEntity.FIELD_CHEQUE_NUMBER, txtChequeNumber.Text, "");
            }
            else if (_searchPanels[1].Visible)
            {
                cond = searchTools.getDateFldCond(ChequeEntity.FIELD_MATURITY_DATE, txtMaturityDate.Text, txtMaturityDateTo.Text, cmbCompareMaturityDate, "");
            }
            else if (_searchPanels[2].Visible)
            {
                cond = searchTools.getDateFldCond(ChequeEntity.FIELD_ENTRY_DATE, txtEntryDate.Text, txtEntryDateTo.Text, cmbCompareEntryDate, "");
            }
            else if (_searchPanels[3].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeEntity.FIELD_PRICE, txtPrice.Text, "");
            }
            else if (_searchPanels[4].Visible)
            {
                cond = searchTools.getCombofldCond(cmbBankId, ChequeEntity.FIELD_BANK_ID, "");
            }
            else if (_searchPanels[5].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeEntity.FIELD_ACCOUNT_HOLDER_NAME, txtAccountHolderName.Text, "");
            }
            else if (_searchPanels[6].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeEntity.FIELD_ACCOUNT_NUMBER, txtAccountNumber.Text, "");
            }
            else if (_searchPanels[7].Visible)
            {
                cond = searchTools.getStringFldCond(ChequeEntity.FIELD_DESCRIPTION, txtDescription.Text, "");
            }
            else if (_searchPanels[8].Visible)
            {
                cond = searchTools.getCombofldCond(cmbPayType, ChequeEntity.FIELD_PAY_TYPE, "");
            }
            else if (_searchPanels[9].Visible)
            {
                cond = searchTools.getNumberFldCond((int)txtCompany.Tag, ChequeEntity.FIELD_COMPANY_ID, "");
            }
            else if (_searchPanels[10].Visible)
            {
                cond = searchTools.getCombofldCond(cmbRefferFrom, ChequeEntity.FIELD_REFER_FROM_USER_ID, "");
            }
            else if (_searchPanels[11].Visible)
            {
                cond = searchTools.getCombofldCond(cmbRefferToUser, ChequeEntity.VIEW_FIELD_REFERENCED_USER_ID, "");
            }

            fillGrid(cond);
        }
        public ActionResult Search(string TagID)
        {
            if (TagID == null)
            {
                TagID = (string)Session["TagID"];
            }
            SearchTools          ST            = new SearchTools();
            ICollection <Offers> FiltredOffers = ST.GetOffersByTag(TagID);

            Session["TagID"] = TagID;
            return(View(FiltredOffers));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// HCommAir tool scanning start
 /// </summary>
 public void Start()
 {
     // clear searched tool list
     SearchTools.Clear();
     // join multicast group
     Client.JoinMulticastGroup(_mcIpAddr);
     // start scan timer
     ScanTimer.Change(0, ScanPeriod);
     // begin receive
     Client.BeginReceive(ClientReceived, null);
     // set scan status
     IsScanning = true;
 }
Ejemplo n.º 10
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (_searchPanels[0].Visible)
            {
                cond = searchTools.getStringFldCond(LetterGroupEntity.FIELD_GROUPTITLE, txtGroupTitle.Text, "");
            }
            else if (_searchPanels[1].Visible)
            {
                cond = searchTools.getStringFldCond(LetterGroupEntity.FIELD_LETTERNUMBERS, txtLetterNumbers.Text, "");
            }

            fillGrid(cond);
        }
        private async Task OnProjectOpenedAsync(ProjectEventArgs args)
        {
            var tools = await SearchTools.SearchAsync(Constants.RadialLineOfSightAndRange);

            if ((tools == null) || tools.Count() == 0)
            {
                AddIn.SystemToolsAvailable = false;
                return;
            }

            string searchResult = tools.ElementAt(0).ToString();

            if (searchResult.Contains(Constants.RadialLineOfSightAndRange))
            {
                AddIn.SystemToolsAvailable = true;
            }
            else
            {
                AddIn.SystemToolsAvailable = false;
            }
        }
Ejemplo n.º 12
0
        private void ScanTimer_Tick(object state)
        {
            // lock searching tool list
            if (!Monitor.TryEnter(SearchTools, _timeoutSpan))
            {
                return;
            }
            try
            {
                // update id
                TransactionId += 1;
                // create packet
                var packet = new byte[]
                { (byte)((TransactionId >> 8) & 0xFF), (byte)(TransactionId & 0xFF), 0x00, 0x01 };
                // send packet
                Client.Send(packet, packet.Length, new IPEndPoint(_mcIpAddr, McPort));

                // check timeout
                for (var i = 0; i < SearchTools.Count; i++)
                {
                    // check state update
                    if (!SearchTools[i].CheckTime())
                    {
                        continue;
                    }
                    // debug console
                    Console.WriteLine($@"Detach Tool: {SearchTools[i].Ip}");
                    Console.WriteLine($@"Detach Tool: {SearchTools[i].Mac}");
                    // detach
                    ToolDetach?.Invoke(SearchTools[i]);
                    // remove tool
                    SearchTools.Remove(SearchTools[i]);
                }
            }
            finally
            {
                // unlock
                Monitor.Exit(SearchTools);
            }
        }
Ejemplo n.º 13
0
        public void SearchDocument(string keys)
        {
            var collection = SearchUtil.Search(Publication.BookId, CurrentTocNode.ID, keys);

            if (collection != null)
            {
                var foundWordList = collection.FoundWordList;
                SearchResultsAll = collection.SearchDisplayResultList.Select(result => new SearchResultModel
                {
                    TocId          = result.TocId,
                    FirstLine      = result.isDocument ? result.Head : result.TocTitle,
                    SecondLine     = result.isDocument ? result.SnippetContent : result.GuideCardTitle,
                    ContentType    = SearchResultFilter[(int)result.ContentType - 1],
                    Type           = result.isDocument ? ResourceLoader.GetString("Document") : ResourceLoader.GetString("Publication"),
                    SnippetContent = result.SnippetContent,
                    Keywords       = foundWordList,
                    HeadType       = result.HeadType.ToString().ToLower(),
                    HeadIndex      = result.HeadSequence
                }).ToList <SearchResultModel>();
                SearchTools.KeepKeyword(foundWordList);
            }
            SearchFilter = searchResultFilter[0];
        }
Ejemplo n.º 14
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (_searchPanels[0].Visible)
            {
                cond = searchTools.getStringFldCond(UsersEntity.FIELD_NAME, txtName.Text, "");
            }
            else if (_searchPanels[1].Visible)
            {
                cond = searchTools.getStringFldCond(UsersEntity.FIELD_FAMILY, txtFamily.Text, "");
            }
            else if (_searchPanels[2].Visible)
            {
                cond = searchTools.getStringFldCond(UsersEntity.FIELD_USERNAME, txtUserName.Text, "");
            }
            else if (_searchPanels[3].Visible)
            {
                cond = getCombofldCond(cmbUserType, UsersEntity.FIELD_USER_TYPE, "");
            }

            fillGrid(cond);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Constructor that instantiates FFACE
        /// </summary>
        /// <param name="processID">The Process ID of the POL Process you want to interface with.</param>
        public FFACE (int processID)
        {
            // create our FFACE instance
            _InstanceID = CreateInstance((UInt32)processID);

            #region Find Windower Plugin Path

            System.Diagnostics.Process[] Processes = System.Diagnostics.Process.GetProcessesByName("pol");
            if (Processes.Length > 0)
                foreach (System.Diagnostics.ProcessModule mod in Processes[0].Modules)
                {
                    if (mod.ModuleName.ToLower() == "hook.dll")
                    {
                        WindowerPath = mod.FileName.Substring(0, mod.FileName.Length - 8) + @"\plugins\";
                        ParseResources.UseFFXIDatFiles = false;
                        break;
                    }
                }
            // Fix for non-windower users
            if (String.IsNullOrEmpty(WindowerPath))
            {
                string ExePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
                // If we have a resources folder, use the resource parser otherwise let it default to using .dat reader
                if (System.IO.Directory.Exists(ExePath + @"\resources\"))
                {
                    WindowerPath = ExePath;
                    ParseResources.UseFFXIDatFiles = false;
                }
            }

            #endregion

            // Find out if we should be using structs or not
            System.Diagnostics.FileVersionInfo fileInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(FFACE_LIBRARY);

            // Need 4, 1, 0, 14 or later.  Adjust these settings as needed.
            UInt64 version = ( (UInt64)fileInfo.FileMajorPart << 48 ) + ( (UInt64)fileInfo.FileMinorPart << 32 ) + ( (UInt64)fileInfo.FileBuildPart << 16 ) + (UInt64)fileInfo.FilePrivatePart;
            if (fileInfo.FileMajorPart != 4)
                throw new Exception(NEED_v410_24_OR_HIGHER);
            else if (version < 0x0004000100000018UL)			// 0004 0001 0000 000E (4, 1, 0, 14) // // 0004 0001 0000 0018 (4, 1, 0, 24)
                throw new Exception(NEED_v410_24_OR_HIGHER);

            /*if (fileInfo.FileMajorPart != 4)
                throw new Exception(NEED_v410_24_OR_HIGHER);
            else if (fileInfo.FileMinorPart < 1)
                throw new Exception(NEED_v410_24_OR_HIGHER);
            else if (fileInfo.FileBuildPart < 0)
                throw new Exception(NEED_v410_24_OR_HIGHER);
            else if (fileInfo.FilePrivatePart < 14)
                throw new Exception(NEED_v410_24_OR_HIGHER);*/


            // instantiate our classes
            Player = new PlayerTools(_InstanceID);
            Target = new TargetTools(_InstanceID);
            Party = new PartyTools(_InstanceID);
            Fish = new FishTools(_InstanceID);
            Windower = new WindowerTools(_InstanceID);
            Timer = new TimerTools(_InstanceID);
            Chat = new ChatTools(_InstanceID);
            Item = new ItemTools(this);
            NPC = new NPCTools(_InstanceID);
            Menu = new MenuTools(this);
            Search = new SearchTools(_InstanceID);
            Navigator = new NavigatorTools(this);
            Resources = ParseResources.Instance;

            #region Party Members

            // instantiate our party members
            PartyMember = new System.Collections.Generic.Dictionary<byte, PartyMemberTools>();
            PartyMember.Add(0, new PartyMemberTools(_InstanceID, 0));
            PartyMember.Add(1, new PartyMemberTools(_InstanceID, 1));
            PartyMember.Add(2, new PartyMemberTools(_InstanceID, 2));
            PartyMember.Add(3, new PartyMemberTools(_InstanceID, 3));
            PartyMember.Add(4, new PartyMemberTools(_InstanceID, 4));
            PartyMember.Add(5, new PartyMemberTools(_InstanceID, 5));
            PartyMember.Add(6, new PartyMemberTools(_InstanceID, 6));
            PartyMember.Add(7, new PartyMemberTools(_InstanceID, 7));
            PartyMember.Add(8, new PartyMemberTools(_InstanceID, 8));
            PartyMember.Add(9, new PartyMemberTools(_InstanceID, 9));
            PartyMember.Add(10, new PartyMemberTools(_InstanceID, 10));
            PartyMember.Add(11, new PartyMemberTools(_InstanceID, 11));
            PartyMember.Add(12, new PartyMemberTools(_InstanceID, 12));
            PartyMember.Add(13, new PartyMemberTools(_InstanceID, 13));
            PartyMember.Add(14, new PartyMemberTools(_InstanceID, 14));
            PartyMember.Add(15, new PartyMemberTools(_InstanceID, 15));
            PartyMember.Add(16, new PartyMemberTools(_InstanceID, 16));
            PartyMember.Add(17, new PartyMemberTools(_InstanceID, 17));

            #endregion

        } // @ public FFACEWrapper(uint processID)
Ejemplo n.º 16
0
 public ChequeAdvanceSearchForm()
 {
     InitializeComponent();
     _searchTools = new SearchTools();
     init();
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Constructor that instantiates FFACE
        /// </summary>
        /// <param name="processID">The Process ID of the POL Process you want to interface with.</param>
        public FFACE(int processID)
        {
            // create our FFACE instance
            _InstanceID = CreateInstance((UInt32)processID);

            if (!System.IO.Directory.Exists(WindowerPath) && !ParseResources.UseFFXIDatFiles)
            {
                ParseResources.UseFFXIDatFiles = true;
            }

            //#region Find Windower Plugin Path

            //System.Diagnostics.Process[] Processes = System.Diagnostics.Process.GetProcessesByName("pol");
            //if (Processes.Length > 0)
            //	foreach (System.Diagnostics.ProcessModule mod in Processes[0].Modules)
            //	{
            //		if (mod.ModuleName.ToLower() == "hook.dll")
            //		{
            //			WindowerPath = mod.FileName.Substring(0, mod.FileName.Length - 8) + @"\plugins\";
            //			break;
            //		}
            //	}

            //if (String.IsNullOrEmpty(WindowerPath))
            //	WindowerPath = "Windower path could not be found";

            //#endregion

            // Find out if we should be using structs or not
            System.Diagnostics.FileVersionInfo fileInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(FFACE_LIBRARY);

            // Need 4, 1, 0, 14 or later.  Adjust these settings as needed.
            UInt64 version = ((UInt64)fileInfo.FileMajorPart << 48) + ((UInt64)fileInfo.FileMinorPart << 32) + ((UInt64)fileInfo.FileBuildPart << 16) + (UInt64)fileInfo.FilePrivatePart;

            if (fileInfo.FileMajorPart != 4)
            {
                throw new Exception(NEED_v410_14_OR_HIGHER);
            }
            else if (version < 0x000400010000000EUL)                                    // 0004 0001 0000 000E (4, 1, 0, 14)
            {
                throw new Exception(NEED_v410_14_OR_HIGHER);
            }

            /*if (fileInfo.FileMajorPart != 4)
             *      throw new Exception(NEED_v410_14_OR_HIGHER);
             * else if (fileInfo.FileMinorPart < 1)
             *      throw new Exception(NEED_v410_14_OR_HIGHER);
             * else if (fileInfo.FileBuildPart < 0)
             *      throw new Exception(NEED_v410_14_OR_HIGHER);
             * else if (fileInfo.FilePrivatePart < 14)
             *      throw new Exception(NEED_v410_14_OR_HIGHER);*/


            // instantiate our classes
            Player    = new PlayerTools(_InstanceID);
            Target    = new TargetTools(_InstanceID);
            Party     = new PartyTools(_InstanceID);
            Fish      = new FishTools(_InstanceID);
            Windower  = new WindowerTools(_InstanceID);
            Timer     = new TimerTools(_InstanceID);
            Chat      = new ChatTools(_InstanceID);
            Item      = new ItemTools(this);
            NPC       = new NPCTools(_InstanceID);
            Menu      = new MenuTools(this);
            Search    = new SearchTools(_InstanceID);
            Navigator = new NavigatorTools(this);
            //Resources = ParseResources.Instance;

            #region Party Members

            // instantiate our party members
            PartyMember = new System.Collections.Generic.Dictionary <byte, PartyMemberTools>();
            PartyMember.Add(0, new PartyMemberTools(_InstanceID, 0));
            PartyMember.Add(1, new PartyMemberTools(_InstanceID, 1));
            PartyMember.Add(2, new PartyMemberTools(_InstanceID, 2));
            PartyMember.Add(3, new PartyMemberTools(_InstanceID, 3));
            PartyMember.Add(4, new PartyMemberTools(_InstanceID, 4));
            PartyMember.Add(5, new PartyMemberTools(_InstanceID, 5));
            PartyMember.Add(6, new PartyMemberTools(_InstanceID, 6));
            PartyMember.Add(7, new PartyMemberTools(_InstanceID, 7));
            PartyMember.Add(8, new PartyMemberTools(_InstanceID, 8));
            PartyMember.Add(9, new PartyMemberTools(_InstanceID, 9));
            PartyMember.Add(10, new PartyMemberTools(_InstanceID, 10));
            PartyMember.Add(11, new PartyMemberTools(_InstanceID, 11));
            PartyMember.Add(12, new PartyMemberTools(_InstanceID, 12));
            PartyMember.Add(13, new PartyMemberTools(_InstanceID, 13));
            PartyMember.Add(14, new PartyMemberTools(_InstanceID, 14));
            PartyMember.Add(15, new PartyMemberTools(_InstanceID, 15));
            PartyMember.Add(16, new PartyMemberTools(_InstanceID, 16));
            PartyMember.Add(17, new PartyMemberTools(_InstanceID, 17));

            #endregion
        }         // @ public FFACEWrapper(uint processID)
Ejemplo n.º 18
0
        /// <summary>
        /// Constructor that instantiates FFACE
        /// </summary>
        /// <param name="processID">The Process ID of the POL Process you want to interface with.</param>
        public FFACE(int processID)
        {
            // create our FFACE instance
            _InstanceID = CreateInstance((UInt32)processID);

            if (!System.IO.Directory.Exists(WindowerPath) && !ParseResources.UseFFXIDatFiles)
                ParseResources.UseFFXIDatFiles = true;

            //#region Find Windower Plugin Path

            //System.Diagnostics.Process[] Processes = System.Diagnostics.Process.GetProcessesByName("pol");
            //if (Processes.Length > 0)
            //	foreach (System.Diagnostics.ProcessModule mod in Processes[0].Modules)
            //	{
            //		if (mod.ModuleName.ToLower() == "hook.dll")
            //		{
            //			WindowerPath = mod.FileName.Substring(0, mod.FileName.Length - 8) + @"\plugins\";
            //			break;
            //		}
            //	}

            //if (String.IsNullOrEmpty(WindowerPath))
            //	WindowerPath = "Windower path could not be found";

            //#endregion

            // Find out if we should be using structs or not
            System.Diagnostics.FileVersionInfo fileInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(FFACE_LIBRARY);

            // Need 4, 1, 0, 14 or later.  Adjust these settings as needed.
            UInt64 version = ((UInt64)fileInfo.FileMajorPart << 48) + ((UInt64)fileInfo.FileMinorPart << 32) + ((UInt64)fileInfo.FileBuildPart << 16) + (UInt64)fileInfo.FilePrivatePart;
            if (fileInfo.FileMajorPart != 4)
                throw new Exception(NEED_v410_14_OR_HIGHER);
            else if (version < 0x000400010000000EUL)			// 0004 0001 0000 000E (4, 1, 0, 14)
                throw new Exception(NEED_v410_14_OR_HIGHER);

            /*if (fileInfo.FileMajorPart != 4)
                throw new Exception(NEED_v410_14_OR_HIGHER);
            else if (fileInfo.FileMinorPart < 1)
                throw new Exception(NEED_v410_14_OR_HIGHER);
            else if (fileInfo.FileBuildPart < 0)
                throw new Exception(NEED_v410_14_OR_HIGHER);
            else if (fileInfo.FilePrivatePart < 14)
                throw new Exception(NEED_v410_14_OR_HIGHER);*/

            // instantiate our classes
            Player = new PlayerTools(_InstanceID);
            Target = new TargetTools(_InstanceID);
            Party = new PartyTools(_InstanceID);
            Fish = new FishTools(_InstanceID);
            Windower = new WindowerTools(_InstanceID);
            Timer = new TimerTools(_InstanceID);
            Chat = new ChatTools(_InstanceID);
            Item = new ItemTools(this);
            NPC = new NPCTools(_InstanceID);
            Menu = new MenuTools(this);
            Search = new SearchTools(_InstanceID);
            Navigator = new NavigatorTools(this);
            //Resources = ParseResources.Instance;

            #region Party Members

            // instantiate our party members
            PartyMember = new System.Collections.Generic.Dictionary<byte, PartyMemberTools>();
            PartyMember.Add(0, new PartyMemberTools(_InstanceID, 0));
            PartyMember.Add(1, new PartyMemberTools(_InstanceID, 1));
            PartyMember.Add(2, new PartyMemberTools(_InstanceID, 2));
            PartyMember.Add(3, new PartyMemberTools(_InstanceID, 3));
            PartyMember.Add(4, new PartyMemberTools(_InstanceID, 4));
            PartyMember.Add(5, new PartyMemberTools(_InstanceID, 5));
            PartyMember.Add(6, new PartyMemberTools(_InstanceID, 6));
            PartyMember.Add(7, new PartyMemberTools(_InstanceID, 7));
            PartyMember.Add(8, new PartyMemberTools(_InstanceID, 8));
            PartyMember.Add(9, new PartyMemberTools(_InstanceID, 9));
            PartyMember.Add(10, new PartyMemberTools(_InstanceID, 10));
            PartyMember.Add(11, new PartyMemberTools(_InstanceID, 11));
            PartyMember.Add(12, new PartyMemberTools(_InstanceID, 12));
            PartyMember.Add(13, new PartyMemberTools(_InstanceID, 13));
            PartyMember.Add(14, new PartyMemberTools(_InstanceID, 14));
            PartyMember.Add(15, new PartyMemberTools(_InstanceID, 15));
            PartyMember.Add(16, new PartyMemberTools(_InstanceID, 16));
            PartyMember.Add(17, new PartyMemberTools(_InstanceID, 17));

            #endregion
        }
Ejemplo n.º 19
0
        public void TestMethod1()
        {
            SearchTools st = new SearchTools();

            string url = st.CreateSearchURL("the fox ran into the woods");
        }
Ejemplo n.º 20
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            SearchTools searchTools = new SearchTools();
            string      cond        = "";

            if (pnlLetterNumber.Visible)
            {
                cond = searchTools.getStringFldCond(LetterEntity.FIELD_LETTER_NUMBER, txtLetterNumber.Text, "");
            }
            else if (pnlLetterDate.Visible)
            {
                cond = searchTools.getDateFldCond(LetterEntity.FIELD_LETTER_DATE, txtLetterDate.Text, txtTo1.Text, cmbCompareLetterDate, "");
            }
            else if (pnlSubject.Visible)
            {
                cond = searchTools.getStringFldCond(LetterEntity.FIELD_LETTER_SUBJECT, txtSubject.Text, "");
            }
            else if (pnlInsurance.Visible)
            {
                cond = searchTools.getCombofldCond(cmbInsuranceType, LetterEntity.FIELD_INSURANCE_TYPE_ID, "");
                cond = searchTools.getStringFldCond(LetterEntity.FIELD_INSURANCE_NUMBER, txtInsuranceNumber.Text, cond);
            }
            else if (pnlInsuranceDate.Visible)
            {
                cond = searchTools.getDateFldCond(LetterEntity.FIELD_INSURANCE_DATE, txtInsuranceDate.Text, txtTo2.Text, cmbCompareInsuranceDate, "");
            }
            else if (pnlLetterState.Visible)
            {
                cond = searchTools.getCombofldCond(cmbLetterStateId, LetterEntity.FIELD_LETTER_STATE_ID, "");
            }
            else if (pnlReferenceUser.Visible)
            {
                cond = searchTools.getCombofldCond(cmbReferenceUserId, LetterEntity.VIEW_FIELD_REFERENCED_USER_ID, "");
            }
            else if (pnlRefferFrom.Visible)
            {
                cond = searchTools.getCombofldCond(cmbRefferFrom, LetterEntity.FIELD_REFER_FROM_USER_ID, "");
            }
            else if (pnlCompanyName.Visible)
            {
                cond = searchTools.getNumberFldCond((int)txtCompany.Tag, LetterEntity.FIELD_COMPANY_ID, "");
            }

            if (cond.Length > 0)
            {
                cond += " AND ";
            }
            cond += LetterEntity.FIELD_LETTER_TYPE + "=" + _letterType;

            if (rbDisplayArchived.Checked)
            {
                if (cond.Length > 0)
                {
                    cond += " AND ";
                }
                cond += LetterEntity.FIELD_ARCHIVE + "=1";
            }
            else if (rbDisplayNew.Checked)
            {
                if (cond.Length > 0)
                {
                    cond += " AND ";
                }
                cond += "(" + LetterEntity.FIELD_ARCHIVE + "=0 OR " + LetterEntity.FIELD_ARCHIVE + " IS NULL)";
            }
            fillGrid(cond);
        }
Ejemplo n.º 21
0
        private async void ScriptNotify(object sender, NotifyEventArgs e)
        {
            var notify = JsonConvert.DeserializeObject <NotifytModel>(e.Value);
            var contentPageViewModel = DataContext as ContentPageViewModel;

            switch (notify.Type)
            {
            case "POSITION":
                ContentMenuPosition = HtmlHelper.ConvertToPoint(notify.Value1, notify.Value2);
                break;

            case "SELECTED":
                string text = notify.Value1;
                SelectContent = SearchTools.RemoveBlank(text);
                double PaddingLeft = LeftSidePanelGrid.Visibility == Visibility.Visible ? 368 : 48;
                ContextMenuInitial(ContentMenuPosition, PaddingLeft);
                break;

            case "INFINITE":
                if (Navigating)
                {
                    return;
                }
                await Task.Run(() => { Navigating = true; });

                WebView webView = sender as WebView;

                switch (notify.Value1)
                {
                case "UP":
                    var last = contentPageViewModel.GetBackwardNode();
                    if (last == null)
                    {
                        break;
                    }
                    contentPageViewModel.LoadingContent(last.Title, RollingDirection.Up);
                    await InvokeScript(webView, "loadingupvisible();");

                    string backwardContent = await contentPageViewModel.GoBackWardContent(last);

                    var recordUP = new NavigationRecord
                    {
                        TOCId = last.ID,
                        Type  = NavigationType.TOCDocument
                    };
                    backwardContent = await HtmlHelper.PageSplit(backwardContent, recordUP);

                    string jsonUp = JsonConvert.SerializeObject(new { content = backwardContent, selector = string.Format("#tocId{0}", last.ID) });
                    await InvokeScript(webView, "AppendHtml_Top(" + jsonUp + ");");

                    contentPageViewModel.LoadingCompleted();
                    await InvokeScript(webView, string.Format("ListenHref('#tocId{0} a');", last.ID));

                    break;

                case "DOWN":
                    var next = contentPageViewModel.GetForwardNode();
                    if (next == null)
                    {
                        break;
                    }
                    contentPageViewModel.LoadingContent(next.Title, RollingDirection.Down);
                    await InvokeScript(webView, "loadingdownvisible();");

                    string forwardContent = await contentPageViewModel.GoForWardContent(next);

                    var recordDown = new NavigationRecord
                    {
                        TOCId = next.ID,
                        Type  = NavigationType.TOCDocument
                    };
                    forwardContent = await HtmlHelper.PageSplit(forwardContent, recordDown);

                    string jsonDowm = JsonConvert.SerializeObject(new { content = forwardContent, selector = string.Format("#tocId{0}", next.ID) });
                    await InvokeScript(webView, "AppendHtml_Bottom(" + jsonDowm + ");");

                    contentPageViewModel.LoadingCompleted();
                    await InvokeScript(webView, string.Format("ListenHref('#tocId{0} a');", next.ID));

                    break;
                }
                //avoid scroll event hannpens twice
                Task.Run(() =>
                {
                    using (ManualResetEvent manualResetEvent = new ManualResetEvent(false))
                    {
                        manualResetEvent.WaitOne(1000);
                        Navigating = false;
                    }
                });
                break;

            case "SCROLL":
                int tocId = int.Parse(notify.Value1.Substring(5));
                await contentPageViewModel.ResetTocByScroll(tocId);

                break;

            case "HREF":
                if (notify.Value1.StartsWith("about:"))
                {
                    notify.Value1 = notify.Value1.Replace("about:", "http://");
                }
                contentPageViewModel.LinkAnalyze(notify.Value1);
                break;

            case "PBO":
                string pageNum = notify.Value1;
                contentPageViewModel.PageNum = "Page " + pageNum;
                break;

            case "COUNTRYCODE":
                break;
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Constructor that instantiates FFACE
        /// </summary>
        /// <param name="processID">The Process ID of the POL Process you want to interface with.</param>
        public FFACE(int processID)
        {
            // create our FFACE instance
            _InstanceID = CreateInstance((UInt32)processID);

            #region Find Windower Plugin Path

            System.Diagnostics.Process[] Processes = System.Diagnostics.Process.GetProcessesByName("pol");
            if (Processes.Length > 0)
            {
                foreach (System.Diagnostics.ProcessModule mod in Processes[0].Modules)
                {
                    if (mod.ModuleName.ToLower() == "hook.dll")
                    {
                        WindowerPath = mod.FileName.Substring(0, mod.FileName.Length - 8) + @"\plugins\";
                        ParseResources.UseFFXIDatFiles = false;
                        break;
                    }
                }
            }
            // Fix for non-windower users
            if (String.IsNullOrEmpty(WindowerPath))
            {
                string ExePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
                // If we have a resources folder, use the resource parser otherwise let it default to using .dat reader
                if (System.IO.Directory.Exists(ExePath + @"\resources\"))
                {
                    WindowerPath = ExePath;
                    ParseResources.UseFFXIDatFiles = false;
                }
            }

            #endregion

            // Find out if we should be using structs or not
            System.Diagnostics.FileVersionInfo fileInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(FFACE_LIBRARY);

            // Need 4, 1, 0, 14 or later.  Adjust these settings as needed.
            UInt64 version = ((UInt64)fileInfo.FileMajorPart << 48) + ((UInt64)fileInfo.FileMinorPart << 32) + ((UInt64)fileInfo.FileBuildPart << 16) + (UInt64)fileInfo.FilePrivatePart;
            if (fileInfo.FileMajorPart != 4)
            {
                throw new Exception(NEED_v410_24_OR_HIGHER);
            }
            else if (version < 0x0004000100000018UL)                    // 0004 0001 0000 000E (4, 1, 0, 14) // // 0004 0001 0000 0018 (4, 1, 0, 24)
            {
                throw new Exception(NEED_v410_24_OR_HIGHER);
            }

            /*if (fileInfo.FileMajorPart != 4)
             *  throw new Exception(NEED_v410_24_OR_HIGHER);
             * else if (fileInfo.FileMinorPart < 1)
             *  throw new Exception(NEED_v410_24_OR_HIGHER);
             * else if (fileInfo.FileBuildPart < 0)
             *  throw new Exception(NEED_v410_24_OR_HIGHER);
             * else if (fileInfo.FilePrivatePart < 14)
             *  throw new Exception(NEED_v410_24_OR_HIGHER);*/


            // instantiate our classes
            Player    = new PlayerTools(_InstanceID);
            Target    = new TargetTools(_InstanceID);
            Party     = new PartyTools(_InstanceID);
            Fish      = new FishTools(_InstanceID);
            Windower  = new WindowerTools(_InstanceID);
            Timer     = new TimerTools(_InstanceID);
            Chat      = new ChatTools(_InstanceID);
            Item      = new ItemTools(this);
            NPC       = new NPCTools(_InstanceID);
            Menu      = new MenuTools(this);
            Search    = new SearchTools(_InstanceID);
            Navigator = new NavigatorTools(this);
            Resources = ParseResources.Instance;

            #region Party Members

            // instantiate our party members
            PartyMember = new System.Collections.Generic.Dictionary <byte, PartyMemberTools>();
            PartyMember.Add(0, new PartyMemberTools(_InstanceID, 0));
            PartyMember.Add(1, new PartyMemberTools(_InstanceID, 1));
            PartyMember.Add(2, new PartyMemberTools(_InstanceID, 2));
            PartyMember.Add(3, new PartyMemberTools(_InstanceID, 3));
            PartyMember.Add(4, new PartyMemberTools(_InstanceID, 4));
            PartyMember.Add(5, new PartyMemberTools(_InstanceID, 5));
            PartyMember.Add(6, new PartyMemberTools(_InstanceID, 6));
            PartyMember.Add(7, new PartyMemberTools(_InstanceID, 7));
            PartyMember.Add(8, new PartyMemberTools(_InstanceID, 8));
            PartyMember.Add(9, new PartyMemberTools(_InstanceID, 9));
            PartyMember.Add(10, new PartyMemberTools(_InstanceID, 10));
            PartyMember.Add(11, new PartyMemberTools(_InstanceID, 11));
            PartyMember.Add(12, new PartyMemberTools(_InstanceID, 12));
            PartyMember.Add(13, new PartyMemberTools(_InstanceID, 13));
            PartyMember.Add(14, new PartyMemberTools(_InstanceID, 14));
            PartyMember.Add(15, new PartyMemberTools(_InstanceID, 15));
            PartyMember.Add(16, new PartyMemberTools(_InstanceID, 16));
            PartyMember.Add(17, new PartyMemberTools(_InstanceID, 17));

            #endregion
        } // @ public FFACEWrapper(uint processID)
Ejemplo n.º 23
0
        private void ClientReceived(IAsyncResult ar)
        {
            // end receive point
            var endPoint = new IPEndPoint(IPAddress.Any, McPort);
            // receive data
            var recv = Client.EndReceive(ar, ref endPoint);

            // begin receive
            Client.BeginReceive(ClientReceived, null);
            // check length
            if (recv.Length < 4)
            {
                return;
            }
            // check header
            var id  = recv[0] << 8 | recv[1];
            var cmd = (ScanCommand)(recv[2] << 8 | recv[3]);

            // check scan acknowledge and id and length
            if (cmd != ScanCommand.ScanAck || id != TransactionId || recv.Length - 4 != HcToolInfo.Count)
            {
                return;
            }
            // set tool information
            var info = new HcToolInfo(recv.Skip(4));

            // check MD/MDTC
            if (info.ToolType == HcToolInfo.ToolModelType.None ||
                info.ToolType == HcToolInfo.ToolModelType.MD || info.ToolType == HcToolInfo.ToolModelType.MDT)
            {
                return;
            }
            // lock searched tool list
            if (!Monitor.TryEnter(SearchTools, _timeoutSpan))
            {
                return;
            }
            try
            {
                // find tool
                var tool = SearchTools.Find(x => x.Mac == info.Mac);
                // check find tool
                if (tool == null)
                {
                    // set timeout time
                    info.Timeout = ScanPeriod + 1000;
                    // debug console
                    Console.WriteLine($@"Attach Tool: {info.Ip}");
                    Console.WriteLine($@"Attach Tool: {info.Mac}");
                    // add tool
                    SearchTools.Add(info);
                    // attached
                    ToolAttach?.Invoke(info);
                }
                else
                {
                    // refresh tool
                    tool.ResetTime();
                    // alive
                    ToolAlive?.Invoke(tool);
                }
            }
            finally
            {
                // unlock
                Monitor.Exit(SearchTools);
            }
        }