Ejemplo n.º 1
0
        public DataTable getDataFromXLS2007(string strFilePath)
        {
            DataTable table;

            try
            {
                OleDbConnection connection = new OleDbConnection(this.connectionString.Replace("{sourcefile}", strFilePath));
                connection.Open();
                OleDbCommand     command = new OleDbCommand("SELECT * FROM [Sheet1$]", connection);
                OleDbDataAdapter adapter = new OleDbDataAdapter {
                    SelectCommand = command
                };
                DataTable dataTable = new DataTable();
                adapter.Fill(dataTable);
                connection.Close();
                adapter = null;
                table   = dataTable;
                table.Columns.Add("NgayModify");
                table.Columns.Add("Image", typeof(byte[]));
            }
            catch (Exception exception)
            {
                CtlError.WriteError("CTLImportExcel GetDataFromXLS2007", exception.Message);
                return(null);
            }
            return(table);
        }
Ejemplo n.º 2
0
 private void timerCount_Tick(object sender, EventArgs e)
 {
     if (this._countCloseAd == 0)
     {
         int count = this._ShowAdCurr.Count;
         for (int i = 0; i < count; i++)
         {
             string ip = this._ShowAdCurr.Dequeue();
             this.SetVNCByIP(ip);
             Thread.Sleep(0x9c4);
             System.Drawing.Point pointRandonApp = this.GetPointRandonApp(Convert.ToInt32("0" + this.txtslapp.Text));
             this.CloseAndRestart(CTLConfig._pointRightClick, pointRandonApp, CTLConfig._PointAppCl);
             CtlError.WriteError("Close may ", ip);
             Thread.Sleep(0x3e8);
             Process process = Process.GetProcessesByName(CTLConfig._ProcessName)[0];
             if (process != null)
             {
                 process.Kill();
             }
         }
         this.timerCount.Enabled = false;
         this.timerCount.Stop();
     }
     this._countCloseAd--;
 }
Ejemplo n.º 3
0
        public DataSet LoadCSV(int numberOfRows)
        {
            DataSet dataSet = new DataSet();

            try
            {
                string         str2;
                OdbcConnection selectConnection = new OdbcConnection(("Driver={Microsoft Text Driver (*.txt; *.csv)};\r\n\t\t\tDbq=" + Path.Combine(Application.StartupPath, "DS Folder.csv") + ";\r\n\t\t\tExtensions=asc,csv,tab,txt;Persist Security Info=False").Trim());
                selectConnection.Open();
                if (numberOfRows == -1)
                {
                    str2 = "select * from [list.csv]";
                }
                else
                {
                    str2 = "select top " + numberOfRows + " * from [list.csv]";
                }
                new OdbcDataAdapter(str2, selectConnection).Fill(dataSet, "csv");
                selectConnection.Close();
            }
            catch (Exception exception)
            {
                CtlError.WriteError("LoadCSV ", exception.Message);
                return(null);
            }
            return(dataSet);
        }
Ejemplo n.º 4
0
 public bool Save_FileListIP()
 {
     try
     {
         string    str        = "IP,Action";
         DataTable dataSource = (DataTable)this.gridlist.DataSource;
         using (StreamWriter writer = new StreamWriter(Path.Combine(Application.StartupPath, "list.csv")))
         {
             writer.WriteLine(str);
             for (int i = 0; i < dataSource.Rows.Count; i++)
             {
                 str = "";
                 if (dataSource.Rows[i]["IP"].ToString().Trim() != string.Empty)
                 {
                     str = dataSource.Rows[i]["IP"].ToString().Trim() + "," + dataSource.Rows[i]["Action"].ToString().Trim();
                     writer.WriteLine(str);
                 }
             }
         }
         return(true);
     }
     catch (Exception exception)
     {
         CtlError.WriteError("export csv ip", exception.Message);
         return(false);
     }
 }
Ejemplo n.º 5
0
 private void timer5p_Tick(object sender, EventArgs e)
 {
     if ((this._listQty != null) && (this._listQty.Count > 1))
     {
         int        num        = this._listQty.Dequeue();
         DataTable  dataSource = (DataTable)this.gridlist.DataSource;
         List <int> list       = new List <int>();
         Random     random     = new Random();
         for (int i = 0; i < num; i++)
         {
             int count = dataSource.Rows.Count;
             int item  = random.Next(0, count);
             while (list.Contains(item))
             {
                 item = random.Next();
             }
             string ex = dataSource.Rows[item]["IP"].ToString();
             Process.Start(Path.Combine(Path.Combine(Application.StartupPath, "profile"), ex.Trim().Replace(".", "") + ".vnc"));
             Thread.Sleep(0xfa0);
             this.Startad(CTLConfig._PointAD);
             CtlError.WriteError("Click may ", ex);
             Thread.Sleep(0x3e8);
             Process process = Process.GetProcessesByName(CTLConfig._ProcessName)[0];
             if (process != null)
             {
                 process.Kill();
             }
         }
         this._countCloseAd       = 0x3b;
         this.timerCount.Interval = 0x3e8;
         this.timerCount.Enabled  = true;
         this.timerCount.Start();
         this.timerCount.Tick += new EventHandler(this.timerCount_Tick);
     }
 }
Ejemplo n.º 6
0
 private void setValueControlByHandle(Process p, int ID, string valueIP)
 {
     try
     {
         int num2;
         Thread.Sleep(0x3e8);
         IntPtr            mainWindowHandle = p.MainWindowHandle;
         List <HwndObject> windows          = HwndObject.GetWindows();
         int num = -1;
         for (num2 = 0; num2 < windows.Count; num2++)
         {
             if (windows[num2].Hwnd == mainWindowHandle)
             {
                 num = num2;
                 break;
             }
         }
         List <HwndObject> children = windows[num].GetChildren();
         int num3 = -1;
         for (num2 = 0; num2 < children.Count; num2++)
         {
             if (GetDlgCtrlID(children[num2].Hwnd) == ID)
             {
                 num3 = num2;
                 break;
             }
         }
         children[num3].Text = valueIP;
     }
     catch (Exception exception)
     {
         CtlError.WriteError("ErroLog", "setValueControlByHandle Loi khi set handle tren form", exception.Message);
     }
 }
Ejemplo n.º 7
0
 private IntPtr GetValueControlByHandle(Process p, int ID, string title)
 {
     try
     {
         Thread.Sleep(0x3e8);
         IntPtr            mainWindowHandle = p.MainWindowHandle;
         List <HwndObject> children         = HwndObject.GetWindowByTitle(title).GetChildren();
         IntPtr            zero             = IntPtr.Zero;
         int num2 = -1;
         for (int i = 0; i < children.Count; i++)
         {
             if (GetDlgCtrlID(children[i].Hwnd) == ID)
             {
                 num2 = i;
                 zero = children[i].Hwnd;
                 break;
             }
         }
         return(zero);
     }
     catch (Exception exception)
     {
         CtlError.WriteError("ErroLog", "get ValueControlByHandle by title Loi khi set handle tren form", exception.Message);
         return(IntPtr.Zero);
     }
 }
Ejemplo n.º 8
0
 public void Gen5p(int QTy)
 {
     try
     {
         Random random = new Random();
         for (int i = 10; i > 0; i--)
         {
             int num2 = QTy / i;
             int item = 1;
             if (num2 > 2)
             {
                 item = random.Next(1, (QTy / 2) + 2);
             }
             else
             {
                 item = random.Next(1, QTy);
             }
             this._listQty.Enqueue(item);
             CtlError.WriteError("Gen 5 sl click ", item.ToString());
             QTy -= item;
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 9
0
        public static void GetConfiguration()
        {
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(Environment.CurrentDirectory + @"\Config.xml");
                _ProcessName   = document.SelectSingleNode("//ProcessName").Attributes["Value"].Value;
                _ControlIDIP   = document.SelectSingleNode("//ControlIDIP").Attributes["Value"].Value;
                _ControlIDPass = document.SelectSingleNode("//ControlIDPass").Attributes["Value"].Value;
                _PathVNC       = document.SelectSingleNode("//Path").Attributes["Value"].Value;
                _Sleep         = document.SelectSingleNode("//Sleep").Attributes["Value"].Value;
                _Time1to24     = document.SelectSingleNode("//Time1to24").Attributes["Value"].Value;
                string[] strArray = document.SelectSingleNode("//PointADAPP").Attributes["Value"].Value.Split(new char[] { ',' });
                _PointAD = new Point(Convert.ToInt32(strArray[0]), Convert.ToInt32(strArray[1]));
                string[] strArray2 = document.SelectSingleNode("//PointAppClo").Attributes["Value"].Value.Split(new char[] { ',' });
                _PointAppCl = new Point(Convert.ToInt32(strArray2[0]), Convert.ToInt32(strArray2[1]));
                string[] strArray3 = document.SelectSingleNode("//PointRightClick").Attributes["Value"].Value.Split(new char[] { ',' });
                _pointRightClick = new Point(Convert.ToInt32(strArray3[0]), Convert.ToInt32(strArray3[1]));
                string   str4      = document.SelectSingleNode("//PointStartApp").Attributes["Value"].Value;
                string[] strArray4 = str4.Split(new char[] { ',' });
                _PointStartApp = new Point(Convert.ToInt32(str4[0]), Convert.ToInt32(str4[1]));
                string[] strArray5 = document.SelectSingleNode("//PointFirtApp").Attributes["Value"].Value.Split(new char[] { ',' });
                _PointFirtApp = new Point(Convert.ToInt32(strArray5[0]), Convert.ToInt32(strArray5[1]));
                string[] strArray6 = document.SelectSingleNode("//PointVNCConnect").Attributes["Value"].Value.Split(new char[] { ',' });
                _PointVNCConnect = new Point(Convert.ToInt32(strArray6[0]), Convert.ToInt32(strArray6[1]));
                string[] strArray7 = document.SelectSingleNode("//PointOK").Attributes["Value"].Value.Split(new char[] { ',' });
                _PointOK = new Point(Convert.ToInt32(strArray7[0]), Convert.ToInt32(strArray7[1]));
                string[] strArray8 = document.SelectSingleNode("//Link").Attributes["Value"].Value.Split(new char[] { ',' });
                _Link = new Point(Convert.ToInt32(strArray8[0]), Convert.ToInt32(strArray8[1]));
                string[] strArray9 = document.SelectSingleNode("//ReLink").Attributes["Value"].Value.Split(new char[] { ',' });
                _ReLink = new Point(Convert.ToInt32(strArray9[0]), Convert.ToInt32(strArray9[1]));
                string[] strArray10 = document.SelectSingleNode("//SetLink").Attributes["Value"].Value.Split(new char[] { ',' });
                _SetLink         = new Point(Convert.ToInt32(strArray10[0]), Convert.ToInt32(strArray10[1]));
                _SLApp           = Convert.ToInt32("0" + document.SelectSingleNode("//SLApp").Attributes["Value"].Value);
                _WidthApp        = Convert.ToInt32("0" + document.SelectSingleNode("//WidthApp").Attributes["Value"].Value);
                _hightApp        = Convert.ToInt32("0" + document.SelectSingleNode("//HightApp").Attributes["Value"].Value);
                _Time1Connectvnc = document.SelectSingleNode("//time1Connectvnc").Attributes["Value"].Value;
                _Time2inputPass  = document.SelectSingleNode("//time2inputPass").Attributes["Value"].Value;
                _Time3Connect    = document.SelectSingleNode("//time3Connect").Attributes["Value"].Value;
                _Time4rightClick = document.SelectSingleNode("//time4rightclick").Attributes["Value"].Value;
                _Time5closeapp   = document.SelectSingleNode("//time5closeapp").Attributes["Value"].Value;
                _Time6StartApp   = document.SelectSingleNode("//time6startapp").Attributes["Value"].Value;
                string[] strArray11 = document.SelectSingleNode("//IDFA").Attributes["Value"].Value.Split(new char[] { ',' });
                _IDFA = new Point(Convert.ToInt32(strArray11[0]), Convert.ToInt32(strArray11[1]));
                string[] strArray12 = document.SelectSingleNode("//IDFASett").Attributes["Value"].Value.Split(new char[] { ',' });
                _IDFASett = new Point(Convert.ToInt32(strArray12[0]), Convert.ToInt32(strArray12[1]));
                string[] strArray13 = document.SelectSingleNode("//IDFAIden").Attributes["Value"].Value.Split(new char[] { ',' });
                _IDFAIden = new Point(Convert.ToInt32(strArray13[0]), Convert.ToInt32(strArray13[1]));
                string[] strArray14 = document.SelectSingleNode("//IDFAGen").Attributes["Value"].Value.Split(new char[] { ',' });
                _IDFAGen      = new Point(Convert.ToInt32(strArray14[0]), Convert.ToInt32(strArray14[1]));
                _SoluongReset = Convert.ToInt32("0" + document.SelectSingleNode("//SoluongReset").Attributes["Value"].Value);
            }
            catch (Exception exception)
            {
                CtlError.WriteError("CTLConfig getconfig", exception.Message);
            }
        }
Ejemplo n.º 10
0
        private void btStart_Click(object sender, EventArgs e)
        {
            int qTy = 0;

            try
            {
                this._isstop         = false;
                this.timer5p.Enabled = false;
                this.timer5p.Stop();
                this.timer5p.Tick    -= new EventHandler(this.timer5p_Tick);
                this.timer10p.Enabled = false;
                this.timer10p.Stop();
                this.timer10p.Tick -= new EventHandler(this.timer10p_Tick);
                if (this.checkBoxIsStartApp.Checked)
                {
                    this.StartAndrestartApp();
                }
                if (this.checkBoxStartAndClose.Checked)
                {
                    this.lookuprestartapp();
                }
                else
                {
                    int num = 60 - DateTime.Now.Minute;
                    qTy = (((num * 10) / 6) * this._listQty24[DateTime.Now.Hour]) / 100;
                    CtlError.WriteError("start click ", qTy.ToString());
                    if (qTy > 30)
                    {
                        this.Gen5p(qTy);
                        CtlError.WriteError("Gen5 ", this._listQty.Count.ToString());
                        int count = this._listQty.Count;
                        this.timer5p.Enabled = true;
                        this.timer5p.Tick   += new EventHandler(this.timer5p_Tick);
                        this.timer5p_Tick(null, null);
                    }
                    else if (qTy > 0)
                    {
                        this.Gen10p(qTy);
                        CtlError.WriteError("Gen10 ", this._listQty.Count.ToString());
                        this.timer10p.Enabled = true;
                        this.timer10p.Tick   += new EventHandler(this.timer10p_Tick);
                        this.timer10p_Tick(null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                CtlError.WriteError("Loi btStart_Click qty=" + qTy.ToString(), ex.Message);
            }
            this.timerGiay.Enabled = true;
            this.timerGiay.Tick   += new EventHandler(this.timerGiay_Tick);
            this.timerGiay.Start();
            this.btStop.Enabled  = true;
            this.btStart.Enabled = false;
        }
Ejemplo n.º 11
0
        public static void SetWidthApp(string width)
        {
            XmlDocument document = new XmlDocument();

            try
            {
                document.Load(Environment.CurrentDirectory + @"\Config.xml");
                document.SelectSingleNode("//WidthApp").Attributes["Value"].Value = width;
                document.Save(Path.Combine(Application.StartupPath, "Config.xml"));
            }
            catch (Exception exception)
            {
                CtlError.WriteError("Loi Setvalue width", exception.Message);
            }
        }
Ejemplo n.º 12
0
 private void timerGiay_Tick(object sender, EventArgs e)
 {
     if ((DateTime.Now.Minute == 0) && (this._currentHour != DateTime.Now.Hour))
     {
         CtlError.WriteError("timer giay Click ", "con lai " + this._listQty.Count.ToString());
         this.timer5p.Enabled = false;
         this.timer5p.Stop();
         this.timer10p.Enabled = false;
         this.timer10p.Stop();
         this.timerphut.Enabled = false;
         this.timerphut.Stop();
         this._isstart = true;
         this._listQty.Clear();
         this._currentHour = DateTime.Now.Hour;
         this.btStart_Click(null, null);
         this._currentHour = DateTime.Now.Hour;
     }
 }
Ejemplo n.º 13
0
        public DataTable LoadCSVList(string filetable)
        {
            DataTable dataTable = new DataTable();

            try
            {
                OdbcConnection selectConnection = new OdbcConnection(("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + Application.StartupPath.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False").Trim());
                selectConnection.Open();
                string selectCommandText = "select * from [" + filetable + "]";
                this.obj_oledb_da = new OdbcDataAdapter(selectCommandText, selectConnection);
                this.obj_oledb_da.Fill(dataTable);
                selectConnection.Close();
            }
            catch (Exception exception)
            {
                CtlError.WriteError("Loi load CSV file ", exception.Message);
                return(dataTable);
            }
            return(dataTable);
        }
Ejemplo n.º 14
0
        public void Gen10p(int QTy)
        {
            Random random = new Random();

            for (int i = 5; i > 0; i--)
            {
                int num2 = QTy / i;
                int item = 1;
                if (num2 > 2)
                {
                    item = random.Next(1, QTy + 2);
                }
                else if (QTy > 0)
                {
                    item = random.Next(1, QTy);
                }
                this._listQty.Enqueue(item);
                CtlError.WriteError("Gen 10 sl click ", item.ToString());
                QTy -= item;
            }
        }
Ejemplo n.º 15
0
 private void setValueControlByHandleByTitle(Process p, int ID, string valueIP, string title)
 {
     try
     {
         Thread.Sleep(0x3e8);
         IntPtr            mainWindowHandle = p.MainWindowHandle;
         List <HwndObject> children         = HwndObject.GetWindowByTitle(title).GetChildren();
         int num2 = -1;
         for (int i = 0; i < children.Count; i++)
         {
             if (GetDlgCtrlID(children[i].Hwnd) == ID)
             {
                 num2 = i;
                 break;
             }
         }
         children[num2].Text = valueIP;
     }
     catch (Exception exception)
     {
         CtlError.WriteError("ErroLog", "setValueControlByHandle Loi khi set handle tren form", exception.Message);
     }
 }
Ejemplo n.º 16
0
 private IntPtr GetValueControlByHandle(Process p, int ID)
 {
     try
     {
         int               num2;
         IntPtr            mainWindowHandle = p.MainWindowHandle;
         List <HwndObject> windows          = HwndObject.GetWindows();
         int               num = -1;
         for (num2 = 0; num2 < windows.Count; num2++)
         {
             if (windows[num2].Hwnd == mainWindowHandle)
             {
                 num = num2;
                 break;
             }
         }
         List <HwndObject> children = windows[num].GetChildren();
         IntPtr            zero     = IntPtr.Zero;
         int num3 = -1;
         for (num2 = 0; num2 < children.Count; num2++)
         {
             if (GetDlgCtrlID(children[num2].Hwnd) == ID)
             {
                 num3 = num2;
                 zero = children[num2].Hwnd;
                 break;
             }
         }
         return(zero);
     }
     catch (Exception exception)
     {
         CtlError.WriteError("ErroLog", "setValueControlByHandle Loi khi set handle tren form", exception.Message);
         return(IntPtr.Zero);
     }
 }