Changeset 2


Ignore:
Timestamp:
Apr 20, 2016, 6:29:54 PM (8 years ago)
Author:
chronos
Message:
  • Added: Support for loading mediawiki acronyms placed on one line.
  • Fixed: Do not try open non existent file.
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      lib
      AcronymDecoder.exe
      AcronymDecoder.lps
  • trunk/Packages/synapse

    • Property svn:ignore set to
      lib
  • trunk/UFormImport.lfm

    r1 r2  
    1313    Top = 8
    1414    Width = 107
    15     Caption = 'Import'
     15    Caption = 'Process'
    1616    OnClick = ButtonImportClick
    1717    TabOrder = 0
  • trunk/UFormImport.pas

    r1 r2  
    6868    Line := Trim(Memo1.Lines[I]);
    6969    if Copy(Line, 1, 1) = ';' then begin
    70       AcronymName := Trim(Copy(Line, 2, Length(Line)));
     70      if Pos(':', Line) > 0 then begin
     71        AcronymName := Trim(Copy(Line, 2, Pos(':', Line) - 2));
     72        Line := Copy(Line, Pos(':', Line), Length(Line));
     73      end else AcronymName := Trim(Copy(Line, 2, Length(Line)));
    7174    end;
    7275    if Copy(Line, 1, 1) = ':' then begin
  • trunk/UFormMain.pas

    r1 r2  
    5353  UFormImport;
    5454
     55const
     56  DefaultFileName = 'Acronyms.csv';
     57
    5558{ TFormMain }
    5659
     
    6972procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    7073begin
    71   AcronymDB.SaveToFile('Abbreviations.txt');
     74  AcronymDB.SaveToFile(DefaultFileName);
    7275end;
    7376
     
    101104procedure TFormMain.FormShow(Sender: TObject);
    102105begin
    103   AcronymDB.LoadFromFile('Abbreviations.txt');
     106  if FileExists(DefaultFileName) then
     107    AcronymDB.LoadFromFile(DefaultFileName);
    104108  AcronymDb.FilterList(EditSearch.Text, FoundAcronyms);
    105109  UpdateAcronymsList;
Note: See TracChangeset for help on using the changeset viewer.