예제 #1
0
        Import(string iniFile, FieldsToImport?fields = null)
        {
            Core.View.ShowProgressBox(ProgressTasks.ImportFromNDL);
            try
            {
                var(error, fmsToScan) = await ImportInternal(iniFile, fields : fields);

                if (error != ImportError.None)
                {
                    Log("Import error: " + error, stackTrace: true);
                    return(false);
                }

                await FMScan.ScanAndFind(fmsToScan,
                                         ScanOptions.FalseDefault(scanGameType: true, scanCustomResources: true));
            }
            catch (Exception ex)
            {
                Log("Exception in NewDarkLoader import", ex);
                return(false);
            }
            finally
            {
                Core.View.HideProgressBox();
            }

            return(true);
        }
예제 #2
0
        Import(string iniFile, bool importFMData, bool importSaves, FieldsToImport fields)
        {
            Core.View.ShowProgressBox(ProgressTasks.ImportFromDarkLoader);
            try
            {
                var(error, fmsToScan) = await ImportInternal(iniFile, importFMData, importSaves, fields : fields);

                if (error != ImportError.None)
                {
                    Log("Import.Error: " + error, stackTrace: true);

                    if (error == ImportError.NoArchiveDirsFound)
                    {
                        Core.View.ShowAlert(LText.Importing.DarkLoader_NoArchiveDirsFound, LText.AlertMessages.Alert);
                        return(false);
                    }

                    Core.View.ShowAlert(
                        "An error occurred with DarkLoader importing. See the log file for details. " +
                        "Aborting import operation.", LText.AlertMessages.Error);

                    return(false);
                }

                await FMScan.ScanAndFind(fmsToScan,
                                         ScanOptions.FalseDefault(scanGameType: true, scanCustomResources: true));
            }
            catch (Exception ex)
            {
                Log("Exception in DarkLoader import", ex);

                Core.View.ShowAlert(
                    "An error occurred with DarkLoader importing. See the log file for details. " +
                    "Aborting import operation.", LText.AlertMessages.Error);

                return(false);
            }
            finally
            {
                Core.View.HideProgressBox();
            }

            return(true);
        }