{******************************************************************************}
{                                                                              }
{                       Pascal Script Source File                              }
{                                                                              }
{             Run by RemObjects Pascal Script in CnPack IDE Wizards            }
{                                                                              }
{                                   Generated by CnPack IDE Wizards            }
{                                                                              }
{******************************************************************************}

program CheckCRLF;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ActnList, Buttons, ClipBrd, ComCtrls, ExtCtrls, ComObj, ExtDlgs, IniFiles,
  Menus, Printers, Registry, StdCtrls, TypInfo, ToolsAPI, CnDebug,
  RegExpr, ScriptEvent, CnCommon, CnWizClasses, CnWizUtils, CnWizIdeUtils,
  CnWizShortCut, CnWizOptions;

var
  CRC, LFC: Integer;
  S: string;
begin
  S := CnOtaGetCurrentSourceFile;
  if CheckFileCRLF(S, CRC, LFC) then
  begin
    if LFC = 0 then
      InfoDlg('Current File: ' + #13#10 + S + #13#10 + 'has ' + IntToStr(CRC) + ' CRLF(s). '
        + 'NO Single LF.' + #13#10#13#10 + 'Seems OK.')
    else
    begin
      if QueryDlg('Current File: ' + #13#10 + S + #13#10 + 'has ' + IntToStr(CRC) + ' CRLF(s). '
        + IntToStr(LFC) + ' Single LF(s).' + #13#10#13#10 + 'Correct it?', False) then
      begin
        if CorrectFileCRLF(S, LFC) then
        InfoDlg('Correct LF(s) ' + IntToStr(LFC));
      end;
    end;
  end;
end.
