private void LoadFiles(ISerializerPlugin plugin, string tvDataFile) { bool dataUpdated = false; try { if (DetectCommonFileCorruptions(tvDataFile)) return; if (!this.LoadTvDataFile(plugin, tvDataFile)) return; dataUpdated = true; this.gviewRight.BeginDataUpdate(); this.gviewLeft.BeginDataUpdate(); this.editor = new Editor(); this.editor.DataRoot = this.dataRoot; this.currentChannelList = null; this.editor.ChannelList = null; this.gridRight.DataSource = null; this.gridLeft.DataSource = null; this.FillChannelListCombo(); //this.SetControlsEnabled(!this.dataRoot.IsEmpty); this.UpdateFavoritesEditor(this.dataRoot.SupportedFavorites); if (this.dataRoot.Warnings.Length > 0 && this.miShowWarningsAfterLoad.Checked) this.BeginInvoke((Action)this.ShowFileInformation); this.BeginInvoke((Action)this.InitInitialChannelOrder); } catch (Exception ex) { if (!(ex is IOException)) throw; string name = plugin != null ? plugin.PluginName : "Loader"; XtraMessageBox.Show(this, name + "\n\n" + ex.Message, Resources.MainForm_LoadFiles_IOException, MessageBoxButtons.OK, MessageBoxIcon.Error); this.currentPlugin = null; this.currentTvFile = null; this.currentTvSerializer = null; this.Text = this.title; } finally { if (dataUpdated) { this.gviewRight.EndDataUpdate(); this.gviewLeft.EndDataUpdate(); } } }
public DataRoot(SerializerBase sbCurrentLoader) { loader = sbCurrentLoader; }
private bool LoadTvDataFile(ISerializerPlugin plugin, string tvDataFile) { if (!File.Exists(tvDataFile)) { XtraMessageBox.Show(this, Resources.MainForm_LoadTvDataFile_FileNotFound_Caption, string.Format(Resources.MainForm_LoadTvDataFile_FileNotFound_Message, tvDataFile), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } if (plugin == null) plugin = this.GetPluginForFile(tvDataFile); // abort action if there is no currentTvSerializer for the input file var serializer = plugin == null ? null : plugin.CreateSerializer(tvDataFile); if (serializer == null) return false; if (!this.PromptSaveAndContinue()) return false; serializer.DefaultEncoding = this.defaultEncoding; serializer.Load(); this.SetFileName(tvDataFile); this.currentPlugin = plugin; this.currentTvSerializer = serializer; this.dataRoot = this.currentTvSerializer.DataRoot; this.AddFileToMruList(this.currentTvFile); this.UpdateMruMenu(); return true; }
public DataRoot(SerializerBase loader) { this.loader = loader; }