Changeset 5 for trunk/USource.pas


Ignore:
Timestamp:
Feb 3, 2011, 2:18:11 PM (13 years ago)
Author:
chronos
Message:
 
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        11lib
        22FreePascalManager.exe
        3 SourceList.xml
        43Config.xml
         4Source
         5Instance
  • trunk/USource.pas

    r4 r5  
    66
    77uses
    8   Classes, SysUtils, Contnrs, FileUtil, Dialogs,
     8  Classes, SysUtils, Contnrs, FileUtil, Dialogs, Forms,
    99  DOM, XMLWrite, XMLRead, HTTPSend;
    1010
     
    1616  TSource = class
    1717    Id: Integer;
    18     Name: string;
     18    ProjectName: string;
     19    ProjectShortName: string;
     20    ProjectType: string;
    1921    SubversionURL: string;
    2022    VersionNumber: string;
    2123    VersionType: string;
    2224    SourceType: TSourceType;
     25    ExecutableFile: string;
    2326    procedure Assign(Source: TSource);
     27    procedure Download;
     28    procedure Update;
     29    procedure ExportTo(Path: string);
     30    function GetExecutableFile: string;
     31    function GetPath: string;
    2432  end;
    2533
     
    3341implementation
    3442
     43uses
     44  UMainForm, UOperationProgress;
     45
    3546{ TSource }
    3647
     
    3849begin
    3950  Id := Source.Id;
    40   Name := Source.Name;
     51  ProjectName := Source.ProjectName;
     52  ProjectShortName := Source.ProjectShortName;
     53  ProjectType := Source.ProjectType;
    4154  VersionNumber := Source.VersionNumber;
    4255  VersionType := Source.VersionType;
    4356  SubversionURL := Source.SubversionURL;
    4457  SourceType := Source.SourceType;
     58  ExecutableFile := Source.ExecutableFile;
     59end;
     60
     61procedure TSource.Download;
     62begin
     63  OperationProgressForm.CommandLine := 'svn checkout "' + SubversionURL +
     64    '" "' + GetPath + '"';
     65  OperationProgressForm.ShowModal;
     66end;
     67
     68procedure TSource.Update;
     69begin
     70  OperationProgressForm.CommandLine := 'svn update "' + GetPath + '"';
     71  OperationProgressForm.ShowModal;
     72end;
     73
     74procedure TSource.ExportTo(Path: string);
     75begin
     76  OperationProgressForm.CommandLine := 'svn export --force "' + GetPath + '" "' +
     77    Path + '"';
     78  OperationProgressForm.ShowModal;
     79end;
     80
     81function TSource.GetExecutableFile: string;
     82var
     83  Postfix: string;
     84begin
     85  PostFix := '';
     86  {$IFDEF WINDOWS}
     87  PostFix := '.exe';
     88  {$ENDIF}
     89  Result := ExecutableFile + Postfix;
     90end;
     91
     92function TSource.GetPath: string;
     93begin
     94  Result := ExtractFileDir(Application.ExeName) + DirectorySeparator +
     95    MainForm.SourceDir + DirectorySeparator + IntToStr(Id);
    4596end;
    4697
     
    78129        NewSource := TSource.Create;
    79130        with NewSource do begin
    80           NewSubNode := Child.FindNode('Name');
     131          NewSubNode := Child.FindNode('ProjectName');
    81132          if Assigned(NewSubNode) then
    82             Name := UTF8Encode(string(NewSubNode.TextContent));
     133            ProjectName := UTF8Encode(string(NewSubNode.TextContent));
     134          NewSubNode := Child.FindNode('ProjectShortName');
     135          if Assigned(NewSubNode) then
     136            ProjectShortName := UTF8Encode(string(NewSubNode.TextContent));
     137          NewSubNode := Child.FindNode('ProjectType');
     138          if Assigned(NewSubNode) then
     139            ProjectType := UTF8Encode(string(NewSubNode.TextContent));
    83140          NewSubNode := Child.FindNode('Id');
    84141          if Assigned(NewSubNode) then
     
    93150          if Assigned(NewSubNode) then
    94151            VersionType := UTF8Encode(string(NewSubNode.TextContent));
     152          NewSubNode := Child.FindNode('ExecutableFile');
     153          if Assigned(NewSubNode) then
     154            ExecutableFile := UTF8Encode(string(NewSubNode.TextContent));
    95155          NewSubNode := Child.FindNode('SourceType');
    96156          if Assigned(NewSubNode) then
Note: See TracChangeset for help on using the changeset viewer.