private void btnUploadS_Click(object sender, EventArgs e) { object loadObject; if (openDialog.ShowDialog() == DialogResult.Cancel) { return; } string filePath = openDialog.FileName; try { InterfaceS serializer = GetSerializer(filePath); if (serializer == null) { MessageBox.Show("Десериализация не удалась!"); return; } //десериализуем и кидаем в лист объектов loadObject = serializer.Deserialize(filePath); ObjectList.Add(loadObject); Redraw(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnUploadS_Click(object sender, EventArgs e) { object loadObject; if (openDialog.ShowDialog() == DialogResult.Cancel) { return; } string filePath = openDialog.FileName; try { //проверяем кодировали ли мы что-то if (GetSerializer(filePath) == null) { if (IsDecoded(ref filePath) == false)//если не вышло раскодировать { MessageBox.Show("Не загружен алгоритм для дешифрования."); return; } } InterfaceS serializer = GetSerializer(filePath); if (serializer == null) { MessageBox.Show("Десериализация не удалась!"); return; } //десериализуем и кидаем в лист объектов loadObject = serializer.Deserialize(filePath); ObjectList.Add(loadObject); Redraw(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }