procedure ExportToFile(AFileName: WideString); var AData: TxomResource; begin AData := TxomResource.Create(nil); if PublicCatalog.EnumGUIDData(AdminGUID, 'OPTIONS', AData) then begin AData.ResourceStream.SaveToFile(AFileName); Say('Saved as: ' + AFileName); end else Say('No Options Found'); AData.Free; end; procedure ImportFromFile(AFileName: WideString); var AData: TxomResource; begin AData := TxomResource.Create(nil); if WideFileExists(AFileName) then begin AData.ResourceStream.LoadFromFile(AFileName); PublicCatalog.StoreGUIDData(AdminGUID, 'OPTIONS', AData); AData.ResourceStream.Position := 0; PublicCatalog.LoadOptions(PublicOptions, nil); Say('Options are read from file. Please restart.'); end else Say('File ' + AFilename + ' Not Found'); AData.Free; end; procedure ImportPreferences; var AFileName: WideString; begin OpenDialog.DefaultExt := '.preferences'; OpenDialog.InitialDir := WindowsDesktopDir; OpenDialog.FileName := 'PhotoSupreme.preferences' OpenDialog.Filter := 'Preferences files|*.preferences|All Files|*.*'; OpenDialog.Title := 'Import Preferences From'; if OpenDialog.Execute then begin if AskYN('Are you sure your want to overwrite your existing Preferences with that from the selected file?') then begin AFileName := OpenDialog.FileName; ImportFromFile(AFileName); end; end; end; procedure ExportPreferences; var AFileName: WideString; begin SaveDialog.DefaultExt := '.preferences'; SaveDialog.InitialDir := WindowsDesktopDir; SaveDialog.FileName := 'PhotoSupreme.preferences' SaveDialog.Filter := 'Preferences files|*.preferences|All Files|*.*'; SaveDialog.Title := 'Export Preferences From'; if SaveDialog.Execute then begin AFileName := SaveDialog.FileName; ExportToFile(AFileName); end; end; var ACustoms: TTntStringList; AIdx: Integer; ACheck: Boolean; begin ACustoms := TTntStringList.Create; try ACustoms.Add ('Export Preferences to File'); ACustoms.Add ('Import Preferences from File'); ACustoms.Add ('Cancel'); ACheck := False; AIdx := AskCustom( 'What operation would you like to perform?', 'CAUTION: Importing Preferences will overwrite existing Preferences', '', '', ACheck, ACustoms ); if AIdx = 0 then ExportPreferences else if AIdx = 1 then ImportPreferences; finally ACustoms.Free; end; end;