using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using WjwLib.API.System;

namespace GatewayTool
{
    public partial class FormJson : FormBase
    {
        private const string jsonFilter = "json文件(*.json)|*.json";

        public FormJson()
        {
            InitializeComponent();
            this.IsMinimizable = false;
            this.ShowInTaskbar = false;
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = jsonFilter;
            dialog.Multiselect = false;
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string path = dialog.FileName;
                string str = WjwLib.API.File.PlainText.GetFileContent(path, Encoding.Default);
                txtPath.Text = path;
                rtResult.Clear();
                rtResult.AppendText(WjwLib.API.System.JsonHelper.ConvertJsonString(str));
            }
        }
    }
}