Esempio n. 1
0
 protected void HUDTick(object sender, EventArgs e)
 {
     try
     {
         WorldObject worldObject = lib.MyCore.WorldFilter[lib.MyHost.Actions.CurrentSelection];
         if (worldObject == null)
         {
             this.TargetHud.Visible = false;
         }
         else if (worldObject.ObjectClass == ObjectClass.Player)
         {
             if (LastID.Equals(0) || !LastID.Equals(lib.MyHost.Actions.CurrentSelection))
             {
                 LastID = lib.MyHost.Actions.CurrentSelection;
                 this.LastRequestUpdateTime = DateTime.MinValue;
             }
             if (DateTime.Now.Subtract(this.LastRequestUpdateTime).TotalSeconds >= 0.5)
             {
                 this.LastRequestUpdateTime = DateTime.Now;
                 lib.MyHost.Actions.RequestId(lib.MyHost.Actions.CurrentSelection);
             }
             this.TargetHud.Visible = true;
             if (!this.CurrentProfile.ShowDebuffIcons && this.TargetSurface != null)
             {
                 this.TargetSurface.Invalidate();
             }
         }
     }
     catch (Exception ex) { Repo.RecordException(ex); }
 }
Esempio n. 2
0
    protected void runJob_Click(object sender, EventArgs e)
    {
        LastID lastID = this.dal.LastIDs.SingleOrDefault(y => y.sdfsdgdf == "1");

        if (lastID == null)
        {
            return;
        }

        //StreamReader reader = new StreamReader(@"C:\Or\Web\CV\urls_doron.txt");
        //StreamReader reader = new StreamReader(@"C:\Users\Or\Desktop\aviCv.txt");
        StreamReader  reader = new StreamReader(@"C:\Or\Web\CV\ima_urls.txt");
        List <string> urls   = new List <string>();

        while (!reader.EndOfStream)
        {
            string url = reader.ReadLine();
            if (!string.IsNullOrEmpty(url))
            {
                if (!urls.Contains(url) && !url.Contains("google"))
                {
                    urls.Add(reader.ReadLine());
                }
            }
        }
        if (reader != null)
        {
            reader.Close();
        }

        StreamWriter writer = new StreamWriter(@"C:\Or\Web\CV\mails.txt", true);

        foreach (string m in urls)
        {
            if (!string.IsNullOrEmpty(m))
            {
                this.GetMails(m, writer, lastID);
            }
        }

        int count      = 0;
        int totalCount = 0;

        if (this.Session["total"] != null)
        {
            totalCount = (int)this.Session["total"];
        }

        totalCount           += count;
        this.Session["total"] = totalCount;

        this.doneLabel.Text  = count.ToString();
        this.totalLabel.Text = totalCount.ToString();

        if (writer != null)
        {
            writer.Close();
        }
    }
Esempio n. 3
0
    private int GetMails(string source, StreamWriter writer, LastID lastID)
    {
        if (this.Session["list"] != null)
        {
            this.list = (List <string>) this.Session["list"];
        }

        string g = this.getPageSource(source);

        if (string.IsNullOrEmpty(g))
        {
            return(0);
        }

        long result = 0;
        int  count  = 0;

        Regex t = new Regex(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");

        foreach (Match m in t.Matches(g))
        {
            if (!list.Contains(m.Value))
            {
                if (ValidateMail(m.Value))
                {
                    string mail = ClearEmail(m.Value);

                    CVMail f = dal.CVMails.SingleOrDefault(b => b.Mail == mail);
                    if (f == null)
                    {
                        try
                        {
                            result = (long)lastID.LastID1;

                            dal.CVMails.InsertOnSubmit(new CVMail
                            {
                                Mail  = mail,
                                asdws = (result + 1)
                            });

                            lastID.LastID1++;

                            dal.SubmitChanges();

                            this.list.Add(mail);
                            writer.Write(mail + ", ");
                            count++;
                            i++;
                        }
                        catch (Exception) { }
                    }
                }
            }
        }

        this.Session["list"] = this.list;
        return(count);
    }
Esempio n. 4
0
    private int GetMails(string source, StreamWriter writer, LastID lastID)
    {
        if (this.Session["list"] != null)
        {
            this.list = (List <string>) this.Session["list"];
        }

        string g = this.getPageSource(source);

        long?result = 0;
        int  count  = 0;

        Regex t = new Regex(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");

        foreach (Match m in t.Matches(g))
        {
            if (!list.Contains(m.Value))
            {
                Mail f = dal.Mails.SingleOrDefault(b => b.Mail1 == m.Value);
                if (f == null)
                {
                    try
                    {
                        result = lastID.LastIDID;

                        dal.Mails.InsertOnSubmit(new Mail
                        {
                            Mail1  = m.Value,
                            MailID = (result + 1).ToString(),
                        });

                        lastID.LastIDID++;

                        dal.SubmitChanges();

                        this.list.Add(m.Value);
                        writer.Write(m.Value + ", ");
                        count++;
                    }
                    catch (Exception) { }
                }
            }
        }

        this.Session["list"] = this.list;
        return(count);
    }
Esempio n. 5
0
    protected void runJob_Click(object sender, EventArgs e)
    {
        LastID lastID = this.dal.LastIDs.SingleOrDefault(y => y.LastIDr == "1");

        if (lastID == null)
        {
            return;
        }

        StreamWriter writer = null;

        try
        {
            writer = new StreamWriter(@"C:\Works\CV\Or\works.txt", true);

            int count      = 0;
            int totalCount = 0;

            if (this.Session["total"] != null)
            {
                totalCount = (int)this.Session["total"];
            }

            if (this.getAddress1.Text != "")
            {
                count += this.GetMails(this.getAddress1.Text, writer, lastID);
            }
            if (this.getAddress2.Text != "")
            {
                count += this.GetMails(this.getAddress2.Text, writer, lastID);
            }
            if (this.getAddress3.Text != "")
            {
                count += this.GetMails(this.getAddress3.Text, writer, lastID);
            }
            if (this.getAddress4.Text != "")
            {
                count += this.GetMails(this.getAddress4.Text, writer, lastID);
            }
            if (this.getAddress5.Text != "")
            {
                count += this.GetMails(this.getAddress5.Text, writer, lastID);
            }
            if (this.getAddress6.Text != "")
            {
                count += this.GetMails(this.getAddress6.Text, writer, lastID);
            }
            if (this.getAddress7.Text != "")
            {
                count += this.GetMails(this.getAddress7.Text, writer, lastID);
            }
            if (this.getAddress8.Text != "")
            {
                count += this.GetMails(this.getAddress8.Text, writer, lastID);
            }
            if (this.getAddress9.Text != "")
            {
                count += this.GetMails(this.getAddress9.Text, writer, lastID);
            }
            if (this.getAddress10.Text != "")
            {
                count += this.GetMails(this.getAddress10.Text, writer, lastID);
            }

            totalCount           += count;
            this.Session["total"] = totalCount;

            this.doneLabel.Text  = count.ToString();
            this.totalLabel.Text = totalCount.ToString();

            this.getAddress1.Text  = "";
            this.getAddress2.Text  = "";
            this.getAddress3.Text  = "";
            this.getAddress4.Text  = "";
            this.getAddress5.Text  = "";
            this.getAddress6.Text  = "";
            this.getAddress7.Text  = "";
            this.getAddress8.Text  = "";
            this.getAddress9.Text  = "";
            this.getAddress10.Text = "";
        }
        catch (Exception) { }
        finally
        {
            if (writer != null)
            {
                writer.Close();
            }
        }
    }
 partial void DeleteLastID(LastID instance);
 partial void UpdateLastID(LastID instance);
 partial void InsertLastID(LastID instance);
Esempio n. 9
0
        public IActionResult Index(String code, String DBName, int beginId, int take,
                                   String uuid, String isWait)
        {
            var filePath = Configs.uploadFilePath;

            filePath = _hostingEnvironment.WebRootPath.TrimEnd('\\', '/')
                       + "/" + filePath.TrimEnd('\\', '/') + "/";
            System.IO.Directory.CreateDirectory(filePath);

            Response.ContentType = "text/plain;charset=utf-8";
            Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            Response.Headers.Add("Access-Control-Allow-Headers", "x-requested-with,content-type");

            String ml = filePath + "/" + code + "/";

            System.IO.Directory.CreateDirectory(ml);

            String         path   = filePath + "/" + code + "/" + DBName + ".db";
            var            lastId = 0L;
            var            locker = SqliteLock.getLockObj(path);
            String         dbUUid = null;
            DownloadResult dr     = new DownloadResult();

            lock (locker)
            {
                dbUUid = OpSqlite.getQuickSaveValue("uuid", path);
                lastId = OpSqlite.getMaxID(path) ?? 0;
                LastID.setLastId(path, lastId);
                dr.maxId = lastId;
                if (dbUUid != (uuid) && !string.IsNullOrEmpty(uuid))
                {
                    if (lastId == 0)
                    {
                        dr.status = (-2);
                    }
                    else
                    {
                        dr.status = (-1);
                    }
                }
                else if (beginId - 1 > lastId)
                {
                    dr.status = (-2);
                }
            }

            if (dr.status != -1 && dr.status != -2)
            {
                int jsq = 0;
                while (lastId != 0 && lastId < (long)beginId && jsq < 120 && "1" == (isWait))
                {
                    Thread.Sleep(500);
                    lastId = LastID.getLastId(path) ?? 0;
                    jsq++;
                }
                lock (locker)
                {
                    dr.status = (1);
                    List <DBObj> db = OpSqlite.SelectDBObj(beginId, take, path);
                    dr.uuid  = (dbUUid);
                    dr.data  = (db);
                    dr.maxId = (lastId);
                    if (db.Count > 0)
                    {
                        List <long> dels = OpSqlite.SelectDelIds(db[(0)].id, db[(db.Count - 1)].id, path);
                        dr.delIds = (dels);
                    }
                }
            }

            return(Json(dr));
        }
Esempio n. 10
0
        public IActionResult Index(String code, String DBName, long localMaxId,
                                   String uuid, String Data, String restore, String localUUID, String uploadUUID)
        {
            var filePath = Configs.uploadFilePath;

            filePath = _hostingEnvironment.WebRootPath.TrimEnd('\\', '/')
                       + "/" + filePath.TrimEnd('\\', '/') + "/";
            System.IO.Directory.CreateDirectory(filePath);

            Response.ContentType = "text/plain;charset=utf-8";
            Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            Response.Headers.Add("Access-Control-Allow-Headers", "x-requested-with,content-type");

            String ml = filePath + "/" + code + "/";

            System.IO.Directory.CreateDirectory(ml);

            String       path   = filePath + "/" + code + "/" + DBName + ".db";
            var          locker = SqliteLock.getLockObj(path);
            long         lastID = 0L;
            UploadResult resObj = new UploadResult();

            lock (locker)
            {
                lastID = OpSqlite.getMaxID(path) ?? 0;
                String dbUUid = OpSqlite.getQuickSaveValue("uuid", path);

                resObj.status = (-9);
                resObj.uuid   = (dbUUid);
                var iswrite     = true;
                var isUUIDMatch = dbUUid == (uuid) || string.IsNullOrEmpty(uuid);
                if (!isUUIDMatch || lastID < localMaxId)
                {
                    if ((isUUIDMatch && lastID < localMaxId) || (!isUUIDMatch && (lastID == 0L) && "1" != (restore)))
                    {
                        resObj.status = (-2);
                        resObj.lastId = (lastID);
                        iswrite       = false;
                    }
                    else if ("1" == (restore) && (lastID == 0))
                    {
                        OpSqlite.QuickSave("uuid", uuid, path);
                    }
                    else
                    {
                        resObj.status = (-1);
                        iswrite       = false;
                    }
                }
                if (iswrite)
                {
                    List <DBObj> db = DBObj.FromJsonLst(Data);
                    if (db != null && db.Count > 0)
                    {
                        long insertResult = OpSqlite.InsertDBObjLst(db, path, localUUID, uploadUUID, "1" == (restore));
                        if (insertResult != 0)
                        {
                            resObj.status = (1);
                            for (int i = 0; i < db.Count; i++)
                            {
                                db[(i)].data = ("");
                                if ("1" != (restore))
                                {
                                    db[(i)].id = (insertResult++);
                                }
                            }
                            resObj.data = (db);
                        }
                        if ("1" == (restore))
                        {
                            lastID = OpSqlite.getMaxID(path) ?? 0;
                        }
                        else
                        {
                            lastID = insertResult - 1;
                        }
                    }
                }
            }
            if (lastID != 0L)
            {
                LastID.setLastId(path, lastID);
            }
            new Thread(async delegate()
            {
                await WebSocketHandler.sendMsg(DBName, code);
            }).Start();

            return(Json(resObj));
        }
Esempio n. 11
0
    protected void runJob_Click(object sender, EventArgs e)
    {
        if (this.Session["list"] != null)
        {
            this.list = (List <string>) this.Session["list"];
        }

        int count      = 0;
        int totalCount = 0;

        if (this.Session["total"] != null)
        {
            totalCount = (int)this.Session["total"];
        }

        StreamWriter writer = null;

        try
        {
            writer = new StreamWriter(@"C:\Works\CV\spider.txt", true);

            //string g = this.getPageSource(this.getAddress.Text);

            for (int i = 1; i < 70; i++)
            {
                string g = this.getPageSource("http://www.shohamnet.co.il/BoardView.asp?page=" + i + "&numType=11");


                LastID lastID = this.cvList.LastIDs.SingleOrDefault(y => y.sdfsdgdf == "1");
                if (lastID == null)
                {
                    return;
                }

                long result = 0;

                Regex t = new Regex(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
                foreach (Match m in t.Matches(g))
                {
                    //if (!list.Contains(m.Value))
                    //{
                    CVMail f = cvList.CVMails.SingleOrDefault(b => b.Mail == m.Value);
                    if (f == null)
                    {
                        try
                        {
                            result = lastID.LastID1;

                            cvList.CVMails.InsertOnSubmit(new CVMail
                            {
                                Mail  = m.Value,
                                asdws = result
                            });

                            lastID.LastID1++;

                            cvList.SubmitChanges();

                            this.list.Add(m.Value);
                            writer.Write(m.Value + ", ");
                            count++;
                        }
                        catch (Exception) { }
                        //}
                        //}
                    }
                }
            }

            totalCount           += count;
            this.Session["total"] = totalCount;

            this.doneLabel.Text  = count.ToString();
            this.totalLabel.Text = totalCount.ToString();

            this.Session["list"] = this.list;
        }
        catch (Exception p)
        {
            string f = p.Message;
        }

        finally
        {
            if (writer != null)
            {
                writer.Close();
            }
        }

        this.getAddress.Text = "";
    }