Ejemplo n.º 1
0
        private void ButtonPanel_Drop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string f in files)
            {
                switch (Path.GetExtension(f))
                {
                case ".json":
                    Corelib.ImportF(f);
                    AddButtons();
                    break;

                case ".zip":
                    string folder = Corelib.DownloadsFolder + Path.GetFileName(f);
                    ZipFile.ExtractToDirectory(f, folder);
                    foreach (string s in Directory.GetFiles(folder, "*.json"))
                    {
                        try
                        {
                            Corelib.ImportF(s);
                            AddButtons();
                        }
                        catch (IOException ex)
                        {
                            Corelib.Write(ex.ToString());
                        }
                    }
                    Corelib.ClearDownloadsFolder();
                    break;
                }
            }
            Corelib.ExportList();
            Notify.Show(new NotificationContent
            {
                Title = "Import Finished",
                Type  = NotificationType.Success
            });
        }