OSDN Git Service

・config\Board フォルダが無いときの対策。
authoryoffy <yoffy>
Thu, 18 Mar 2004 07:26:39 +0000 (07:26 +0000)
committeryoffy <yoffy>
Thu, 18 Mar 2004 07:26:39 +0000 (07:26 +0000)
res/ExternalBoardPlugIn/ShitarabaJBBSPlugIn.dpr

index f3704cd..3a060e2 100644 (file)
@@ -3,7 +3,7 @@ library ShitarabaJBBSPlugIn;
 {
        ShitarabaJBBSPlugIn
        \82µ\82½\82ç\82Î\8f\88\97\9d\83\86\83j\83b\83g
-       $Id: ShitarabaJBBSPlugIn.dpr,v 1.18 2004/03/18 07:07:51 yoffy Exp $
+       $Id: ShitarabaJBBSPlugIn.dpr,v 1.19 2004/03/18 07:26:39 yoffy Exp $
 }
 
 uses
@@ -361,7 +361,8 @@ begin
                initdir := PreferencesFolder;
                filter  := '\82·\82Ä\82×\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
                if agent = 'gikoNavi' then begin
-                       initdir := initdir + 'Board\';
+                       if DirectoryExists( initdir + 'Board\' ) then
+                               initdir := initdir + 'Board\';
                        filter  := '\94Â\83t\83@\83C\83\8b (*.txt)|*.txt';
                end;
        finally
@@ -383,49 +384,49 @@ begin
                try
                        if (responseCode = 200) or (responseCode = 206) then begin
                                saveText := TStringList.Create;
-        saveText.Add( '[' + keyword + ']' );
+                               saveText.Add( '[' + keyword + ']' );
                                downResult := EUCtoSJIS( tmp );
                                found := AnsiPos( '<a ', downResult );
                                while found > 0 do begin
-               downResult := Copy( downResult, found + 3, MaxInt );    // 3 = Length( '<a ' )
-          found := AnsiPos( 'href=', downResult );
-          if found = 0 then
-               Break;
-
-          if downResult[ found + 5 ] = '"' then begin // 5 = Length( 'href=' )
-            downResult := Copy( downResult, found + 6, MaxInt );       // 6 = Length( 'href="' )
-            found := AnsiPos( '"', downResult );
-          end else begin
-            downResult := Copy( downResult, found + 5, MaxInt );       // 5 = Length( 'href=' )
-            found              := AnsiPos( ' ', downResult );
-            found2     := AnsiPos( '>', downResult );
-            if (found = 0) or (found2 = 0) then
-              found := Max( found, found2 )
-            else
-              found := Min( found, found2 );
-          end;
-          board := Copy( downResult, 1, found - 1 );
-          downResult := Copy( downResult, found, MaxInt );
-
-          if board = BBS_HOST then
+                                       downResult := Copy( downResult, found + 3, MaxInt );    // 3 = Length( '<a ' )
+                                       found := AnsiPos( 'href=', downResult );
+                                       if found = 0 then
+                                               Break;
+
+                                       if downResult[ found + 5 ] = '"' then begin // 5 = Length( 'href=' )
+                                               downResult := Copy( downResult, found + 6, MaxInt );    // 6 = Length( 'href="' )
+                                               found := AnsiPos( '"', downResult );
+                                       end else begin
+                                               downResult := Copy( downResult, found + 5, MaxInt );    // 5 = Length( 'href=' )
+                                               found           := AnsiPos( ' ', downResult );
+                                               found2  := AnsiPos( '>', downResult );
+                                               if (found = 0) or (found2 = 0) then
+                                                       found := Max( found, found2 )
+                                               else
+                                                       found := Min( found, found2 );
+                                       end;
+                                       board := Copy( downResult, 1, found - 1 );
+                                       downResult := Copy( downResult, found, MaxInt );
+
+                                       if board = BBS_HOST then
                                                goto NextBoard;
-          if AnsiPos( '../', board ) = 1 then
-               board := BBS_HOST + Copy( board, 1 + 3, MaxInt );       // 3 = Length( '../' )
+                                       if AnsiPos( '../', board ) = 1 then
+                                               board := BBS_HOST + Copy( board, 1 + 3, MaxInt );       // 3 = Length( '../' )
 
-          found := AnsiPos( '>', downResult );
-          if found = 0 then
-               Break;
-          downResult := Copy( downResult, found + 1, MaxInt ); // 1 = Length( '>' )
+                                       found := AnsiPos( '>', downResult );
+                                       if found = 0 then
+                                               Break;
+                                       downResult := Copy( downResult, found + 1, MaxInt );    // 1 = Length( '>' )
 
-          found := AnsiPos( '</a>', downResult );
-          if found = 0 then
-               Break;
-          board := Copy( downResult, 1, found - 1 ) + '=' + board;
-          downResult := Copy( downResult, found + 4, MaxInt ); // 4 = Length( '</a>' )
+                                       found := AnsiPos( '</a>', downResult );
+                                       if found = 0 then
+                                               Break;
+                                       board := Copy( downResult, 1, found - 1 ) + '=' + board;
+                                       downResult := Copy( downResult, found + 4, MaxInt );    // 4 = Length( '</a>' )
 
-          saveText.Add( board );
+                                       saveText.Add( board );
 NextBoard:
-                       found := AnsiPos( '<a ', downResult );
+                                       found := AnsiPos( '<a ', downResult );
                                end;
                                saveText.SaveToFile( savepath );
                                saveText.Free;
@@ -444,7 +445,7 @@ end;
 
 // \83\81\83j\83\85\81[\83n\83\93\83h\83\89
 procedure OnPlugInMenu(
-  inHandle : HMENU                                     // \83\81\83j\83\85\81[\83n\83\93\83h\83\8b
+       inHandle : HMENU                                        // \83\81\83j\83\85\81[\83n\83\93\83h\83\8b
 ); stdcall;
 begin
 
@@ -526,7 +527,7 @@ var
        uri                                             : TIdURI;
        uriList                         : TStringList;
        datURL                          : string;
-    tmpText: string;
+               tmpText: string;
 begin
 
        Result := dsError;
@@ -564,9 +565,9 @@ begin
                if (responseCode = 200) or (responseCode = 206) then begin
                        downResult := TStringList.Create;
                        try
-                tmpText := CustomStringReplace( string( tmp ), '¡÷¡®', ',' );
+                                                               tmpText := CustomStringReplace( string( tmp ), '¡÷¡®', ',' );
                                downResult.Text := EUCtoSJIS( tmpText );
-                ArrangeDownloadData(Count, downResult);
+                                                               ArrangeDownloadData(Count, downResult);
                                if downResult.Count > 0 then begin
                                        if FileExists( FilePath ) then
                                                logStream := TFileStream.Create( FilePath, fmOpenReadWrite or fmShareDenyWrite )
@@ -580,13 +581,13 @@ begin
                                        end;
 
                                        if Count = 0 then
-                       // \90V\8bK
+                                                                                       // \90V\8bK
                                                Result := dsComplete
                                        else
                                                // \92Ç\8bL
                                                Result := dsDiffComplete;
 
-                    Size                                       := Size + Length( downResult.Text );
+                                                                               Size                                    := Size + Length( downResult.Text );
                                        // CGI \82©\82ç\82Í\90³\82µ\82¢\93ú\95t\82ª\93¾\82ç\82ê\82È\82¢\82Ì\82Å\8c»\8dÝ\82É\90Ý\92è
                                        LastModified    := Now;
 
@@ -617,31 +618,31 @@ end;
 // \83\8c\83X\90\94\82Æ\88ê\92v\82·\82é\82æ\82¤\82É\82·\82é
 // *************************************************************************
 procedure      TShitarabaThreadItem.ArrangeDownloadData(
-       start: Integer;  // \90V\8bK\81F\82O\81@\92Ç\8bL\81F\91O\89ñ\82Ü\82Å\82Ì\8eæ\93¾\90\94
-    var Data: TStringList  //Dat\82Ì\83f\81[\83^
+       start: Integer; // \90V\8bK\81F\82O\81@\92Ç\8bL\81F\91O\89ñ\82Ü\82Å\82Ì\8eæ\93¾\90\94
+               var Data: TStringList   //Dat\82Ì\83f\81[\83^
 );
 var
        i: Integer;
-    n: Integer;
-    tmp: string;
+               n: Integer;
+               tmp: string;
 begin
        i := start;
-    while i < Data.count + start do begin
-       try
-               tmp := Copy(Data[i - start], 1 , AnsiPos('<>', Data[ i - start ] )-1 );
-            try
-               n := StrToInt(tmp);
-                if n > i + 1 then begin
-                       Data.Insert(i - start, Format('%d<><><><><><>', [i+1]));
-                end;
-                Inc(i);
-            except
-               Inc(i);
+               while i < Data.count + start do begin
+                       try
+                                       tmp := Copy(Data[i - start], 1 , AnsiPos('<>', Data[ i - start ] )-1 );
+                                               try
+                                                       n := StrToInt(tmp);
+                                                               if n > i + 1 then begin
+                                                                       Data.Insert(i - start, Format('%d<><><><><><>', [i+1]));
+                                                               end;
+                                                               Inc(i);
+                                               except
+                                                       Inc(i);
                        end;
-        except
+                               except
 
-        end;
-    end;
+                               end;
+               end;
 
 end;
 
@@ -712,7 +713,7 @@ begin
 
        // \93Æ\8e©\82É\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\8ds\82í\82È\82¢\8fê\8d\87\82Í
        // InternalAbon \82¨\82æ\82Ñ Dat2HTML \82É\94C\82¹\82é\82±\82Æ\82ª\8fo\97\88\82é
-    {
+               {
        LoadDat;
        if FDat = nil then begin
                // \83\8d\83O\82É\91\8dÝ\82µ\82È\82¢\82Ì\82Å\82±\82Ì\82Ü\82Ü\8fI\97¹
@@ -720,8 +721,8 @@ begin
                Exit;
        end;
        res := Copy( FDat[ inNo - 1 ], AnsiPos( '<>', FDat[ inNo - 1 ] ) + 2, MaxInt );
-    }
-    res := GetDat( inNo );
+               }
+               res := GetDat( inNo );
        tmp := InternalAbonForOne( PChar( res ), PChar( FilePath ),inNo );
        try
                Result := Dat2HTML( string( tmp ), inNo );
@@ -739,8 +740,8 @@ function TShitarabaThreadItem.GetDat(
 ) : string;                                            // \82Q\82¿\82á\82ñ\82Ë\82é\82ÌDat\8c`\8e®
 var
        res                     : string;
-    tmp                        : array[1..5] of string;
-    i                  : Integer;
+               tmp                     : array[1..5] of string;
+               i                       : Integer;
 begin
 
        // \93Æ\8e©\82É\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\8ds\82í\82È\82¢\8fê\8d\87\82Í
@@ -751,19 +752,19 @@ begin
                Result := '';
                Exit;
        end;
-    try
+               try
 
                res := Copy( FDat[ inNo - 1 ], AnsiPos( '<>', FDat[ inNo - 1 ] ) + 2, MaxInt );
-        //\96\96\94ö\82ÉID\82ª\95\\8e¦\82³\82ê\82Ä\82¢\82é\82Ì\82Å\82»\82ê\82ð\93\8a\8de\93ú\82Ì\82Æ\82±\82ë\82É\93ü\82ê\82é
-        // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95t<>\96{\95¶<>\83X\83\8c\83^\83C<>ID
-        for i := 0 to 4 do begin
-               tmp[ i + 1 ] := Copy( res, 1, AnsiPos('<>', res) - 1 );
-               Delete( res, 1, AnsiPos('<>', res) + 1 );
+                               //\96\96\94ö\82ÉID\82ª\95\\8e¦\82³\82ê\82Ä\82¢\82é\82Ì\82Å\82»\82ê\82ð\93\8a\8de\93ú\82Ì\82Æ\82±\82ë\82É\93ü\82ê\82é
+                               // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95t<>\96{\95¶<>\83X\83\8c\83^\83C<>ID
+                               for i := 0 to 4 do begin
+                                       tmp[ i + 1 ] := Copy( res, 1, AnsiPos('<>', res) - 1 );
+                                       Delete( res, 1, AnsiPos('<>', res) + 1 );
                end;
-        // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<>\83X\83\8c\83^\83C
+                               // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<>\83X\83\8c\83^\83C
                Result := tmp[1] + '<>' + tmp[2] + '<>' + tmp[3] + ' ' + res + '<>'+ tmp[4] + '<>' +tmp[5];
        except
-       Result := '';
+                       Result := '';
        end;
 
 end;
@@ -1090,7 +1091,7 @@ var
        uri                                             : TIdURI;
        uriList                         : TStringList;
        i                                                       : Integer;
-    tmpText : String;
+               tmpText : String;
 begin
 
        Result := dsError;
@@ -1127,7 +1128,7 @@ begin
                                ForceDirectoriesEx( Copy( FilePath, 1, LastDelimiter( '\', FilePath ) ) );
 
                                // EUC \82ð Shift_JIS \82É
-                tmpText := CustomStringReplace( string( downResult ), '¡÷¡®', ',');
+                                                               tmpText := CustomStringReplace( string( downResult ), '¡÷¡®', ',');
                                FDat.Text := EUCtoSJIS( tmpText );
                                // \82µ\82½\82ç\82ΠJBBS \82Í\83`\83F\83b\83N\97p\82É\90æ\93ª\82Æ\8dÅ\8fI\8ds\82ª\93¯\82
                                i := FDat.Count - 1;
@@ -1374,7 +1375,7 @@ begin
                        BoardItemOnDispose      := BoardItemOnDisposeOfTShitarabaBoardItem;
                end;
                DLL_PROCESS_DETACH:
-    begin
+               begin
                        RemovePlugInMenu( SyncronizeMenu );
                end;
                DLL_THREAD_ATTACH: