modified PBE_U.dfm
modified PBE_U.pas + Record start and end index of data types (Contacts, Calendar, SMS, etc.) for speed optimizations
This commit is contained in:
parent
2a6017fd84
commit
b935092202
@ -687,6 +687,15 @@ object Form1: TForm1
|
|||||||
Caption = 'Last entry of this group'
|
Caption = 'Last entry of this group'
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
|
object DBG_Groups: TMemo
|
||||||
|
Left = 328
|
||||||
|
Top = 104
|
||||||
|
Width = 281
|
||||||
|
Height = 145
|
||||||
|
Lines.Strings = (
|
||||||
|
'DBG_Groups')
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
|
69
PBE_U.pas
69
PBE_U.pas
@ -103,6 +103,7 @@ type
|
|||||||
Label20: TLabel;
|
Label20: TLabel;
|
||||||
DBG_SelEntry: TSpinEdit;
|
DBG_SelEntry: TSpinEdit;
|
||||||
DBG_LastEntry: TCheckBox;
|
DBG_LastEntry: TCheckBox;
|
||||||
|
DBG_Groups: TMemo;
|
||||||
procedure Button_LoadClick(Sender: TObject);
|
procedure Button_LoadClick(Sender: TObject);
|
||||||
procedure PB_ListClick(Sender: TObject);
|
procedure PB_ListClick(Sender: TObject);
|
||||||
procedure PB_OrderFLClick(Sender: TObject);
|
procedure PB_OrderFLClick(Sender: TObject);
|
||||||
@ -133,6 +134,21 @@ type
|
|||||||
Value: AnsiString;
|
Value: AnsiString;
|
||||||
LastOfGroup: Boolean;
|
LastOfGroup: Boolean;
|
||||||
end;
|
end;
|
||||||
|
TStartEnd = record
|
||||||
|
from, til: word;
|
||||||
|
end;
|
||||||
|
TGroups = record
|
||||||
|
Contacts: TStartEnd;
|
||||||
|
Calendar: TStartEnd;
|
||||||
|
SMSes: TStartEnd;
|
||||||
|
SettingsData: TStartEnd;
|
||||||
|
SettingsWAP: TStartEnd;
|
||||||
|
Bookmarks: TStartEnd;
|
||||||
|
SettingsProfiles: TStartEnd;
|
||||||
|
SettingsLocks: TStartEnd;
|
||||||
|
SettingsTime: TStartEnd;
|
||||||
|
SettingsCustMenu: TStartEnd;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
Form1: TForm1;
|
Form1: TForm1;
|
||||||
@ -140,6 +156,7 @@ var
|
|||||||
PB: array of TPBData;
|
PB: array of TPBData;
|
||||||
PhoneBook: array of TPhoneEntry;
|
PhoneBook: array of TPhoneEntry;
|
||||||
PhoneBookPhotoCount: integer = 0;
|
PhoneBookPhotoCount: integer = 0;
|
||||||
|
Groups: TGroups;
|
||||||
f: Textfile;
|
f: Textfile;
|
||||||
|
|
||||||
|
|
||||||
@ -359,6 +376,27 @@ begin
|
|||||||
Form1.ProgressBar.Position := FilePos(InFile);
|
Form1.ProgressBar.Position := FilePos(InFile);
|
||||||
cl := Trim(cl);
|
cl := Trim(cl);
|
||||||
cl := StringReplace(cl, '<br/>', CRLF, [rfReplaceAll]);
|
cl := StringReplace(cl, '<br/>', CRLF, [rfReplaceAll]);
|
||||||
|
if (cl='<Contacts>') then Groups.Contacts.from := i
|
||||||
|
else if (cl='<Contacts/>') then Groups.Contacts.til := i-1
|
||||||
|
else if (cl='<Calendar>') then Groups.Calendar.from := i
|
||||||
|
else if (cl='<Calendar/>') then Groups.Calendar.til := i-1
|
||||||
|
else if (cl='<SMS_Messages>') then Groups.SMSes.from := i
|
||||||
|
else if (cl='<SMS_Messages/>') then Groups.SMSes.til := i-1
|
||||||
|
else if (cl='<Settings_DataAccount>') then Groups.SettingsData.from := i
|
||||||
|
else if (cl='<Settings_DataAccount/>') then Groups.SettingsData.til := i-1
|
||||||
|
else if (cl='<Settings_WAP>') then Groups.SettingsWAP.from := i
|
||||||
|
else if (cl='<Settings_WAP/>') then Groups.SettingsWAP.til := i-1
|
||||||
|
else if (cl='<Bookmarks>') then Groups.Bookmarks.from := i
|
||||||
|
else if (cl='<Bookmarks/>') then Groups.Bookmarks.til := i-1
|
||||||
|
else if (cl='<Settings_Profiles>') then Groups.SettingsProfiles.from := i
|
||||||
|
else if (cl='<Settings_Profiles/>') then Groups.SettingsProfiles.til := i-1
|
||||||
|
else if (cl='<Settings_Locks>') then Groups.SettingsLocks.from := i
|
||||||
|
else if (cl='<Settings_Locks/>') then Groups.SettingsLocks.til := i-1
|
||||||
|
else if (cl='<Settings_Time>') then Groups.SettingsTime.from := i
|
||||||
|
else if (cl='<Settings_Time/>') then Groups.SettingsTime.til := i-1
|
||||||
|
else if (cl='<Settings_CustomMenu>') then Groups.SettingsCustMenu.from := i
|
||||||
|
else if (cl='<Settings_CustomMenu/>') then Groups.SettingsCustMenu.til := i-1;
|
||||||
|
|
||||||
if (cl[1]='<') AND (cl[Length(cl)]='>') AND (cl[Length(cl)-1]<>'/') AND (Pos(' ',cl)=0) then begin
|
if (cl[1]='<') AND (cl[Length(cl)]='>') AND (cl[Length(cl)-1]<>'/') AND (Pos(' ',cl)=0) then begin
|
||||||
gp := gp + '>' + Copy(cl, 2, Length(cl)-2);
|
gp := gp + '>' + Copy(cl, 2, Length(cl)-2);
|
||||||
end else if (cl[1]='<') AND (cl[Length(cl)-1]+cl[Length(cl)]='/>') AND (Pos(' ',cl)=0) then begin
|
end else if (cl[1]='<') AND (cl[Length(cl)-1]+cl[Length(cl)]='/>') AND (Pos(' ',cl)=0) then begin
|
||||||
@ -387,22 +425,35 @@ begin
|
|||||||
until Eof(InFile);
|
until Eof(InFile);
|
||||||
Form1.DBG_Count.Text := IntToStr(i);
|
Form1.DBG_Count.Text := IntToStr(i);
|
||||||
Form1.DBG_SelEntry.MaxValue := i-1;
|
Form1.DBG_SelEntry.MaxValue := i-1;
|
||||||
|
Form1.DBG_Groups.Text := 'Contacts: '+IntToStr(Groups.Contacts.from)+'..'+IntToStr(Groups.Contacts.til)+CRLF+
|
||||||
|
'Calendar: '+IntToStr(Groups.Calendar.from)+'..'+IntToStr(Groups.Calendar.til)+CRLF+
|
||||||
|
'SMSes: '+IntToStr(Groups.SMSes.from)+'..'+IntToStr(Groups.SMSes.til)+CRLF+
|
||||||
|
'Data: '+IntToStr(Groups.SettingsData.from)+'..'+IntToStr(Groups.SettingsData.til)+CRLF+
|
||||||
|
'WAP: '+IntToStr(Groups.SettingsWAP.from)+'..'+IntToStr(Groups.SettingsWAP.til)+CRLF+
|
||||||
|
'Bookmarks: '+IntToStr(Groups.Bookmarks.from)+'..'+IntToStr(Groups.Bookmarks.til)+CRLF+
|
||||||
|
'Profiles: '+IntToStr(Groups.SettingsProfiles.from)+'..'+IntToStr(Groups.SettingsProfiles.til)+CRLF+
|
||||||
|
'Locks: '+IntToStr(Groups.SettingsLocks.from)+'..'+IntToStr(Groups.SettingsLocks.til)+CRLF+
|
||||||
|
'Time: '+IntToStr(Groups.SettingsTime.from)+'..'+IntToStr(Groups.SettingsTime.til)+CRLF+
|
||||||
|
'CustomMenu: '+IntToStr(Groups.SettingsCustMenu.from)+'..'+IntToStr(Groups.SettingsCustMenu.til);
|
||||||
|
|
||||||
|
Form1.ProgressBar.Visible := false;
|
||||||
Form1.StatusBar.SimpleText := 'File openened. Now parsing for Contacts ...';
|
Form1.StatusBar.SimpleText := 'File openened. Now parsing for Contacts ...';
|
||||||
|
|
||||||
j := 1;
|
j := 1;
|
||||||
i := 0;
|
i := Groups.Contacts.from;
|
||||||
while (i<Length(PB)-1) do begin
|
Form1.ProgressBar.Min := Groups.Contacts.from;
|
||||||
if (Pos('Contacts', PB[i].Group)>0) then begin
|
Form1.ProgressBar.Max := Groups.Contacts.til;
|
||||||
SetLength(PhoneBook, j);
|
Form1.ProgressBar.Position := Groups.Contacts.from;
|
||||||
PhoneBook[j-1] := ParsePBStream(PB[i].Value);
|
Form1.ProgressBar.Visible := true;
|
||||||
Inc(j);
|
while (i<=Groups.Contacts.til) do begin
|
||||||
end;
|
Form1.ProgressBar.Position := i;
|
||||||
|
SetLength(PhoneBook, j);
|
||||||
|
PhoneBook[j-1] := ParsePBStream(PB[i].Value);
|
||||||
|
Inc(j);
|
||||||
Inc(i);
|
Inc(i);
|
||||||
if (Pos('Calendar', PB[i].Group)>0) then break;
|
|
||||||
end;
|
end;
|
||||||
Form1.StatusBar.SimpleText := 'Loaded '+IntToStr(Length(PhoneBook))+' contacts into memory.';
|
Form1.StatusBar.SimpleText := 'Loaded '+IntToStr(Length(PhoneBook))+' contacts into memory.';
|
||||||
BuildPBList;
|
BuildPBList;
|
||||||
|
|
||||||
Form1.ProgressBar.Visible := false;
|
Form1.ProgressBar.Visible := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user