Exemple #1
0
        void doLoadGridData(object sender, EventArgs e)
        {
            card_type_lbl.Top = issue_date_lbl.Top = GF.pageTop;
            card_type.Top     = card_type_lbl.Top - 3;
            issue_date.Top    = issue_date_lbl.Top - 2;

            line_sep1.Top = card_type_lbl.Top + 35; line_sep1.Width = btn_dgv.Width;
            btn_dgv.rearrange(line_sep1.Top + 15);

            btn_dgv.enable_btn.Visible = false;
            btn_dgv.add_btn.Visible    = false;
            btn_dgv.edit_btn.Visible   = false;
            btn_dgv.del_btn.Text       = "RE-ISSUE";

            GF.resetAC(this);
            loadGridData();
        }
Exemple #2
0
        public static void initPage(Form childPage, main_page mainPage)
        {
            GF.closeChildren(mainPage);
            GF.showLoading(mainPage);

            GF.doDebug("========== MAIN FORM :: " + childPage.Name + " ==========");
            GF.selected_id = 0;

            childPage.MdiParent = mainPage;
            if (childPage.Name.IndexOf("report_") != -1)
            {
                childPage.Dock = DockStyle.Fill;
            }
            else
            {
                childPage.Size          = childPage.MdiParent.ClientSize;
                childPage.StartPosition = FormStartPosition.Manual;
            }
            childPage.WindowState = FormWindowState.Maximized;

            GF.addKeyUp(childPage);

            childPage.Load += (s, e) =>
            {
                //((Form)s).Visible = true;
            };
            childPage.LocationChanged += (s, e) =>
            {
                if (childPage.Left != 0)
                {
                    childPage.Left = -5;
                }
                if (childPage.Top != 0)
                {
                    childPage.Top = 0;
                }
            };
            if (!childPage.IsDisposed)
            {
                childPage.Show();
            }

            GF.closeLoading();
        }
Exemple #3
0
 public static bool beginTrans()
 {
     GF.doDebug("[TRANSACTION] ESTABLISHING TRANSACTION ...");
     try
     {
         if (conn == null)
         {
             if (!open())
             {
                 return(false);
             }
         }
         else if (conn.State == ConnectionState.Closed)
         {
             if (!open())
             {
                 return(false);
             }
         }
         GF.doDebug("[TRANSACTION] NULL CONNECTION IS NULL ? : " + (conn == null).ToString());
         GF.doDebug("[TRANSACTION] CONNECTION IS CLOSED ? : " + (conn.State == ConnectionState.Closed).ToString());
         if (conn.State == ConnectionState.Closed)
         {
             conn.Close();
         }
         if (trans != null)
         {
             trans.Dispose();
         }
         trans = conn.BeginTransaction(IsolationLevel.ReadUncommitted);
         GF.doDebug("[TRANSACTION] TRANSACTION IS ESTABLISHED");
         return(true);
     }
     catch (Exception e)
     {
         if (conn != null)
         {
             conn.Dispose();
         }
         GF.doDebug("COULD NOT ESTABLISH TRANSACTION ... " + e.Message);
         return(false);
     }
 }
Exemple #4
0
        public static void deleteTempAttachment(int owner_id, string owner_form)
        {
            GF.showLoading();
            DataTable DT;
            String    queryString = "SELECT FILE_NAME FROM ATTACHMENT WHERE OWNER_ID = " + owner_id.ToString() + " AND OWNER_FORM = " + owner_form;

            Dictionary <string, string> Params = new Dictionary <string, string>();

            /*Params.Add("@owner_id", owner_id.ToString());
             * Params.Add("@owner_form", owner_form);*/

            using (DT = DB.getS(queryString, Params, "GET TEMP ATTACHMENT[OWNER_ID=" + owner_id.ToString() + " : OWNER_FORM=" + owner_form + "]", false))
            {
                foreach (DataRow row in DT.Rows)
                {
                    string fileName = row["file_name"].ToString();
                    //MessageBox.Show(fileName);
                    if (FTP.delete(fileName, "ATTACHMENT"))
                    {
                        queryString = "DELETE FROM ATTACHMENT WHERE FILE_NAME LIKE '" + fileName + "'";
                        DB.beginTrans();
                        if (DB.set(queryString, "DELETE ATTACHMENT[" + fileName + "]"))
                        {
                            DB.close();
                        }
                        else
                        {
                            MessageBox.Show("ERROR DELETE ATTACHMENT FROM DATABASE !!", "ERROR");
                            GF.closeLoading();
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("CANNOT DELETE ATTACHMENT FILE via FTP !!", "ERROR");
                        GF.closeLoading();
                        return;
                    }
                }
                GF.closeLoading();
                return;
            }
        }
Exemple #5
0
        private void myAC_textChanged(object sender, EventArgs e)
        {
            GF.bringToFront(this);

            this.list = new Dictionary <int, string>();
            if (myAC.acTxt.Text.Trim() != "")
            {
                doQuery();
            }
            else
            {
                myAC.acBox.Items.Clear();
            }

            myAC.acBox.DisplayMember = "Value";
            myAC.acBox.Items.AddRange(list.OfType <object>().ToArray());
            myAC.acBox.Refresh();
            this.Height = myAC.Height;
            this.Width  = myAC.Width;
        }
Exemple #6
0
 private static void saveLog(String Query, String logMsg)
 {
     GF.doDebug("saving log ...");
     try
     {
         String logQueryString = @"INSERT INTO LOG (
                                     subject, query, log_datetime, user_id, emp_id, old_value
                                 ) VALUES (
                                     '" + logMsg + @"', 
                                     '" + Query.Replace("'", "''") + @"', 
                                     CURRENT_TIMESTAMP, 
                                     " + GF.user_id + @", 
                                     ";
         if (GF.emp_id == 0)
         {
             logQueryString += "NULL";
         }
         else
         {
             logQueryString += GF.emp_id;
         }
         logQueryString += @", '" + GF.old_value + @"'
                 )
             ";
         GF.doDebug("[LOG] >>> " + logQueryString);
         //command = new SqlCommand(logQueryString, conn, trans);
         //command.ExecuteNonQuery();
     }
     catch (Exception e)
     {
         errorMsg = e.ToString();
         trans.Rollback();
         GF.doDebug("could not save log ... " + errorMsg);
         return;
     }
     GF.doDebug("log saved ...");
 }
Exemple #7
0
        public static bool open()
        {
            if (localIP == "")
            {
                System.Net.IPHostEntry host;
                host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
                foreach (System.Net.IPAddress ip in host.AddressList)
                {
                    if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        localIP = ip.ToString();
                        break;
                    }
                }
            }
            GF.doDebug("opening connection ...");
            errorMsg = "";

            if (localIP == "192.168.1.251" || Environment.MachineName == "SPA01-PC")
            {
                DataSource = "localhost";
            }
            else if (Properties.Settings.Default.db_ip == "")
            {
                DataSource = DataSource = "85.30.232.165";                                              //"192.168.1.251";
            }
            else
            {
                DataSource = Properties.Settings.Default.db_ip;
            }

            if (useLocalHost)
            {
                DataSource = "localhost";
            }

            DataSource += "\\SQLEXPRESS,25529";

            SqlConnectionStringBuilder connectionString = new SqlConnectionStringBuilder();

            connectionString.UserID         = UserID;
            connectionString.Password       = Password;
            connectionString.DataSource     = DataSource;
            connectionString.InitialCatalog = DBName;
            connectionString.ConnectTimeout = 15;
            GF.doDebug("\r\n" + connectionString.ConnectionString + "\r\n");

            if (conn == null || conn.State == ConnectionState.Closed)
            {
                conn = new SqlConnection(connectionString.ConnectionString);
                try
                {
                    GF.doDebug("CREATING NEW SQL CONNECTION ...");
                    conn.Open();

                    GF.doDebug("SQL CONNECTION IS CREATED !!");
                }
                catch (Exception e)
                {
                    if (conn != null)
                    {
                        conn.Dispose();
                    }
                    errorMsg = e.ToString();
                    MessageBox.Show("CANNOT CONNECT TO DATABASE.\r\n\r\nPLEASE TRY AGAIN A FEW MINUTES LATER ...", "ERROR");
                    GF.doDebug("could not open connection ... \r\n\r\n" + errorMsg);
                    System.Environment.Exit(0);
                    return(false);
                }
                GF.doDebug("connection opened ...");
                return(true);
            }

            GF.doDebug("CONNECTION STATE :: " + conn.State.ToString());

            return(true);
        }
Exemple #8
0
        /*public static DataTable get(string Query, string logMsg, bool paging = true)
         * {
         *  //if (!open("GET"))
         *  if (!open())
         *  {
         *      //RAISE ERROR
         *      return null;
         *  }
         *  else
         *  {
         *      GF.doDebug("[GET] getting data ... [ " + logMsg + " ]");
         *      GF.doDebug("[GET] >>> " + modifySelect(Query, paging));
         *
         *      try
         *      {
         *          using (command = new SqlCommand(modifySelect(Query, paging), conn, trans))
         *          {
         *              using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command))
         *              {
         *                  using (DataSet myDS = new DataSet())
         *                  {
         *                      //GF.closeLoading();
         *                      dataAdapter.Fill(myDS);
         *                      GF.doDebug("got data ...");
         *                      lastQuery = modifySelect(Query, paging);
         *                      GF.doDebug("HAS " + myDS.Tables[0].Rows.Count.ToString() + " DATA");
         *                      return myDS.Tables[0];
         *                  }
         *              }
         *          }
         *      }
         *      catch (Exception e)
         *      {
         *          errorMsg = e.ToString();
         *          GF.doDebug("could not get data ... \r\n\r\n" + errorMsg + "\r\n\r\n");
         *          GF.doDebug(modifySelect(Query, paging));
         *
         *          MessageBox.Show("COULD NOT GET DATA ...\r\nPLEASE TRY AGAIN LATER :)", "ERROR");
         *
         *          return null;
         *      }
         *      finally
         *      {
         *          close();
         *      }
         *  }
         * }*/

        public static DataTable getS(string Query, Dictionary <string, string> Params, string logMsg, bool paging = true)
        {
            //if (!open("GET"))
            if (!open())
            {
                //RAISE ERROR
                return(null);
            }
            else
            {
                GF.doDebug("[GET] getting data ... [ " + logMsg + " ]");
                GF.doDebug("[GET] >>> " + modifySelect(Query, paging));

                try
                {
                    using (command = new SqlCommand(modifySelect(Query, paging), conn, trans))
                    {
                        if (Params != null)
                        {
                            if (Params.Count > 0)
                            {
                                SqlParameter param;
                                foreach (KeyValuePair <string, string> entry in Params)
                                {
                                    param = new SqlParameter();
                                    Console.WriteLine(entry.Key + " : " + entry.Value);
                                    param.ParameterName = entry.Key;
                                    param.Value         = entry.Value.Trim();
                                    command.Parameters.Add(param);
                                }
                            }
                        }

                        using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command))
                        {
                            using (DataSet myDS = new DataSet())
                            {
                                //GF.closeLoading();

                                dataAdapter.Fill(myDS);
                                GF.doDebug("got data ...");
                                lastQuery = modifySelect(Query, paging);
                                GF.doDebug("HAS " + myDS.Tables[0].Rows.Count.ToString() + " DATA");
                                return(myDS.Tables[0]);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    errorMsg = e.ToString();
                    Console.WriteLine(Query);
                    GF.doDebug("could not get data ... \r\n\r\n" + errorMsg + "\r\n\r\n");
                    GF.doDebug(modifySelect(Query, paging));

                    MessageBox.Show("COULD NOT GET DATA ...\r\nPLEASE TRY AGAIN LATER :)", "ERROR");

                    return(null);
                }
                finally
                {
                    close();
                }
            }
        }
Exemple #9
0
        void getFTPFileList()
        {
            FTPFiles = new List <string>();
            using (DataTable myDT = DB.getS("SELECT FRONT_CARD, BACK_CARD, ATTACH_PAPER FROM MEMBERCARD_TYPE WHERE IS_USE = 1", null, "GET MEMBERCARD FILES", false))
            {
                foreach (DataRow myDR in myDT.Rows)
                {
                    FTPFiles.Add(myDR["FRONT_CARD"].ToString());
                    FTPFiles.Add(myDR["BACK_CARD"].ToString());
                    FTPFiles.Add(myDR["ATTACH_PAPER"].ToString());
                }
            }

            using (DataTable myDT = DB.getS("SELECT CARD1, CARD2 FROM GIFT_CERTIFICATE_CONFIG", null, "GET GIFT_CERTIFICATE FILES", false))
            {
                foreach (DataRow myDR in myDT.Rows)
                {
                    FTPFiles.Add(myDR["CARD1"].ToString());
                    FTPFiles.Add(myDR["CARD2"].ToString());
                }
            }

            foreach (String tmpStr in FTPFiles)
            {
                GF.doDebug("- " + tmpStr);
            }

            /*StringBuilder result = new StringBuilder();
             * WebResponse response = null;
             * StreamReader reader = null;
             * try
             * {
             *  FtpWebRequest reqFTP;
             *  reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + remoteAddr + "/SMS_CARDS/"));
             *  reqFTP.UseBinary = true;
             *  reqFTP.Credentials = credential;
             *  reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
             *  reqFTP.Proxy = null;
             *  reqFTP.KeepAlive = true;
             *  reqFTP.UsePassive = true;
             *  using (response = reqFTP.GetResponse())
             *  {
             *      using (reader = new StreamReader(response.GetResponseStream()))
             *      {
             *          string line = reader.ReadLine();
             *          while (line != null)
             *          {
             *              result.Append(line);
             *              result.Append("\n");
             *              line = reader.ReadLine();
             *          }
             *          // to remove the trailing '\n'
             *          result.Remove(result.ToString().LastIndexOf('\n'), 1);
             *          result.Replace("version.txt\n", "");
             *          String[] tmp = result.ToString().Split('\n');
             *          GF.doDebug("\r\n========== FTP FILE ==========");
             *          FTPFiles = new List<string>();
             *          foreach (String tmpStr in tmp) {
             *              FTPFiles.Add(tmpStr);
             *              GF.doDebug("- " + tmpStr);
             *          }
             *          GF.doDebug("\r\n");
             *          return true;
             *      }
             *  }
             * }
             * catch (Exception ex)
             * {
             *  if (reader != null)
             *  {
             *      reader.Close();
             *  }
             *  if (response != null)
             *  {
             *      response.Close();
             *  }
             *  FTPFiles = null;
             *  GF.doDebug("[ GET FILE LIST :: ERROR ] >>> " + ex.Message);
             *  return false;
             * }*/
        }
Exemple #10
0
        void syncFile()
        {
            if (FilesToDownload.Count > 0)
            {
                GF.doDebug("[ FILE LIST :: BEGIN ] TOTAL : " + FilesToDownload.Count.ToString() + " FILE" + (FilesToDownload.Count > 1 ? "S" : ""));
                int count = 1;
                foreach (String file in FilesToDownload)
                {
                    GF.doDebug(count.ToString() + ". " + file);
                    count++;
                }
                GF.doDebug("[ FILE LIST :: END ]");
                backgroundTask.ReportProgress(0);

                bytesTotal = new long[FilesToDownload.Count];

                foreach (String file in FilesToDownload)
                {
                    FtpWebRequest fileSizeFTP;
                    fileSizeFTP             = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + remoteAddr + "/" + folderName + "/" + file));
                    fileSizeFTP.Credentials = credential;
                    fileSizeFTP.KeepAlive   = false;
                    fileSizeFTP.Method      = WebRequestMethods.Ftp.GetFileSize;
                    fileSizeFTP.UseBinary   = true;
                    fileSizeFTP.Proxy       = null;
                    fileSizeFTP.UsePassive  = true;

                    using (FtpWebResponse fileSizeResponse = (FtpWebResponse)fileSizeFTP.GetResponse())
                    {
                        bytesTotal[index] = fileSizeResponse.ContentLength;
                        fileSizeResponse.Close();
                    }

                    index++;
                }

                // START DOWNLOAD FILE
                Mode  = 1;
                index = 0;
                foreach (String file in FilesToDownload)
                {
                    backgroundTask.ReportProgress(0);
                    //GF.doDebug("FILE " + (index + 1).ToString() + " : " + file);
                    string uri       = "ftp://" + remoteAddr + "/" + folderName + "/" + file;
                    Uri    serverUri = new Uri(uri);
                    if (serverUri.Scheme != Uri.UriSchemeFtp)
                    {
                        return;
                    }

                    FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + remoteAddr + "/" + folderName + "/" + file));
                    reqFTP.Credentials = credential;
                    reqFTP.KeepAlive   = true;
                    reqFTP.Method      = WebRequestMethods.Ftp.DownloadFile;
                    reqFTP.UseBinary   = true;
                    reqFTP.Proxy       = null;
                    reqFTP.UsePassive  = true;

                    using (FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse())
                    {
                        using (Stream responseStream = response.GetResponseStream())
                        {
                            int    Length    = 2048;
                            Byte[] buffer    = new Byte[Length];
                            int    bytesRead = 0;
                            long   allRead   = 0;
                            using (FileStream writeStream = new FileStream(@"C:\" + folderName + @"\" + file, FileMode.Create))
                            {
                                GF.doDebug("[ DOWNLOAD FILE ] " + "ftp://" + remoteAddr + "/" + folderName + "/" + file);
                                allRead += bytesRead = responseStream.Read(buffer, 0, buffer.Length);
                                //GF.doDebug("[" + file + "] " + ((int)(((float)allRead / (float)bytesTotal[index]) * 100.0)).ToString() + "% " + allRead.ToString() + "/" + bytesTotal[index].ToString());
                                backgroundTask.ReportProgress((int)(((float)allRead / (float)bytesTotal[index]) * 100.0));
                                while (bytesRead > 0)
                                {
                                    writeStream.Write(buffer, 0, bytesRead);
                                    allRead += bytesRead = responseStream.Read(buffer, 0, Length);
                                    backgroundTask.ReportProgress((int)(((float)allRead / (float)bytesTotal[index]) * 100.0));
                                    //GF.doDebug("[" + file + "] " + ((int)(((float)allRead / (float)bytesTotal[index]) * 100.0)).ToString() + "% " + allRead.ToString() + "/" + bytesTotal[index].ToString());
                                }
                                GF.doDebug("[ DOWNLOAD COMPLETED ] " + file);
                                writeStream.Close();
                            }
                            response.Close();
                        }
                    }

                    while (true)
                    {
                        if (progressBar.Value == progressBar.Maximum)
                        {
                            Thread.Sleep(1000);
                            break;
                        }
                    }
                    index++;
                    //if (index == 2) return;
                    currentFile++;
                }

                //GF.doDebug("PROGRESS CLOSE !!");
            }
        }
Exemple #11
0
        void versionCheck()
        {
            this.SetText("getting local file list ...");
            // GET LOCAL FILE LIST
            GF.doDebug("========== LOCAL FILE @ " + GF.localCardPath + "==========");
            String[] tmp = Directory.GetFiles(GF.localCardPath);
            LOCALFiles = new List <string>();

            if (tmp.Length == 0)
            {
                GF.doDebug("!!! NO LOCAL FILE !!!");
            }
            else
            {
                foreach (String tmpStr in tmp)
                {
                    String tmp2 = tmpStr;
                    tmp2 = tmp2.Replace(GF.localCardPath, "");
                    LOCALFiles.Add(tmp2);
                    GF.doDebug("- " + tmp2);
                }
            }

            // GET FTP FILE LIST
            this.SetText("getting ftp file list ...");
            getFTPFileList();

            this.SetText("comparing files ...");
            GF.doDebug("========== COMPARE FTP FILE WITH LOCAL :: FOR DOWNLOAD OR UPDATE LOCAL ==========");
            FilesToDownload = new List <string>();
            foreach (String fileName in FTPFiles) // LOOP THROUGH ALL FTP FILE LIST ==> CHECK WHICH FILE IS NEEDED TO BE DOWNLOADED.
            {
                String debugStr = "[" + fileName + "] ";
                if (LOCALFiles.Count == 0)
                {
                    GF.doDebug(debugStr + "EMPTY LOCAL FILE ==> DOWNLOAD.");
                    FilesToDownload.Add(fileName); // IF NO LOCAL FILE ==> JUST EMPTY FOLDER ==> DOWNLOAD IT
                }
                else // NOT EMPTY FOLDER
                {
                    bool foundFile = false;
                    foreach (String file in LOCALFiles) // LOOP THROUGHT LOCAL FILE
                    {
                        if (fileName == file)
                        {
                            foundFile = true;
                            break;
                        }
                    }
                    if (!foundFile)
                    {
                        GF.doDebug(debugStr + "NOT FOUND LOCAL FILE ==> DOWNLOAD.");
                        FilesToDownload.Add(fileName); // IF FTP FILE IS NOT IN LOCAL FOLDER ==> DOWNLOAD IT
                    }
                    else // FTP FILE IS IN LOCAL FOLDER
                    {
                        // COMPARE LAST MODIFIED
                        FileInfo targetLocalfile  = new FileInfo(GF.localCardPath + fileName);
                        DateTime lastModLocalFile = targetLocalfile.LastWriteTime;
                        DateTime lastModFTPFile;

                        FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + remoteAddr + "/" + folderName + "/" + fileName));
                        reqFTP.Credentials = credential;
                        reqFTP.KeepAlive   = true;
                        reqFTP.Method      = WebRequestMethods.Ftp.GetDateTimestamp;
                        reqFTP.UseBinary   = true;
                        reqFTP.Proxy       = null;
                        reqFTP.UsePassive  = true;

                        using (FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse())
                        {
                            lastModFTPFile = response.LastModified;
                        }

                        // IF LAST MODIFIED OF FTP FILE IS NEWER THAN LOCAL FILE ==> DOWNLOAD IT.
                        if (lastModFTPFile > lastModLocalFile)
                        {
                            GF.doDebug(debugStr + "NEED UPDATE !! ==> DOWNLOAD");
                            GF.doDebug("FTP : " + lastModFTPFile.ToString() + " // LOCAL : " + lastModLocalFile.ToString());
                            FilesToDownload.Add(fileName);
                        }
                        else
                        {
                            // SAME LAST MODIFIED
                            // CHECK FILE SIZE. JUST IN CASE OF BROKEN FILE
                            reqFTP             = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + remoteAddr + "/" + folderName + "/" + fileName));
                            reqFTP.Credentials = credential;
                            reqFTP.KeepAlive   = true;
                            reqFTP.Method      = WebRequestMethods.Ftp.GetFileSize;
                            reqFTP.UseBinary   = true;
                            reqFTP.Proxy       = null;
                            reqFTP.UsePassive  = true;

                            using (FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse())
                            {
                                if (response.ContentLength != targetLocalfile.Length)
                                {
                                    GF.doDebug(debugStr + "SIZE IS NOT EQUAL !! ==> DOWNLOAD");
                                    GF.doDebug("FTP : " + response.ContentLength.ToString() + " // LOCAL : " + targetLocalfile.Length.ToString());
                                    FilesToDownload.Add(fileName);
                                }
                            }
                        }
                    }
                }
            }

            GF.doDebug("========== COMPARE LOCAL FILE WITH FTP :: FOR DELETE IF NO FILE ON FTP ==========");
            FilesToDelete = new List <string>();

            /*foreach (String fileName in LOCALFiles) // LOOP THROUGHT LOCAL FILE LIST ==> IF LOCAL FILE NOT ON FTP SERVER ==> DELETE IT.
             * {
             *  bool foundFile = false;
             *  foreach (String file in FTPFiles)
             *  {
             *      if (fileName == file)
             *      {
             *          foundFile = true;
             *          break;
             *      }
             *  }
             *
             *  if (!foundFile)
             *  {
             *      GF.doDebug("[ QUEUE FILE TO DELETE ] " + fileName);
             *      FilesToDelete.Add(fileName);
             *  }
             * }
             *
             * this.SetText("deleting unused local file ...");
             * // DELETE LOCAL FILES
             * foreach (String fileName in FilesToDelete)
             * {
             *  System.IO.File.Delete(GF.localCardPath + fileName);
             *  GF.doDebug("[DELETED] " + GF.localCardPath + fileName);
             * }*/

            this.SetText("connecting to server ...");
            syncFile();

            /*string old_version = "0";
             * if (File.Exists(@"C:\" + folderName + @"\version.txt")) old_version = System.IO.File.ReadAllText(@"C:\" + folderName + @"\version.txt").Trim().Split('\n')[0];
             * FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + remoteAddr + "/" + folderName + "/version.txt"));
             * reqFTP.Credentials = credential;
             * reqFTP.KeepAlive = true;
             * reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
             * reqFTP.UseBinary = true;
             * reqFTP.Proxy = null;
             * reqFTP.UsePassive = true;
             * //reqFTP.UsePassive = false;
             *
             * using (FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse())
             * {
             *  using (Stream responseStream = response.GetResponseStream())
             *  {
             *      int Length = 2048;
             *      Byte[] buffer = new Byte[Length];
             *      int bytesRead = 0;
             *      long allRead = 0;
             *      //GF.doDebug("[ TEMP PATH ] >>> " + Path.GetTempPath());
             *      using (FileStream writeStream = new FileStream(Path.GetTempPath() + "version.txt", FileMode.Create))
             *      {
             *          allRead += bytesRead = responseStream.Read(buffer, 0, buffer.Length);
             *          while (bytesRead > 0)
             *          {
             *              writeStream.Write(buffer, 0, bytesRead);
             *              allRead += bytesRead = responseStream.Read(buffer, 0, Length);
             *          }
             *          writeStream.Close();
             *      }
             *      response.Close();
             *  }
             * }
             *
             * string version = System.IO.File.ReadAllText(Path.GetTempPath() + "version.txt").Replace("\r", "").Split('\n')[0];
             * version = version.Trim();
             * //GF.doDebug(Convert.ToInt32(version).ToString() + " : " + Convert.ToInt32(old_version).ToString());
             * if (old_version == "0" || old_version == "")
             * {
             *  GF.doDebug("NO FILE or FILES WAS NOT COMPLETE !! HAVE TO DOWNLOAD ALL FILES !!");
             *  getFileList();
             *  syncFile();
             * }
             * else if ((Convert.ToInt32(version) < Convert.ToInt32(old_version)))
             * {
             *  GF.doDebug("FILES ARE NEEDED TO BE UPDATED !!");
             *  fileList = System.IO.File.ReadAllText(Path.GetTempPath() + "version.txt").Trim().Replace("\r", "").Split('\n');
             *  String[] tmp = new String[fileList.Length - 1];
             *  for (int index = 1; index < fileList.Length; index++)
             *  {
             *      tmp[index - 1] = fileList[index];
             *  }
             *  fileList = new String[tmp.Length];
             *  for (int index = 0; index < tmp.Length; index++)
             *  {
             *      Array.Copy(tmp, index, fileList, index, 1);
             *  }
             *  File.Delete(Path.GetTempPath() + "version.txt");
             *  syncFile();
             * }
             * else
             * {
             *  GF.doDebug("FILES ARE UP TO DATE ^_^");
             *  is_updated_version = true;
             * }
             * */
        }