private SyncLibraryHandler ExecuteSyncHandler(string[] files, FileManagement fileManagement, ITagData tag = null) { SyncLibraryHandler handler = null; try { handler = new SyncLibraryHandler(DataSourceAdapter, DirectoryDataSourceAdapter, AppConfiguration.GameFileDirectory, AppConfiguration.TempDirectory, AppConfiguration.DateParseFormats, fileManagement); handler.SyncFileChange += syncHandler_SyncFileChange; handler.GameFileDataNeeded += syncHandler_GameFileDataNeeded; handler.Execute(files); if (m_pendingZdlFiles != null) { SyncPendingZdlFiles(); m_pendingZdlFiles = null; } if (tag != null) { TagSyncFiles(handler, tag); } } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } return(handler); }
private bool VerifyGameFilesDirectory() { bool check = false; try { InitGameFilesDebug(); check = InitFileCheck("GameFiles", "GameFiles_", true); if (!check) { MessageBox.Show(this, "Initialization failure. Could not find DoomLauncher GameFiles directory. Please update your settings to continue.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult result; bool success = false; do { success = ShowSettings(true, out result); } while (result != DialogResult.Cancel && !success); check = success; } } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } return(check); }
private bool VerifyDatabase() { bool check = false; try { if (File.Exists(Path.Combine(LauncherPath.GetDataDirectory(), DbDataSourceAdapter.DatabaseFileName))) { check = true; // Still attempt to delete the init database here for people that manually update (not installed) if (File.Exists(DbDataSourceAdapter.InitDatabaseFileName)) { File.Delete(DbDataSourceAdapter.InitDatabaseFileName); } return(check); } check = InitFileCheck(DbDataSourceAdapter.DatabaseFileName, DbDataSourceAdapter.InitDatabaseFileName, false); if (!check) { MessageBox.Show(this, "Initialization failure. Could not find DoomLauncher database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } return(check); }
private void ctrlFiles_NewItemNeeded(object sender, AdditionalFilesEventArgs e) { using (FileSelectForm fileSelect = new FileSelectForm()) { fileSelect.Initialize(m_adapter, m_additionalFileViews); fileSelect.MultiSelect = true; fileSelect.StartPosition = FormStartPosition.CenterParent; if (fileSelect.ShowDialog(this) == DialogResult.OK) { IGameFile[] selectedFiles = fileSelect.SelectedFiles.Except(new IGameFile[] { GameFile }).ToArray(); if (selectedFiles.Length > 0) { e.NewItems = selectedFiles.Cast <object>().ToList(); try { ResetSpecificFilesSelections(new IGameFile[] { selectedFiles.First() }); } catch (FileNotFoundException ex) { MessageBox.Show(this, string.Format("The Game File {0} is missing from the library.", ex.FileName), "File Not Found"); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } } } SetColumnConfigToMain(fileSelect.TabViews); } }
private string BuildColumnConfig() { if (m_tabHandler != null) { List <ColumnConfig> config = new List <ColumnConfig>(); foreach (ITabView tab in m_tabHandler.TabViews) { config.AddRange(tab.GetColumnConfig()); } try { StringWriter text = new StringWriter(); XmlSerializer xml = new XmlSerializer(typeof(ColumnConfig[])); xml.Serialize(text, config.ToArray()); return(text.ToString()); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } } return(string.Empty); }
private void btnDelete_Click(object sender, EventArgs e) { if (SelectedItem != null && MessageBox.Show(this, GetDeleteConfirm(), "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK) { try { if (m_launchType == SourcePortLaunchType.SourcePort) { m_adapter.UpdateGameFiles(GameFileFieldType.SourcePortID, GameFileFieldType.SourcePortID, SelectedItem.SourcePortID, null); m_adapter.UpdateFiles(SelectedItem.SourcePortID, -1); } m_adapter.DeleteSourcePort(SelectedItem); } catch (IOException) { MessageBox.Show(this, "This file appears to be in use and cannot be deleted.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } ResetData(); } }
private void btnDelete_Click(object sender, EventArgs e) { MessageCheckBox messageBox = new MessageCheckBox("Confirm", GetDeleteConfirm(), "Delete save games, demos, and statistics associated with this port", SystemIcons.Exclamation, MessageBoxButtons.OKCancel); messageBox.SetShowCheckBox(m_launchType == SourcePortLaunchType.SourcePort); if (SelectedItem != null && messageBox.ShowDialog(this) == DialogResult.OK) { int index = dgvSourcePorts.SelectedRows[0].Index; try { if (m_launchType == SourcePortLaunchType.SourcePort) { m_adapter.UpdateGameFiles(GameFileFieldType.SourcePortID, GameFileFieldType.SourcePortID, SelectedItem.SourcePortID, null); if (messageBox.Checked) { DeleteSourcePortFiles(); } else { UnlinkFilesFromSourcePort(); } } m_adapter.DeleteSourcePort(SelectedItem); } catch (IOException) { MessageBox.Show(this, "This file appears to be in use and cannot be deleted.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } ResetData(); if (index >= dgvSourcePorts.Rows.Count) { index = dgvSourcePorts.Rows.Count - 1; } if (dgvSourcePorts.Rows.Count > 0) { dgvSourcePorts.Rows[index].Selected = true; } } }
private string SerializeColumnConfig(List <ColumnConfig> config) { try { StringWriter text = new StringWriter(); XmlSerializer xml = new XmlSerializer(typeof(ColumnConfig[])); xml.Serialize(text, config.ToArray()); return(text.ToString()); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } return(string.Empty); }
public void Initialize(LauncherPath gameFileDirectory, IEnumerable <IGameFile> gameFiles, string[] supportedExtensions, string[] specificFiles, LauncherPath tempDirectory) { if (specificFiles != null) { m_specificFiles = specificFiles.ToArray(); } m_supportedExtensions = supportedExtensions.ToArray(); m_gameFiles = gameFiles.ToList(); m_directory = gameFileDirectory; m_temp = tempDirectory; try { SetGrid(); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } }
private void SyncIWads(string[] files) { IEnumerable <string> iwads = DataSourceAdapter.GetIWads().Select(x => x.Name); IEnumerable <string> iwadsToAdd = files.Except(iwads); foreach (string file in iwadsToAdd) { try { DataSourceAdapter.InsertIWad(new IWadData() { FileName = file, Name = file }); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } } }
static void Main(string[] args) { try { string launchFile = null; if (args.Length > 0) { launchFile = args[0]; } Directory.SetCurrentDirectory(AssemblyDirectory); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm(launchFile)); } catch (Exception ex) { Util.DisplayUnexpectedException(null, ex); } }
private bool VerifyDatabase() { bool check = false; try { check = InitFileCheck("DoomLauncher.sqlite", "DoomLauncher_.sqlite", false); if (!check) { MessageBox.Show(this, "Initialization failure. Could not find DoomLauncher database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } return(check); }
private void btnOK_Click(object sender, EventArgs e) { if (cmbGame.SelectedItem == null) { MessageBox.Show(this, "A game must be selected.", "Game", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string textFile = CreateTextFile(); string filename = "outgen.txt"; try { File.WriteAllText(filename, textFile); Process.Start(filename); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } }
private void btnOK_Click(object sender, EventArgs e) { if (cmbGame.SelectedItem == null) { MessageBox.Show(this, "A game must be selected.", "Game", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string textFile = CreateTextFile(); string filename = Path.Combine(DataCache.Instance.AppConfiguration.TempDirectory.GetFullPath(), "outgen.txt"); try { File.WriteAllText(filename, textFile); Process.Start(filename); } catch (Exception ex) { Util.DisplayUnexpectedException(this, ex); } }