// Decompiled with JetBrains decompiler
// Type: FileCash_v3._0.FTP
// Assembly: FileCash_v3.0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 1DECC99D-34C5-4E02-A85D-DC744B5C555A
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Constructor.MSIL.ArchSMS.a-33cc8dceb24ed9df287e1f92d02773477af42b8d2b6de53a45bb9b5a3ead070b.exe

using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace FileCash_v3._0
{
  public class FTP : Form
  {
    private FileCash FCashObj;
    private IContainer components;
    private GroupBox groupBox1;
    private Button FTP_Add;
    private TextBox FtpPath;
    private Label label6;
    private TextBox FtpPort;
    private Label label5;
    private TextBox FtpServer;
    private TextBox FtpPass;
    private TextBox FtpLogin;
    private TextBox FtpName;
    private Label label4;
    private Label label3;
    private Label label2;
    private Label label1;

    public FTP(ref FileCash FC)
    {
      this.FCashObj = FC;
      this.InitializeComponent();
    }

    private void FTP_Add_Click(object sender, EventArgs e)
    {
      if (this.FtpName.Text.Trim() == "")
      {
        int num1 = (int) MessageBox.Show("Нужно ввести название FTP!", "Ошибка добавления FTP", MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
      else if (this.FtpServer.Text.Trim() == "")
      {
        int num2 = (int) MessageBox.Show("Нужно ввести имя сервера FTP!", "Ошибка добавления FTP", MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
      else if (this.FtpPort.Text.Trim() == "")
      {
        int num3 = (int) MessageBox.Show("Нужно ввести номер порта!", "Ошибка добавления FTP", MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
      else if (this.FtpLogin.Text.Trim() == "")
      {
        int num4 = (int) MessageBox.Show("Нужно ввести логин!", "Ошибка добавления FTP", MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
      else if (this.FtpPass.Text.Trim() == "")
      {
        int num5 = (int) MessageBox.Show("Нужно ввести пароль!", "Ошибка добавления FTP", MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
      else
      {
        if (!Directory.Exists(this.FCashObj.LocalTmpPath))
          Directory.CreateDirectory(this.FCashObj.LocalTmpPath);
        if (!File.Exists(this.FCashObj.FTP_XML_Path))
        {
          FileStream fileStream = File.Open(this.FCashObj.FTP_XML_Path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
          StreamWriter streamWriter = new StreamWriter((Stream) fileStream, Encoding.UTF8);
          streamWriter.WriteLine("<ftp>");
          streamWriter.Flush();
          streamWriter.WriteLine("</ftp>");
          streamWriter.Flush();
          streamWriter.Close();
          fileStream.Dispose();
          fileStream.Close();
        }
        string str = "<acc>" + "<name>" + this.FtpName.Text.Trim() + "</name>" + "<server>" + this.FtpServer.Text.Trim() + "</server>" + "<port>" + this.FtpPort.Text.Trim() + "</port>" + "<login>" + this.FtpLogin.Text.Trim() + "</login>" + "<pass>" + this.FtpPass.Text.Trim() + "</pass>" + "<path>" + this.FtpPath.Text.Trim() + "</path>" + "</acc>";
        XmlDocument xmlDocument1;
        XmlDocument xmlDocument2 = xmlDocument1 = new XmlDocument();
        xmlDocument2.Load(this.FCashObj.FTP_XML_Path);
        XmlDocumentFragment documentFragment = xmlDocument2.CreateDocumentFragment();
        documentFragment.InnerXml = str;
        xmlDocument2.DocumentElement.AppendChild((XmlNode) documentFragment);
        FileStream outStream = new FileStream(this.FCashObj.FTP_XML_Path, FileMode.Truncate, FileAccess.Write, FileShare.ReadWrite);
        xmlDocument2.Save((Stream) outStream);
        outStream.Close();
        this.Close();
      }
    }

    protected override void Dispose(bool disposing)
    {
      if (disposing && this.components != null)
        this.components.Dispose();
      base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
      this.groupBox1 = new GroupBox();
      this.label1 = new Label();
      this.label2 = new Label();
      this.label3 = new Label();
      this.label4 = new Label();
      this.FtpName = new TextBox();
      this.FtpLogin = new TextBox();
      this.FtpPass = new TextBox();
      this.FtpServer = new TextBox();
      this.label5 = new Label();
      this.FtpPort = new TextBox();
      this.FtpPath = new TextBox();
      this.label6 = new Label();
      this.FTP_Add = new Button();
      this.groupBox1.SuspendLayout();
      this.SuspendLayout();
      this.groupBox1.Controls.Add((Control) this.FTP_Add);
      this.groupBox1.Controls.Add((Control) this.FtpPath);
      this.groupBox1.Controls.Add((Control) this.label6);
      this.groupBox1.Controls.Add((Control) this.FtpPort);
      this.groupBox1.Controls.Add((Control) this.label5);
      this.groupBox1.Controls.Add((Control) this.FtpServer);
      this.groupBox1.Controls.Add((Control) this.FtpPass);
      this.groupBox1.Controls.Add((Control) this.FtpLogin);
      this.groupBox1.Controls.Add((Control) this.FtpName);
      this.groupBox1.Controls.Add((Control) this.label4);
      this.groupBox1.Controls.Add((Control) this.label3);
      this.groupBox1.Controls.Add((Control) this.label2);
      this.groupBox1.Controls.Add((Control) this.label1);
      this.groupBox1.Location = new Point(4, 6);
      this.groupBox1.Name = "groupBox1";
      this.groupBox1.Size = new Size(276, 234);
      this.groupBox1.TabIndex = 0;
      this.groupBox1.TabStop = false;
      this.groupBox1.Text = "Добавить FTP";
      this.label1.AutoSize = true;
      this.label1.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 204);
      this.label1.Location = new Point(18, 27);
      this.label1.Name = "label1";
      this.label1.Size = new Size(67, 15);
      this.label1.TabIndex = 0;
      this.label1.Text = "Название:";
      this.label2.AutoSize = true;
      this.label2.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 204);
      this.label2.Location = new Point(18, 61);
      this.label2.Name = "label2";
      this.label2.Size = new Size(53, 15);
      this.label2.TabIndex = 1;
      this.label2.Text = "Сервер:";
      this.label3.AutoSize = true;
      this.label3.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 204);
      this.label3.Location = new Point(18, 93);
      this.label3.Name = "label3";
      this.label3.Size = new Size(44, 15);
      this.label3.TabIndex = 2;
      this.label3.Text = "Логин:";
      this.label4.AutoSize = true;
      this.label4.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 204);
      this.label4.Location = new Point(18, (int) sbyte.MaxValue);
      this.label4.Name = "label4";
      this.label4.Size = new Size(54, 15);
      this.label4.TabIndex = 3;
      this.label4.Text = "Пароль:";
      this.FtpName.Location = new Point(91, 27);
      this.FtpName.Name = "FtpName";
      this.FtpName.Size = new Size(177, 20);
      this.FtpName.TabIndex = 4;
      this.FtpLogin.Location = new Point(91, 92);
      this.FtpLogin.Name = "FtpLogin";
      this.FtpLogin.Size = new Size(177, 20);
      this.FtpLogin.TabIndex = 5;
      this.FtpPass.Location = new Point(91, 126);
      this.FtpPass.Name = "FtpPass";
      this.FtpPass.Size = new Size(177, 20);
      this.FtpPass.TabIndex = 6;
      this.FtpServer.Location = new Point(91, 60);
      this.FtpServer.Name = "FtpServer";
      this.FtpServer.Size = new Size(105, 20);
      this.FtpServer.TabIndex = 7;
      this.label5.AutoSize = true;
      this.label5.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Bold, GraphicsUnit.Point, (byte) 204);
      this.label5.Location = new Point(202, 61);
      this.label5.Name = "label5";
      this.label5.Size = new Size(11, 15);
      this.label5.TabIndex = 8;
      this.label5.Text = ":";
      this.FtpPort.Location = new Point(219, 60);
      this.FtpPort.Name = "FtpPort";
      this.FtpPort.Size = new Size(49, 20);
      this.FtpPort.TabIndex = 9;
      this.FtpPort.Text = "21";
      this.FtpPath.Location = new Point(91, 161);
      this.FtpPath.Name = "FtpPath";
      this.FtpPath.Size = new Size(177, 20);
      this.FtpPath.TabIndex = 11;
      this.label6.AutoSize = true;
      this.label6.Font = new Font("Microsoft Sans Serif", 9f, FontStyle.Regular, GraphicsUnit.Point, (byte) 204);
      this.label6.Location = new Point(18, 161);
      this.label6.Name = "label6";
      this.label6.Size = new Size(35, 15);
      this.label6.TabIndex = 10;
      this.label6.Text = "Путь";
      this.FTP_Add.Location = new Point(21, 199);
      this.FTP_Add.Name = "FTP_Add";
      this.FTP_Add.Size = new Size(247, 23);
      this.FTP_Add.TabIndex = 12;
      this.FTP_Add.Text = "Добавить";
      this.FTP_Add.UseVisualStyleBackColor = true;
      this.FTP_Add.Click += new EventHandler(this.FTP_Add_Click);
      this.AutoScaleDimensions = new SizeF(6f, 13f);
      this.AutoScaleMode = AutoScaleMode.Font;
      this.ClientSize = new Size(284, 245);
      this.Controls.Add((Control) this.groupBox1);
      this.FormBorderStyle = FormBorderStyle.FixedSingle;
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Name = nameof (FTP);
      this.ShowIcon = false;
      this.ShowInTaskbar = false;
      this.StartPosition = FormStartPosition.CenterParent;
      this.Text = "Добавить FTP";
      this.groupBox1.ResumeLayout(false);
      this.groupBox1.PerformLayout();
      this.ResumeLayout(false);
    }
  }
}
