コード例 #1
0
        //void tbMessage_TextChanged(object sender, EventArgs e)
        //{
        //    tbMessage.SelectionStart = tbMessage.TextLength;
        //    tbMessage.ScrollToCaret();
        //}

        private void ListAndDeleteErrorFile()
        {
            try
            {
                string   currentHHID   = DatabaseModule.Instance.HHTID;
                string   fileList      = m_ftp.GetFileList(false);
                string[] fileListSplit = null;
                if (fileList.Length > 0)
                {
                    fileList      = fileList.Replace(Environment.NewLine, ",");
                    fileListSplit = fileList.Split(',');
                }

                if (fileListSplit != null)
                {
                    List <string> filesName = new List <string>();

                    for (int i = 0; i < fileListSplit.Length - 1; i++)
                    {
                        if (fileListSplit[i].Length > 3 &&
                            fileListSplit[i].Substring(0, 3).Equals(DatabaseModule.Instance.HHTID))
                        {
                            if (fileListSplit[i].Contains(".zip"))
                            {
                                m_ftp.DeleteFile(fileListSplit[i]);
                            }
                            else
                            {
                                filesName.Add(fileListSplit[i]);
                            }
                        }
                    }

                    if (filesName.Count > 0)
                    {
                        foreach (string item in filesName)
                        {
                            m_ftp.DeleteFile(item);
                        }
                    }
                }
            }
            catch (FTPException ex)
            {
                throw new FTPException("Cant send command to ftp server");
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Jyguy/Discord-Bot-CSharp
        private async void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            FTP ftp = new FTP($"ftp://{Hidden_Info.Ftp.Domain}/Jacob/Program%20Files/Bot/", Hidden_Info.Ftp.Username, Hidden_Info.Ftp.Password);

            ftp.DeleteFile("Bot.accdb");
            ftp.UploadFile("Bot.accdb", $"C:/Users/{Environment.UserName}/Documents/Bot.accdb");

            await Program.Client.LogoutAsync();

            Application.Exit();
        }