procedure ExportToFile(AFileName: WideString); var AData: TxomResource; begin AData := TxomResource.Create(nil); if PublicCatalog.EnumGUIDData(AdminGUID, 'GEOFAVORITES', AData) then begin AData.ResourceStream.SaveToFile(AFileName); Say('Saved as: ' + AFileName); end else Say('No GEO Favorites 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, 'GEOFAVORITES', AData); AData.ResourceStream.Position := 0; PublicOptions.LoadFromStream(AData.ResourceStream); Say('GEO Favorites are read from file.'); end else Say('File ' + AFilename + ' Not Found'); AData.Free; end; procedure StartImport; var AFileName: WideString; begin OpenDialog.DefaultExt := '.preferences'; OpenDialog.InitialDir := WindowsDesktopDir; OpenDialog.FileName := 'PhotoSupreme.geofav' OpenDialog.Filter := 'GEO Favorites files|*.geofav|All Files|*.*'; OpenDialog.Title := 'Import GEO Favorites From'; if OpenDialog.Execute then begin if AskYN('Are you sure your want to overwrite your existing GEO Favorites with that from the selected file?') then begin AFileName := OpenDialog.FileName; ImportFromFile(AFileName); end; end; end; procedure StartExport; var AFileName: WideString; begin SaveDialog.DefaultExt := '.geofav'; SaveDialog.InitialDir := WindowsDesktopDir; SaveDialog.FileName := 'PhotoSupreme.geofav' SaveDialog.Filter := 'GEO Favorites files|*.geofav|All Files|*.*'; SaveDialog.Title := 'Export GEO Favorites To'; 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 GEO Favorites to File'); ACustoms.Add ('Import GEO Favorites from File'); ACustoms.Add ('Cancel'); ACheck := False; AIdx := AskCustom( 'What operation would you like to perform?', 'CAUTION: Importing GEO Favorites will overwrite existing GEO Favorites', '', '', ACheck, ACustoms ); if AIdx = 0 then StartExport else if AIdx = 1 then StartImport; finally ACustoms.Free; end; end;