hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f1ac689d7599256254ab3f21bce817e9c6079681 | 21,978 | pas | Pascal | Chameleon/backup/weather.pas | ianmartinez/WallShifter | 7eae0c06875cc368284d30a294dcb55f03989a51 | [
"MIT"
]
| 128 | 2018-09-26T21:28:14.000Z | 2022-03-13T17:50:44.000Z | Chameleon/backup/weather.pas | ianmartinez/WallShifter | 7eae0c06875cc368284d30a294dcb55f03989a51 | [
"MIT"
]
| 15 | 2018-09-28T23:33:41.000Z | 2021-04-27T22:38:34.000Z | Chameleon/backup/weather.pas | ianmartinez/WallShifter | 7eae0c06875cc368284d30a294dcb55f03989a51 | [
"MIT"
]
| 9 | 2018-10-18T12:51:41.000Z | 2022-02-19T16:43:28.000Z | unit Weather;
(*
Get weather for the United States and Canada by parsing weather data from:
http://w1.weather.gov/xml/current_obs/
*)
{$mode objfpc}{$H+}
interface
const AllStationsXMLFile : string = 'https://w1.weather.gov/xml/current_obs/index.xml';
const DegF : string = '°F';
const DegC : string = '°C';
const WeatherConditions : array [0..23] of string =
('Mostly Cloudy', 'Clear', 'A Few Clouds', 'Partly Cloudy', 'Overcast',
'Fog', 'Smoke', 'Freezing Drizzle', 'Hail', 'Mixed Rain and Snow',
'Rain and Hail', 'Heavy Mixed Rain and Snow', 'Rain Showers', 'Thunderstorm',
'Snow', 'Windy', 'Scattered Showers', 'Freezing Rain', 'Scattered Thunderstorms',
'Drizzle', 'Heavy Rain', 'Tornado', 'Dust', 'Haze');
const StateAbreviations : array [0..63] of string =
((* United States *) 'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DE', 'FL',
'GA', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA',
'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE',
'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'PA','RI', 'SC',
'SD', 'TN', 'TX', 'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY', '----',
(* Canada *) 'AB', 'BC', 'MB', 'NB', 'NL', 'NT', 'NS', 'NU', 'ON', 'PE',
'QC', 'SK', 'YT');
(*
All of the information needed for displaying weather stations
and fetching their weather data.
*)
type TWeatherStation = record
Id: string;
Name: string;
State: string;
XMLUrl: string;
end;
(*
All of the values that can be reliably found in the weather data,
though Canada does not seem to have condition data for many locations.
*)
type TWeatherData = record
Conditions: string;
Temperature: integer;
Humidity: integer;
HeatIndex: integer;
WindSpeed: double;
WindDirection: string;
end;
type TWeatherStationArray = array of TWeatherStation;
function DownloadTextFile(Url: string; FilePath: string) : string;
function GetAllWeatherStationsXML() : string;
function GetWeatherDataXML(Station: TWeatherStation) : string;
function GetAllWeatherStations(AllStationsXML: string) : TWeatherStationArray;
function GetStationsForState(AllStations: TWeatherStationArray; StateAbbreviation: string) : TWeatherStationArray;
function GetStationByName(AllStations: TWeatherStationArray; StationName: string) : TWeatherStation;
function GetWeatherByStationName(WeatherStationName: string) : TWeatherData;
function GetWeatherData(Station: TWeatherStation) : TWeatherData;
function PrintWeatherReport(Weather: TWeatherData) : string;
function PrintMiniWeatherReport(Weather: TWeatherData) : string;
function NormalizeWeatherCondition(WeatherCondition: string) : string;
function CalcHeatIndex(Temperature: integer; Humidity: integer) : integer;
implementation
uses
Classes, SysUtils, laz2_DOM, laz2_XMLRead, StrUtils, URLMon, Settings;
procedure SplitString(Delimiter: Char; Str: string; ListOfStrings: TStrings);
begin
ListOfStrings.Clear;
ListOfStrings.Delimiter := Delimiter;
ListOfStrings.StrictDelimiter := True;
ListOfStrings.DelimitedText := Str;
end;
(*
Some stations like to scream when giving their name:
FOREMOST AGDM
This function will calm them down:
Foremost Agdm
*)
function FormatName(sBuffer: string):string;
var
iLen, iIndex: integer;
begin
sBuffer := sBuffer.Replace('/', ' / ', [rfReplaceAll]);
sBuffer := sBuffer.Replace('-', ' - ', [rfReplaceAll]);
sBuffer := sBuffer.Replace('(', ' ( ', [rfReplaceAll]);
sBuffer := sBuffer.Replace(')', ' ) ', [rfReplaceAll]);
iLen := Length(sBuffer);
sBuffer:= Uppercase(MidStr(sBuffer, 1, 1)) + Lowercase(MidStr(sBuffer,2, iLen));
for iIndex := 0 to iLen do begin
if MidStr(sBuffer, iIndex, 1) = ' ' then
sBuffer := MidStr(sBuffer, 0, iIndex)
+ Uppercase(MidStr(sBuffer, iIndex + 1, 1))
+ Lowercase(MidStr(sBuffer, iIndex + 2, iLen));
end;
sBuffer := sBuffer.Replace(' / ', '/', [rfReplaceAll]);
sBuffer := sBuffer.Replace(' / ', '/', [rfReplaceAll]);
sBuffer := sBuffer.Replace(' - ', '-', [rfReplaceAll]);
sBuffer := sBuffer.Replace(' ( ', '(', [rfReplaceAll]);
sBuffer := sBuffer.Replace(' ) ', ')', [rfReplaceAll]);
sBuffer := sBuffer.Replace('Exxonmobile','ExxonMobile', [rfReplaceAll]);
Result := sBuffer;
end;
(*
Create a weather station with a name, state, and a URL to fetch it's weather
XML data from.
*)
function CreateWeatherStation(Name: string; State: string; XMLURL: string) : TWeatherStation;
var
Station: TWeatherStation;
begin
Station.Name := Name;
Station.State := State;
Station.XMLUrl := XMLUrl;
Result := Station;
end;
(*
Download a text file from a url into a file.
*)
function DownloadTextFile(Url: string; FilePath: string) : string;
var
FileStrings: TStringList;
begin
if URLDownloadToFile(nil, PChar(Url), PChar(FilePath), 0, nil) = 0 then begin
FileStrings := TStringList.Create;
try
FileStrings.LoadFromFile(FilePath);
Result := FileStrings.Text;
finally
FileStrings.Free;
end;
end
else begin
Result := '';
end;
end;
(*
Get the XML file that lists the available weather stations.
*)
function GetAllWeatherStationsXML() : string;
begin
Result := DownloadTextFile(AllStationsXMLFile, GetWeatherStationsXmlPath());
end;
(*
Get the raw weather XML for a given weather station.
*)
function GetWeatherDataXML(Station: TWeatherStation) : string;
const
TempWeatherDataFile : string = 'WeatherData.xml';
begin
Result := DownloadTextFile(Station.XMLUrl, GetWeatherDataXmlPath());
end;
(*
Get all weather stations in a stations list XML file.
*)
function GetAllWeatherStations(AllStationsXML: string) : TWeatherStationArray;
var
i: integer;
StationCount: integer = 0;
CurrentStation: TWeatherStation;
Stations: TWeatherStationArray;
Doc: TXMLDocument;
Child: TDOMNode;
StringStream: TStringStream;
NodeName: string;
begin
Result := nil;
if AllStationsXML <> '' then begin
try
Doc := TXMLDocument.Create;
StringStream := TStringStream.Create(AllStationsXML);
ReadXMLFile(Doc, StringStream);
Child := Doc.DocumentElement.FirstChild;
while Assigned(Child) do
begin
NodeName := Child.NodeName;
if NodeName = 'station' then begin
// Loop through attributes of weather station
with Child.ChildNodes do
try
for i := 0 to (Count - 1) do begin
if Item[i].NodeName = 'station_name' then begin
CurrentStation.Name := FormatName(Item[i].FirstChild.NodeValue);
end
else if Item[i].NodeName = 'station_id' then begin
CurrentStation.Id := Item[i].FirstChild.NodeValue;
end
else if Item[i].NodeName = 'state' then begin
CurrentStation.State := Item[i].FirstChild.NodeValue;
end
else if Item[i].NodeName = 'xml_url' then begin
CurrentStation.XMLUrl := Item[i].FirstChild.NodeValue;
CurrentStation.XMLUrl := CurrentStation.XMLUrl.Replace('https:', 'http:', [rfReplaceAll]);
CurrentStation.XMLUrl := CurrentStation.XMLUrl.Replace('//weather.gov', '//w1.weather.gov', [rfReplaceAll]);
end;
end;
// Station is valid
if CurrentStation.Name <> '' then begin
// Resize array to accommodate new weather station
Inc(StationCount);
SetLength(Stations, StationCount);
// Add weatherstation
Stations[StationCount - 1] := CurrentStation;
// Reset CurrentStation
CurrentStation.Name := '';
CurrentStation.Id := '';
CurrentStation.State := '';
CurrentStation.XMLUrl := '';
end;
finally
Free;
end;
end;
Child := Child.NextSibling;
end;
Result := Stations;
finally
Doc.Free;
StringStream.Free;
end;
end;
end;
(*
Get an array of weather stations in a given state.
*)
function GetStationsForState(AllStations: TWeatherStationArray; StateAbbreviation: string) : TWeatherStationArray;
var
StationCount: integer = 0;
CurrentStation: TWeatherStation;
Stations: TWeatherStationArray;
begin
for CurrentStation in AllStations do begin
if CurrentStation.State = StateAbbreviation then begin
Inc(StationCount);
SetLength(Stations, StationCount);
Stations[StationCount - 1] := CurrentStation;
end;
end;
Result := Stations;
end;
(*
Get a weather station by name.
*)
function GetStationByName(AllStations: TWeatherStationArray; StationName: string) : TWeatherStation;
var
Station: TWeatherStation;
begin
for Station in AllStations do
if Station.Name = StationName then
Result := Station;
end;
(*
Get weather data by a station name.
*)
function GetWeatherByStationName(WeatherStationName: string) : TWeatherData;
var
SelectedStation: TWeatherStation;
WeatherStations: TWeatherStationArray;
begin
if (WeatherStationName <> '') then begin
WeatherStations := GetAllWeatherStations(GetAllWeatherStationsXML());
SelectedStation := GetStationByName(WeatherStations, WeatherStationName);
Result := GetWeatherData(SelectedStation);
end;
end;
(*
Fetch the weather data for a given weather station.
*)
function GetWeatherData(Station: TWeatherStation) : TWeatherData;
var
Weather: TWeatherData;
Doc: TXMLDocument;
Child: TDOMNode;
StringStream: TStringStream;
NodeName: string;
WeatherDataXML: string;
begin
WeatherDataXML := GetWeatherDataXML(Station);
if WeatherDataXML <> '' then begin
try
Doc := TXMLDocument.Create;
StringStream := TStringStream.Create(WeatherDataXML);
ReadXMLFile(Doc, StringStream);
Weather.Conditions := 'NO DATA';
Weather.WindDirection := 'NO DATA';
Child := Doc.DocumentElement.FirstChild;
while Assigned(Child) do
begin
NodeName := Child.NodeName;
if NodeName = 'weather' then begin
Weather.Conditions := NormalizeWeatherCondition(Child.FirstChild.NodeValue);
end
else if NodeName = 'temp_f' then begin
Weather.Temperature := Round(Child.FirstChild.NodeValue.ToDouble());
end
else if NodeName = 'relative_humidity' then begin
Weather.Humidity := Child.FirstChild.NodeValue.ToInteger();
end
else if NodeName = 'wind_mph' then begin
Weather.WindSpeed := Child.FirstChild.NodeValue.ToDouble();
end
else if NodeName = 'wind_dir' then begin
Weather.WindDirection := Child.FirstChild.NodeValue;
end;
Child := Child.NextSibling;
end;
Weather.HeatIndex := CalcHeatIndex(Weather.Temperature, Weather.Humidity);
Result := Weather;
finally
Doc.Free;
StringStream.Free;
end;
end;
end;
(*
Print all of the weather data as a string.
*)
function PrintWeatherReport(Weather: TWeatherData) : string;
var
Report: TStringList;
begin
Report := TStringList.Create;
try
Report.Add('Conditions: ' + Weather.Conditions);
Report.Add('Temperature: ' + Weather.Temperature.ToString() + DegF);
Report.Add('Humidity: ' + Weather.Humidity.ToString() + '%');
Report.Add('Heat Index: ' + Weather.HeatIndex.ToString() + DegF);
Report.Add('Wind Speed: ' + Weather.WindSpeed.ToString() + ' MPH');
Report.Add('Wind Direction: ' + Weather.WindDirection);
Result := Report.Text;
finally
Report.Free;
end;
end;
(*
Print all of the weather data as a string.
*)
function PrintMiniWeatherReport(Weather: TWeatherData) : string;
var
Report: TStringList;
begin
Report := TStringList.Create;
try
Report.Add(Weather.Conditions);
Report.Add(Weather.Temperature.ToString() + DegF + ' (Feels Like ' + Weather.HeatIndex.ToString() + DegF + ')');
Report.Add(Weather.Humidity.ToString() + '% Humidity');
Report.Add(Weather.WindSpeed.ToString() + ' MPH Wind (' + Weather.WindDirection + ')');
Result := Report.Text;
finally
Report.Free;
end;
end;
(*
Many weather conditions returned from weather.gov can be described
dozens of different ways:
http://w1.weather.gov/xml/current_obs/weather.php
This function normalizes them to match those in the array WeatherConditions
declared above.
*)
function NormalizeWeatherCondition(WeatherCondition: string) : string;
const
WeatherConditionsIrregular : array [0..23] of string =
('Mostly Cloudy|Mostly Cloudy with Haze|Mostly Cloudy and Breezy',
'Fair|Clear|Fair with Haze|Clear with Haze|Fair and Breezy|Clear and Breezy',
'A Few Clouds|A Few Clouds with Haze|A Few Clouds and Breezy',
'Partly Cloudy|Partly Cloudy with Haze|Partly Cloudy and Breezy',
'Overcast|Overcast with Haze|Overcast and Breezy',
'Fog/Mist|Fog|Freezing Fog|Shallow Fog|Partial Fog|Patches of Fog|Fog in Vicinity|Freezing Fog in Vicinity|Shallow Fog in Vicinity|Partial Fog in Vicinity|Patches of Fog in Vicinity|Showers in Vicinity Fog|Light Freezing Fog|Heavy Freezing Fog',
'Smoke',
'Freezing Rain|Freezing Drizzle|Light Freezing Rain|Light Freezing Drizzle|Heavy Freezing Rain|Heavy Freezing Drizzle|Freezing Rain in Vicinity|Freezing Drizzle in Vicinity',
'Ice Pellets|Light Ice Pellets|Heavy Ice Pellets|Ice Pellets in Vicinity|Showers Ice Pellets|Thunderstorm Ice Pellets|Ice Crystals|Hail|Small Hail/Snow Pellets|Light Small Hail/Snow Pellets|Heavy small Hail/Snow Pellets|Showers Hail|Hail Showers',
'Freezing Rain Snow|Light Freezing Rain Snow|Heavy Freezing Rain Snow|Freezing Drizzle Snow|Light Freezing Drizzle Snow|Heavy Freezing Drizzle Snow|Snow Freezing Rain|Light Snow Freezing Rain|Heavy Snow Freezing Rain|Snow Freezing Drizzle|Light Snow Freezing Drizzle|Heavy Snow Freezing Drizzle',
'Rain Ice Pellets|Light Rain Ice Pellets|Heavy Rain Ice Pellets|Drizzle Ice Pellets|Light Drizzle Ice Pellets|Heavy Drizzle Ice Pellets|Ice Pellets Rain|Light Ice Pellets Rain|Heavy Ice Pellets Rain|Ice Pellets Drizzle|Light Ice Pellets Drizzle|Heavy Ice Pellets Drizzle',
'Rain Snow|Light Rain Snow|Heavy Rain Snow|Snow Rain|Light Snow Rain|Heavy Snow Rain|Drizzle Snow|Light Drizzle Snow|Heavy Drizzle Snow|Snow Drizzle|Light Snow Drizzle|Heavy Drizzle Snow',
'Rain Showers|Light Rain Showers|Light Rain and Breezy|Heavy Rain Showers|Rain Showers in Vicinity|Light Showers Rain|Heavy Showers Rain|Showers Rain|Showers Rain in Vicinity|Rain Showers Fog/Mist|Light Rain Showers Fog/Mist|Heavy Rain Showers Fog/Mist|Rain Showers in Vicinity Fog/Mist|Light Showers Rain Fog/Mist|Heavy Showers Rain Fog/Mist|Showers Rain Fog/Mist|Showers Rain in Vicinity Fog/Mist',
'Thunderstorm|Thunderstorm Rain|Light Thunderstorm Rain|Heavy Thunderstorm Rain|Thunderstorm Rain Fog/Mist|Light Thunderstorm Rain Fog/Mist|Heavy Thunderstorm Rain Fog and Windy|Heavy Thunderstorm Rain Fog/Mist|Thunderstorm Showers in Vicinity|Light Thunderstorm Rain Haze|Heavy Thunderstorm Rain Haze|Thunderstorm Fog|Light Thunderstorm Rain Fog|Heavy Thunderstorm Rain Fog|Thunderstorm Light Rain|Thunderstorm Heavy Rain|Thunderstorm Rain Fog/Mist|Thunderstorm Light Rain Fog/Mist|Thunderstorm Heavy Rain Fog/Mist|Thunderstorm in Vicinity Fog/Mist|Thunderstorm Showers in Vicinity|Thunderstorm in Vicinity Haze|Thunderstorm Haze in Vicinity|Thunderstorm Light Rain Haze|Thunderstorm Heavy Rain Haze|Thunderstorm Fog|Thunderstorm Light Rain Fog|Thunderstorm Heavy Rain Fog|Thunderstorm Hail|Light Thunderstorm Rain Hail|Heavy Thunderstorm Rain Hail|Thunderstorm Rain Hail Fog/Mist|Light Thunderstorm Rain Hail Fog/Mist|Heavy Thunderstorm Rain Hail Fog/Hail|Thunderstorm Showers in Vicinity Hail|Light Thunderstorm Rain Hail Haze|Heavy Thunderstorm Rain Hail Haze|Thunderstorm Hail Fog|Light Thunderstorm Rain Hail Fog|Heavy Thunderstorm Rain Hail Fog|Thunderstorm Light Rain Hail|Thunderstorm Heavy Rain Hail|Thunderstorm Rain Hail Fog/Mist|Thunderstorm Light Rain Hail Fog/Mist|Thunderstorm Heavy Rain Hail Fog/Mist|Thunderstorm in Vicinity Hail|Thunderstorm in Vicinity Hail Haze|Thunderstorm Haze in Vicinity Hail|Thunderstorm Light Rain Hail Haze|Thunderstorm Heavy Rain Hail Haze|Thunderstorm Hail Fog|Thunderstorm Light Rain Hail Fog|Thunderstorm Heavy Rain Hail Fog|Thunderstorm Small Hail/Snow Pellets|Thunderstorm Rain Small Hail/Snow Pellets|Light Thunderstorm Rain Small Hail/Snow Pellets|Heavy Thunderstorm Rain Small Hail/Snow Pellets',
'Snow|Light Snow|Heavy Snow|Snow Showers|Light Snow Showers|Heavy Snow Showers|Showers Snow|Light Showers Snow|Heavy Showers Snow|Snow Fog/Mist|Light Snow Fog/Mist|Heavy Snow Fog/Mist|Snow Showers Fog/Mist|Light Snow Showers Fog/Mist|Heavy Snow Showers Fog/Mist|Showers Snow Fog/Mist|Light Showers Snow Fog/Mist|Heavy Showers Snow Fog/Mist|Snow Fog|Light Snow Fog|Heavy Snow Fog|Snow Showers Fog|Light Snow Showers Fog|Heavy Snow Showers Fog|Showers Snow Fog|Light Showers Snow Fog|Heavy Showers Snow Fog|Showers in Vicinity Snow|Snow Showers in Vicinity|Snow Showers in Vicinity Fog/Mist|Snow Showers in Vicinity Fog|Low Drifting Snow|Blowing Snow|Snow Low Drifting Snow|Snow Blowing Snow|Light Snow Low Drifting Snow|Light Snow Blowing Snow|Light Snow Blowing Snow Fog/Mist|Heavy Snow Low Drifting Snow|Heavy Snow Blowing Snow|Thunderstorm Snow|Light Thunderstorm Snow|Heavy Thunderstorm Snow|Snow Grains|Light Snow Grains|Heavy Snow Grains|Heavy Blowing Snow|Blowing Snow in Vicinity',
'Windy|Breezy|Fair and Windy|A Few Clouds and Windy|Partly Cloudy and Windy|Mostly Cloudy and Windy|Overcast and Windy',
'Showers in Vicinity|Showers in Vicinity Fog/Mist|Showers in Vicinity Fog|Showers in Vicinity Haze',
'Freezing Rain Rain|Light Freezing Rain Rain|Heavy Freezing Rain Rain|Rain Freezing Rain|Light Rain Freezing Rain|Heavy Rain Freezing Rain|Freezing Drizzle Rain|Light Freezing Drizzle Rain|Heavy Freezing Drizzle Rain|Rain Freezing Drizzle|Light Rain Freezing Drizzle|Heavy Rain Freezing Drizzle',
'Thunderstorm in Vicinity|Thunderstorm in Vicinity Fog|Thunderstorm in Vicinity Haze',
'Light Rain|Drizzle|Light Drizzle|Heavy Drizzle|Light Rain Fog/Mist|Drizzle Fog/Mist|Light Drizzle Fog/Mist|Heavy Drizzle Fog/Mist|Light Rain Fog|Drizzle Fog|Light Drizzle Fog|Heavy Drizzle Fog',
'Rain|Heavy Rain|Rain Fog/Mist|Heavy Rain Fog/Mist|Rain Fog|Heavy Rain Fog',
'Funnel Cloud|Funnel Cloud in Vicinity|Tornado/Water Spout',
'Dust|Low Drifting Dust|Blowing Dust|Sand|Blowing Sand|Low Drifting Sand|Dust/Sand Whirls|Dust/Sand Whirls in Vicinity|Dust Storm|Heavy Dust Storm|Dust Storm in Vicinity|Sand Storm|Heavy Sand Storm|Sand Storm in Vicinity',
'Haze');
var
i: integer;
ConditionNames: TStringList;
ConditionNamePos: integer;
NormalizedWeatherCondition: string;
MatchFound : boolean = false;
begin
NormalizedWeatherCondition := 'Invalid: ' + WeatherCondition;
for i := low(WeatherConditions) to high(WeatherConditions) do begin
ConditionNames := TStringList.Create;
try
SplitString('|', WeatherConditionsIrregular[i], ConditionNames);
for ConditionNamePos := 0 to ConditionNames.Count - 1 do
if(LowerCase(WeatherCondition) = LowerCase(ConditionNames[ConditionNamePos])) then begin
NormalizedWeatherCondition := WeatherConditions[i];
MatchFound := true;
end;
finally
ConditionNames.Free();
end;
end;
if not MatchFound then begin
if WeatherCondition.ToLower.Contains('thunderstorm') then begin
NormalizedWeatherCondition := 'Thunderstorm';
end;
end;
Result := NormalizedWeatherCondition;
end;
(*
Calculate the heat index (how the temperature actually feels)
for a specified temperature and humidity.
Equation from: https://en.wikipedia.org/wiki/Heat_index#Formula
Table: https://en.wikipedia.org/wiki/Heat_index#Table_of_values
*)
function CalcHeatIndex(Temperature: integer; Humidity: integer) : integer;
var
t: integer;
r: integer;
const
c1: double = -42.379;
c2: double = 2.04901523;
c3: double = 10.14333127;
c4: double = -0.22475541;
c5: double = -6.83783e-3;
c6: double = -5.481717e-2;
c7: double = 1.22874e-3;
c8: double = 8.5282e-4;
c9: double = -1.99e-6;
begin
t := Temperature;
r := Humidity;
if (t >= 80) and (t <= 112) then begin
// This is more accurate, but only works between the values above
Result := Round(c1 + c2*t + c3*r + c4*t*r + c5*sqr(t) + c6*sqr(r) +
c7*sqr(t)*r + c8*t*sqr(r) + c9*sqr(t)*sqr(r));
end
else begin
// This is the less accurate, but works with values outside of the above range
Result := Round((t + (0.5 * (t + 61.0 + ((t-68.0)*1.2) + (r*0.094))))/2);
end;
end;
end.
| 43.607143 | 1,756 | 0.672946 |
478456fec400d2dfca2759a168ed24136a5e4e78 | 18,744 | pas | Pascal | SDK/LeanCloud/REST.Backend.LeanCloudProvider.pas | leancloud/delphi-sdk | 06b425c0fd0d35640824570866fc9d07bb0b117c | [
"MIT"
]
| 13 | 2015-03-21T11:26:00.000Z | 2019-07-28T04:12:42.000Z | SDK/LeanCloud/REST.Backend.LeanCloudProvider.pas | leancloud/delphi-sdk | 06b425c0fd0d35640824570866fc9d07bb0b117c | [
"MIT"
]
| null | null | null | SDK/LeanCloud/REST.Backend.LeanCloudProvider.pas | leancloud/delphi-sdk | 06b425c0fd0d35640824570866fc9d07bb0b117c | [
"MIT"
]
| 8 | 2015-03-21T14:59:22.000Z | 2021-09-10T02:15:27.000Z | {*******************************************************}
{ }
{ Delphi REST Client Framework }
{ }
{ Copyright(c) 2015 yuanpeng }
{ }
{*******************************************************}
{$HPPEMIT LINKUNIT}
unit REST.Backend.LeanCloudProvider;
interface
uses System.Classes, System.Generics.Collections, REST.Backend.Providers,
REST.Backend.LeanCloudAPI, REST.Client, REST.Backend.ServiceTypes,
REST.Backend.MetaTypes;
type
TCustomLeanCloudConnectionInfo = class(TComponent)
public type
TNotifyList = class
private
FList: TList<TNotifyEvent>;
procedure Notify(Sender: TObject);
public
constructor Create;
destructor Destroy; override;
procedure Add(const ANotify: TNotifyEvent);
procedure Remove(const ANotify: TNotifyEvent);
end;
TAndroidPush = class(TPersistent)
private
FInstallationID: string;
FHaveID: Boolean;
procedure ReadBlank(Reader: TReader);
procedure WriteBlank(Writer: TWriter);
function GetInstallationID: string;
procedure SetInstallationID(const Value: string);
protected
procedure AssignTo(AValue: TPersistent); override;
procedure DefineProperties(Filer: TFiler); override;
public
class function NewInstallationID: string;
published
property InstallationID: string read GetInstallationID write SetInstallationID stored True;
end;
private
FConnectionInfo: TLeanCloudApi.TConnectionInfo;
FNotifyOnChange: TNotifyList;
FAndroidPush: TAndroidPush;
procedure SetApiVersion(const Value: string);
procedure SetApplicationID(const Value: string);
procedure SetRestApiKey(const Value: string);
procedure SetMasterKey(const Value: string);
function GetApiVersion: string;
function GetRestApiKey: string;
function GetMasterKey: string;
function GetApplicationID: string;
procedure SetAndroidPush(const Value: TAndroidPush);
function GetProxyPassword: string;
function GetProxyPort: integer;
function GetProxyServer: string;
function GetProxyUsername: string;
procedure SetProxyPassword(const Value: string);
procedure SetProxyPort(const Value: integer);
procedure SetProxyServer(const Value: string);
procedure SetProxyUsername(const Value: string);
protected
procedure DoChanged; virtual;
property NotifyOnChange: TNotifyList read FNotifyOnChange;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure UpdateApi(const ALeanCloudApi: TLeanCloudApi);
property ApiVersion: string read GetApiVersion write SetApiVersion;
property ApplicationID: string read GetApplicationID write SetApplicationID;
property RestApiKey: string read GetRestApiKey write SetRestApiKey;
property MasterKey: string read GetMasterKey write SetMasterKey;
property AndroidPush: TAndroidPush read FAndroidPush write SetAndroidPush;
property ProxyPassword: string read GetProxyPassword write SetProxyPassword;
property ProxyPort: integer read GetProxyPort write SetProxyPort default 0;
property ProxyServer: string read GetProxyServer write SetProxyServer;
property ProxyUsername: string read GetProxyUsername write SetProxyUsername;
end;
TCustomLeanCloudProvider = class(TCustomLeanCloudConnectionInfo, IBackendProvider, IRESTIPComponent)
public const
ProviderID = 'LeanCloud';
protected
{ IBackendProvider }
function GetProviderID: string;
end;
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidOSX32 or pidiOSSimulator or pidiOSDevice or pidAndroid)]
TLeanCloudProvider = class(TCustomLeanCloudProvider)
published
property ApiVersion;
property ApplicationID;
property RestApiKey;
property MasterKey;
// LeanCloud/GCM not currently supported
property AndroidPush;
property ProxyPassword;
property ProxyPort;
property ProxyServer;
property ProxyUsername;
end;
TLeanCloudBackendService = class(TInterfacedObject)
private
FConnectionInfo: TCustomLeanCloudConnectionInfo;
procedure SetConnectionInfo(const Value: TCustomLeanCloudConnectionInfo);
procedure OnConnectionChanged(Sender: TObject);
protected
procedure DoAfterConnectionChanged; virtual;
property ConnectionInfo: TCustomLeanCloudConnectionInfo read FConnectionInfo write SetConnectionInfo;
public
constructor Create(const AProvider: IBackendProvider); virtual;
destructor Destroy; override;
end;
// Use to access TLeanCloudAPI from a component
//
// if Supports(BackendStorage1.ProviderService, IGetLeanCloudAPI, LIntf) then
// LLeanCloudAPI := LIntf.LeanCloudAPI;
IGetLeanCloudAPI = interface
['{9EFB309D-6A53-4F3B-8B7F-D9E7D92998E8}']
function GetLeanCloudAPI: TLeanCloudAPI;
property LeanCloudAPI: TLeanCloudAPI read GetLeanCloudApi;
end;
TLeanCloudServiceAPI = class(TInterfacedObject, IBackendAPI, IGetLeanCloudAPI)
private
FLeanCloudAPI: TLeanCloudAPI;
{ IGetLeanCloudAPI }
function GetLeanCloudAPI: TLeanCloudAPI;
protected
property LeanCloudAPI: TLeanCloudAPI read FLeanCloudAPI;
public
constructor Create;
destructor Destroy; override;
end;
TLeanCloudServiceAPIAuth = class(TLeanCloudServiceAPI, IBackendAuthenticationApi)
protected
{ IBackendAuthenticationApi }
procedure Login(const ALogin: TBackendEntityValue);
procedure Logout;
procedure SetDefaultAuthentication(ADefaultAuthentication: TBackendDefaultAuthentication);
function GetDefaultAuthentication: TBackendDefaultAuthentication;
procedure SetAuthentication(AAuthentication: TBackendAuthentication);
function GetAuthentication: TBackendAuthentication;
end;
TLeanCloudBackendService<TAPI: TLeanCloudServiceAPI, constructor> = class(TLeanCloudBackendService, IGetLeanCloudAPI)
private
FBackendAPI: TAPI;
FBackendAPIIntf: IInterface;
procedure ReleaseBackendApi;
{ IGetLeanCloudAPI }
function GetLeanCloudAPI: TLeanCloudAPI;
protected
function CreateBackendApi: TAPI; virtual;
procedure EnsureBackendApi;
procedure DoAfterConnectionChanged; override;
end;
procedure Register;
implementation
uses System.SysUtils, REST.Backend.LeanCloudMetaTypes, System.TypInfo, REST.Backend.Consts;
{ TCustomLeanCloudProvider }
procedure Register;
begin
RegisterComponents('BAAS Client', [TLeanCloudProvider]);
end;
function TCustomLeanCloudProvider.GetProviderID: string;
begin
Result := ProviderID;
end;
{ TCustomLeanCloudConnectionInfo }
constructor TCustomLeanCloudConnectionInfo.Create(AOwner: TComponent);
begin
inherited;
FConnectionInfo := TLeanCloudApi.TConnectionInfo.Create(TLeanCloudApi.cDefaultApiVersion, '');
FNotifyOnChange := TNotifyList.Create;
FAndroidPush := TAndroidPush.Create;
end;
destructor TCustomLeanCloudConnectionInfo.Destroy;
begin
FAndroidPush.Free;
inherited;
FNotifyOnChange.Free;
end;
procedure TCustomLeanCloudConnectionInfo.DoChanged;
begin
FNotifyOnChange.Notify(Self);
end;
function TCustomLeanCloudConnectionInfo.GetApiVersion: string;
begin
Result := FConnectionInfo.ApiVersion;
end;
function TCustomLeanCloudConnectionInfo.GetApplicationID: string;
begin
Result := FConnectionInfo.ApplicationID;
end;
function TCustomLeanCloudConnectionInfo.GetRestApiKey: string;
begin
Result := FConnectionInfo.RestApiKey;
end;
function TCustomLeanCloudConnectionInfo.GetMasterKey: string;
begin
Result := FConnectionInfo.MasterKey;
end;
function TCustomLeanCloudConnectionInfo.GetProxyPassword: string;
begin
Result := FConnectionInfo.ProxyPassword;
end;
function TCustomLeanCloudConnectionInfo.GetProxyPort: integer;
begin
Result := FConnectionInfo.ProxyPort;
end;
function TCustomLeanCloudConnectionInfo.GetProxyServer: string;
begin
Result := FConnectionInfo.ProxyServer;
end;
function TCustomLeanCloudConnectionInfo.GetProxyUsername: string;
begin
Result := FConnectionInfo.ProxyUsername;
end;
procedure TCustomLeanCloudConnectionInfo.SetAndroidPush(const Value: TAndroidPush);
begin
FAndroidPush.Assign(Value);
end;
procedure TCustomLeanCloudConnectionInfo.SetApiVersion(const Value: string);
begin
if Value <> ApiVersion then
begin
FConnectionInfo.ApiVersion := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetApplicationID(const Value: string);
begin
if Value <> ApplicationID then
begin
FConnectionInfo.ApplicationID := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetRestApiKey(const Value: string);
begin
if Value <> RestApiKey then
begin
FConnectionInfo.RestApiKey := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetMasterKey(const Value: string);
begin
if Value <> MasterKey then
begin
FConnectionInfo.MasterKey := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetProxyPassword(const Value: string);
begin
if Value <> ProxyPassword then
begin
FConnectionInfo.ProxyPassword := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetProxyPort(const Value: integer);
begin
if Value <> ProxyPort then
begin
FConnectionInfo.ProxyPort := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetProxyServer(const Value: string);
begin
if Value <> ProxyServer then
begin
FConnectionInfo.ProxyServer := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.SetProxyUsername(const Value: string);
begin
if Value <> ProxyUsername then
begin
FConnectionInfo.ProxyUsername := Value;
DoChanged;
end;
end;
procedure TCustomLeanCloudConnectionInfo.UpdateApi(const ALeanCloudApi: TLeanCloudApi);
begin
ALeanCloudApi.ConnectionInfo := FConnectionInfo;
end;
{ TCustomLeanCloudConnectionInfo.TNotifyList }
procedure TCustomLeanCloudConnectionInfo.TNotifyList.Add(const ANotify: TNotifyEvent);
begin
Assert(not FList.Contains(ANotify));
if not FList.Contains(ANotify) then
FList.Add(ANotify);
end;
constructor TCustomLeanCloudConnectionInfo.TNotifyList.Create;
begin
FList := TList<TNotifyEvent>.Create;
end;
destructor TCustomLeanCloudConnectionInfo.TNotifyList.Destroy;
begin
FList.Free;
inherited;
end;
procedure TCustomLeanCloudConnectionInfo.TNotifyList.Notify(Sender: TObject);
var
LProc: TNotifyEvent;
begin
for LProc in FList do
LProc(Sender);
end;
procedure TCustomLeanCloudConnectionInfo.TNotifyList.Remove(
const ANotify: TNotifyEvent);
begin
Assert(FList.Contains(ANotify));
FList.Remove(ANotify);
end;
{ TLeanCloudServiceAPI }
constructor TLeanCloudServiceAPI.Create;
begin
FLeanCloudAPI := TLeanCloudAPI.Create(nil);
end;
destructor TLeanCloudServiceAPI.Destroy;
begin
FLeanCloudAPI.Free;
inherited;
end;
function TLeanCloudServiceAPI.GetLeanCloudAPI: TLeanCloudAPI;
begin
Result := FLeanCloudAPI;
end;
{ TLeanCloudBackendService<TAPI> }
function TLeanCloudBackendService<TAPI>.CreateBackendApi: TAPI;
begin
Result := TAPI.Create;
if ConnectionInfo <> nil then
ConnectionInfo.UpdateAPI(Result.FLeanCloudAPI)
else
Result.FLeanCloudAPI.ConnectionInfo := TLeanCloudAPI.EmptyConnectionInfo;
end;
procedure TLeanCloudBackendService<TAPI>.EnsureBackendApi;
begin
if FBackendAPI = nil then
begin
FBackendAPI := CreateBackendApi;
FBackendAPIIntf := FBackendAPI; // Reference
end;
end;
function TLeanCloudBackendService<TAPI>.GetLeanCloudAPI: TLeanCloudAPI;
begin
EnsureBackendApi;
if FBackendAPI <> nil then
Result := FBackendAPI.FLeanCloudAPI;
end;
procedure TLeanCloudBackendService<TAPI>.ReleaseBackendApi;
begin
FBackendAPI := nil;
FBackendAPIIntf := nil;
end;
procedure TLeanCloudBackendService<TAPI>.DoAfterConnectionChanged;
begin
ReleaseBackendApi;
end;
{ TLeanCloudBackendService }
constructor TLeanCloudBackendService.Create(const AProvider: IBackendProvider);
begin
if AProvider is TCustomLeanCloudConnectionInfo then
ConnectionInfo := TCustomLeanCloudConnectionInfo(AProvider)
else
raise EArgumentException.Create(sWrongProvider);
end;
destructor TLeanCloudBackendService.Destroy;
begin
if Assigned(FConnectionInfo) then
FConnectionInfo.NotifyOnChange.Remove(OnConnectionChanged);
inherited;
end;
procedure TLeanCloudBackendService.DoAfterConnectionChanged;
begin
//
end;
procedure TLeanCloudBackendService.OnConnectionChanged(Sender: TObject);
begin
DoAfterConnectionChanged;
end;
procedure TLeanCloudBackendService.SetConnectionInfo(
const Value: TCustomLeanCloudConnectionInfo);
begin
if FConnectionInfo <> nil then
FConnectionInfo.NotifyOnChange.Remove(OnConnectionChanged);
FConnectionInfo := Value;
if FConnectionInfo <> nil then
FConnectionInfo.NotifyOnChange.Add(OnConnectionChanged);
OnConnectionChanged(Self);
end;
{ TCustomLeanCloudConnectionInfo.TAndroidProps }
procedure TCustomLeanCloudConnectionInfo.TAndroidPush.AssignTo(
AValue: TPersistent);
begin
if AValue is TAndroidPush then
Self.FInstallationID := TAndroidPush(AValue).FInstallationID
else
inherited;
end;
procedure TCustomLeanCloudConnectionInfo.TAndroidPush.DefineProperties(Filer: TFiler);
begin
inherited DefineProperties(Filer);
Filer.DefineProperty('BlankID', ReadBlank, WriteBlank,
FInstallationID = '');
end;
function TCustomLeanCloudConnectionInfo.TAndroidPush.GetInstallationID: string;
begin
if not FHaveID then
begin
FHaveID := True;
if FInstallationID = '' then
FInstallationID := NewInstallationID;
end;
Result := FInstallationID;
end;
procedure TCustomLeanCloudConnectionInfo.TAndroidPush.WriteBlank(Writer: TWriter);
begin
Writer.WriteBoolean(True);
end;
procedure TCustomLeanCloudConnectionInfo.TAndroidPush.ReadBlank(Reader: TReader);
begin
Reader.ReadBoolean;
FHaveID := True;
end;
procedure TCustomLeanCloudConnectionInfo.TAndroidPush.SetInstallationID(
const Value: string);
begin
FHaveID := True;
FInstallationID := Value;
end;
{ TLeanCloudServiceAPIAuth }
function TLeanCloudServiceAPIAuth.GetAuthentication: TBackendAuthentication;
begin
case LeanCloudAPI.Authentication of
TLeanCloudApi.TAuthentication.Default:
Result := TBackendAuthentication.Default;
TLeanCloudApi.TAuthentication.MasterKey:
Result := TBackendAuthentication.Root;
TLeanCloudApi.TAuthentication.APIKey:
Result := TBackendAuthentication.Application;
TLeanCloudApi.TAuthentication.Session:
Result := TBackendAuthentication.Session;
else
Assert(False);
Result := TBackendAuthentication.Default;
end;
end;
function TLeanCloudServiceAPIAuth.GetDefaultAuthentication: TBackendDefaultAuthentication;
begin
case LeanCloudAPI.DefaultAuthentication of
TLeanCloudApi.TDefaultAuthentication.APIKey:
Result := TBackendDefaultAuthentication.Application;
TLeanCloudApi.TDefaultAuthentication.MasterKey:
Result := TBackendDefaultAuthentication.Root;
TLeanCloudApi.TDefaultAuthentication.Session:
Result := TBackendDefaultAuthentication.Session;
else
Assert(False);
Result := TBackendDefaultAuthentication.Root;
end;
end;
procedure TLeanCloudServiceAPIAuth.Login(const ALogin: TBackendEntityValue);
var
LMetaLogin: TMetaLogin;
begin
if ALogin.Data is TMetaLogin then
begin
LMetaLogin := TMetaLogin(ALogin.Data);
LeanCloudAPI.Login(LMetaLogin.Login);
end
else
raise EArgumentException.Create(sParameterNotLogin); // Do not localize
end;
procedure TLeanCloudServiceAPIAuth.Logout;
begin
LeanCloudAPI.Logout;
end;
procedure TLeanCloudServiceAPIAuth.SetAuthentication(
AAuthentication: TBackendAuthentication);
begin
case AAuthentication of
TBackendAuthentication.Default:
LeanCloudAPI.Authentication := TLeanCloudApi.TAuthentication.Default;
TBackendAuthentication.Root:
LeanCloudAPI.Authentication := TLeanCloudApi.TAuthentication.MasterKey;
TBackendAuthentication.Application:
LeanCloudAPI.Authentication := TLeanCloudApi.TAuthentication.APIKey;
TBackendAuthentication.Session:
LeanCloudAPI.Authentication := TLeanCloudApi.TAuthentication.Session;
TBackendAuthentication.None:
LeanCloudAPI.Authentication := TLeanCloudApi.TAuthentication.None;
TBackendAuthentication.User:
raise ELeanCloudAPIError.CreateFmt(sAuthenticationNotSupported, [
System.TypInfo.GetEnumName(TypeInfo(TBackendAuthentication), Integer(AAuthentication))]);
else
Assert(False);
end;
end;
procedure TLeanCloudServiceAPIAuth.SetDefaultAuthentication(
ADefaultAuthentication: TBackendDefaultAuthentication);
begin
case ADefaultAuthentication of
TBackendDefaultAuthentication.Root:
LeanCloudAPI.DefaultAuthentication := TLeanCloudApi.TDefaultAuthentication.MasterKey;
TBackendDefaultAuthentication.Application:
LeanCloudAPI.DefaultAuthentication := TLeanCloudApi.TDefaultAuthentication.APIKey;
TBackendDefaultAuthentication.Session:
LeanCloudAPI.DefaultAuthentication := TLeanCloudApi.TDefaultAuthentication.Session;
TBackendDefaultAuthentication.None:
LeanCloudAPI.DefaultAuthentication := TLeanCloudApi.TDefaultAuthentication.None;
TBackendDefaultAuthentication.User:
raise ELeanCloudAPIError.CreateFmt(sAuthenticationNotSupported, [
System.TypInfo.GetEnumName(TypeInfo(TBackendDefaultAuthentication), Integer(ADefaultAuthentication))]);
else
Assert(False);
end;
end;
class function TCustomLeanCloudConnectionInfo.TAndroidPush.NewInstallationID: string;
var
LGuid: TGuid;
begin
CreateGUID(LGuid);
Result := GUIDToString(LGuid);
// Strip '{','}'
Result := Result.Substring(1, Result.Length - 2);
end;
initialization
TBackendProviders.Instance.Register(TCustomLeanCloudProvider.ProviderID, 'LeanCloud'); // Do not localize
finalization
TBackendProviders.Instance.UnRegister(TCustomLeanCloudProvider.ProviderID);
end.
| 30.379254 | 120 | 0.751387 |
8361862d2ebb88da2f375fcc10c97463017d6c58 | 37,398 | pas | Pascal | components/pxlib/PxXmlFile.pas | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 15 | 2016-08-24T07:32:49.000Z | 2021-11-16T11:25:00.000Z | components/pxlib/PxXmlFile.pas | CWBudde/delcos | 656384c43c2980990ea691e4e52752d718fb0277 | [
"Apache-2.0"
]
| 1 | 2016-08-24T19:00:34.000Z | 2016-08-25T19:02:14.000Z | components/pxlib/PxXmlFile.pas | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 4 | 2015-11-06T12:15:36.000Z | 2018-10-08T15:17:17.000Z | // --------------------------------------------------------------------------------------------
// Unit : XmlFile.pas
// Autor: Maciej "Padcom" Hryniszak
//
// Data : 2002-08-xx - Works for the first time. Writen upon the base of XmlFile.pas used for
// "RadioTaxi Manager 3.1".
// 2002-09-xx - Method of reading th content changed to more "proffessional". Now it is
// used a TParser class from Classes.pas and changed to fit the needs of
// Xml format (doublequote instead of quote as an string delimiter).
// Added error handling routines (with line number where the error has
// occured)
// 2002-10-30 - Extension: a custom tag named Include has been introduced. It allows to
// make embedded Xml content instead of writting all in one file. This
// feature is enabled by default but can be disabled by passing
// ResolveIncludes = False to the constructor of TPxXmlFile.
// WARNING: Only the first root tag is included into resulting Xml tree.
// So the included file must have a form
// <ExampleTag>
// interior...
// </ExampleTag>
// instead of
// <ExampleTag1>
// interior...
// </ExampleTag1>
// <ExampleTag2>
// interior...
// </ExampleTag2>
// In the second example only the <ExampleTag1> will be included and the
// <ExampleTag2> will be omnited.
// 2002-11-04 - Inside change: Now adding and removing of params is done by TPxXmlParam
// instead of providing a complex maintance of params with TPxXmlItem.
// Also TPxXmlItem is automaticaly added to his owner (the param Owner in
// TPxXmlItem is required !)
// 2002-12-19 - Fix with included XmlFiles: There was a problem with including of XmlFiles
// that included only on the first level. Now it is possible to add
// <Inclide FileName="filename.xml"/> in any place (not inside a tag definition)
// and the content will be inserted in the selected place.
// 2003-02-15 - Added handling of Xml params <?xml-param-name param="" ?>
// 2003-11-10 - Changed description of unit to fit the standard.
// - Added conditional definition DEBUG only if there is no FINALVERSION defined
// (to fit the standard)
// - Change the form XML to Xml (to look more like Xml class from .NET framework)
// 2003-11-12 - Added two methods StoreStream and RestoreStream to the TPxXmlParam class.
// Savind is done as UUEncode and therefore it may take a while to store some
// larger data into such params.
// - Access methods to AsString property has been modified to proper handling
// of \" sequence (to make the UUEncode streams possible)
// 2004-05-03 - Fixed bug while disposing TPxXmlProperty
// 2006-02-24 - added compatibility with Delphi 6
//
// Desc : todo.
//
// ToDo : - usage description, doc, additional comments in code;
// --------------------------------------------------------------------------------------------
unit PxXmlFile;
{$I PxDefines.inc}
interface
uses
Classes, SysUtils;
type
TPxXmlItem = class;
TPxXmlObject = class (TObject)
end;
TPxXmlParam = class (TPxXmlObject)
private
FName: String;
FValue: String;
FParent: TPxXmlItem;
function GetBoolean: Boolean;
procedure SetBoolean(Value: Boolean);
function GetFloat: Extended;
procedure SetFloat(Value: Extended);
function GetInteger: Int64;
procedure SetInteger(Value: Int64);
function GetString: String;
procedure SetString(Value: String);
public
constructor Create(AParent: TPxXmlItem);
destructor Destroy; override;
function IsParamName(ParamName: String): Boolean;
procedure StoreStream(Stream: TStream);
procedure RestoreStream(Stream: TStream);
property Parent: TPxXmlItem read FParent;
property Name: String read FName write FName;
// string (exactly as it is written in xml)
property Value: String read FValue write FValue;
property AsBoolean: Boolean read GetBoolean write SetBoolean;
property AsFloat: Extended read GetFloat write SetFloat;
property AsInteger: Int64 read GetInteger write SetInteger;
// string that knows how to handle special character sequences ("\|", "\'", "\\", "\"");
property AsString: String read GetString write SetString;
end;
TPxXmlParamList = class (TList)
private
function GetItem(Index: Integer): TPxXmlParam;
public
property Items[Index: Integer]: TPxXmlParam read GetItem; default;
end;
TPxXmlItemList = class;
TPxXmlItem = class (TPxXmlObject)
private
FParent: TPxXmlItem;
FName: String;
FParams: TPxXmlParamList;
FItems: TPxXmlItemList;
function GetParamCount: Integer;
function GetItemCount: Integer;
function GetThis: TPxXmlItem;
public
constructor Create(AParent: TPxXmlItem);
destructor Destroy; override;
function GetItemByName(ItemName: String): TPxXmlItem;
function HasItem(ItemName: String): Boolean;
function GetParamByName(ParamName: String): TPxXmlParam;
function GetParamByNameS(ParamName: String): String;
function HasParam(ParamName: String): Boolean;
function IsItemName(ItemName: String): Boolean;
property Parent: TPxXmlItem read FParent;
property This: TPxXmlItem read GetThis;
property Name: String read FName write FName;
property Params: TPxXmlParamList read FParams;
property ParamCount: Integer read GetParamCount;
property Items: TPxXmlItemList read FItems;
property ItemCount: Integer read GetItemCount;
end;
TPxXmlItemList = class (TList)
private
function GetItem(Index: Integer): TPxXmlItem;
procedure SetItem(Index: Integer; Value: TPxXmlItem);
public
property Items[Index: Integer]: TPxXmlItem read GetItem write SetItem; default;
end;
TPxXmlProperty = class;
TPxXmlValue = class (TPxXmlObject)
private
FName: String;
FValue: String;
FParent: TPxXmlProperty;
function GetBoolean: Boolean;
procedure SetBoolean(Value: Boolean);
function GetFloat: Extended;
procedure SetFloat(Value: Extended);
function GetInteger: Int64;
procedure SetInteger(Value: Int64);
function GetString: String;
procedure SetString(Value: String);
public
constructor Create(AParent: TPxXmlProperty);
destructor Destroy; override;
function IsValueName(ValueName: String): Boolean;
property Parent: TPxXmlProperty read FParent;
property Name: String read FName write FName;
// string (exactly as it is written in xml)
property Value: String read FValue write FValue;
property AsBoolean: Boolean read GetBoolean write SetBoolean;
property AsFloat: Extended read GetFloat write SetFloat;
property AsInteger: Int64 read GetInteger write SetInteger;
// string that knows how to handle special character sequences ("\|", "\'", "\\", "\"");
property AsString: String read GetString write SetString;
end;
TPxXmlValueList = class (TList)
private
function GetItem(Index: Integer): TPxXmlValue;
public
property Items[Index: Integer]: TPxXmlValue read GetItem; default;
end;
TPxXmlProperty = class (TPxXmlObject)
private
FName: String;
FValues: TPxXmlValueList;
public
constructor Create;
destructor Destroy; override;
function GetValueByName(ParamName: String): TPxXmlValue;
function GetValueByNameS(ParamName: String): String;
function HasValue(ParamName: String): Boolean;
function IsPropertyName(ItemName: String): Boolean;
property Name: String read FName write FName;
property Values: TPxXmlValueList read FValues write FValues;
end;
TPxXmlPropertyList = class (TList)
private
function GetByName(Name: String): TPxXmlProperty;
function GetItem(Index: Integer): TPxXmlProperty;
public
function PropertyExists(Name: String): Boolean;
property ByName[Name: String]: TPxXmlProperty read GetByName;
property Items[Index: Integer]: TPxXmlProperty read GetItem; default;
end;
TPxXmlParseStatus = (psNotLoaded, psLoaded, psError);
TPxXmlFile = class (TPxXmlObject)
private
FXmlProperties: TPxXmlPropertyList;
FXmlRoot: TPxXmlItem;
FStatus: TPxXmlParseStatus;
FStatusMessage: String;
FResolveIncludes: Boolean;
FInternalFileNameCounter: array of record
Extension: string;
Value: Integer;
end;
procedure Parse(Stream: TStream);
procedure DisconnectRoot;
procedure ResolveIncludes;
public
constructor Create(ResolveIncludes: Boolean = True; CreateRoot: Boolean = False);
destructor Destroy; override;
function GetNextInternalFileName(Base, Ext: string): string;
procedure ReadFile(FileName: String);
procedure ReadStrings(Strings: TStrings);
procedure ReadStream(Stream: TStream);
procedure GenerateTree(XmlItem: TPxXmlItem; Strings: TStrings; Ident: String);
procedure WriteFile(FileName: String);
procedure WriteStrings(Strings: TStrings);
procedure WriteStream(Stream: TStream);
property Status: TPxXmlParseStatus read FStatus;
property StatusMessage: String read FStatusMessage;
property XmlProperties: TPxXmlPropertyList read FXmlProperties;
property XmlItem: TPxXmlItem read FXmlRoot;
end;
implementation
uses
{$IFDEF VER130}
Consts;
{$ENDIF}
{$IFDEF VER140}
RtlConsts;
{$ENDIF}
{$IFDEF VER150}
RtlConsts;
{$ENDIF}
{$IFDEF FPC}
RtlConsts;
{$ENDIF}
{ TParser }
const
ParseBufSize = 65536;
{ TParser special tokens }
toEOF = Char(0);
toSymbol = Char(1);
toString = Char(2);
toInteger = Char(3);
toFloat = Char(4);
type
TParser = class(TObject)
private
FStream: TStream;
FOrigin: Longint;
FBuffer: PChar;
FBufPtr: PChar;
FBufEnd: PChar;
FSourcePtr: PChar;
FSourceEnd: PChar;
FTokenPtr: PChar;
FStringPtr: PChar;
FSourceLine: Integer;
FSaveChar: Char;
FToken: Char;
FStringDelimiter: Char;
procedure ReadBuffer;
procedure SkipBlanks;
public
constructor Create(Stream: TStream; StringDelimiter: Char);
destructor Destroy; override;
procedure Error(const Ident: string);
procedure ErrorFmt(const Ident: string; const Args: array of const);
procedure ErrorStr(const Message: string);
function NextToken: Char;
function SourcePos: Longint;
function TokenFloat: Extended;
function TokenInt: Int64;
function TokenString: string;
property SourceLine: Integer read FSourceLine;
property Token: Char read FToken;
end;
constructor TParser.Create(Stream: TStream; StringDelimiter: Char);
begin
inherited Create;
FStream := Stream;
GetMem(FBuffer, ParseBufSize);
FBuffer[0] := #0;
FBufPtr := FBuffer;
FBufEnd := FBuffer + ParseBufSize;
FSourcePtr := FBuffer;
FSourceEnd := FBuffer;
FTokenPtr := FBuffer;
FSourceLine := 1;
FStringDelimiter := StringDelimiter;
NextToken;
end;
destructor TParser.Destroy;
begin
if FBuffer <> nil then
begin
FStream.Seek(Longint(FTokenPtr) - Longint(FBufPtr), 1);
FreeMem(FBuffer, ParseBufSize);
end;
end;
procedure TParser.Error(const Ident: string);
begin
ErrorStr(Ident);
end;
procedure TParser.ErrorFmt(const Ident: string; const Args: array of const);
begin
ErrorStr(Format(Ident, Args));
end;
procedure TParser.ErrorStr(const Message: string);
begin
// raise EParserError.CreateResFmt(@SParseError, [Message, FSourceLine]);
end;
function TParser.NextToken: Char;
var
P: PChar;
NextCharIsNotControl: Boolean;
begin
SkipBlanks;
P := FSourcePtr;
FTokenPtr := P;
if P^ = FStringDelimiter then
begin
NextCharIsNotControl := False;
repeat
Inc(P);
if P^ in [#0, #10, #13] then Error(SInvalidString)
else if P^ = '\' then
NextCharIsNotControl := True
else if (not NextCharIsNotControl) and (P^ = FStringDelimiter) then Break
else if NextCharIsNotControl then NextCharIsNotControl := False;
until False;
FStringPtr := P;
P := P + 1;
FTokenPtr := FTokenPtr + 1;
Result := toString;
end
else
case P^ of
'A'..'Z', 'a'..'z', '_':
begin
Inc(P);
while P^ in ['A'..'Z', 'a'..'z', '0'..'9', '_'] do Inc(P);
Result := toSymbol;
end;
'$':
begin
Inc(P);
while P^ in ['0'..'9', 'A'..'F', 'a'..'f'] do Inc(P);
Result := toInteger;
end;
'-', '0'..'9':
begin
Inc(P);
while P^ in ['0'..'9'] do Inc(P);
Result := toInteger;
while P^ in ['0'..'9', '.', 'e', 'E', '+', '-'] do
begin
Inc(P);
Result := toFloat;
end;
end;
else
Result := P^;
if Result <> toEOF then Inc(P);
end;
FSourcePtr := P;
FToken := Result;
end;
procedure TParser.ReadBuffer;
var
Count: Integer;
begin
Inc(FOrigin, FSourcePtr - FBuffer);
FSourceEnd[0] := FSaveChar;
Count := FBufPtr - FSourcePtr;
if Count <> 0 then Move(FSourcePtr[0], FBuffer[0], Count);
FBufPtr := FBuffer + Count;
Inc(FBufPtr, FStream.Read(FBufPtr[0], FBufEnd - FBufPtr));
FSourcePtr := FBuffer;
FSourceEnd := FBufPtr;
if FSourceEnd = FBufEnd then
begin
FSourceEnd := LineStart(FBuffer, FSourceEnd - 1);
if FSourceEnd = FBuffer then Error(SLineTooLong);
end;
FSaveChar := FSourceEnd[0];
FSourceEnd[0] := #0;
end;
procedure TParser.SkipBlanks;
begin
repeat
case FSourcePtr^ of
#0:
begin
ReadBuffer;
if FSourcePtr^ = #0 then Exit;
Continue;
end;
#10:
Inc(FSourceLine);
#33..#255:
Exit;
end;
Inc(FSourcePtr);
until False;
end;
function TParser.SourcePos: Longint;
begin
Result := FOrigin + (FTokenPtr - FBuffer);
end;
function TParser.TokenFloat: Extended;
begin
Result := StrToFloat(TokenString);
end;
function TParser.TokenInt: Int64;
begin
Result := StrToInt64(TokenString);
end;
function TParser.TokenString: string;
var
L: Integer;
begin
Result := '';
if FToken = toString then
L := FStringPtr - FTokenPtr
else
L := FSourcePtr - FTokenPtr;
SetString(Result, FTokenPtr, L);
end;
{ TPxXmlObject }
{ TPxXmlParam }
function TPxXmlParam.GetBoolean: Boolean;
begin
Result := (AnsiCompareText(FValue, 'True') = 0) or (AnsiCompareText(FValue, 'Yes') = 0) or (AnsiCompareText(FValue, '1') = 0);
end;
procedure TPxXmlParam.SetBoolean(Value: Boolean);
begin
if Value then FValue := '1'
else FValue := '0';
end;
{$IFNDEF VER150}
function TryStrToFloat(S: String; var Value: Extended): Boolean;
begin
try
Value := StrToFloat(S);
Result := True;
except
Result := False;
end;
end;
function TryStrToInt64(S: String; var Value: Int64): Boolean;
var
E: Integer;
begin
Val(S, Value, E);
Result := E = 0;
end;
{$ENDIF}
function TPxXmlParam.GetFloat: Extended;
begin
Result := 0;
if not TryStrToFloat(FValue, Result) then
Result := 0;
end;
procedure TPxXmlParam.SetFloat(Value: Extended);
begin
FValue := FloatToStr(Value);
end;
function TPxXmlParam.GetInteger: Int64;
begin
Result := 0;
if not TryStrToInt64(FValue, Result) then
Result := 0;
end;
procedure TPxXmlParam.SetInteger(Value: Int64);
begin
FValue := IntToStr(Value);
end;
function TPxXmlParam.GetString: String;
var
I: Integer;
begin
Result := '';
I := 1;
while I <= Length(FValue) do
begin
if FValue[I] = '\' then
begin
Inc(I);
if I <= Length(FValue) then
case FValue[I] of
'''', '\', '"':
begin
Result := Result + FValue[I];
Inc(I);
end;
'|':
begin
Result := Result + #13#10;
Inc(I);
end;
else raise Exception.Create('Unknown control character ' + FValue[I] + ' !');
end;
end
else
begin
Result := Result + FValue[I];
Inc(I);
end;
end;
end;
procedure TPxXmlParam.SetString(Value: String);
var
I: Integer;
begin
I := 1;
while I <= Length(Value) do
begin
case Value[I] of
'''', '\', '"':
begin
Insert('\', Value, I);
Inc(I, 2);
end;
#13:
begin
if (I = Length(Value)) and (Value[I + 1] <> #10) then Delete(Value, I, 1)
else Delete(Value, I, 2);
Insert('\|', Value, I);
Inc(I, 2);
end;
else Inc(I);
end;
end;
FValue := Value;
end;
{ Public declarations }
constructor TPxXmlParam.Create(AParent: TPxXmlItem);
begin
inherited Create;
FParent := AParent;
if Assigned(Parent) then
Parent.Params.Add(Self);
end;
destructor TPxXmlParam.Destroy;
begin
if Assigned(Parent) then
Parent.Params.Remove(Self);
inherited Destroy;
end;
function TPxXmlParam.IsParamName(ParamName: String): Boolean;
begin
Result := AnsiCompareText(FName, ParamName) = 0;
end;
procedure TPxXmlParam.StoreStream(Stream: TStream);
var
ResultString: String;
procedure Enc(Buffer: PChar; var Index: Integer);
function EncOne(Sym: Integer): Char;
begin
if Sym = 0 then Result := '`'
else Result := Chr((Sym and 63) + Ord(' '));
end;
var
C1, C2, C3, C4: Char;
begin
C1 := EncOne(Word(Buffer^) shr 2);
C2 := EncOne(((Word(Buffer^) shl 4) and 48) or ((Word(Buffer[1]) shr 4) and 15));
C3 := EncOne(((Word(Buffer[1]) shl 2) and 60) or ((Word(Buffer[2]) shr 6) and 3));
C4 := EncOne(Word(Buffer[2]) and 63);
ResultString[Index] := C1;
ResultString[Index + 1] := C2;
ResultString[Index + 2] := C3;
ResultString[Index + 3] := C4;
Inc(Index, 4);
end;
var
I, Index: Integer;
TmpStream: TMemoryStream;
P: ^Byte;
begin
TmpStream := TMemoryStream.Create;
TmpStream.CopyFrom(Stream, Stream.Size);
ResultString := IntToStr(Stream.Size) + ';';
Index := Length(ResultString) + 1;
// align data to 4 bytes
I := 0;
while TmpStream.Size mod 4 <> 0 do
TmpStream.Write(I, 1);
SetLength(ResultString, Length(ResultString) + Trunc(TmpStream.Size * 1.34));
// save to UU stream
P := TmpStream.Memory;
I := 0;
while I < TmpStream.Size do
begin
Enc(PChar(P), Index);
Inc(I, 3);
Inc(P, 3);
end;
TmpStream.Free;
if Index > 3 then
SetLength(ResultString, Index);
SetString(ResultString);
end;
procedure TPxXmlParam.RestoreStream(Stream: TStream);
var
Length: Integer;
function Dec(Sym: Char): Word;
begin
Dec := (Ord(Sym) - Ord(' ')) and $3F;
end;
procedure OutDec(Buffer: PChar);
var
C1, C2, C3: Char;
begin
C1 := Chr((Word(Dec(Buffer^)) shl 2) or (Word(Dec(Buffer[1])) shr 4));
C2 := Chr((Word(Dec(Buffer[1])) shl 4) or (Word(Dec(Buffer[2])) shr 2));
C3 := Chr((Word(Dec(Buffer[2])) shl 6) or (Word(Dec(Buffer[3]))));
with Stream do
begin
if Size < Length then
Write(C1, 1);
if Size < Length then
Write(C2, 1);
if Size < Length then
Write(C3, 1);
end;
end;
var
I, P: Integer;
S: String;
begin
S := GetString;
P := Pos(';', GetString);
if P > 0 then
begin
Length := StrToInt(Copy(S, 1, P - 1));
I := P + 1;
while Stream.Size < Length do
begin
OutDec(@(Copy(S, I, 4)[1]));
Inc(I, 4);
end;
end;
end;
{ TPxXmlParamList }
function TPxXmlParamList.GetItem(Index: Integer): TPxXmlParam;
begin
Result := TObject(inherited Items[Index]) as TPxXmlParam;
end;
{ TPxXmlItem }
{ Private declarations }
function TPxXmlItem.GetParamCount: Integer;
begin
Result := FParams.Count;
end;
function TPxXmlItem.GetItemCount: Integer;
begin
Result := FItems.Count;
end;
function TPxXmlItem.GetThis: TPxXmlItem;
begin
Result := Self;
end;
{ Public declarations }
constructor TPxXmlItem.Create(AParent: TPxXmlItem);
begin
inherited Create;
FParent := AParent;
FParams := TPxXmlParamList.Create;
FItems := TPxXmlItemList.Create;
if Assigned(Parent) then
Parent.Items.Add(Self);
end;
destructor TPxXmlItem.Destroy;
begin
if Assigned(Parent) then
Parent.Items.Remove(Self);
while FParams.Count > 0 do
FParams[FParams.Count - 1].Free;
FParams.Free;
while FItems.Count > 0 do
FItems[FItems.Count - 1].Free;
FItems.Free;
inherited Destroy;
end;
function TPxXmlItem.GetItemByName(ItemName: String): TPxXmlItem;
var
I: Integer;
begin
Result := nil;
for I := 0 to FItems.Count - 1 do
begin
Result := FItems[I];
if AnsiCompareText(Result.Name, ItemName) = 0 then Break
else Result := nil;
end;
if not Assigned(Result) then
begin
Result := TPxXmlItem.Create(Self);
Result.FName := ItemName;
end;
end;
function TPxXmlItem.HasItem(ItemName: String): Boolean;
var
I: Integer;
XmlItem: TPxXmlItem;
begin
Result := False;
for I := 0 to FItems.Count - 1 do
begin
XmlItem := FItems[I];
if AnsiCompareText(XmlItem.Name, ItemName) = 0 then
begin
Result := True;
Break;
end;
end;
end;
function TPxXmlItem.GetParamByName(ParamName: String): TPxXmlParam;
var
I: Integer;
begin
Result := nil;
for I := 0 to FParams.Count - 1 do
begin
Result := FParams[I];
if AnsiCompareText(Result.Name, ParamName) = 0 then Break
else Result := nil;
end;
if not Assigned(Result) then
begin
Result := TPxXmlParam.Create(Self);
Result.FName := ParamName;
end;
end;
function TPxXmlItem.GetParamByNameS(ParamName: String): String;
begin
Result := GetParamByName(ParamName).AsString;
end;
function TPxXmlItem.HasParam(ParamName: String): Boolean;
var
I: Integer;
XmlParam: TPxXmlParam;
begin
Result := False;
for I := 0 to FParams.Count - 1 do
begin
XmlParam := FParams[I];
if AnsiCompareText(XmlParam.Name, ParamName) = 0 then
begin
Result := True;
Break;
end;
end;
end;
function TPxXmlItem.IsItemName(ItemName: String): Boolean;
begin
Result := AnsiCompareText(FName, ItemName) = 0;
end;
{ TPxXmlItemList }
function TPxXmlItemList.GetItem(Index: Integer): TPxXmlItem;
begin
Result := TObject(inherited Items[Index]) as TPxXmlItem;
end;
procedure TPxXmlItemList.SetItem(Index: Integer; Value: TPxXmlItem);
begin
inherited Items[Index] := Value;
end;
{ TPxXmlValue }
{ Private declarations }
function TPxXmlValue.GetBoolean: Boolean;
begin
Result := (AnsiCompareText(FValue, 'True') = 0) or (AnsiCompareText(FValue, 'Yes') = 0) or (AnsiCompareText(FValue, '1') = 0);
end;
procedure TPxXmlValue.SetBoolean(Value: Boolean);
begin
if Value then FValue := '1'
else FValue := '0';
end;
function TPxXmlValue.GetFloat: Extended;
begin
try
Result := StrToFloat(FValue);
except
Result := 0;
end;
end;
procedure TPxXmlValue.SetFloat(Value: Extended);
begin
FValue := FloatToStr(Value);
end;
function TPxXmlValue.GetInteger: Int64;
begin
try
Result := StrToInt64(FValue);
except
Result := 0;
end;
end;
procedure TPxXmlValue.SetInteger(Value: Int64);
begin
FValue := IntToStr(Value);
end;
function TPxXmlValue.GetString: String;
var
I: Integer;
begin
Result := '';
I := 1;
while I <= Length(FValue) do
begin
if FValue[I] = '\' then
begin
Inc(I);
if I <= Length(FValue) then
case FValue[I] of
'''', '\':
begin
Result := Result + FValue[I];
Inc(I);
end;
'|':
begin
Result := Result + #13#10;
Inc(I);
end;
else raise Exception.Create('Unknown control character ' + FValue[I] + ' !');
end;
end
else
begin
Result := Result + FValue[I];
Inc(I);
end;
end;
end;
procedure TPxXmlValue.SetString(Value: String);
var
I: Integer;
begin
I := 1;
while I <= Length(Value) do
begin
case Value[I] of
'''', '\':
begin
Insert('\', Value, I);
Inc(I, 2);
end;
#13:
begin
if (I = Length(Value)) and (Value[I + 1] <> #10) then Delete(Value, I, 1)
else Delete(Value, I, 2);
Insert('\|', Value, I);
Inc(I, 2);
end;
else Inc(I);
end;
end;
FValue := Value;
end;
{ Public declarations }
constructor TPxXmlValue.Create(AParent: TPxXmlProperty);
begin
inherited Create;
FParent := AParent;
if Assigned(Parent) then
Parent.Values.Add(Self);
end;
destructor TPxXmlValue.Destroy;
begin
if Assigned(Parent) then
Parent.Values.Remove(Self);
inherited Destroy;
end;
function TPxXmlValue.IsValueName(ValueName: String): Boolean;
begin
Result := AnsiCompareText(Name, ValueName) = 0;
end;
{ TPxXmlValueList }
{ Private declarations }
function TPxXmlValueList.GetItem(Index: Integer): TPxXmlValue;
begin
Result := TObject(inherited Items[Index]) as TPxXmlValue;
end;
{ TPxXmlProperty }
constructor TPxXmlProperty.Create;
begin
inherited Create;
FValues := TPxXmlValueList.Create;
end;
destructor TPxXmlProperty.Destroy;
begin
while Values.Count > 0 do
Values[0].Free;
Values.Free;
inherited Destroy;
end;
function TPxXmlProperty.GetValueByName(ParamName: String): TPxXmlValue;
var
I: Integer;
begin
Result := nil;
for I := 0 to FValues.Count - 1 do
begin
Result := FValues[I];
if AnsiCompareText(Result.Name, ParamName) = 0 then Break
else Result := nil;
end;
if not Assigned(Result) then
begin
Result := TPxXmlValue.Create(Self);
Result.FName := ParamName;
end;
end;
function TPxXmlProperty.GetValueByNameS(ParamName: String): String;
begin
Result := GetValueByName(ParamName).AsString;
end;
function TPxXmlProperty.HasValue(ParamName: String): Boolean;
var
I: Integer;
XmlValue: TPxXmlValue;
begin
Result := False;
for I := 0 to FValues.Count - 1 do
begin
XmlValue := FValues[I];
if AnsiCompareText(XmlValue.Name, ParamName) = 0 then
begin
Result := True;
Break;
end;
end;
end;
function TPxXmlProperty.IsPropertyName(ItemName: String): Boolean;
begin
Result := AnsiCompareText(FName, Name) = 0;
end;
{ TPxXmlPropertyList }
{ Private declarations }
function TPxXmlPropertyList.GetByName(Name: String): TPxXmlProperty;
var
I: Integer;
begin
Result := nil;
for I := 0 to Count - 1 do
if AnsiCompareText(Items[I].Name, Name) = 0 then
begin
Result := Items[I];
Break;
end;
if not Assigned(Result) then
begin
Result := TPxXmlProperty.Create;
Result.Name := Name;
Add(Result);
end;
end;
function TPxXmlPropertyList.GetItem(Index: Integer): TPxXmlProperty;
begin
Result := TObject(inherited Items[Index]) as TPxXmlProperty;
end;
{ Public declarations }
function TPxXmlPropertyList.PropertyExists(Name: String): Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 to Count - 1 do
if AnsiCompareText(Items[I].Name, Name) = 0 then
begin
Result := True;
Break;
end;
end;
{ TPxXmlFile }
{ Private declaratinos }
procedure TPxXmlFile.Parse(Stream: TStream);
var
Parser: TParser;
XmlItem: TPxXmlItem;
XmlParam: TPxXmlParam;
XmlProp: TPxXmlProperty;
XmlValue: TPxXmlValue;
ParamList: Boolean;
Comment: String;
begin
if Assigned(FXmlRoot) then
FreeAndNil(FXmlRoot);
XmlItem := nil; ParamList := False;
Parser := TParser.Create(Stream, '"');
repeat
if Parser.TokenString = '<' then
begin
Parser.NextToken;
if Parser.TokenString = '/' then
begin
// end of item
Parser.NextToken;
if (Parser.Token = toSymbol) and (AnsiCompareText(Parser.TokenString, XmlItem.Name) = 0) then XmlItem := XmlItem.Parent
else Parser.ErrorStr('Fotter for ' + XmlItem.Name + ' is invalid');
end
else if Parser.TokenString = '!' then
begin
Parser.NextToken;
if Parser.TokenString = '--' then
begin
Comment := '';
while Copy(Comment, Length(Comment) - 2, 3) <> '-->' do
begin
if Parser.NextToken = toEOF then raise EParserError.Create('Comment not closed !');
Comment := Comment + Parser.TokenString;
end;
end
else Parser.ErrorStr('Invalid comment');
end
else if Parser.TokenString = '?' then
begin
if Assigned(FXmlRoot) then Parser.ErrorStr('Invalid Xml parameter definition');
XmlProp := TPxXmlProperty.Create;
XmlProperties.Add(XmlProp);
Parser.NextToken;
repeat
XmlProp.Name := Parser.TokenString;
Parser.NextToken;
if Parser.Token <> '-' then Break;
until False;
repeat
if Parser.Token = toSymbol then
begin
XmlValue := TPxXmlValue.Create(XmlProp);
XmlValue.Name := Parser.TokenString;
if Parser.NextToken <> '=' then Parser.ErrorStr('Invalid Xml parameter definition');
if Parser.NextToken <> toString then Parser.ErrorStr('No param value specified');
XmlValue.Value := Parser.TokenString;
end;
Parser.NextToken;
until Parser.Token = '?';
Parser.NextToken;
end
else
begin
// new subitem
if Parser.Token <> toSymbol then Parser.ErrorStr('Invalid item identifier');
if XmlItem = nil then
begin
XmlItem := TPxXmlItem.Create(XmlItem);
FXmlRoot := XmlItem;
end
else XmlItem := TPxXmlItem.Create(XmlItem);
XmlItem.Name := Parser.TokenString;
ParamList := True;
end
end
else if Parser.TokenString = '/' then
begin
// end of item
Parser.NextToken;
if Parser.TokenString = '>' then
begin
XmlItem := XmlItem.Parent;
ParamList := False;
end
else Parser.ErrorStr('Invalid end of item');
end
else if Parser.TokenString = '>' then
ParamList := False
else if ParamList then
begin
// param
if Parser.Token <> toSymbol then Parser.ErrorStr('Invalid param name');
XmlParam := TPxXmlParam.Create(XmlItem);
XmlParam.Name := Parser.TokenString;
if Parser.NextToken <> '=' then
Parser.ErrorStr('Invalid Xml parameter definition');
if Parser.NextToken <> toString then Parser.ErrorStr('No param value specified');
XmlParam.Value := Parser.TokenString;
end
else Parser.ErrorStr('Parse error');
until Parser.NextToken = toEOF;
Parser.Free;
ResolveIncludes;
end;
procedure TPxXmlFile.DisconnectRoot;
begin
FXmlRoot := nil;
end;
procedure TPxXmlFile.ResolveIncludes;
procedure Resolve(XmlItem: TPxXmlItem);
var
I: Integer;
X: TPxXmlFile;
Item: TPxXmlItem;
FileName: String;
begin
I := 0;
while I < XmlItem.Items.Count do
begin
Item := XmlItem.Items[I];
if Item.IsItemName('Include') then
begin
FileName := Item.GetParamByNameS('FileName');
if FileName = '' then // no filename has been given
raise Exception.Create('Included file has no file name !');
if not FileExists(FileName) then // given filename does not point to an existing file
raise Exception.CreateFmt('Included file "%s" not found', [Item.GetParamByNameS('FileName')]);
// create the included file
X := TPxXmlFile.Create(True);
// read the included file
X.ReadFile(Item.GetParamByNameS('FileName'));
// free the "Include" item
XmlItem.Items[I].FParent := nil; // a trick,...
XmlItem.Items[I].Free;
XmlItem.Items[I] := X.XmlItem;
XmlItem.Items[I].FParent := XmlItem; // a trick,...
// disconnect the root from file object
X.DisconnectRoot;
// free the included file
X.Free;
end
else
begin
Resolve(XmlItem.Items[I]);
Inc(I);
end;
end;
end;
begin
if not FResolveIncludes then Exit;
Resolve(XmlItem);
end;
{ Public declarations }
constructor TPxXmlFile.Create(ResolveIncludes: Boolean = True; CreateRoot: Boolean = False);
begin
inherited Create;
FXmlProperties := TPxXmlPropertyList.Create;
if CreateRoot then
begin
FXmlRoot := TPxXmlItem.Create(nil);
FStatus := psLoaded;
FStatusMessage := 'Loaded';
end
else
begin
FXmlRoot := nil;
FStatus := psNotLoaded;
FStatusMessage := 'Not loaded';
end;
FResolveIncludes := ResolveIncludes;
end;
destructor TPxXmlFile.Destroy;
var
I: Integer;
begin
for I := 0 to FXmlProperties.Count - 1 do
FXmlProperties[I].Free;
FXmlProperties.Free;
if Assigned(FXmlRoot) then
FXmlRoot.Free;
inherited Destroy;
end;
function TPxXmlFile.GetNextInternalFileName(Base, Ext: string): string;
var
I: Integer;
Value: ^Integer;
begin
if (Ext = '') then
Ext := '.dat';
if Ext[1] <> '.' then
Ext := '.' + Ext;
Value := nil;
for I := 0 to Length(FInternalFileNameCounter) - 1 do
if AnsiCompareText(Ext, FInternalFileNameCounter[I].Extension) = 0 then
begin
Value := @FInternalFileNameCounter[I].Value;
Break;
end;
if not Assigned(Value) then
begin
SetLength(FInternalFileNameCounter, Length(FInternalFileNameCounter) + 1);
with FInternalFileNameCounter[Length(FInternalFileNameCounter) - 1] do
begin
Value := 0;
Extension := Ext;
end;
Value := @FInternalFileNameCounter[Length(FInternalFileNameCounter) - 1].Value;
end;
Inc(Value^);
Result :=
// file path
ExtractFilePath(Base) +
// file core with incremented counter
Copy(ExtractFileName(Base), 1, Length(ExtractFileName(Base)) - Length(ExtractFileExt(Base))) + IntToStr(Value^) +
// extension
Ext;
end;
procedure TPxXmlFile.ReadFile(FileName: String);
var
S: TStream;
begin
S := TFileStream.Create(FileName, fmOpenRead);
ReadStream(S);
S.Free;
end;
procedure TPxXmlFile.ReadStrings(Strings: TStrings);
var
S: TStream;
begin
S := TMemoryStream.Create;
Strings.SaveToStream(S);
S.Position := 0;
ReadStream(S);
S.Free;
end;
procedure TPxXmlFile.ReadStream(Stream: TStream);
begin
try
Parse(Stream);
FStatus := psLoaded;
FStatusMessage := 'OK';
except
on E: Exception do
begin
if Assigned(FXmlRoot) then FreeAndNil(FXmlRoot);
FStatus := psError;
FStatusMessage := E.Message;
end;
end;
end;
procedure TPxXmlFile.GenerateTree(XmlItem: TPxXmlItem; Strings: TStrings; Ident: String);
var
I: Integer;
XmlParam: TPxXmlParam;
S: String;
begin
S := '';
for I := 0 to XmlItem.Params.Count - 1 do
begin
XmlParam := XmlItem.Params[I];
S := S + ' ' + XmlParam.Name + '="' + XmlParam.Value + '"';
end;
if XmlItem.Items.Count = 0 then
begin
Strings.Add(Ident + '<' + XmlItem.Name + S + '/>');
if Ident = ' ' then
Strings.Add('');
end
else
begin
Strings.Add(Ident + '<' + XmlItem.Name + S + '>');
for I := 0 to XmlItem.Items.Count - 1 do
GenerateTree(XmlItem.Items[I], Strings, Ident + ' ');
Strings.Add(Ident + '</' + XmlItem.Name + '>');
if Ident = ' ' then
Strings.Add('');
end;
end;
procedure TPxXmlFile.WriteFile(FileName: String);
var
Strings: TStrings;
begin
Strings := TStringList.Create;
WriteStrings(Strings);
Strings.SaveToFile(FileName);
Strings.Free;
end;
procedure TPxXmlFile.WriteStrings(Strings: TStrings);
begin
Strings.BeginUpdate;
Strings.Clear;
GenerateTree(FXmlRoot, Strings, '');
Strings.EndUpdate;
end;
procedure TPxXmlFile.WriteStream(Stream: TStream);
var
Strings: TStrings;
begin
Strings := TStringList.Create;
WriteStrings(Strings);
Strings.SaveToStream(Stream);
Strings.Free;
end;
end.
| 26.392378 | 129 | 0.619124 |
47d216d3ac18ab151994aa8356aecd8446777431 | 263 | pas | Pascal | Test/SimpleScripts/for_in_func_array.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| 1 | 2022-02-18T22:14:44.000Z | 2022-02-18T22:14:44.000Z | Test/SimpleScripts/for_in_func_array.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | Test/SimpleScripts/for_in_func_array.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | Type TProc = Procedure;
procedure Hello;
begin
PrintLn('Hello');
end;
procedure World;
begin
PrintLn('World');
end;
Var arr : Array Of TProc;
arr.Add(Hello);
arr.Add(World);
arr.Add(World);
arr.Add(Hello);
Var proc : TProc;
For proc In arr Do
proc; | 11.434783 | 25 | 0.676806 |
479aeb190e958b44cc88b93c8c09732dfe9efa54 | 2,539 | dfm | Pascal | vseditor/ValueSetEditorExceptionForm.dfm | novakjf2000/FHIRServer | a47873825e94cd6cdfa1a077f02e0960098bbefa | [
"BSD-3-Clause"
]
| 1 | 2018-01-08T06:40:02.000Z | 2018-01-08T06:40:02.000Z | vseditor/ValueSetEditorExceptionForm.dfm | novakjf2000/FHIRServer | a47873825e94cd6cdfa1a077f02e0960098bbefa | [
"BSD-3-Clause"
]
| null | null | null | vseditor/ValueSetEditorExceptionForm.dfm | novakjf2000/FHIRServer | a47873825e94cd6cdfa1a077f02e0960098bbefa | [
"BSD-3-Clause"
]
| null | null | null | object ExceptionDialog: TExceptionDialog
Left = 310
Top = 255
BorderIcons = [biSystemMenu]
Caption = 'ValueSetEditor Exception Trap'
ClientHeight = 344
ClientWidth = 473
Color = clBtnFace
Constraints.MinWidth = 200
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
ShowHint = True
OnCreate = FormCreate
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
OnPaint = FormPaint
OnResize = FormResize
OnShow = FormShow
DesignSize = (
473
344)
PixelsPerInch = 96
TextHeight = 13
object BevelDetails: TBevel
Left = 5
Top = 154
Width = 463
Height = 9
Anchors = [akLeft, akTop, akRight]
Shape = bsTopLine
end
object Label1: TLabel
Left = 5
Top = 130
Width = 104
Height = 13
Caption = 'What you were doing:'
end
object SendBtn: TButton
Left = 393
Top = 125
Width = 75
Height = 25
Hint = 'Send bug report using default mail client'
Anchors = [akTop, akRight]
Caption = '&Send'
TabOrder = 0
OnClick = SendBtnClick
end
object TextMemo: TMemo
Left = 4
Top = 8
Width = 374
Height = 105
Hint = 'Use Ctrl+C to copy the report to the clipboard'
Anchors = [akLeft, akTop, akRight]
BorderStyle = bsNone
Ctl3D = True
ParentColor = True
ParentCtl3D = False
ReadOnly = True
TabOrder = 1
WantReturns = False
end
object OkBtn: TButton
Left = 393
Top = 4
Width = 75
Height = 25
Anchors = [akTop, akRight]
Caption = '&OK (Not)'
Default = True
ModalResult = 1
TabOrder = 2
end
object DetailsBtn: TButton
Left = 393
Top = 91
Width = 75
Height = 25
Hint = 'Show or hide additional information|'
Anchors = [akTop, akRight]
Caption = '&Details'
Enabled = False
TabOrder = 3
OnClick = DetailsBtnClick
end
object DetailsMemo: TMemo
Left = 4
Top = 166
Width = 464
Height = 171
Anchors = [akLeft, akTop, akRight, akBottom]
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentColor = True
ParentFont = False
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 4
WantReturns = False
WordWrap = False
end
object Edit1: TEdit
Left = 116
Top = 127
Width = 262
Height = 21
TabOrder = 5
end
end
| 20.983471 | 59 | 0.628594 |
47c5b15a37450d1e96a468501721cc318de890db | 1,616 | pas | Pascal | Modelo/Persistencia/UDM.pas | helnatanbp/general-control | 25e50cf7eac217f02ac9986161ac90dd2673c473 | [
"MIT"
]
| null | null | null | Modelo/Persistencia/UDM.pas | helnatanbp/general-control | 25e50cf7eac217f02ac9986161ac90dd2673c473 | [
"MIT"
]
| null | null | null | Modelo/Persistencia/UDM.pas | helnatanbp/general-control | 25e50cf7eac217f02ac9986161ac90dd2673c473 | [
"MIT"
]
| null | null | null | unit UDM;
interface
uses
SysUtils, Classes, DB, SqlExpr, FMTBcd
, UMensagens, DBXFirebird, DBXInterBase
, DBXCommon
;
type
TdmEntra21 = class(TDataModule)
SQLConnection: TSQLConnection;
SQLSelect: TSQLDataSet;
procedure DataModuleCreate(Sender: TObject);
private
FTransaction: TDBXTransaction;
public
procedure AbortaTransacao;
procedure FinalizaTransacao;
procedure IniciaTransacao;
procedure ValidaTransacaoAtiva;
function TemTransacaoAtiva: Boolean;
end;
var
dmEntra21: TdmEntra21;
const
CNT_DATA_BASE = 'Database';
implementation
{$R *.dfm}
uses
Math
;
procedure TdmEntra21.AbortaTransacao;
begin
if not TemTransacaoAtiva then
raise Exception.CreateFmt(STR_NAO_EXISTE_TRANSACAO_ATIVA, [STR_ABORTAR]);
SQLConnection.RollbackFreeAndNil(FTransaction);
end;
procedure TdmEntra21.FinalizaTransacao;
begin
if not TemTransacaoAtiva then
raise Exception.CreateFmt(STR_NAO_EXISTE_TRANSACAO_ATIVA, [STR_FINALIZAR]);
SQLConnection.CommitFreeAndNil(FTransaction);
end;
procedure TdmEntra21.IniciaTransacao;
begin
if TemTransacaoAtiva then
raise Exception.Create(STR_JA_EXISTE_TRANSACAO_ATIVA);
FTransaction := SQLConnection.BeginTransaction;
end;
function TdmEntra21.TemTransacaoAtiva: Boolean;
begin
Result := SQLConnection.InTransaction;
end;
procedure TdmEntra21.DataModuleCreate(Sender: TObject);
begin
SQLConnection.Connected := True;
SQLConnection.Open;
end;
procedure TdmEntra21.ValidaTransacaoAtiva;
begin
if not TemTransacaoAtiva then
raise Exception.Create(STR_VALIDA_TRANSACAO_ATIVA);
end;
end.
| 19.238095 | 79 | 0.785272 |
f1ab32679d0c1dbe86203bf6e22f29a4e389e46c | 4,339 | pas | Pascal | components/dunit/Contrib/DUnitWizard/Source/Common/dunit/XPTempReleaseTests.pas | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 15 | 2016-08-24T07:32:49.000Z | 2021-11-16T11:25:00.000Z | components/dunit/Contrib/DUnitWizard/Source/Common/dunit/XPTempReleaseTests.pas | CWBudde/delcos | 656384c43c2980990ea691e4e52752d718fb0277 | [
"Apache-2.0"
]
| 1 | 2016-08-24T19:00:34.000Z | 2016-08-25T19:02:14.000Z | components/dunit/Contrib/DUnitWizard/Source/Common/dunit/XPTempReleaseTests.pas | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 4 | 2015-11-06T12:15:36.000Z | 2018-10-08T15:17:17.000Z | unit XPTempReleaseTests;
interface
uses
TestFrameWork;
type
ICrackedInterface = interface
['{6E3BE71F-B368-4DFD-A6BA-0659813365DD}']
function RefCount: integer;
end;
TXPTempReleaseTests = class(TTestCase)
private
FSource: ICrackedInterface;
protected
procedure SetUp; override;
procedure TearDown; override;
published
procedure TestNoTemps;
procedure TestFactoryClassTemp;
procedure TestFactoryFuncTemp;
procedure TestLeftRightTemps;
end;
implementation
{$IFDEF VER130}
uses
XPInterfacedObject;
{$ENDIF}
type
TCracked = class (TInterfacedObject, ICrackedInterface, IInterface)
protected
function RefCount: integer;
function _Release: integer; stdcall;
public
destructor Destroy; override;
end;
TFactory = class(TInterfacedObject, ICrackedInterface)
private
FCracked: ICrackedInterface;
protected
property Cracked: ICrackedInterface
read FCracked implements ICrackedInterface;
public
constructor Create(const ACracked: ICrackedInterface);
destructor Destroy; override;
end;
function CreateCracked(const ACracked: ICrackedInterface): ICrackedInterface;
begin
Result := TFactory.Create(ACracked);
end;
{ TXPTempReleaseTests }
procedure TXPTempReleaseTests.SetUp;
begin
inherited;
FSource := TCracked.Create;
end;
procedure TXPTempReleaseTests.TearDown;
begin
FSource := nil;
inherited;
end;
procedure TXPTempReleaseTests.TestNoTemps;
var
Cracked: ICrackedInterface;
Factory: IInterface;
begin
CheckEquals(1, FSource.RefCount, 'fsource rc after construction');
Factory := TFactory.Create(FSource);
CheckEquals(2, FSource.RefCount, 'fsource rc after factory construction');
Cracked := Factory as ICrackedInterface;
CheckEquals(3, FSource.RefCount, 'fsource rc after cracked assigned');
Cracked := nil;
CheckEquals(2, FSource.RefCount, 'fsource rc after cracked released');
Factory := nil;
CheckEquals(1, FSource.RefCount, 'fsource rc after factory released');
end;
procedure TXPTempReleaseTests.TestFactoryClassTemp;
var
Cracked: ICrackedInterface;
begin
CheckEquals(1, FSource.RefCount, 'fsource rc after construction');
Cracked := TFactory.Create(FSource);
CheckEquals(3, FSource.RefCount, 'fsource rc after cracked assigned');
Cracked := nil;
// instance of TFactory has not been destroyed
CheckEquals(2, FSource.RefCount, 'fsource rc after cracked released');
end;
procedure TXPTempReleaseTests.TestFactoryFuncTemp;
var
Cracked: ICrackedInterface;
begin
CheckEquals(1, FSource.RefCount, 'fsource rc after construction');
Cracked := CreateCracked(FSource);
CheckEquals(3, FSource.RefCount, 'fsource rc after cracked assigned');
Cracked := nil;
// instance of TFactory has not been destroyed but temp inc in rc due to
// assignment to result has been recovered
CheckEquals(2, FSource.RefCount, 'fsource rc after cracked released');
end;
procedure TXPTempReleaseTests.TestLeftRightTemps;
var
Factory: IInterface;
begin
CheckEquals(1, FSource.RefCount, 'fsource rc after construction');
Factory := TFactory.Create(FSource);
CheckEquals(2, FSource.RefCount, 'fsource rc after factory construction');
Check(Factory as ICrackedInterface = Factory as ICrackedInterface,
'equality check failure');
CheckEquals(4, FSource.RefCount, 'fsource rc after cast equality check');
Check(Factory as ICrackedInterface <> nil, 'cast inequality to nil');
CheckEquals(5, FSource.RefCount, 'fsource rc after cast inequality to nil');
Factory := nil;
CheckEquals(4, FSource.RefCount, 'fsource rc after factory released');
end;
{ TCracked }
destructor TCracked.Destroy;
begin
inherited;
end;
function TCracked.RefCount: integer;
begin
Result := FRefCount;
end;
function TCracked._Release: integer;
begin
Result := inherited _Release;
end;
{ TFactory }
constructor TFactory.Create(const ACracked: ICrackedInterface);
begin
inherited Create;
FCracked := ACracked;
end;
destructor TFactory.Destroy;
begin
inherited;
end;
initialization
TestFramework.RegisterTest('TXPTempReleaseTests Suite',
TXPTempReleaseTests.Suite);
end.
| 23.203209 | 79 | 0.727587 |
4791e1620c5f857a5eadfed33dc78557d90f1c40 | 972 | pas | Pascal | ThemidaSDK/ExamplesSDK/Custom Message DLL/Delphi/Unit1.pas | qzhsjz/LXDInjector | 44c34e9677b4e3543e58584fad3844eb7bb33ff8 | [
"MIT"
]
| 1 | 2021-05-22T11:10:43.000Z | 2021-05-22T11:10:43.000Z | ThemidaSDK/ExamplesSDK/Custom Message DLL/Delphi/Unit1.pas | luoxiandu/LXDInjector | 44c34e9677b4e3543e58584fad3844eb7bb33ff8 | [
"MIT"
]
| null | null | null | ThemidaSDK/ExamplesSDK/Custom Message DLL/Delphi/Unit1.pas | luoxiandu/LXDInjector | 44c34e9677b4e3543e58584fad3844eb7bb33ff8 | [
"MIT"
]
| null | null | null | unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
labelStatus: TLabel;
lbMessage: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function CustMsg_ShowMessage(MsgId: Integer; pMsg:PChar):Boolean; stdcall;
exports
CustMsg_ShowMessage;
implementation
{$R *.dfm}
function CustMsg_ShowMessage(MsgId: Integer; pMsg:PChar):Boolean;
begin
Form1 := TForm1.Create(application);
Form1.LabelStatus.Caption := 'Calling Message: ' + IntToStr(MsgId);
if pMsg <> nil then
Form1.lbMessage.Caption := 'Original Message: ' + pMsg;
Form1.labelStatus.Width := Form1.Width;
Form1.ShowModal;
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;
end.
| 16.2 | 76 | 0.701646 |
85315c885d6a852cbed4080bd99ccae6f5cc3151 | 521 | dpr | Pascal | ImperativeDemo.dpr | NickHodges/FunctionalDelphi | 508a954c144259db6d9c7fbc81c2219f74c6d554 | [
"MIT"
]
| 6 | 2020-11-17T18:46:08.000Z | 2021-08-03T05:25:05.000Z | ImperativeDemo.dpr | NickHodges/FunctionalDelphi | 508a954c144259db6d9c7fbc81c2219f74c6d554 | [
"MIT"
]
| null | null | null | ImperativeDemo.dpr | NickHodges/FunctionalDelphi | 508a954c144259db6d9c7fbc81c2219f74c6d554 | [
"MIT"
]
| 1 | 2021-08-03T05:25:06.000Z | 2021-08-03T05:25:06.000Z | program ImperativeDemo;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
uImperativeNumberClassifier in 'uImperativeNumberClassifier.pas';
var
i: integer;
begin
try
for i := 1 to 30 do
begin
case ImperativeNumberClassification(i) of
Perfect: WriteLn(i, ' is Perfect');
Abundant: WriteLn(i, ' is Abundant');
Deficient: WriteLn(i, ' is Deficient');
end;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
ReadLn;
end.
| 16.806452 | 67 | 0.631478 |
47c8a863451634e9f2a29ee9f3295b4578bf4b30 | 682 | pas | Pascal | Test/DelegateLib/eventL0.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/DelegateLib/eventL0.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/DelegateLib/eventL0.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | type
TTest = class
procedure Test1(Sender : TObject);
begin
Print(ClassName);
PrintLn(Sender<>nil);
end;
procedure Test2(Sender : TObject);
begin
Print(ClassName);
PrintLn(Sender.ClassName);
end;
procedure Test31(Sender : TObject);
begin
Test1(Sender);
end;
procedure Test32(Sender : TObject);
begin
Test2(Sender);
end;
end;
type
TSubTest = class(TTest) end;
var t := TTest.Create;
var s := TSubTest.Create;
CallEvent(t.Test1, t);
CallEvent(t.Test2, t);
CallEvent(t.Test31, t);
CallEvent(t.Test32, t);
CallEvent(t.Test1, s);
CallEvent(t.Test2, s);
CallEvent(t.Test31, s);
CallEvent(t.Test32, s);
| 17.947368 | 38 | 0.640762 |
f1d3266eb330db2752b97c00d590a8bf797e3e9e | 2,315 | pas | Pascal | Source/Services/SimpleNotificationService/Base/Transform/AWS.SNS.Transform.TagLimitExceededExceptionUnmarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/SimpleNotificationService/Base/Transform/AWS.SNS.Transform.TagLimitExceededExceptionUnmarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/SimpleNotificationService/Base/Transform/AWS.SNS.Transform.TagLimitExceededExceptionUnmarshaller.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.SNS.Transform.TagLimitExceededExceptionUnmarshaller;
interface
uses
AWS.Transform.IErrorResponseUnmarshaller,
AWS.Transform.UnmarshallerContext,
AWS.SNS.Model.TagLimitExceededException,
AWS.Internal.ErrorResponse;
type
ITagLimitExceededExceptionUnmarshaller = IErrorResponseUnmarshaller<ETagLimitExceededException, TXmlUnmarshallerContext>;
TTagLimitExceededExceptionUnmarshaller = class(TInterfacedObject, IErrorResponseUnmarshaller<ETagLimitExceededException, TXmlUnmarshallerContext>)
strict private
class var FInstance: ITagLimitExceededExceptionUnmarshaller;
class constructor Create;
public
function Unmarshall(AContext: TXmlUnmarshallerContext): ETagLimitExceededException; overload;
function Unmarshall(AContext: TXmlUnmarshallerContext; AErrorResponse: TErrorResponse): ETagLimitExceededException; overload;
class function Instance: ITagLimitExceededExceptionUnmarshaller; static;
end;
implementation
{ TTagLimitExceededExceptionUnmarshaller }
function TTagLimitExceededExceptionUnmarshaller.Unmarshall(AContext: TXmlUnmarshallerContext): ETagLimitExceededException;
var
ErrorResponse: TErrorResponse;
begin
ErrorResponse := TErrorResponse.Create;
try
Result := Unmarshall(AContext, ErrorResponse);
finally
ErrorResponse.Free;
end;
end;
function TTagLimitExceededExceptionUnmarshaller.Unmarshall(AContext: TXmlUnmarshallerContext; AErrorResponse: TErrorResponse): ETagLimitExceededException;
var
OriginalDepth: Integer;
Response: ETagLimitExceededException;
begin
Response := ETagLimitExceededException.Create(AErrorResponse.Message, AErrorResponse.InnerException, AErrorResponse.ErrorType, AErrorResponse.Code, AErrorResponse.RequestId, AErrorResponse.StatusCode);
try
OriginalDepth := AContext.CurrentDepth;
while AContext.ReadAtDepth(OriginalDepth) do
if AContext.IsStartElement or AContext.IsAttribute then
begin
end;
Result := Response;
Response := nil;
finally
Response.Free;
end;
end;
class constructor TTagLimitExceededExceptionUnmarshaller.Create;
begin
FInstance := TTagLimitExceededExceptionUnmarshaller.Create;
end;
class function TTagLimitExceededExceptionUnmarshaller.Instance: ITagLimitExceededExceptionUnmarshaller;
begin
Result := FInstance;
end;
end.
| 33.071429 | 203 | 0.828078 |
478903d41f7826474fc13f0fae503c9b2daa0988 | 7,858 | pas | Pascal | HashLib/src/Crypto/HlpMD5.pas | bogomolov-a-a/HashLib4Pascal | 1e48625c6969f282bf082789d55c49679c707eb3 | [
"MIT"
]
| 159 | 2016-07-10T13:00:27.000Z | 2022-03-18T04:18:51.000Z | HashLib/src/Crypto/HlpMD5.pas | bogomolov-a-a/HashLib4Pascal | 1e48625c6969f282bf082789d55c49679c707eb3 | [
"MIT"
]
| 24 | 2020-01-04T11:50:53.000Z | 2022-02-17T09:55:23.000Z | HashLib/src/Crypto/HlpMD5.pas | bogomolov-a-a/HashLib4Pascal | 1e48625c6969f282bf082789d55c49679c707eb3 | [
"MIT"
]
| 61 | 2016-07-11T02:50:51.000Z | 2022-02-24T15:04:53.000Z | unit HlpMD5;
{$I ..\Include\HashLib.inc}
interface
uses
{$IFDEF DELPHI2010}
SysUtils, // to get rid of compiler hint "not inlined" on Delphi 2010.
{$ENDIF DELPHI2010}
HlpBits,
HlpMDBase,
{$IFDEF DELPHI}
HlpHashBuffer,
HlpHash,
{$ENDIF DELPHI}
HlpIHash,
HlpConverters,
HlpIHashInfo;
type
TMD5 = class sealed(TMDBase, ITransformBlock)
strict protected
procedure TransformBlock(AData: PByte; ADataLength: Int32;
AIndex: Int32); override;
public
constructor Create();
function Clone(): IHash; override;
end;
implementation
{ TMD5 }
function TMD5.Clone(): IHash;
var
LHashInstance: TMD5;
begin
LHashInstance := TMD5.Create();
LHashInstance.FState := System.Copy(FState);
LHashInstance.FBuffer := FBuffer.Clone();
LHashInstance.FProcessedBytesCount := FProcessedBytesCount;
result := LHashInstance as IHash;
result.BufferSize := BufferSize;
end;
constructor TMD5.Create;
begin
Inherited Create(4, 16);
end;
procedure TMD5.TransformBlock(AData: PByte; ADataLength: Int32; AIndex: Int32);
var
A, B, C, D: UInt32;
LData: array [0 .. 15] of UInt32;
begin
TConverters.le32_copy(AData, AIndex, @(LData[0]), 0, ADataLength);
A := FState[0];
B := FState[1];
C := FState[2];
D := FState[3];
A := LData[0] + $D76AA478 + A + ((B and C) or (not B and D));
A := TBits.RotateLeft32(A, 7) + B;
D := LData[1] + $E8C7B756 + D + ((A and B) or (not A and C));
D := TBits.RotateLeft32(D, 12) + A;
C := LData[2] + $242070DB + C + ((D and A) or (not D and B));
C := TBits.RotateLeft32(C, 17) + D;
B := LData[3] + $C1BDCEEE + B + ((C and D) or (not C and A));
B := TBits.RotateLeft32(B, 22) + C;
A := LData[4] + $F57C0FAF + A + ((B and C) or (not B and D));
A := TBits.RotateLeft32(A, 7) + B;
D := LData[5] + $4787C62A + D + ((A and B) or (not A and C));
D := TBits.RotateLeft32(D, 12) + A;
C := LData[6] + $A8304613 + C + ((D and A) or (not D and B));
C := TBits.RotateLeft32(C, 17) + D;
B := LData[7] + $FD469501 + B + ((C and D) or (not C and A));
B := TBits.RotateLeft32(B, 22) + C;
A := LData[8] + $698098D8 + A + ((B and C) or (not B and D));
A := TBits.RotateLeft32(A, 7) + B;
D := LData[9] + $8B44F7AF + D + ((A and B) or (not A and C));
D := TBits.RotateLeft32(D, 12) + A;
C := LData[10] + $FFFF5BB1 + C + ((D and A) or (not D and B));
C := TBits.RotateLeft32(C, 17) + D;
B := LData[11] + $895CD7BE + B + ((C and D) or (not C and A));
B := TBits.RotateLeft32(B, 22) + C;
A := LData[12] + $6B901122 + A + ((B and C) or (not B and D));
A := TBits.RotateLeft32(A, 7) + B;
D := LData[13] + $FD987193 + D + ((A and B) or (not A and C));
D := TBits.RotateLeft32(D, 12) + A;
C := LData[14] + $A679438E + C + ((D and A) or (not D and B));
C := TBits.RotateLeft32(C, 17) + D;
B := LData[15] + $49B40821 + B + ((C and D) or (not C and A));
B := TBits.RotateLeft32(B, 22) + C;
A := LData[1] + $F61E2562 + A + ((B and D) or (C and not D));
A := TBits.RotateLeft32(A, 5) + B;
D := LData[6] + $C040B340 + D + ((A and C) or (B and not C));
D := TBits.RotateLeft32(D, 9) + A;
C := LData[11] + $265E5A51 + C + ((D and B) or (A and not B));
C := TBits.RotateLeft32(C, 14) + D;
B := LData[0] + $E9B6C7AA + B + ((C and A) or (D and not A));
B := TBits.RotateLeft32(B, 20) + C;
A := LData[5] + $D62F105D + A + ((B and D) or (C and not D));
A := TBits.RotateLeft32(A, 5) + B;
D := LData[10] + $2441453 + D + ((A and C) or (B and not C));
D := TBits.RotateLeft32(D, 9) + A;
C := LData[15] + $D8A1E681 + C + ((D and B) or (A and not B));
C := TBits.RotateLeft32(C, 14) + D;
B := LData[4] + $E7D3FBC8 + B + ((C and A) or (D and not A));
B := TBits.RotateLeft32(B, 20) + C;
A := LData[9] + $21E1CDE6 + A + ((B and D) or (C and not D));
A := TBits.RotateLeft32(A, 5) + B;
D := LData[14] + $C33707D6 + D + ((A and C) or (B and not C));
D := TBits.RotateLeft32(D, 9) + A;
C := LData[3] + $F4D50D87 + C + ((D and B) or (A and not B));
C := TBits.RotateLeft32(C, 14) + D;
B := LData[8] + $455A14ED + B + ((C and A) or (D and not A));
B := TBits.RotateLeft32(B, 20) + C;
A := LData[13] + $A9E3E905 + A + ((B and D) or (C and not D));
A := TBits.RotateLeft32(A, 5) + B;
D := LData[2] + $FCEFA3F8 + D + ((A and C) or (B and not C));
D := TBits.RotateLeft32(D, 9) + A;
C := LData[7] + $676F02D9 + C + ((D and B) or (A and not B));
C := TBits.RotateLeft32(C, 14) + D;
B := LData[12] + $8D2A4C8A + B + ((C and A) or (D and not A));
B := TBits.RotateLeft32(B, 20) + C;
A := LData[5] + $FFFA3942 + A + (B xor C xor D);
A := TBits.RotateLeft32(A, 4) + B;
D := LData[8] + $8771F681 + D + (A xor B xor C);
D := TBits.RotateLeft32(D, 11) + A;
C := LData[11] + $6D9D6122 + C + (D xor A xor B);
C := TBits.RotateLeft32(C, 16) + D;
B := LData[14] + $FDE5380C + B + (C xor D xor A);
B := TBits.RotateLeft32(B, 23) + C;
A := LData[1] + $A4BEEA44 + A + (B xor C xor D);
A := TBits.RotateLeft32(A, 4) + B;
D := LData[4] + $4BDECFA9 + D + (A xor B xor C);
D := TBits.RotateLeft32(D, 11) + A;
C := LData[7] + $F6BB4B60 + C + (D xor A xor B);
C := TBits.RotateLeft32(C, 16) + D;
B := LData[10] + $BEBFBC70 + B + (C xor D xor A);
B := TBits.RotateLeft32(B, 23) + C;
A := LData[13] + $289B7EC6 + A + (B xor C xor D);
A := TBits.RotateLeft32(A, 4) + B;
D := LData[0] + $EAA127FA + D + (A xor B xor C);
D := TBits.RotateLeft32(D, 11) + A;
C := LData[3] + $D4EF3085 + C + (D xor A xor B);
C := TBits.RotateLeft32(C, 16) + D;
B := LData[6] + $4881D05 + B + (C xor D xor A);
B := TBits.RotateLeft32(B, 23) + C;
A := LData[9] + $D9D4D039 + A + (B xor C xor D);
A := TBits.RotateLeft32(A, 4) + B;
D := LData[12] + $E6DB99E5 + D + (A xor B xor C);
D := TBits.RotateLeft32(D, 11) + A;
C := LData[15] + $1FA27CF8 + C + (D xor A xor B);
C := TBits.RotateLeft32(C, 16) + D;
B := LData[2] + $C4AC5665 + B + (C xor D xor A);
B := TBits.RotateLeft32(B, 23) + C;
A := LData[0] + $F4292244 + A + (C xor (B or not D));
A := TBits.RotateLeft32(A, 6) + B;
D := LData[7] + $432AFF97 + D + (B xor (A or not C));
D := TBits.RotateLeft32(D, 10) + A;
C := LData[14] + $AB9423A7 + C + (A xor (D or not B));
C := TBits.RotateLeft32(C, 15) + D;
B := LData[5] + $FC93A039 + B + (D xor (C or not A));
B := TBits.RotateLeft32(B, 21) + C;
A := LData[12] + $655B59C3 + A + (C xor (B or not D));
A := TBits.RotateLeft32(A, 6) + B;
D := LData[3] + $8F0CCC92 + D + (B xor (A or not C));
D := TBits.RotateLeft32(D, 10) + A;
C := LData[10] + $FFEFF47D + C + (A xor (D or not B));
C := TBits.RotateLeft32(C, 15) + D;
B := LData[1] + $85845DD1 + B + (D xor (C or not A));
B := TBits.RotateLeft32(B, 21) + C;
A := LData[8] + $6FA87E4F + A + (C xor (B or not D));
A := TBits.RotateLeft32(A, 6) + B;
D := LData[15] + $FE2CE6E0 + D + (B xor (A or not C));
D := TBits.RotateLeft32(D, 10) + A;
C := LData[6] + $A3014314 + C + (A xor (D or not B));
C := TBits.RotateLeft32(C, 15) + D;
B := LData[13] + $4E0811A1 + B + (D xor (C or not A));
B := TBits.RotateLeft32(B, 21) + C;
A := LData[4] + $F7537E82 + A + (C xor (B or not D));
A := TBits.RotateLeft32(A, 6) + B;
D := LData[11] + $BD3AF235 + D + (B xor (A or not C));
D := TBits.RotateLeft32(D, 10) + A;
C := LData[2] + $2AD7D2BB + C + (A xor (D or not B));
C := TBits.RotateLeft32(C, 15) + D;
B := LData[9] + $EB86D391 + B + (D xor (C or not A));
B := TBits.RotateLeft32(B, 21) + C;
FState[0] := FState[0] + A;
FState[1] := FState[1] + B;
FState[2] := FState[2] + C;
FState[3] := FState[3] + D;
System.FillChar(LData, System.SizeOf(LData), UInt32(0));
end;
end.
| 37.778846 | 80 | 0.537923 |
47fce7024daff6e4befbd9d611132761937fecf7 | 335 | dpr | Pascal | Utils/FPC/WriteCDate2.dpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Utils/FPC/WriteCDate2.dpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Utils/FPC/WriteCDate2.dpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | Program WriteCDate2;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
{$IFNDEF UNIX}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
{$IFDEF UNIX}
Unt_CDate in '$HOME\Unt_CDate.pas',
{$ELSE}
unt_cdate in 'C:\unt_cdate.pas',
{$ENDIF}
Unt_WriteCDDate2 in '..\source\Unt_WriteCDDate2.pas';
{$R *.res}
Begin
Execute;
End.
| 13.958333 | 56 | 0.61194 |
47af7f7e5747a9a164d8a668b92ac8a015097b23 | 3,442 | pas | Pascal | Validador.UI.VisualizarXML.pas | ftathiago/ValidadorDBChange | f486155f538aca2f0623ccb19be5bea13d739e07 | [
"Apache-2.0"
]
| null | null | null | Validador.UI.VisualizarXML.pas | ftathiago/ValidadorDBChange | f486155f538aca2f0623ccb19be5bea13d739e07 | [
"Apache-2.0"
]
| null | null | null | Validador.UI.VisualizarXML.pas | ftathiago/ValidadorDBChange | f486155f538aca2f0623ccb19be5bea13d739e07 | [
"Apache-2.0"
]
| null | null | null | unit Validador.UI.VisualizarXML;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Actions, Vcl.ActnList, Vcl.ComCtrls,
Vcl.ToolWin, Vcl.StdCtrls, Xml.xmldom, Xml.XMLIntf, Xml.XMLDoc, Xml.Win.msxmldom, Xml.omnixmldom,
Xml.adomxmldom;
type
TVisualizarXML = class(TFrame)
memoXML: TMemo;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ActionList: TActionList;
actAbrirArquivo: TAction;
ToolButton2: TToolButton;
actSalvarArquivo: TAction;
OpenDialog: TOpenDialog;
SaveDialog: TSaveDialog;
actSelecionarTudo: TAction;
actCopiarXML: TAction;
ToolButton3: TToolButton;
procedure actAbrirArquivoExecute(Sender: TObject);
procedure actSalvarArquivoExecute(Sender: TObject);
procedure actSelecionarTudoExecute(Sender: TObject);
procedure actCopiarXMLExecute(Sender: TObject);
private
function GetXML: WideString;
procedure ConfigurarXML(const AXMLDocument: IXMLDocument);
public
procedure AfterConstruction; override;
procedure SetDiretorioBase(const ADiretorioBase: string);
procedure SetXML(const AXML: TStrings);
function GetXMLDocument: IXMLDocument;
property Xml: WideString read GetXML;
end;
implementation
{$R *.dfm}
uses Validador.Data.dbChangeXML;
procedure TVisualizarXML.AfterConstruction;
begin
inherited;
memoXML.Lines.DefaultEncoding := TUTF8Encoding.UTF8;
end;
procedure TVisualizarXML.actAbrirArquivoExecute(Sender: TObject);
begin
if Not OpenDialog.Execute then
Exit;
memoXML.Lines.LoadFromFile(OpenDialog.FileName);
end;
procedure TVisualizarXML.actCopiarXMLExecute(Sender: TObject);
begin
actSelecionarTudo.Execute;
memoXML.CopyToClipboard;
end;
procedure TVisualizarXML.actSalvarArquivoExecute(Sender: TObject);
var
_xmlDocument: IXMLDocument;
_stream: TMemoryStream;
begin
if not SaveDialog.Execute then
Exit;
_xmlDocument := GetXMLDocument;
_xmlDocument.SaveToFile(SaveDialog.FileName);
_stream := TMemoryStream.Create;
try
_xmlDocument.SaveToStream(_stream);
_stream.Position := 0;
_stream.SaveToFile(SaveDialog.FileName);
finally
FreeAndNil(_stream);
end;
end;
procedure TVisualizarXML.actSelecionarTudoExecute(Sender: TObject);
begin
memoXML.SelectAll;
end;
function TVisualizarXML.GetXML: WideString;
var
_xmlDocument: IXMLDocument;
begin
_xmlDocument := GetXMLDocument;
Result := _xmlDocument.Xml.Text;
end;
function TVisualizarXML.GetXMLDocument: IXMLDocument;
var
_xmlDocument: IXMLDocument;
begin
_xmlDocument := LoadXMLData(memoXML.Text);
ConfigurarXML(_xmlDocument);
Result := _xmlDocument;
end;
procedure TVisualizarXML.ConfigurarXML(const AXMLDocument: IXMLDocument);
begin
AXMLDocument.Options := [doNodeAutoCreate, doNodeAutoIndent, doAttrNull, doAutoPrefix,
doNamespaceDecl, doAutoSave];
AXMLDocument.Active := True;
end;
procedure TVisualizarXML.SetDiretorioBase(const ADiretorioBase: string);
begin
OpenDialog.InitialDir := ADiretorioBase;
SaveDialog.InitialDir := ADiretorioBase;
end;
procedure TVisualizarXML.SetXML(const AXML: TStrings);
var
_stream: TMemoryStream;
begin
_stream := TMemoryStream.Create;
try
AXML.SaveToStream(_stream);
_stream.Position := 0;
memoXML.Lines.Clear;
memoXML.Lines.LoadFromStream(_stream);
finally
FreeAndNil(_stream);
end;
end;
end.
| 25.308824 | 99 | 0.773678 |
f1fa7c209c6a7506ebc38a50f557022c48954f63 | 1,424 | pas | Pascal | bgludf/bglclassicudf.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | bgludf/bglclassicudf.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | bgludf/bglclassicudf.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | { Copyright Elikom 2003 }
{ UDF for Firebird 1.5 }
library bglclassicudf;
{$mode objfpc}
{$PACKRECORDS C}
uses bglsys,bglmath,bgldatetime,bglstr,bglblob;
exports
{System function for Bagel}
check_numeric name 'check_numeric',
check_integer name 'check_integer',
check_string name 'check_string',
check_date name 'check_date',
check_inscheme name 'check_inscheme',
{Math function}
roundfloat name 'roundfloat',
doubleabs name 'doubleabs',
integerabs name 'integerabs',
truncate name 'truncate',
doubleplus name 'doubleplus',
{Date function}
day name 'day',
month name 'month',
year name 'year',
isleapyear name 'isleapyear',
addmonth name 'addmonth',
addyear name 'addyear',
ageindays name 'ageindays',
ageinmonths name 'ageinmonths',
ageinweeks name 'ageinweeks',
dayofmonth name 'dayofmonth',
dayofweek name 'dayofweek',
dayofyear name 'dayofyear',
quarter name 'quarter',
weekofyear name 'weekofyear',
{String function}
rupper name 'rupper',
rlower name 'rlower',
character name 'character',
crlf name 'crlf',
findnthword name 'findnthword',
findword name 'findword',
alltrim name 'alltrim',
stringlength name 'stringlength',
substr name 'substr',
copysubstr name 'copysubstr',
{blolb function}
blobaspchar name 'blobaspchar';
end.
| 25.428571 | 47 | 0.676264 |
83bd81af97140452906b739154783cc8a9a52002 | 1,430 | pas | Pascal | algoritmos-1/aulas/questao21.pas | eucarito/UFPR | 060857296663002ae8891c2d0a84910ca685f1aa | [
"MIT"
]
| 1 | 2020-04-29T16:14:38.000Z | 2020-04-29T16:14:38.000Z | algoritmos-1/aulas/questao21.pas | tiagoserique/UFPR | 8168ff72a63fabc94b8f481190ebaed3d8cec684 | [
"MIT"
]
| null | null | null | algoritmos-1/aulas/questao21.pas | tiagoserique/UFPR | 8168ff72a63fabc94b8f481190ebaed3d8cec684 | [
"MIT"
]
| 1 | 2020-07-15T03:53:15.000Z | 2020-07-15T03:53:15.000Z | program exer21;
var
n,cont,d4,dz2,dz1,soma,somadez:integer;
begin
read(n);
cont:=0;
soma:=0;
d4:=n div 1000;
d5:=n div 10000;
if (d4 > 0) and (d5 = 0) then
begin
dz1:= n mod 100;
dz2:= n div 100;
somadez:= (dz1+dz2)*(dz1+dz2);
if (somadez = n) then
begin
while (cont < 4) do
begin
soma:=soma+ (n mod 10);
n:=n div 10;
cont:=cont+1;
end;
somadez:=dz1+dz2;
dz1:=somadez mod 10;
dz2:=somadez div 10;
somadez:=dz1+dz2;
if (somadez = soma) then
writeln('eh especial')
else
writeln('nao eh especial');
end
else
writeln('nao eh especial');
end
else
writeln('ERRO');
end.
//EXERCICIO
//Um numero natural com 4 digitos n e' dito ser especial se: (i) n e' igual
//ao quadrado do valor obtido pela soma das 'dezenas' que compoem n (SomaDez)
//e (ii) se a soma dos digitos de n e' igual a soma dos digitos de SomaDez.
//Por exemplo, 2025 e' especial porque (i) suas 'dezenas' sao 20 e 25 e
//(20 + 25)^2 = (45)^2 = 2025 e (ii) 2 + 0 + 2 + 5 = 4 + 5. Por outro lado,
//1021 nao e' especial porque (i) suas 'dezenas' sao 10 e 21 e
//(10 + 21)^2 = (31)^2 = 961 <> 1021. Escreva um programa Pascal que leia um
//numero natural n de 4 digitos e verifique se n e' um numero especial.
//O programa deve mostrar uma mensagem informando o resultado da verificacao.
//Se o numero informado nao tiver 4 digitos, o programa deve apresentar uma mensagem
//de erro.
| 28.039216 | 85 | 0.641259 |
f1b1524bf62f6ca3eae9ce6e73a6c85044ad68fe | 7,031 | pas | Pascal | Importer/FastObjLoader/uFastObjLoader.pas | hartmutdavid/FMX3DViewer | ec6942ce29a3eff811b05553a8e415134e3dcf1f | [
"Apache-2.0"
]
| 8 | 2017-12-23T11:26:32.000Z | 2020-06-28T10:09:01.000Z | Importer/FastObjLoader/uFastObjLoader.pas | hartmutdavid/FMX3DViewer | ec6942ce29a3eff811b05553a8e415134e3dcf1f | [
"Apache-2.0"
]
| null | null | null | Importer/FastObjLoader/uFastObjLoader.pas | hartmutdavid/FMX3DViewer | ec6942ce29a3eff811b05553a8e415134e3dcf1f | [
"Apache-2.0"
]
| 3 | 2019-02-08T17:03:25.000Z | 2020-06-29T06:41:16.000Z | unit uFastObjLoader;
interface
//load and save meshes in WaveFront OBJ format
{
Zur Real-Konvertierung diese Funktion verwenden, aus System.SysUtil:
function TextToFloat(const S: string; var Value: Double;
const AFormatSettings: TFormatSettings): Boolean; overload;
}
uses
Classes, sysutils, uDefineTypesCtm;
procedure Load3DObjModel(const FileName: string;
var faces: TFaces;
var vertices: TVertices;
var vertexRGBA : TVertexRGBA);
procedure Save3DObjModel(const FileName: string;
var faces: TFaces;
var vertices: TVertices;
var vertexRGBA : TVertexRGBA);
implementation
function FSize (lFName: String): longint;
var
F : File Of byte;
begin
result := 0;
if not fileexists(lFName) then
exit;
Assign (F, lFName);
Reset (F);
result := FileSize(F);
Close (F);
end;
procedure Load3DObjModel(const FileName: string;
var faces: TFaces;
var vertices: TVertices;
var vertexRGBA : TVertexRGBA);
const
kBlockSize = 8192;
var
l_lOk: Boolean;
f: TextFile;
fsz : int64;
d: Double;
l_sLine, l_sStr: string;
l_lstLineParts: TStringList;
i, j, li, num_v, num_f, new_f: integer;
l_oUSFormatSettings: TFormatSettings;
l_lstLines: TStringList;
begin
fsz := FSize (FileName);
if fsz < 32 then
exit;
//init values
l_oUSFormatSettings := TFormatSettings.Invariant;
num_v := 0;
num_f := 0;
l_lstLineParts := TStringList.Create;
setlength(vertices, (fsz div 70)+kBlockSize); //guess number of faces based on filesize to reduce reallocation frequencey
setlength(faces, (fsz div 35)+kBlockSize); //guess number of vertices based on filesize to reduce reallocation frequencey
setlength(vertexRGBA,0);
//load faces and vertices
l_lstLines := TStringList.Create;
l_lstLines.LoadFromFile(FileName);
for li := 0 to l_lstLines.Count-1 do begin
l_sLine := l_lstLines[li];
if length(l_sLine) < 7 then
continue;
if (l_sLine[1] <> 'v') and (l_sLine[1] <> 'f') then
continue; //only read 'f'ace and 'v'ertex lines
if (l_sLine[2] = 'p') or (l_sLine[2] = 'n') or (l_sLine[2] = 't') then
continue; //ignore vp/vn/vt data: avoid delimiting text yields 20% faster loads
l_lstLineParts.DelimitedText := l_sLine;
if l_lstLineParts.count > 3 then begin
if l_lstLineParts[0] = 'f' then begin
//warning: need to handle "f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3"
//warning: face could be triangle, quad, or more vertices!
new_f := l_lstLineParts.count - 3;
if ((num_f+new_f) >= length(faces)) then
setlength(faces, length(faces)+new_f+kBlockSize);
for i := 1 to (l_lstLineParts.count-1) do begin
if (pos('/', l_lstLineParts[i]) > 1) then begin
// f v1 v2 v3
// f v1//vn1 v2//vn2 v3//vn3
// f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3
l_lstLineParts[i] := Copy(l_lstLineParts[i], 1, pos('/', l_lstLineParts[i])-1);
end;
end;
j := 1;
if new_f = 1 then begin
// f v1 v2 v3
faces[num_f].X := StrToUInt(l_lstLineParts[1]) - 1;
faces[num_f].Y := StrToUInt(l_lstLineParts[2]) - 1;
faces[num_f].Z := StrToUInt(l_lstLineParts[3]) - 1;
inc(num_f);
end
else if new_f = 2 then begin
// f v1 v2 v3 v4
faces[num_f].X := StrToUInt(l_lstLineParts[2]) - 1;
faces[num_f].Y := StrToUInt(l_lstLineParts[3]) - 1;
faces[num_f].Z := StrToUInt(l_lstLineParts[4]) - 1;
inc(num_f);
faces[num_f].X := StrToUInt(l_lstLineParts[4]) - 1;
faces[num_f].Y := StrToUInt(l_lstLineParts[1]) - 1;
faces[num_f].Z := StrToUInt(l_lstLineParts[2]) - 1;
inc(num_f);
end
else begin
for j := 1 to (new_f) do begin
faces[num_f].X := StrToUInt(l_lstLineParts[j]) - 1; //-1 since "A valid vertex index starts from 1"
faces[num_f].Y := StrToUInt(l_lstLineParts[j+1]) - 1; //-1 since "A valid vertex index starts from 1"
faces[num_f].Z := StrToUInt(l_lstLineParts[j+2]) - 1; //-1 since "A valid vertex index starts from 1"
inc(num_f);
end;
end;
end
else if l_lstLineParts[0] = 'v' then begin
if ((num_v+1) >= length(vertices)) then
SetLength(vertices, length(vertices)+kBlockSize);
l_lOk := TextToFloat(l_lstLineParts[1], vertices[num_v].X, l_oUSFormatSettings);
l_lOk := TextToFloat(l_lstLineParts[2], vertices[num_v].Y, l_oUSFormatSettings);
l_lOk := TextToFloat(l_lstLineParts[3], vertices[num_v].Z, l_oUSFormatSettings);
if l_lstLineParts.count >= 7 then begin
// v x y z 4x ohne Farben
// v x y z R G B 7x with RGB
// v x y z R G B A 8x with RGBA
if ((num_v+1) >= length(vertexRGBA)) then
SetLength(vertexRGBA, length(vertices));
l_sStr := Copy(l_lstLineParts[4],1,6);
l_lOk := TextToFloat(l_sStr, d, l_oUSFormatSettings);
vertexRGBA[num_v].R := Trunc(d * 255.0);
l_sStr := Copy(l_lstLineParts[5],1,6);
l_lOk := TextToFloat(l_sStr, d, l_oUSFormatSettings);
vertexRGBA[num_v].G := Trunc(d * 255.0);
l_sStr := Copy(l_lstLineParts[6],1,6);
l_lOk := TextToFloat(l_sStr, d, l_oUSFormatSettings);
vertexRGBA[num_v].B := Trunc(d * 255.0);
if l_lstLineParts.count = 8 then begin
l_sStr := Copy(l_lstLineParts[7],1,6);
l_lOk := TextToFloat(l_sStr, d, l_oUSFormatSettings);
vertexRGBA[num_v].A := Trunc(d * 255.0);
end
else begin
vertexRGBA[num_v].A := 200;
end;
end;
inc(num_v);
end;
end;
end;
l_lstLines.Clear;
l_lstLines.Free;
l_lstLineParts.free;
setlength(faces, num_f);
setlength(vertices, num_v);
if Length(vertexRGBA) > 0 then
SetLength(vertexRGBA, num_v);
end; // LoadObj()
procedure Save3DObjModel(const FileName: string;
var faces: TFaces;
var vertices: TVertices;
var vertexRGBA : TVertexRGBA);
//create WaveFront object file
// https://en.wikipedia.org/wiki/Wavefront_.obj_file
var
f : TextFile;
FileNameObj: string;
i : integer;
begin
if (length(faces) < 1) or (length(vertices) < 3) then begin
writeln('You need to open a mesh before you can save it');
exit;
end;
FileNameObj := changeFileExt(FileName, '.obj');
AssignFile(f, FileNameObj);
ReWrite(f);
WriteLn(f, '# WaveFront Object format image created with Surf Ice');
for i := 0 to (length(vertices)-1) do
WriteLn(f, 'v ' + floattostr(vertices[i].X)+' '+floattostr(vertices[i].Y)+' '+ floattostr(vertices[i].Z));
for i := 0 to (length(faces)-1) do
WriteLn(f, 'f ' + inttostr(faces[i].X+1)+' '+inttostr(faces[i].Y+1)+' '+ inttostr(faces[i].Z+1)); //+1 since "A valid vertex index starts from 1 "
CloseFile(f);
end;
end.
| 35.510101 | 152 | 0.615844 |
47f372c06869c2c3741fb442a30351e83d8c521d | 4,202 | pas | Pascal | src/Server/Game/GameHoles.pas | hsreina/pangya-server | 1720cdceafcd58379904476791752ac6c643e221 | [
"Apache-2.0"
]
| 32 | 2016-03-08T13:47:36.000Z | 2022-01-01T18:47:17.000Z | src/Server/Game/GameHoles.pas | hsreina/pangya-server | 1720cdceafcd58379904476791752ac6c643e221 | [
"Apache-2.0"
]
| 6 | 2016-01-18T03:08:00.000Z | 2020-11-12T01:32:25.000Z | src/Server/Game/GameHoles.pas | hsreina/pangya-server | 1720cdceafcd58379904476791752ac6c643e221 | [
"Apache-2.0"
]
| 22 | 2015-11-10T13:04:54.000Z | 2021-06-21T21:00:39.000Z | {*******************************************************}
{ }
{ Pangya Server }
{ }
{ Copyright (C) 2015 Shad'o Soft tm }
{ }
{*******************************************************}
unit GameHoles;
interface
uses
Generics.Collections, GameHoleInfo, defs, LoggerInterface;
type
TGameHoles = class
private
var m_gameHoles: TList<TGameHoleInfo>;
var m_rainDropRatio: UInt8;
var m_currentHole: UInt8;
var m_holeCount: UInt8;
var m_logger: ILoggerInterface;
function FGetCurrentHole: TGameHoleInfo;
procedure RandomizeWeather;
procedure RandomizeWind;
procedure InitGameHoles(gameMode: TGAME_MODE; map: UInt8);
public
constructor Create(const ALogger: ILoggerInterface);
destructor Destroy; override;
procedure Init(gameMode: TGAME_MODE; map: UInt8; holeCount: UInt8);
property CurrentHole: TGameHoleInfo read FGetCurrentHole;
property Holes: TList<TGameHoleInfo> read m_gameHoles;
function GoToNext: Boolean;
end;
implementation
constructor TGameHoles.Create(const ALogger: ILoggerInterface);
var
I: UInt8;
begin
inherited Create;
m_logger := ALogger;
m_holeCount := 0;
m_rainDropRatio := 10;
m_gameHoles := TList<TGameHoleInfo>.Create;
for I := 1 to 18 do
begin
m_gameHoles.Add(TGameHoleInfo.Create);
end;
end;
destructor TGameHoles.Destroy;
var
holeInfo: TGameHoleInfo;
begin
for holeInfo in m_gameHoles do
begin
TObject(holeInfo).Free;
end;
m_gameHoles.Free;
inherited;
end;
procedure TGameHoles.RandomizeWeather;
var
holeInfo: TGameHoleInfo;
flagged: Boolean;
begin
flagged := false;
for holeInfo in m_gameHoles do
begin
if flagged then
begin
holeInfo.weather := 2;
break;
end;
if random(100) <= m_rainDropRatio then
begin
holeInfo.weather := 1;
flagged := true;
end else
begin
holeInfo.weather := 0;
end;
end;
end;
procedure TGameHoles.RandomizeWind;
var
holeInfo: TGameHoleInfo;
flagged: Boolean;
begin
flagged := false;
for holeInfo in m_gameHoles do
begin
holeInfo.Wind.windpower := UInt8(random(9));
end;
end;
procedure TGameHoles.InitGameHoles(gameMode: TGAME_MODE; map: UInt8);
var
hole: UInt8;
x, randomPosition, temp: Int32;
holeInfo: TGameHoleInfo;
begin
randomize;
m_currentHole := 0;
x := 0;
case gameMode of
TGAME_MODE.GAME_MODE_REPEAT : begin
for x := 0 to 17 do begin
m_gameHoles[x].Hole := x + 1;
end;
end;
TGAME_MODE.GAME_MODE_FRONT : begin
for x := 0 to 17 do begin
m_gameHoles[x].Hole := x + 1;
end;
end;
TGAME_MODE.GAME_MODE_BACK : begin
for x := 0 to 17 do begin
m_gameHoles[x].Hole := 18 - x;
end;
end;
TGAME_MODE.GAME_MODE_RANDOM : begin
for x := 0 to 17 do begin
m_gameHoles[x].Hole := Int32(random(19));
end;
end;
TGAME_MODE.GAME_MODE_SHUFFLE : begin
for x := 0 to 17 do begin
m_gameHoles[x].Hole := x + 1;
end;
for x := 0 to 17 do begin
temp := m_gameHoles[x].Hole;
randomposition := Int32(random(18));
m_gameHoles[x].Hole := m_gameHoles[randomposition].Hole;
m_gameHoles[randomposition].Hole := temp;
end;
end
else begin
m_logger.Error('Unregistred game mode');
for x := 0 to 17 do begin
m_gameHoles[x].Hole := x + 1;
end;
end;
end;
for x := 0 to 17 do begin
m_gameHoles[x].Map := map;
end;
end;
procedure TGameHoles.Init(gameMode: TGAME_MODE; map: UInt8; holeCount: UInt8);
begin
m_holeCount := holeCount;
RandomizeWeather;
RandomizeWind;
InitGameHoles(gameMode, map);
end;
function TGameHoles.FGetCurrentHole: TGameHoleInfo;
begin
Result := m_gameHoles[m_currentHole];
end;
function TGameHoles.GoToNext;
begin
inc(m_currentHole);
Result := m_currentHole < m_holeCount;
if not Result then
begin
m_currentHole := 0;
end;
end;
end.
| 22.470588 | 78 | 0.611851 |
f13185d36060a7c35daba74a71cbee43a9de0df6 | 2,786 | pas | Pascal | Part4/19 ProcessMessages reentrancy problem/ProcessMsgMainF.pas | dalijap/code-delphi-async | 4a7ccb8ca89024ce2435ea5e72fd47493e785439 | [
"MIT"
]
| 26 | 2021-01-03T06:34:46.000Z | 2022-01-22T17:12:36.000Z | Part4/19 ProcessMessages reentrancy problem/ProcessMsgMainF.pas | kitesoft/code-delphi-async | 2d729af96e7b71f310994749391b40fadd8455a3 | [
"MIT"
]
| null | null | null | Part4/19 ProcessMessages reentrancy problem/ProcessMsgMainF.pas | kitesoft/code-delphi-async | 2d729af96e7b71f310994749391b40fadd8455a3 | [
"MIT"
]
| 9 | 2021-01-11T16:45:40.000Z | 2022-02-26T13:38:01.000Z | unit ProcessMsgMainF;
interface
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
System.Variants,
System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.ExtCtrls;
type
TMainForm = class(TForm)
Panel1: TPanel;
BlockingBtn: TButton;
Memo: TMemo;
ReentrantProcessMsgBtn: TButton;
ProcessMsgBtn: TButton;
UIBtn: TButton;
ProcessingBtn: TButton;
procedure BlockingBtnClick(Sender: TObject);
procedure ReentrantProcessMsgBtnClick(Sender: TObject);
procedure ProcessMsgBtnClick(Sender: TObject);
procedure UIBtnClick(Sender: TObject);
procedure ProcessingBtnClick(Sender: TObject);
private
Processing: Boolean;
procedure DoFoo;
procedure DoBar;
procedure DoFork;
procedure EnableUI;
procedure DisableUI;
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.DoFoo;
begin
Memo.Lines.Add('Foo');
Sleep(1000);
end;
procedure TMainForm.DoBar;
begin
Memo.Lines.Add('Bar');
Sleep(1000);
end;
procedure TMainForm.DoFork;
begin
Memo.Lines.Add('Fork');
end;
procedure TMainForm.BlockingBtnClick(Sender: TObject);
begin
DoFoo;
DoBar;
DoFork;
end;
procedure TMainForm.ReentrantProcessMsgBtnClick(Sender: TObject);
begin
DoFoo;
Application.ProcessMessages;
DoBar;
Application.ProcessMessages;
DoFork;
end;
procedure TMainForm.ProcessMsgBtnClick(Sender: TObject);
begin
ProcessMsgBtn.Enabled := False;
try
DoFoo;
Application.ProcessMessages;
DoBar;
Application.ProcessMessages;
DoFork;
finally
ProcessMsgBtn.Enabled := True;
end;
end;
procedure TMainForm.ProcessingBtnClick(Sender: TObject);
begin
if Processing then
Exit;
Processing := True;
try
DoFoo;
Application.ProcessMessages;
DoBar;
Application.ProcessMessages;
DoFork;
finally
Processing := False;
end;
end;
procedure TMainForm.EnableUI;
begin
BlockingBtn.Enabled := True;
ReentrantProcessMsgBtn.Enabled := True;
ProcessMsgBtn.Enabled := True;
ProcessingBtn.Enabled := True;
UIBtn.Enabled := True;
end;
procedure TMainForm.DisableUI;
begin
BlockingBtn.Enabled := False;
ReentrantProcessMsgBtn.Enabled := False;
ProcessMsgBtn.Enabled := False;
ProcessingBtn.Enabled := False;
UIBtn.Enabled := False;
end;
procedure TMainForm.UIBtnClick(Sender: TObject);
begin
if Processing then
Exit;
Processing := True;
try
DisableUI;
DoFoo;
Application.ProcessMessages;
DoBar;
Application.ProcessMessages;
DoFork;
finally
Processing := False;
EnableUI;
end;
end;
end.
| 18.328947 | 66 | 0.680187 |
85c228da110b36255904bb1225d50f9f7996e4c2 | 1,635 | pas | Pascal | extras/Delphi/sdr_demo/SDRMain.pas | AnttiLukats/Antti-Bible | 746b20b255b848f3ebac9a81213cc254796671ca | [
"Apache-2.0"
]
| null | null | null | extras/Delphi/sdr_demo/SDRMain.pas | AnttiLukats/Antti-Bible | 746b20b255b848f3ebac9a81213cc254796671ca | [
"Apache-2.0"
]
| null | null | null | extras/Delphi/sdr_demo/SDRMain.pas | AnttiLukats/Antti-Bible | 746b20b255b848f3ebac9a81213cc254796671ca | [
"Apache-2.0"
]
| null | null | null | unit SDRMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Mitov.Types, SLCommonGen, SLSignalGen,
Mitov.VCLTypes, VCL.LPControl, SLControlCollection, LPControlDrawLayers,
SLBasicDataDisplay, SLDataDisplay, SLDataChart, SLScope, SLMultiInput,
SLMultiply, LPComponent, SLCommonFilter, SLSimpleFilter, SLFrequencyFilter,
SLLowPass, TLBasicTimingFilter, TLClockGen, SLAdd, Vcl.StdCtrls, Vcl.Buttons,
SLBasicAnalysis, SLRMSMeter, SLSubtract, SLFourier, SLAverageValue;
type
TForm2 = class(TForm)
SLScope1: TSLScope;
LO_I: TSLSignalGen;
LO_Q: TSLSignalGen;
SLScope2: TSLScope;
signal: TSLSignalGen;
MIX_I: TSLMultiply;
MIX_Q: TSLMultiply;
LP_I: TSLLowPass;
LP_Q: TSLLowPass;
refclock: TTLClockGen;
MIX2_I: TSLMultiply;
MIX2_Q: TSLMultiply;
sumout: TSLAdd;
WO_I: TSLSignalGen;
WO_Q: TSLSignalGen;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
lblF: TLabel;
SLScope3: TSLScope;
SLFourier1: TSLFourier;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
signal.Frequency := signal.Frequency + 50;
lblF.Caption := IntToStr(trunc(signal.Frequency));
end;
procedure TForm2.BitBtn2Click(Sender: TObject);
begin
signal.Frequency := signal.Frequency - 50;
lblF.Caption := IntToStr(trunc(signal.Frequency));
end;
end.
| 24.772727 | 98 | 0.73578 |
f1e148027c14c9bb47ae5c4e2f4680a44698514f | 183 | pas | Pascal | Test/FailureScripts/record_empty.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| 1 | 2022-02-18T22:14:44.000Z | 2022-02-18T22:14:44.000Z | Test/FailureScripts/record_empty.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | Test/FailureScripts/record_empty.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | type
TRec = record
function Hello : String;
begin
Result:='Hello';
end;
property PropHello : Integer read Hello;
end;
var r : TRec;
r.Bug; | 15.25 | 46 | 0.546448 |
83f43b4d1c80ae93f63201f202efce1300eac526 | 1,276 | dfm | Pascal | REST/LoginExample/UnitMain.dfm | RetailProInternational/PrismSDK | 4387ff26ec6a0e70db1cb7a12da6f737059034b2 | [
"Unlicense"
]
| 2 | 2021-04-13T20:12:49.000Z | 2022-03-11T09:35:05.000Z | REST/LoginExample/UnitMain.dfm | RetailProInternational/PrismSDK | 4387ff26ec6a0e70db1cb7a12da6f737059034b2 | [
"Unlicense"
]
| null | null | null | REST/LoginExample/UnitMain.dfm | RetailProInternational/PrismSDK | 4387ff26ec6a0e70db1cb7a12da6f737059034b2 | [
"Unlicense"
]
| 1 | 2021-06-04T21:24:51.000Z | 2021-06-04T21:24:51.000Z | object FormLoginSample: TFormLoginSample
Left = 0
Top = 0
Caption = 'FormLoginSample'
ClientHeight = 318
ClientWidth = 679
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 24
Top = 16
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Memo: TMemo
Left = 105
Top = 16
Width = 559
Height = 294
Lines.Strings = (
'Memo')
TabOrder = 1
end
object HTTP: TIdHTTP
AllowCookies = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.ContentRangeEnd = -1
Request.ContentRangeStart = -1
Request.ContentRangeInstanceLength = -1
Request.Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
Request.Ranges.Units = 'bytes'
Request.Ranges = <>
HTTPOptions = [hoForceEncodeParams]
OnHeadersAvailable = HTTPHeadersAvailable
Left = 48
Top = 56
end
end
| 24.075472 | 86 | 0.667712 |
fc0398377cd1db722f2e35ee58ca15114bf0be40 | 1,789 | pas | Pascal | src/libraries/hashlib4pascal/HlpCRC16.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 384 | 2016-07-16T10:07:28.000Z | 2021-12-29T11:22:56.000Z | src/libraries/hashlib4pascal/HlpCRC16.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 165 | 2016-09-11T11:06:04.000Z | 2021-12-05T23:31:55.000Z | src/libraries/hashlib4pascal/HlpCRC16.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 210 | 2016-08-26T14:49:47.000Z | 2022-02-22T18:06:33.000Z | unit HlpCRC16;
{$I HashLib.inc}
interface
uses
HlpHashLibTypes,
HlpHash,
HlpICRC,
HlpIHashResult,
HlpIHashInfo,
HlpCRC;
type
TCRC16Polynomials = class sealed(TObject)
private
const
BUYPASS = UInt16($8005);
end;
TCRC16 = class(THash, IChecksum, IHash16, ITransformBlock)
strict private
var
FCRCAlgorithm: ICRC;
public
constructor Create(APolynomial, AInitial: UInt64;
AIsInputReflected, AIsOutputReflected: Boolean;
AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray);
procedure Initialize(); override;
procedure TransformBytes(const AData: THashLibByteArray;
AIndex, ALength: Int32); override;
function TransformFinal(): IHashResult; override;
end;
TCRC16_BUYPASS = class sealed(TCRC16)
public
constructor Create();
end;
implementation
{ TCRC16 }
constructor TCRC16.Create(APolynomial, AInitial: UInt64;
AIsInputReflected, AIsOutputReflected: Boolean;
AOutputXor, ACheckValue: UInt64; const ANames: THashLibStringArray);
begin
Inherited Create(2, 1);
FCRCAlgorithm := TCRC.Create(16, APolynomial, AInitial, AIsInputReflected,
AIsOutputReflected, AOutputXor, ACheckValue, ANames);
end;
procedure TCRC16.Initialize;
begin
FCRCAlgorithm.Initialize;
end;
procedure TCRC16.TransformBytes(const AData: THashLibByteArray;
AIndex, ALength: Int32);
begin
FCRCAlgorithm.TransformBytes(AData, AIndex, ALength);
end;
function TCRC16.TransformFinal: IHashResult;
begin
result := FCRCAlgorithm.TransformFinal();
end;
{ TCRC16_BUYPASS }
constructor TCRC16_BUYPASS.Create;
begin
Inherited Create(TCRC16Polynomials.BUYPASS, $0000, false, false, $0000, $FEE8,
THashLibStringArray.Create('CRC-16/BUYPASS', 'CRC-16/VERIFONE',
'CRC-16/UMTS'));
end;
end.
| 19.659341 | 80 | 0.746786 |
470a177dee9bcbf1ee8c2faf22227502b204644d | 416 | dpr | Pascal | Projects/Lazarus_Bible/FPC/Checks2.dpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Projects/Lazarus_Bible/FPC/Checks2.dpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Projects/Lazarus_Bible/FPC/Checks2.dpr | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | program Checks2;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
uses
{$IFnDEF FPC}
{$ELSE}
Interfaces,
{$ENDIF}
Forms,
Frm_Checks2Main in '..\source\CHECKS\Frm_Checks2Main.PAS' {MainForm};
{$R *.res}
{$IFNDEF FPC}
{$E EXE}
{$ENDIF}
begin
Application.Initialize;
Application.Title := 'Demo: Checks2';
Application.CreateForm(TfrmChecks2Main, frmChecks2Main);
Application.Run;
end.
| 15.407407 | 72 | 0.651442 |
47d83a2143a746235860f139530ef491240bfa21 | 1,943 | pas | Pascal | Lego/bricxcc/uRemoteGlobals.pas | jodosh/Personal | 92c943b95d3a07789d5f24faf60d4708040e22cb | [
"MIT"
]
| null | null | null | Lego/bricxcc/uRemoteGlobals.pas | jodosh/Personal | 92c943b95d3a07789d5f24faf60d4708040e22cb | [
"MIT"
]
| 1 | 2017-09-18T14:15:00.000Z | 2017-09-18T14:15:00.000Z | Lego/bricxcc/uRemoteGlobals.pas | jodosh/Personal | 92c943b95d3a07789d5f24faf60d4708040e22cb | [
"MIT"
]
| null | null | null | (*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of this code is John Hansen.
* Portions created by John Hansen are Copyright (C) 2009 John Hansen.
* All Rights Reserved.
*
*)
unit uRemoteGlobals;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
{$I bricxcc.inc}
interface
uses
Registry;
type
TProgramNames = array[0..5] of string;
var
RemotePrograms : TProgramNames;
procedure LoadRemoteValues(reg : TRegistry);
procedure SaveRemoteValues(reg : TRegistry);
procedure ResetRemoteValues(reg : TRegistry);
implementation
uses
SysUtils, uRegUtils;
procedure LoadRemoteValues(reg : TRegistry);
var
i : integer;
begin
Reg_OpenKey(reg, 'Remote');
try
for i := Low(RemotePrograms) to High(RemotePrograms)-1 do
RemotePrograms[i] := Reg_ReadString(reg, 'Program'+IntToStr(i), Format('remote%d.rxe', [i]));
i := High(RemotePrograms);
RemotePrograms[i] := Reg_ReadString(reg, 'Program'+IntToStr(i), 'default');
finally
reg.CloseKey;
end;
end;
procedure SaveRemoteValues(reg : TRegistry);
var
i : integer;
begin
Reg_DeleteKey(reg, 'Remote');
Reg_OpenKey(reg, 'Remote');
try
for i := Low(RemotePrograms) to High(RemotePrograms) do
reg.WriteString('Program'+IntToStr(i),RemotePrograms[i]);
finally
reg.CloseKey;
end;
end;
procedure ResetRemoteValues(reg : TRegistry);
begin
Reg_DeleteKey(reg, 'Remote');
LoadRemoteValues(reg);
end;
end.
| 23.987654 | 100 | 0.689655 |
4703d6bb1b0cae4ed03626112d362a9be17b090e | 1,848 | pas | Pascal | tests/DesignPatterns/Fido.DesignPatterns.Adapter.DataSetAsReadonlyList.Test.pas | sonjli/FidoLib | d86c5bdf97e13cd2317ace207a6494da6cfe92f3 | [
"MIT"
]
| 27 | 2021-09-26T18:14:51.000Z | 2022-01-04T09:26:42.000Z | tests/DesignPatterns/Fido.DesignPatterns.Adapter.DataSetAsReadonlyList.Test.pas | sonjli/FidoLib | d86c5bdf97e13cd2317ace207a6494da6cfe92f3 | [
"MIT"
]
| 5 | 2021-11-08T19:20:29.000Z | 2022-01-29T18:50:23.000Z | tests/DesignPatterns/Fido.DesignPatterns.Adapter.DataSetAsReadonlyList.Test.pas | sonjli/FidoLib | d86c5bdf97e13cd2317ace207a6494da6cfe92f3 | [
"MIT"
]
| 7 | 2021-09-26T17:30:40.000Z | 2022-02-14T02:19:05.000Z | unit Fido.DesignPatterns.Adapter.DataSetAsReadonlyList.Test;
interface
uses
DUnitX.TestFramework,
SysUtils,
DB,
Spring,
Spring.Collections,
Fido.Db.ListDatasets,
Fido.DesignPatterns.Adapter.DataSetAsReadonlyList;
type
IType = interface(IInvokable)
['{A9FD79E3-BED9-402F-8CE7-A92B80D95413}']
function GetId: Integer;
Function GetName: string;
end;
TType = class(TInterfacedObject, IType)
strict private
FId: Integer;
FName: string;
public
constructor Create(const Id: Integer; const Name: string);
function GetId: Integer;
Function GetName: string;
end;
[TestFixture]
TDataSetAsReadonlyListTests = class
public
[Test]
procedure TDataSetAsReadonlyListWorks;
end;
implementation
{ TType }
constructor TType.Create(const Id: Integer; const Name: string);
begin
inherited Create;
FId := Id;
FName := Name;
end;
function TType.GetId: Integer;
begin
Result := FId;
end;
function TType.GetName: string;
begin
Result := FName;
end;
{ TDataSetAsReadonlyListTests }
procedure TDataSetAsReadonlyListTests.TDataSetAsReadonlyListWorks;
var
List: IList<IType>;
DataSet: Shared<TDataSet>;
TestList: Shared<TDataSetAsReadonlyList<IType>>;
begin
List := TCollections.CreateInterfaceList<IType>([
TType.Create(1, 'Name1'),
TType.Create(2, 'Name2')]);
DataSet := ListDatasets.ListToReadOnlyDataset<IType>(List);
TestList := TDataSetAsReadonlyList<IType>.Create(DataSet);
Assert.AreEqual(2, TestList.Value.Count);
Assert.AreEqual(1, TestList.Value.ElementAt(0).GetId);
Assert.AreEqual('Name1', TestList.Value.ElementAt(0).GetName);
Assert.AreEqual(2, TestList.Value.ElementAt(1).GetId);
Assert.AreEqual('Name2', TestList.Value.ElementAt(1).GetName);
end;
initialization
TDUnitX.RegisterTestFixture(TDataSetAsReadonlyListTests);
end.
| 20.764045 | 66 | 0.741342 |
853f9221e563e0f87240f727997a3f889c28338e | 1,985 | pas | Pascal | src/Primitives/Block/Unit_TBlockHeader.pas | SkybuckFlying/Delphicoin | 3a966d710b507ab1235bfdce6cd7ccef6d27bf14 | [
"MIT"
]
| 7 | 2020-12-25T13:29:52.000Z | 2021-12-06T00:14:05.000Z | src/Primitives/Block/Unit_TBlockHeader.pas | SkybuckFlying/Delphicoin | 3a966d710b507ab1235bfdce6cd7ccef6d27bf14 | [
"MIT"
]
| 1 | 2021-05-08T17:20:55.000Z | 2021-05-19T17:17:15.000Z | src/Primitives/Block/Unit_TBlockHeader.pas | SkybuckFlying/Delphicoin | 3a966d710b507ab1235bfdce6cd7ccef6d27bf14 | [
"MIT"
]
| 5 | 2021-02-26T11:25:19.000Z | 2021-12-06T00:14:06.000Z | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Copyright (c) 2020-2020 Skybuck Flying
// Copyright (c) 2020-2020 The Delphicoin Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// Bitcoin file: src/primitives/block.h
// Bitcoin file: src/primitives/block.cpp
// Bitcoin commit hash: f656165e9c0d09e654efabd56e6581638e35c26c
unit Unit_TBlockHeader;
interface
type
{** Nodes collect new transactions into a block, hash them into a hash tree,
* and scan through nonce values to make the block's hash satisfy proof-of-work
* requirements. When they solve the proof-of-work, they broadcast the block
* to everyone and the block is added to the block chain. The first transaction
* in the block is a special one that creates a new coin owned by the creator
* of the block.
*}
TBlockHeader = class
public:
// header
nVersion: int32_t;
hashPrevBlock: uint256;
hashMerkleRoot: uint256;
nTime: uint32_t;
nBits: uint32_t;
nNonce: uint32_t;
SERIALIZE_METHODS(CBlockHeader, obj) { READWRITE(obj.nVersion, obj.hashPrevBlock, obj.hashMerkleRoot, obj.nTime, obj.nBits, obj.nNonce); }
procedure TBlockHeader.SetNull();
function TBlockHeader.IsNull() : boolean;
function TBlockHeader.GetHash() : uint256;
function TBlockHeader.GetBlockTime() : int64_t;
end;
implementation
// #include <hash.h>
// #include <tinyformat.h>
constructor TBlockHeader.Create;
begin
SetNull();
end;
procedure TBlockHeader.SetNull();
begin
nVersion := 0;
hashPrevBlock.SetNull();
hashMerkleRoot.SetNull();
nTime := 0;
nBits := 0;
nNonce := 0;
end;
function TBlockHeader.IsNull() : boolean;
begin
result := (nBits == 0);
end;
function TBlockHeader.GetHash() : uint256;
begin
return SerializeHash( *this);
end;
function TBlockHeader.GetBlockTime() : int64_t;
begin
result := (int64_t) nTime;
end;
end.
| 23.915663 | 140 | 0.741058 |
479b2c2ffa7bfbf641bddf387be1da3618e170c8 | 5,535 | pas | Pascal | SkyIUTSansExe/unitinventaire.pas | Orchanyne/SKY-IUT | c02f2e29b85b148fbf2dae3d73a16a8f9e05c008 | [
"MIT"
]
| 1 | 2021-11-20T15:36:31.000Z | 2021-11-20T15:36:31.000Z | SkyIUTSansExe/unitinventaire.pas | Orchanyne/SKY-IUT | c02f2e29b85b148fbf2dae3d73a16a8f9e05c008 | [
"MIT"
]
| null | null | null | SkyIUTSansExe/unitinventaire.pas | Orchanyne/SKY-IUT | c02f2e29b85b148fbf2dae3d73a16a8f9e05c008 | [
"MIT"
]
| null | null | null | unit unitInventaire;
{$codepage utf8}
interface
uses
Classes, SysUtils;
var //horizontale//verticale(je crois)
tabEpee : array[0..30,0..9] of char;
tabArmure : array[0..30,0..9] of char;
tabEquipement : array[0..30,0..10] of char;
capaciteInventaire:integer;
procedure Inventaire;
procedure InventaireEpee;
procedure InventaireArmure;
procedure AttributDegat;
procedure AttributResistance;
implementation
uses
GestionEcran,unitPage, unitMagasin,unitSquelette,unitEquipement,unitRace,unitCombat;
var
choisir:integer;
procedure Inventaire; //pour l'instant affiche l'inventaire du joueur jusqu'a 10
var i,j,k,m:integer;
begin
squelette;
menuPersonnage;
dessinerCadreXY(40,10,80,31,simple,15,0);
deplacerCurseurXY(58,11);
writeln('Epee');
dessinerCadreXY(40,12,80,31,simple,15,0);
dessinerCadreXY(90,10,130,31,simple,15,0);
deplacerCurseurXY(108,11);
writeln('Armure');
dessinerCadreXY(90,12,130,31,simple,15,0);
deplacerCurseurXY(5,20);
writeln('Capacite inventaire ',capaciteInventaire,'/10');
//k:=0;
m:=0;
for i := 0 to 9 do
begin
for j := 0 to 29 do
begin
deplacerCurseurXY(42+j,13+i);
writeln(tabEpee[j,i]);
end;
end;
for i := 0 to 9 do
begin
for j := 0 to 29 do
begin
deplacerCurseurXY(92+j,13+i);
writeln(tabArmure[j,i]);
end;
end;
deplacerCurseurXY(3,37);
writeln('1/ Equiper une epee');
deplacerCurseurXY(3,39);
writeln('2/ Equiper une armure');
deplacerCurseurXY(3,41);
writeln('3/ Quittez l''inventaire');
deplacerCurseurXY(12,33);//pos du curseur
writeln('Choisir un numero pour realiser une action : ');
deplacerCurseurXY(57,33);
readln(conditionQuitter);
//if (conditionQuitter = '1') then magasin;
case conditionQuitter of
'1':begin
InventaireEpee;
end;
'2':begin
InventaireArmure;
end;
end;
while conditionQuitter<>'3' do
begin
utiliseMenuPersonnage(choix);
Inventaire;
end
end;
procedure InventaireEpee;
var i,j,k:integer;
test:char;
test2:string;
begin
squelette;
menuPersonnage;
dessinerCadreXY(60,10,100,31,simple,15,0);
deplacerCurseurXY(80,11);
writeln('Epee');
dessinerCadreXY(60,12,100,31,simple,15,0);
dessinerCadreXY(56,12,60,31,simple,15,0);
for i := 1 to 10 do
begin
deplacerCurseurXY(58,12+i);
writeln(i);
end;
for i := 0 to 9 do
begin
for j := 2 to 29 do
begin
deplacerCurseurXY(62+j,13+i);
writeln(tabEpee[j,i]);
end;
end;
deplacerCurseurXY(5,38);
writeln('Laquelle voulez vous equiper ?');
test2:=' ';
deplacerCurseurXY(36,38);
readln(choisir);
if (tabEpee[0,choisir-1]<>'0') then
begin
son(9,0);
j:=0;
for k := 1 to length(test2) do
begin
test:=tabEpee[k,choisir-1];
test2[j]:=test;
j:=j+1;
end;
arme.nomArme := test2;
AttributDegat;
attaquePerso1.nom:=arme.nomArme;
attaquePerso1.degat:=arme.degatArme;
deplacerCurseurXY(5,16);
writeln(arme.nomArme);
deplacerCurseurXY(5,17);
writeln(arme.degatArme);
readln;
Inventaire;
end
else
begin
deplacerCurseurXY(5,15);
writeln('Vous n''avez rien équiper');
readln;
Inventaire;
end;
end;
procedure AttributDegat;
begin
if (tabEpee[1,choisir-1] ='1') then arme.degatArme := 10
else if (tabEpee[1,choisir-1]) ='2' then arme.degatArme := 20
else if (tabEpee[1,choisir-1]) ='3' then arme.degatArme := 40
else if (tabEpee[1,choisir-1]) ='4' then arme.degatArme := 80;
end;
procedure InventaireArmure;
var i,j,k:integer;
test:char;
test2:string;
begin
squelette;
menuPersonnage;
dessinerCadreXY(60,10,100,31,simple,15,0);
deplacerCurseurXY(80,11);
writeln('Armure');
dessinerCadreXY(60,12,100,31,simple,15,0);
dessinerCadreXY(56,12,60,31,simple,15,0);
for i := 1 to 9 do
begin
deplacerCurseurXY(58,12+i);
writeln(i);
end;
for i := 0 to 9 do
begin
for j := 2 to 29 do
begin
deplacerCurseurXY(62+j,13+i);
writeln(tabArmure[j,i]);
end;
end;
deplacerCurseurXY(5,38);
writeln('Laquelle voulez vous equiper ?');
test2:=' ';
deplacerCurseurXY(36,38);
readln(choisir);
if (tabArmure[0,choisir-1]<>'0') then
begin
son(10,0);
j:=0;
for k := 1 to length(test2) do
begin
test:=tabArmure[k,choisir-1];
test2[j]:=test;
j:=j+1;
end;
armure.nomArmure := test2;
AttributResistance;
deplacerCurseurXY(5,16);
writeln(armure.nomArmure);
deplacerCurseurXY(5,17);
writeln(armure.coefArmure:1:1);
readln;
Inventaire;
end
else
begin
deplacerCurseurXY(5,15);
writeln('Vous n''avez rien équiper');
readln;
Inventaire;
end;
end;
procedure AttributResistance;
begin
if (tabArmure[1,choisir-1] ='1') then armure.coefArmure := 0.9
else if (tabArmure[1,choisir-1]) ='2' then armure.coefArmure := 0.8
else if (tabArmure[1,choisir-1]) ='3' then armure.coefArmure := 0.6
else if (tabArmure[1,choisir-1]) ='4' then armure.coefArmure := 0.5;
end;
end.
| 19.353147 | 86 | 0.601626 |
f16de8548cacdffdf326d11b8131272964155668 | 476 | pas | Pascal | source/exer10.pas | electric-socket/xdpw | c308883b09475d23e383df19906d672cbcaaa7ff | [
"BSD-2-Clause"
]
| 4 | 2020-11-09T09:29:01.000Z | 2021-11-13T16:35:11.000Z | source/exer10.pas | electric-socket/xdpw | c308883b09475d23e383df19906d672cbcaaa7ff | [
"BSD-2-Clause"
]
| null | null | null | source/exer10.pas | electric-socket/xdpw | c308883b09475d23e383df19906d672cbcaaa7ff | [
"BSD-2-Clause"
]
| null | null | null | program exer10;
Const
A = 0xBeef;
A1= 0Xbeef;
B = $BEEF;
D = $beef;
B1 = 8#05;
C = 16#BEEF;
X0= 2#1010; X1=4#10; X5=8#177362; X9=10#70944;
begin
writeln('A = 0xBeef; A1= 0Xbeef; B = $BEEF; D = $beef; B1 = 8#05; C = 16#BEEF;');
Writeln('A=',a,' a1=',a1,' b=',b,' d=',d,' b1=',b1,' c=',c);
writeln;
writeln(' X0= 2#1010; X1=4#10; X5=8#177362; X9=10#70944;');
Writeln('X0=',X0,' X1=',X1,' X5=',X5,' X9=',X9);
end.
| 20.695652 | 85 | 0.476891 |
479c7f8824cd90cc565760db87d827a7fc2e90bb | 2,509 | dfm | Pascal | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/fAlertNoteSelector.dfm | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 72 | 2015-02-03T02:30:45.000Z | 2020-01-30T17:20:52.000Z | CPRSChart/OR_30_377V9_SRC/CPRS-chart/fAlertNoteSelector.dfm | VHAINNOVATIONS/Transplant | a6c000a0df4f46a17330cec95ff25119fca1f472 | [
"Apache-2.0"
]
| 80 | 2016-04-19T12:04:06.000Z | 2020-01-31T14:35:19.000Z | CPRSChart/OR_30_377V9_SRC/CPRS-chart/fAlertNoteSelector.dfm | VHAINNOVATIONS/Transplant | a6c000a0df4f46a17330cec95ff25119fca1f472 | [
"Apache-2.0"
]
| 67 | 2015-01-27T16:47:56.000Z | 2020-02-12T21:23:56.000Z | object frmAlertNoteSelector: TfrmAlertNoteSelector
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = 'Alert Processing Note Selector'
ClientHeight = 459
ClientWidth = 467
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object rbtnNewNote: TRadioButton
Left = 16
Top = 144
Width = 265
Height = 17
Caption = 'Create New Note Using Default Note Title'
Checked = True
TabOrder = 2
TabStop = True
OnClick = rbtnNewNoteClick
end
object rbtnSelectAddendum: TRadioButton
Left = 16
Top = 167
Width = 265
Height = 17
Caption = 'Add Adendum to Note From Initial SMART Visit Date'
TabOrder = 3
TabStop = True
OnClick = rbtnSelectAddendumClick
end
object rbtnSelectOwn: TRadioButton
Left = 8
Top = 424
Width = 265
Height = 17
Caption = 'Select Different Note For Addendum'
TabOrder = 5
TabStop = True
OnClick = rbtnSelectOwnClick
end
object btnOK: TButton
Left = 304
Top = 420
Width = 75
Height = 25
Caption = '&OK'
ModalResult = 1
TabOrder = 6
end
object lbATRNotes_ORIG: TORListBox
Left = 32
Top = 206
Width = 337
Height = 138
ItemHeight = 13
ParentShowHint = False
ShowHint = True
TabOrder = 8
Caption = ''
ItemTipColor = clWindow
LongList = True
Pieces = '2'
end
object lbATRs: TORListBox
Left = 16
Top = 24
Width = 427
Height = 114
Color = clCream
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ItemHeight = 14
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
Caption = ''
ItemTipColor = clWindow
LongList = True
end
object lbATRNotes: TListBox
Left = 16
Top = 190
Width = 427
Height = 211
ItemHeight = 13
TabOrder = 4
OnClick = lbATRNotesClick
end
object buCancel: TButton
Left = 385
Top = 420
Width = 75
Height = 25
Caption = '&Cancel'
ModalResult = 2
TabOrder = 7
OnClick = buCancelClick
end
object StaticText1: TStaticText
Left = 16
Top = 8
Width = 98
Height = 17
Caption = 'SMART Alert Values'
TabOrder = 0
TabStop = True
end
end
| 20.565574 | 65 | 0.630929 |
f1dff15c5aab3456866243e0dd929b3c74b1056c | 1,095 | dfm | Pascal | Chapter 4/AllocateMain.dfm | PacktPublishing/Delphi-High-Performance | bcb84190e8660a28cbc0caada2e1bed3b8adfe42 | [
"MIT"
]
| 45 | 2018-04-08T07:01:13.000Z | 2022-02-18T17:28:10.000Z | Chapter 4/AllocateMain.dfm | anomous/Delphi-High-Performance | 051a8f7d7460345b60cb8d2a10a974ea8179ea41 | [
"MIT"
]
| null | null | null | Chapter 4/AllocateMain.dfm | anomous/Delphi-High-Performance | 051a8f7d7460345b60cb8d2a10a974ea8179ea41 | [
"MIT"
]
| 17 | 2018-03-21T11:22:15.000Z | 2022-03-16T05:55:54.000Z | object frmAllocate: TfrmAllocate
Left = 0
Top = 0
Caption = 'Allocate'
ClientHeight = 505
ClientWidth = 545
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
DesignSize = (
545
505)
PixelsPerInch = 96
TextHeight = 13
object btnAllocClass: TButton
Left = 24
Top = 24
Width = 129
Height = 41
Caption = 'Allocate objects'
TabOrder = 0
OnClick = btnAllocClassClick
end
object btnAllocRecord: TButton
Left = 24
Top = 71
Width = 129
Height = 41
Caption = 'Allocate records'
TabOrder = 1
OnClick = btnAllocRecordClick
end
object ListBox1: TListBox
Left = 184
Top = 24
Width = 337
Height = 457
Anchors = [akLeft, akTop, akRight, akBottom]
ItemHeight = 13
TabOrder = 2
end
object btnAllocGeneric: TButton
Left = 24
Top = 135
Width = 129
Height = 41
Caption = 'Allocate node<string>'
TabOrder = 3
OnClick = btnAllocGenericClick
end
end
| 19.553571 | 48 | 0.63653 |
f1ac86f4d444706e211c59a3663151f0de14ac0e | 5,165 | pas | Pascal | comm/0045.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | comm/0045.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | comm/0045.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | unit ddfossil;
{$S-,V-,R-}
interface
uses dos;
const
name='Fossil drivers for TP 4.0';
author='Scott Baker';
type
fossildatatype = record
strsize: word;
majver: byte;
minver: byte;
ident: pointer;
ibufr: word;
ifree: word;
obufr: word;
ofree: word;
swidth: byte;
sheight: byte;
baud: byte;
end;
var
port_num: integer;
fossildata: fossildatatype;
procedure async_send(ch: char);
procedure async_send_string(s: string);
function async_receive(var ch: char): boolean;
function async_carrier_drop: boolean;
function async_carrier_present: boolean;
function async_buffer_check: boolean;
function async_init_fossil: boolean;
procedure async_deinit_fossil;
procedure async_flush_output;
procedure async_purge_output;
procedure async_purge_input;
procedure async_set_dtr(state: boolean);
procedure async_watchdog_on;
procedure async_watchdog_off;
procedure async_warm_reboot;
procedure async_cold_reboot;
procedure async_Set_baud(n: integer);
procedure async_set_flow(SoftTran,Hard,SoftRecv: boolean);
procedure Async_Buffer_Status(var Insize,Infree,OutSize,Outfree: word);
implementation
procedure async_send(ch: char);
var
regs: registers;
begin;
regs.al:=ord(ch);
regs.dx:=port_num;
regs.ah:=1;
intr($14,regs);
end;
procedure async_send_string(s: string);
var
a: integer;
begin;
for a:=1 to length(s) do async_send(s[a]);
end;
function async_receive(var ch: char): boolean;
var
regs: registers;
begin;
ch:=#0;
regs.ah:=3;
regs.dx:=port_num;
intr($14,regs);
if (regs.ah and 1)=1 then begin;
regs.ah:=2;
regs.dx:=port_num;
intr($14,regs);
ch:=chr(regs.al);
async_receive:=true;
end else async_receive:=false;
end;
function async_carrier_drop: boolean;
var
regs: registers;
begin;
regs.ah:=3;
regs.dx:=port_num;
intr($14,regs);
if (regs.al and $80)<>0 then async_carrier_drop:=false else async_carrier_drop:=true;
end;
function async_carrier_present: boolean;
var
regs: registers;
begin;
regs.ah:=3;
regs.dx:=port_num;
intr($14,regs);
if (regs.al and $80)<>0 then async_carrier_present:=true else async_carrier_present:=false;
end;
function async_buffer_check: boolean;
var
regs: registers;
begin;
regs.ah:=3;
regs.dx:=port_num;
intr($14,regs);
if (regs.ah and 1)=1 then async_buffer_check:=true else async_buffer_check:=false;
end;
function async_init_fossil: boolean;
var
regs: registers;
begin;
regs.ah:=4;
regs.bx:=0;
regs.dx:=port_num;
intr($14,regs);
if regs.ax=$1954 then async_init_fossil:=true else async_init_fossil:=false;
end;
procedure async_deinit_fossil;
var
regs: registers;
begin;
regs.ah:=5;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_set_dtr(state: boolean);
var
regs: registers;
begin;
regs.ah:=6;
if state then regs.al:=1 else regs.al:=0;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_flush_output;
var
regs: registers;
begin;
regs.ah:=8;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_purge_output;
var
regs: registers;
begin;
regs.ah:=9;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_purge_input;
var
regs: registers;
begin;
regs.ah:=$0a;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_watchdog_on;
var
regs: registers;
begin;
regs.ah:=$14;
regs.al:=01;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_watchdog_off;
var
regs: registers;
begin;
regs.ah:=$14;
regs.al:=00;
regs.dx:=port_num;
intr($14,regs);
end;
procedure async_warm_reboot;
var
regs: registers;
begin;
regs.ah:=$17;
regs.al:=01;
intr($14,regs);
end;
procedure async_cold_reboot;
var
regs: registers;
begin;
regs.ah:=$17;
regs.al:=00;
intr($14,regs);
end;
procedure async_set_baud(n: integer);
var
regs: registers;
begin;
regs.ah:=00;
regs.al:=3;
regs.dx:=port_num;
case n of
300: regs.al:=regs.al or $40;
1200: regs.al:=regs.al or $80;
2400: regs.al:=regs.al or $A0;
4800: regs.al:=regs.al or $C0;
9600: regs.al:=regs.al or $E0;
19200: regs.al:=regs.al or $00;
end;
intr($14,regs);
end;
procedure async_set_flow(SoftTran,Hard,SoftRecv: boolean);
var
regs: registers;
begin;
regs.ah:=$0F;
regs.al:=00;
if softtran then regs.al:=regs.al or $01;
if Hard then regs.al:=regs.al or $02;
if SoftRecv then regs.al:=regs.al or $08;
regs.al:=regs.al or $F0;
Intr($14,regs);
end;
procedure async_get_fossil_data;
var
regs: registers;
begin;
regs.ah:=$1B;
regs.cx:=sizeof(fossildata);
regs.dx:=port_num;
regs.es:=seg(fossildata);
regs.di:=ofs(fossildata);
intr($14,regs);
end;
procedure Async_Buffer_Status(var Insize,Infree,OutSize,Outfree: word);
begin;
async_get_fossil_data;
insize:=fossildata.ibufr;
infree:=fossildata.ifree;
outsize:=fossildata.obufr;
outfree:=fossildata.ofree;
end;
end.
| 19.71374 | 93 | 0.661762 |
478a1334916b3ec75f92ea7fa532fe32b33d66ab | 36,813 | pas | Pascal | commandsu.pas | ningfei/surf-ice | 11a978d922f53abd02c0aa1b6896443f7f1af9e1 | [
"BSD-2-Clause"
]
| 59 | 2016-04-28T05:54:56.000Z | 2022-02-08T20:10:32.000Z | commandsu.pas | ningfei/surf-ice | 11a978d922f53abd02c0aa1b6896443f7f1af9e1 | [
"BSD-2-Clause"
]
| 30 | 2017-01-08T07:58:33.000Z | 2022-03-15T21:07:50.000Z | commandsu.pas | ningfei/surf-ice | 11a978d922f53abd02c0aa1b6896443f7f1af9e1 | [
"BSD-2-Clause"
]
| 15 | 2017-03-03T14:07:52.000Z | 2022-03-21T17:01:14.000Z | unit commandsu;
{$Include opts.inc}
interface
function EXISTS(lFilename: string): boolean; //function
function ATLASMAXINDEX(OVERLAY: integer): integer;
function VERSION: string;
procedure ATLASSTATMAP(ATLASNAME, STATNAME: string; const Indices: array of integer; const Intensities: array of single);
procedure ATLASSATURATIONALPHA(lSaturation, lTransparency: single);
procedure ATLASHIDE(OVERLAY: integer; const Filt: array of integer);
procedure ATLASGRAYBG(const Filt: array of integer);
procedure ATLASGRAY(OVERLAY: integer; const Filt: array of integer);
procedure AZIMUTH (DEG: integer);
procedure AZIMUTHELEVATION (AZI, ELEV: integer);
procedure BACKCOLOR (R,G,B: byte);
procedure BMPZOOM(Z: byte);
procedure CAMERADISTANCE(DISTANCE: single);
procedure CAMERAPAN(X, Y: single);
procedure CLIP (DEPTH: single);
procedure CLIPAZIMUTHELEVATION (DEPTH,AZI,ELEV: single);
procedure COLORBARPOSITION(P: integer);
procedure COLORBARVISIBLE (VISIBLE: boolean);
procedure COLORBARCOLOR (COLOR: integer);
procedure CONTOUR(layer: integer);
procedure EDGECOLOR(name: string; varies: boolean);
procedure EDGELOAD(lFilename: string);
procedure EDGESIZE(size: single; varies: boolean);
procedure EDGETHRESH (LO, HI: single);
procedure ELEVATION (DEG: integer);
procedure FONTNAME(name: string);
procedure FULLSCREEN (isFullScreen: boolean);
procedure HEMISPHEREDISTANCE (DX: single);
procedure HEMISPHEREPRY(DEG: single);
procedure PITCH(DEG: single);
procedure ATLAS2NODE(lFilename: string);
function MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer): boolean;
procedure MESHCURV;
procedure MESHHEMISPHERE (VAL: integer);
procedure MESHLOAD(lFilename: string);
procedure MESHOVERLAYORDER (FLIP: boolean);
procedure MESHREVERSEFACES;
procedure MESHSAVE(lFilename: string);
procedure NODELOAD(lFilename: string);
procedure MODALMESSAGE(STR: string);
procedure MODELESSMESSAGE(STR: string);
procedure NODECOLOR(name: string; varies: boolean);
procedure NODEHEMISPHERE(VAL: integer);
procedure NODEPOLARITY(VAL: integer);
procedure NODECREATE(filename: string; const x,y,z,clr,radius: array of single);
procedure EDGECREATE(filename: string; const mtx: array of single);
procedure NODESIZE(size: single; varies: boolean);
procedure NODETHRESH (LO, HI: single);
procedure NODETHRESHBYSIZENOTCOLOR (NodeThresholdBySize: boolean);
procedure MESHCOLOR (R,G,B: byte);
procedure ORIENTCUBEVISIBLE (VISIBLE: boolean);
procedure OVERLAYADDITIVE (ADD: boolean);
procedure OVERLAYCLOSEALL;
procedure OVERLAYCOLORNAME(lOverlay: integer; lFilename: string);
procedure OVERLAYCOLOR(lOverlay: integer; rLo, gLo, bLo, rHi, gHi, bHi: byte);
procedure OVERLAYLOAD(lFilename: string);
procedure OVERLAYEXTREME (lOverlay, lMode: integer);
procedure OVERLAYMINMAX (lOverlay: integer; lMin,lMax: single);
procedure OVERLAYTRANSPARENCYONBACKGROUND(lPct: integer);
procedure OVERLAYVISIBLE(lOverlay: integer; VISIBLE: boolean);
procedure OVERLAYTRANSLUCENT(lOverlay: integer; TRANSLUCENT: boolean);
procedure OVERLAYOPACITY(lOverlay: integer; OPACITY: byte);
procedure OVERLAYINVERT(lOverlay: integer; INVERT: boolean);
procedure OVERLAYSMOOTHVOXELWISEDATA (SMOOTH: boolean);
procedure OVERLAYOVERLAPOVERWRITE (OVERWRITE: boolean);
procedure QUIT;
procedure RESETDEFAULTS;
procedure SAVEBMP(lFilename: string);
procedure SAVEBMPXY(lFilename: string; X,Y: integer);
procedure SCRIPTFORMVISIBLE (VISIBLE: boolean);
procedure SHADERADJUST(lProperty: string; lVal: single);
procedure SHADERAMBIENTOCCLUSION(lVal: single);
procedure SHADERFORBACKGROUNDONLY(BGONLY: boolean);
procedure SHADERLIGHTAZIMUTHELEVATION (AZI, ELEV: integer);
procedure SHADERNAME(lFilename: string);
procedure SHADERMATCAP(lFilename: string);
procedure SHADERXRAY(lObject, lOverlay: single);
procedure TRACKLOAD(lFilename: string);
procedure TRACKPREFS(lLength,lWidth,lDither: single);
procedure VIEWAXIAL (STD: boolean);
procedure VIEWCORONAL (STD: boolean);
procedure VIEWSAGITTAL (STD: boolean);
procedure WAIT (MSEC: integer);
type
TScriptRec = RECORD //peristimulus plot
Ptr: Pointer;
Decl,Vars: string[255];
end;
const
knFunc = 3;
kFuncRA : array [1..knFunc] of TScriptRec =(
(Ptr:@ATLASMAXINDEX;Decl:'ATLASMAXINDEX';Vars:'(OVERLAY: integer): integer'),
(Ptr:@EXISTS;Decl:'EXISTS';Vars:'(lFilename: string): boolean'),
(Ptr:@VERSION;Decl:'VERSION';Vars:'(): string')
);
knProc = 78;
kProcRA : array [1..knProc] of TScriptRec = (
(Ptr:@ATLASSTATMAP;Decl:'ATLASSTATMAP';Vars:'(ATLASNAME, STATNAME: string; const Intensities: array of integer; const Intensities: array of single)'),
(Ptr:@ATLASSATURATIONALPHA;Decl:'ATLASSATURATIONALPHA';Vars:'(lSaturation, lTransparency: single)'),
(Ptr:@ATLASHIDE;Decl:'ATLASHIDE';Vars:'(OVERLAY: integer; const Filt: array of integer)'),
(Ptr:@ATLASGRAY;Decl:'ATLASGRAY';Vars:'(OVERLAY: integer; const Filt: array of integer)'),
(Ptr:@AZIMUTH;Decl:'AZIMUTH';Vars:'(DEG: integer)'),
(Ptr:@AZIMUTHELEVATION;Decl:'AZIMUTHELEVATION';Vars:'(AZI, ELEV: integer)'),
(Ptr:@BMPZOOM;Decl:'BMPZOOM';Vars:'(Z: byte)'),
(Ptr:@BACKCOLOR;Decl:'BACKCOLOR';Vars:'(R, G, B: byte)'),
(Ptr:@CAMERADISTANCE;Decl:'CAMERADISTANCE';Vars:'(DISTANCE: single)'),
(Ptr:@CAMERAPAN;Decl:'CAMERAPAN';Vars:'(X, Y: single)'),
(Ptr:@CLIP;Decl:'CLIP';Vars:'(DEPTH: single)'),
(Ptr:@CLIPAZIMUTHELEVATION;Decl:'CLIPAZIMUTHELEVATION';Vars:'(DEPTH,AZI,ELEV: single)'),
(Ptr:@COLORBARPOSITION;Decl:'COLORBARPOSITION';Vars:'(P: integer)'),
(Ptr:@COLORBARVISIBLE;Decl:'COLORBARVISIBLE';Vars:'(VISIBLE: boolean)'),
(Ptr:@COLORBARCOLOR;Decl:'COLORBARCOLOR';Vars:'(COLOR: integer)'),
(Ptr:@EDGECOLOR;Decl:'EDGECOLOR';Vars:'(name: string; varies: boolean)'),
(Ptr:@EDGECREATE;Decl:'EDGECREATE';Vars:'(filename: string; const mtx: array of single)'),
(Ptr:@EDGESIZE;Decl:'EDGESIZE';Vars:'(size: single; varies: boolean)'),
(Ptr:@EDGETHRESH;Decl:'EDGETHRESH';Vars:'(LO, HI: single)'),
(Ptr:@ELEVATION;Decl:'ELEVATION';Vars:'(DEG: integer)'),
(Ptr:@EDGELOAD;Decl:'EDGELOAD';Vars:'(lFilename: string)'),
(Ptr:@FONTNAME;Decl:'FONTNAME';Vars:'(name: string)'),
(Ptr:@FULLSCREEN;Decl:'FULLSCREEN';Vars:'(isFullScreen: boolean)'),
(Ptr:@HEMISPHEREDISTANCE;Decl:'HEMISPHEREDISTANCE';Vars:'(DX: single)'),
(Ptr:@HEMISPHEREPRY;Decl:'HEMISPHEREPRY';Vars:'(DEG: single)'),
(Ptr:@PITCH;Decl:'PITCH';Vars:'(DEG: single)'),
(Ptr:@ATLAS2NODE;Decl:'ATLAS2NODE';Vars:'(lFilename: string)'),
(Ptr:@MESHCURV;Decl:'MESHCURV';Vars:''),
(Ptr:@MESHREVERSEFACES;Decl:'MESHREVERSEFACES';Vars:''),
(Ptr:@MESHLOAD;Decl:'MESHLOAD';Vars:'(lFilename: string)'),
(Ptr:@MESHCREATE;Decl:'MESHCREATE';Vars:'(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer)'),
(Ptr:@MESHHEMISPHERE;Decl:'MESHHEMISPHERE';Vars:'(VAL: integer)'),
(Ptr:@MESHOVERLAYORDER;Decl:'MESHOVERLAYORDER';Vars:'(FLIP: boolean)'),
(Ptr:@MESHSAVE;Decl:'MESHSAVE';Vars:'(lFilename: string)'),
(Ptr:@NODELOAD;Decl:'NODELOAD';Vars:'(lFilename: string)'),
//(Ptr:@MESHLOADBILATERAL;Decl:'MESHLOADBILATERAL';Vars:'(BILAT: boolean)'),
(Ptr:@MODALMESSAGE;Decl:'MODALMESSAGE';Vars:'(STR: string)'),
(Ptr:@MODELESSMESSAGE;Decl:'MODELESSMESSAGE';Vars:'(STR: string)'),
(Ptr:@NODECOLOR;Decl:'NODECOLOR';Vars:'(name: string; varies: boolean)'),
(Ptr:@NODEHEMISPHERE;Decl:'NODEHEMISPHERE';Vars:'(VAL: integer)'),
(Ptr:@NODEPOLARITY;Decl:'NODEPOLARITY';Vars:'(VAL: integer)'),
(Ptr:@NODECREATE;Decl:'NODECREATE';Vars:'(filename: string; const x,y,z,clr,radius: array of single)'),
(Ptr:@NODESIZE;Decl:'NODESIZE';Vars:'(size: single; varies: boolean)'),
(Ptr:@NODETHRESH;Decl:'NODETHRESH';Vars:'(LO, HI: single)'),
(Ptr:@NODETHRESHBYSIZENOTCOLOR;Decl:'NODETHRESHBYSIZENOTCOLOR';Vars:'(NodeThresholdBySize: boolean)'),
(Ptr:@MESHCOLOR;Decl:'MESHCOLOR';Vars:'(R, G, B: byte)'),
(Ptr:@ORIENTCUBEVISIBLE;Decl:'ORIENTCUBEVISIBLE';Vars:'(VISIBLE: boolean)'),
(Ptr:@OVERLAYADDITIVE;Decl:'OVERLAYADDITIVE';Vars:'(ADD: boolean)'),
(Ptr:@OVERLAYCLOSEALL;Decl:'OVERLAYCLOSEALL';Vars:''),
(Ptr:@OVERLAYCOLOR;Decl:'OVERLAYCOLOR';Vars:'(lOverlay: integer; rLo, gLo, bLo, rHi, gHi, bHi: byte)'),
(Ptr:@OVERLAYCOLORNAME;Decl:'OVERLAYCOLORNAME';Vars:'(lOverlay: integer; lFilename: string)'),
(Ptr:@OVERLAYLOAD;Decl:'OVERLAYLOAD';Vars:'(lFilename: string)'),
(Ptr:@OVERLAYEXTREME;Decl:'OVERLAYEXTREME';Vars:'(lOverlay, lMode: integer)'),
(Ptr:@OVERLAYMINMAX;Decl:'OVERLAYMINMAX';Vars:'(lOverlay: integer; lMin,lMax: single)'),
(Ptr:@OVERLAYOPACITY;Decl:'OVERLAYOPACITY';Vars:'(lOverlay: integer; OPACITY: byte)'),
(Ptr:@OVERLAYTRANSPARENCYONBACKGROUND;Decl:'OVERLAYTRANSPARENCYONBACKGROUND';Vars:'(lPct: integer)'),
(Ptr:@OVERLAYVISIBLE;Decl:'OVERLAYVISIBLE';Vars:'(lOverlay: integer; VISIBLE: boolean)'),
(Ptr:@OVERLAYTRANSLUCENT;Decl:'OVERLAYTRANSLUCENT';Vars:'(lOverlay: integer; TRANSLUCENT: boolean)'),
(Ptr:@OVERLAYINVERT;Decl:'OVERLAYINVERT';Vars:'(lOverlay: integer; INVERT: boolean)'),
(Ptr:@OVERLAYSMOOTHVOXELWISEDATA;Decl:'OVERLAYSMOOTHVOXELWISEDATA';Vars:'(SMOOTH: boolean)'),
(Ptr:@OVERLAYOVERLAPOVERWRITE;Decl:'OVERLAYOVERLAPOVERWRITE';Vars:'(OVERWRITE: boolean)'),
(Ptr:@QUIT;Decl:'QUIT';Vars:''),
(Ptr:@RESETDEFAULTS;Decl:'RESETDEFAULTS';Vars:''),
(Ptr:@SAVEBMP;Decl:'SAVEBMP';Vars:'(lFilename: string)'),
(Ptr:@SAVEBMPXY;Decl:'SAVEBMPXY';Vars:'(lFilename: string; X,Y: integer)'),
(Ptr:@SCRIPTFORMVISIBLE;Decl:'SCRIPTFORMVISIBLE';Vars:'(VISIBLE: boolean)'),
(Ptr:@SHADERADJUST;Decl:'SHADERADJUST';Vars:'(lProperty: string; lVal: single)'),
(Ptr:@SHADERAMBIENTOCCLUSION;Decl:'SHADERAMBIENTOCCLUSION';Vars:'(lVal: single)'),
(Ptr:@SHADERFORBACKGROUNDONLY;Decl:'SHADERFORBACKGROUNDONLY';Vars:'(BGONLY: boolean)'),
(Ptr:@SHADERMATCAP;Decl:'SHADERMATCAP';Vars:'(lFilename: string)'),
(Ptr:@SHADERNAME;Decl:'SHADERNAME';Vars:'(lFilename: string)'),
(Ptr:@SHADERLIGHTAZIMUTHELEVATION;Decl:'SHADERLIGHTAZIMUTHELEVATION';Vars:'(AZI, ELEV: integer)'),
(Ptr:@SHADERXRAY;Decl:'SHADERXRAY';Vars:'(lObject, lOverlay: single)'),
(Ptr:@TRACKLOAD;Decl:'TRACKLOAD';Vars:'(lFilename: string)'),
(Ptr:@TRACKPREFS;Decl:'TRACKPREFS';Vars:'(lLength,lWidth,lDither: single)'),
(Ptr:@VIEWAXIAL;Decl:'VIEWAXIAL';Vars:'(STD: boolean)'),
(Ptr:@VIEWCORONAL;Decl:'VIEWCORONAL';Vars:'(STD: boolean)'),
(Ptr:@VIEWSAGITTAL;Decl:'VIEWSAGITTAL';Vars:'(STD: boolean)'),
(Ptr:@WAIT;Decl:'WAIT';Vars:'(MSEC: integer)')
);
implementation
uses
//{$IFDEF UNIX}fileutil,{$ENDIF}
prefs, mainunit, define_types, shaderui, graphics, LCLintf, Forms, SysUtils, Dialogs, mesh, meshify;
function IsReadable(lFilename: string): boolean;
begin
result := true;
if fileexists(lFilename) and (not FileIsReadableByThisExecutable(lFilename)) then begin
GLForm1.ScriptOutputMemo.Lines.Add('This application does not have permission to read "'+lFilename+'"');
result := false;
end;
end;
procedure SCRIPTFORMVISIBLE (VISIBLE: boolean);
begin
//ScriptForm.visible := VISIBLE;
if (GLForm1.ScriptPanel.Width < 24) and (VISIBLE) then
GLForm1.ScriptPanel.Width := 240;
if (not VISIBLE) then
GLForm1.ScriptPanel.Width := 0;
end;
function ATLASMAXINDEX(OVERLAY: integer): integer;
begin
if (OVERLAY < 1) or (OVERLAY > kMaxOverlays) then
result := gMesh.AtlasMaxIndex
else
result := gMesh.overlay[OVERLAY].atlasMaxIndex;
if result < 1 then
GLForm1.ScriptOutputMemo.Lines.Add('Current mesh is not an atlas.');
end;
procedure ATLASGRAYBG(const Filt: array of integer);
// ATLASGRAY([]);
// ATLASGRAY([17, 22, 32]);
var
i, maxROI: integer;
begin
maxROI := gMesh.AtlasMaxIndex;
setlength(gMesh.atlasTransparentFilter,0); //release
if (length(Filt) < 1) or (maxROI < 1) then begin
gMesh.isRebuildList:= true;
GLForm1.GLboxRequestUpdate(nil);
exit;
end;
setlength(gMesh.atlasTransparentFilter,maxROI+1);
for i := 0 to maxROI do
gMesh.atlasTransparentFilter[i] := false;
for i := Low(Filt) to High(Filt) do
if (Filt[i] > 0) and (Filt[i] <= maxROI) then
gMesh.atlasTransparentFilter[Filt[i]] := true;
gMesh.isRebuildList:= true;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure ATLASGRAY(OVERLAY: integer; const Filt: array of integer);
// ATLASGRAY([]);
// ATLASGRAY([17, 22, 32]);
var
i, maxROI: integer;
begin
if (OVERLAY < 1) or (OVERLAY > kMaxOverlays) then begin
ATLASGRAYBG(FILT);
exit;
end;
maxROI := gMesh.overlay[OVERLAY].AtlasMaxIndex;
setlength(gMesh.overlay[OVERLAY].atlasTransparentFilter,0); //release
if (length(Filt) < 1) or (maxROI < 1) then begin
gMesh.isRebuildList:= true;
GLForm1.GLboxRequestUpdate(nil);
exit;
end;
//ScriptForm.Memo2.Lines.Add(inttostr(OVERLAY)+'F= '+inttostr(maxROI));
setlength(gMesh.overlay[OVERLAY].atlasTransparentFilter,maxROI+1);
for i := 0 to maxROI do
gMesh.overlay[OVERLAY].atlasTransparentFilter[i] := false;
for i := Low(Filt) to High(Filt) do
if (Filt[i] > 0) and (Filt[i] <= maxROI) then
gMesh.overlay[OVERLAY].atlasTransparentFilter[Filt[i]] := true;
gMesh.isRebuildList:= true;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure ATLASHIDEBG(const Filt: array of integer);
// http://rvelthuis.de/articles/articles-openarr.html
// ATLASHIDE([]);
// ATLASHIDE([17, 22, 32]);
var
i: integer;
begin
setlength(gMesh.atlasHideFilter, length(Filt));
gMesh.isRebuildList:= true;
{$IFDEF LHRH}
if length(gMesh.RH.faces) > 0 then begin
setlength(gMesh.RH.atlasHideFilter, length(Filt));
gMesh.RH.isRebuildList:= true;
end;
{$ENDIF}
if length(Filt) < 1 then begin //release filter
GLForm1.GLboxRequestUpdate(nil);
exit;
end;
for i := Low(Filt) to High(Filt) do
gMesh.atlasHideFilter[i] := Filt[i];//ScriptForm.Memo2.Lines.Add('F= '+inttostr(Filt[i]));
{$IFDEF LHRH}
if length(gMesh.RH.faces) > 0 then begin
for i := Low(Filt) to High(Filt) do
gMesh.RH.atlasHideFilter[i] := Filt[i];//ScriptForm.Memo2.Lines.Add('F= '+inttostr(Filt[i]));
end;
{$ENDIF}
GLForm1.GLboxRequestUpdate(nil);
end;
procedure ATLASHIDE(OVERLAY: integer; const Filt: array of integer);
// http://rvelthuis.de/articles/articles-openarr.html
// ATLASHIDE([]);
// ATLASHIDE([17, 22, 32]);
var
i: integer;
begin
if (OVERLAY < 1) or (OVERLAY > kMaxOverlays) then begin
ATLASHIDEBG(FILT);
exit;
end;
gMesh.isRebuildList:= true;
setlength(gMesh.overlay[OVERLAY].atlasHideFilter, length(Filt));
{$IFDEF LHRH}
if length(gMesh.RH.faces) > 0 then begin
setlength(gMesh.RH.overlay[OVERLAY].atlasHideFilter, length(Filt));
gMesh.RH.isRebuildList:= true;
end;
{$ENDIF}
if length(Filt) < 1 then begin //release filter
GLForm1.GLboxRequestUpdate(nil);
exit;
end;
for i := Low(Filt) to High(Filt) do
gMesh.overlay[OVERLAY].atlasHideFilter[i] := Filt[i];//ScriptForm.Memo2.Lines.Add('F= '+inttostr(Filt[i]));
{$IFDEF LHRH}
if length(gMesh.RH.faces) > 0 then begin
for i := Low(Filt) to High(Filt) do
gMesh.RH.overlay[OVERLAY].atlasHideFilter[i] := Filt[i];//ScriptForm.Memo2.Lines.Add('F= '+inttostr(Filt[i]));
end;
{$ENDIF}
GLForm1.GLboxRequestUpdate(nil);
end;
procedure ATLASSTATMAP(ATLASNAME, STATNAME: string; const Indices: array of integer; const Intensities: array of single);
label
123;
const
kUndefined : single = 1/0; //NaN - used to indicate unused region - faces connected to these vertices will be discarded
var
i, idx, num_idx, num_inten, maxROI: integer;
ok: boolean;
err: string;
begin
err := '';
num_idx := length(Indices);
num_inten := length(Intensities);
if (num_inten < 1) then begin
err := 'No intensities specified';
goto 123;
end;
if (num_idx > 1) and (num_idx <> num_inten) then begin
err := 'Number of indices ('+inttostr(num_idx)+') does not match number of intensities ('+inttostr(num_inten)+')';
goto 123;
end;
if not IsReadable(ATLASNAME) then
goto 123;
//ignore: preserve previous filter setlength(gMesh.AtlasHide, 0); //show all regions - we might need some for parsing
if not GLForm1.OpenMesh(ATLASNAME) then begin
err := 'Unable to load mesh named "'+ATLASNAME+'"';
goto 123;
end;
maxROI := gMesh.AtlasMaxIndex;
if maxROI < 1 then begin
err := 'This mesh not an Atlas "'+ATLASNAME+'"';
goto 123;
end;
if (num_idx = 0) and (maxROI <> num_inten) then begin
err := 'Expected precisely '+inttostr(maxROI)+' intensities, not '+inttostr(num_inten);
goto 123;
end;
//create temporary data - no need to save a file
setlength(gMesh.tempIntensityLUT, maxROI+1);
for i := 0 to maxROI do
gMesh.tempIntensityLUT[i] := kUndefined;
if (length(Indices) < 1) then begin //no indices - precise mapping
for i := 1 to maxROI do
gMesh.tempIntensityLUT[i] := Intensities[i-1]; //e.g. first intensity is indexed from 0
end else begin //indexed mapping - only specified regions are used
for i := 0 to (length(Indices) - 1) do begin
idx := Indices[i];
if (idx < 0) or (idx > maxROI) then continue;
gMesh.tempIntensityLUT[idx] := Intensities[i];
end;
end;
//load temporary file
ok := gMesh.LoadOverlay('',false);
err := gMesh.errorString;
if not ok then goto 123;
if STATNAME <> '' then begin
STATNAME := DefaultToHomeDir(STATNAME);
STATNAME := changefileext(STATNAME,'.mz3');
gMesh.SaveOverlay(STATNAME, gMesh.OpenOverlays);
GLForm1.ScriptOutputMemo.Lines.Add('Creating mesh '+STATNAME);
end;
//err := gMesh.AtlasStatMapCore(AtlasName, StatName, idxs, intens);
123:
if err <> '' then //report error
GLForm1.ScriptOutputMemo.Lines.Add('ATLASSTATMAP: '+err);
GLForm1.GLboxRequestUpdate(nil);
GLForm1.UpdateToolbar;
GLForm1.UpdateLayerBox(true);
end;
procedure BMPZOOM(Z: byte);
begin
if (Z > 10) or (Z < 1) then
Z := 1;
gPrefs.ScreenCaptureZoom := Z;
end;
procedure RESETDEFAULTS;
begin
GLForm1.CloseMenuClick(nil);
GLForm1.ResetMenuClick(nil);
end;
function VERSION(): string;
begin
result := kVers;
end;
function EXISTS(lFilename: string): boolean;
begin
result := FileExists(lFilename);
end;
procedure CAMERAPAN(X, Y: single);
begin
if (X > 1) then X := 1;
if (X < -1) then X := -1;
if (Y > 1) then Y := 1;
if (Y < -1) then Y := -1;
gPrefs.ScreenPan.X := X;
gPrefs.ScreenPan.Y := Y;
//GLBox.Invalidate;
end;
procedure CAMERADISTANCE(DISTANCE: single);
begin
GLForm1.SetDistance(DISTANCE);
end;
procedure AZIMUTH (DEG: integer);
begin
gAzimuth := gAzimuth + DEG;
while gAzimuth < 0 do
gAzimuth := gAzimuth + 360;
while gAzimuth > 359 do
gAzimuth := gAzimuth - 360;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure HEMISPHEREDISTANCE (DX: single);
begin
gPrefs.DisplaceLHRH:=DX;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure HEMISPHEREPRY (DEG: single);
begin
gPrefs.PryLHRH:=DEG;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure PITCH (DEG: single);
begin
gPrefs.PITCH:=DEG;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure MESHHEMISPHERE (VAL: integer);
begin
if VAL < 0 then
GLForm1.BilateralLeftOnlyMenu.click
else if VAL > 0 then
GLForm1.BilateralRightOnlyMenu.click
else
GLForm1.BilateralEitherMenu.click;
end;
procedure ELEVATION (DEG: integer);
begin
gElevation := gElevation -Deg;
IntBound(gElevation,-90,90);
GLForm1.GLboxRequestUpdate(nil);
end;
procedure AZIMUTHELEVATION (AZI, ELEV: integer);
begin
gElevation := ELEV;
IntBound(gElevation,-90,90);
gAzimuth := AZI;
while gAzimuth < 0 do
gAzimuth := gAzimuth + 360;
while gAzimuth > 359 do
gAzimuth := gAzimuth - 360;
GLForm1.GLboxRequestUpdate(nil);
end;
procedure VIEWAXIAL (STD: boolean);
begin
if STD then
AZIMUTHELEVATION(0,90)
else
AZIMUTHELEVATION(180,-90);
end;
procedure VIEWCORONAL (STD: boolean);
begin
if STD then
AZIMUTHELEVATION(0,0)
else
AZIMUTHELEVATION(180,0);
end;
procedure FULLSCREEN (isFullScreen: boolean);
begin
if (isFullScreen) then begin
GLForm1.WindowState := wsFullScreen;// wsMaximized
{$IFNDEF LCLCocoa}GLForm1.ExitFullScreenMenu.Visible:=true;{$ENDIF} //Linux has issues getting out of full screen
end else
GLForm1.WindowState := wsMaximized;
end;
procedure FONTNAME(name: string);
begin
gPrefs.FontName:= name;
GLForm1.UpdateFont(false);
end;
procedure VIEWSAGITTAL (STD: boolean);
begin
if STD then
AZIMUTHELEVATION(90,0)
else
AZIMUTHELEVATION(270,0);
end;
procedure MESHREVERSEFACES;
begin
GLForm1.ReverseFacesMenu.Click;
end;
procedure MESHCURV;
begin
GLForm1.CurvMenuTemp.Click;
end;
function MESHCREATE(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer): boolean;
var
nVtx: integer;
meshnamePth: string;
begin
//Nii2MeshCore(niiname, meshname: string; threshold, decimateFrac: single; minimumClusterVox, smoothStyle: integer): integer;
result := false;
if (niiname = '') then begin
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate error: no NIfTI name');
exit;
end;
if (meshname = '') then begin
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate error: no mesh name');
exit;
end;
meshnamePth := DefaultToHomeDir(meshname);
nVtx := Nii2MeshCore(niiname, meshnamePth, threshold, decimateFrac, minimumClusterVox, smoothStyle);
if (nVtx < 3) then
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate error: no mesh created')
else begin
GLForm1.ScriptOutputMemo.Lines.Add('meshcreate generated mesh with '+inttostr(nVtx)+' vertices');
result := true;
end;
end;
procedure MESHLOAD(lFilename: string);
begin
if not IsReadable(lFilename) then exit;
if not GLForm1.OpenMesh(lFilename) then begin
GLForm1.ScriptOutputMemo.Lines.Add('Unable to load mesh named "'+lFilename+'"');
end;
end;
procedure ATLAS2NODE(lFilename: string);
begin
if not IsReadable(lFilename) then begin
GLForm1.ScriptOutputMemo.Lines.Add('Unable to create file named "'+lFilename+'"');
exit;
end;
GLForm1.ScriptOutputMemo.Lines.Add('Creating file named "'+lFilename+'"');
if not GLForm1.Atlas2Node(lFilename) then begin
GLForm1.ScriptOutputMemo.Lines.Add('Unable to convert mesh to nodes (make sure mesh is not watertight or that .annot file is loaded)');
end;
end;
procedure MESHSAVE(lFilename: string);
begin
if not GLForm1.SaveMeshCore(lFilename) then begin
GLForm1.ScriptOutputMemo.Lines.Add('Unable to save mesh named "'+lFilename+'"');
end;
end;
procedure MESHOVERLAYORDER (FLIP: boolean);
begin
gPrefs.isFlipMeshOverlay:= FLIP;
end;
procedure OVERLAYLOAD(lFilename: string);
begin
if not IsReadable(lFilename) then exit;
if not GLForm1.OpenOverlay(lFilename)then
GLForm1.ScriptOutputMemo.Lines.Add('Unable to load overlay named "'+lFilename+'"');
end;
procedure TRACKLOAD(lFilename: string);
begin
if not IsReadable(lFilename) then exit;
if not GLForm1.OpenTrack(lFilename) then
GLForm1.ScriptOutputMemo.Lines.Add('Unable to load track named "'+lFilename+'"');
end;
procedure NODELOAD(lFilename: string);
begin
if not IsReadable(lFilename) then exit;
if not GLForm1.OpenNode(lFilename) then
GLForm1.ScriptOutputMemo.Lines.Add('Unable to load node named "'+lFilename+'"');
end;
procedure EDGELOAD(lFilename: string);
begin
if not IsReadable(lFilename) then exit;
if not GLForm1.OpenEdge(lFilename)then
GLForm1.ScriptOutputMemo.Lines.Add('Unable to load edge named "'+lFilename+'"');
end;
procedure SHADERNAME(lFilename: string);
begin
SetShaderAndDrop(lFilename);
end;
procedure SHADERMATCAP(lFilename: string);
var
i: integer;
begin
i := GLForm1.MatCapDrop.Items.IndexOf(lFilename);
if i < 0 then begin
if GLForm1.MatCapDrop.Items.Count < 1 then
GLForm1.ScriptOutputMemo.Lines.Add('No matcap images available: reinstall Surfice.')
else
GLForm1.ScriptOutputMemo.Lines.Add('Unable to find matcap named '+lFilename+'. Solution: choose an available matcap, e.g. "'+GLForm1.MatCapDrop.Items[0]+'"');
exit;
end;
GLForm1.MatCapDrop.ItemIndex := i;
GLForm1.MatCapDropChange(nil);
if not GLForm1.MatCapDrop.visible then
GLForm1.ScriptOutputMemo.Lines.Add('Hint: shadermatcap() requires using a shader that supports matcaps (use shadername() to select a new shader).')
end;
procedure SHADERFORBACKGROUNDONLY(BGONLY: boolean);
begin
gPrefs.ShaderForBackgroundOnly:= BGONLY;
GLForm1.ShaderForBackgroundOnlyCheck.Checked := BGONLY;
GLForm1.GLBoxRequestUpdate(nil);
end;
procedure SHADERAMBIENTOCCLUSION( lVal: single);
begin
GLForm1.occlusionTrack.Position := round(lVal * GLForm1.occlusionTrack.Max);
end;
procedure SHADERLIGHTAZIMUTHELEVATION (AZI, ELEV: integer);
begin
GLForm1.LightElevTrack.Position := Elev;
GLForm1.LightAziTrack.Position := Azi;
GLForm1.SurfaceAppearanceChange(nil);
end;
procedure ATLASSATURATIONALPHA(lSaturation, lTransparency: single);
begin
GLForm1.meshTransparencyTrack.Position := round(lTransparency * GLForm1.meshAlphaTrack.Max);
GLForm1.MeshSaturationTrack.Position := round(lSaturation * GLForm1.MeshSaturationTrack.Max);
//gMesh.isRebuildList:= true;
//GLBoxRequestUpdate(nil);
end;
procedure SHADERXRAY(lObject, lOverlay: single);
begin
GLForm1.meshAlphaTrack.Position := round(lObject * GLForm1.meshAlphaTrack.Max);
GLForm1.meshBlendTrack.Position := round(lOverlay * GLForm1.meshBlendTrack.Max);
end;
procedure SHADERADJUST(lProperty: string; lVal: single);
begin
SetShaderAdjust(lProperty,lVal);
end;
procedure SAVEBMP(lFilename: string);
begin
GLForm1.SaveBitmap(lFilename);
end;
procedure SAVEBMPXY(lFilename: string; X,Y: integer);
begin
GLForm1.SaveBitmap(lFilename, X, Y);
end;
procedure TRACKPREFS(lLength,lWidth,lDither: single);
begin
GLForm1.TrackLengthTrack.Position := round(lLength);
GLForm1.TrackWidthTrack.Position := round(lWidth);
GLForm1.TrackDitherTrack.Position := round(lDither * GLForm1.TrackDitherTrack.Max);
end;
procedure CONTOUR(layer: integer);
begin
gMesh.Contours(layer);
GLForm1.GLboxRequestUpdate(nil);
GLForm1.UpdateToolbar;
GLForm1.UpdateLayerBox(true);
end;
procedure BACKCOLOR (R,G,B: byte);
begin
gPrefs.BackColor := RGBToColor(R,G,B);
GLForm1.GLBoxRequestUpdate(nil);
end;
procedure EDGECOLOR(name: string; varies: boolean);
var
OK: boolean;
begin
GLForm1.LUTdropEdge.ItemIndex := GLForm1.ComboBoxName2Index(GLForm1.LUTdropEdge, name, OK);
GLForm1.EdgeColorVariesCheck.Checked := varies;
end;
procedure EDGETHRESH (LO, HI: single);
begin
GLForm1.EdgeMinEdit.Value := LO;
GLForm1.EdgeMaxEdit.Value := HI;
GLForm1.NodePrefChange(nil);
end;
procedure MODALMESSAGE(STR: string);
begin
showmessage(STR);
end;
procedure MODELESSMESSAGE(STR: string);
begin
GLForm1.ScriptOutputMemo.Lines.Add(STR);
GLForm1.Refresh;
end;
procedure NODECOLOR(name: string; varies: boolean);
var
OK: boolean;
begin
GLForm1.LUTdropNode.ItemIndex := GLForm1.ComboBoxName2Index(GLForm1.LUTdropNode, name, OK);
GLForm1.NodeColorVariesCheck.Checked := varies;
end;
procedure NODETHRESH (LO, HI: single);
begin
GLForm1.NodeMinEdit.Value := LO;
GLForm1.NodeMaxEdit.Value := HI;
GLForm1.NodePrefChange(nil);
end;
procedure NODETHRESHBYSIZENOTCOLOR (NodeThresholdBySize: boolean);
begin
if NodeThresholdBySize then
GLForm1.NodeThreshDrop.ItemIndex := 0 //threshold by size
else
GLForm1.NodeThreshDrop.ItemIndex := 1; //threshold by color
GLForm1.NodeThreshDropChange(nil);
end;
procedure NODEHEMISPHERE(VAL: integer);
begin
if VAL < 0 then
GLForm1.RestrictLeftMenu.Click
else if VAL > 0 then
GLForm1.RestrictRightMenu.Click
else
GLForm1.RestrictNoMenu.Click;
end;
procedure NODEPOLARITY(VAL: integer);
begin
if VAL < 0 then
GLForm1.RestrictNegEdgeMenu.Click
else if VAL > 0 then
GLForm1.RestrictPosEdgeMenu.Click
else
GLForm1.RestrictAnyEdgeMenu.Click;
end;
procedure EDGESIZE(size: single; varies: boolean);
begin
GLForm1.edgeScaleTrack.Position := round(size * 10);
GLForm1.EdgeSizeVariesCheck.checked := varies;
GLForm1.NodePrefChange(nil);
end;
procedure EDGECREATE(filename: string; const mtx: array of single);
var
n, i,j, k, nRow : integer;
fnm : string;
f : TextFile;
begin
n := length(mtx);
nRow := round(sqrt(n));
if (n < 1) or ((nRow * nRow) <> n) then begin
GLForm1.ScriptOutputMemo.Lines.Add('EDGECREATE expects a matrix that has a size of n*n. For example, a connectome with 3 nodes should have a matrix with 9 items.');
exit;
end;
//write output
if filename = '' then
fnm := 'surficeEdgeTemp.edge'
else
fnm := filename;
fnm := changeFileExt(fnm, '.edge');
fnm := DefaultToHomeDir(fnm);
FileMode := fmOpenWrite;
AssignFile(f, fnm);
ReWrite(f);
WriteLn(f, '# created with Surf Ice EDGECREATE command');
k := 0;
for i := 0 to (nRow-1) do begin
for j := 0 to (nRow-1) do begin
if j < (nRow -1) then
Write(f, floattostr(mtx[k])+kTab)
else
Writeln(f, floattostr(mtx[k]));
inc(k);
end;
end;
CloseFile(f);
FileMode := fmOpenRead;
if not GLForm1.OpenEdge(fnm) then
GLForm1.ScriptOutputMemo.Lines.Add('EDGECREATE Unable to load edge file named "'+fnm+'" (use nodecreate or nodeload first) ')
else
GLForm1.ScriptOutputMemo.Lines.Add('EDGECREATE created "'+fnm+'"')
end;
procedure NODECREATE(filename: string; const x,y,z,clr,radius: array of single);
var
n, i : integer;
fnm : string;
f : TextFile;
c,r: array of single;
begin
n := length(x);
if (n < 1) or (n <> length(y)) or (n <> length(z)) then begin
GLForm1.ScriptOutputMemo.Lines.Add('NODECREATE error: x,y,z must have same number of nodes');
exit;
end;
if (length(clr) > 1) and (length(clr) <> n) then begin
GLForm1.ScriptOutputMemo.Lines.Add('NODECREATE error: color must have same number of items as x,y and z');
exit;
end;
if (length(radius) > 1) and (length(radius) <> n) then begin
GLForm1.ScriptOutputMemo.Lines.Add('NODECREATE error: radius must have same number of items as x,y and z');
exit;
end;
//set color
setlength(c,n);
if length(clr) < 1 then
c[0] := 1
else
c[0] := clr[0];
if length(clr) = n then
for i := 0 to (n-1) do
c[i] := clr[i]
else
for i := 0 to (n-1) do
c[i] := c[0];
//set radius
setlength(r,n);
if length(radius) < 1 then
r[0] := 1
else
r[0] := radius[0];
if length(radius) = n then
for i := 0 to (n-1) do
r[i] := radius[i]
else
for i := 0 to (n-1) do
r[i] := r[0];
//write output
if filename = '' then
fnm := 'surficeNodeTemp.node'
else
fnm := filename;
fnm := changeFileExt(fnm, '.node');
fnm := DefaultToHomeDir(fnm);
FileMode := fmOpenWrite;
AssignFile(f, fnm);
ReWrite(f);
WriteLn(f, '# created with Surf Ice NODECREATE command');
for i := 0 to (n-1) do
WriteLn(f, format('%g %g %g %g %g', [x[i], y[i], z[i], c[i], r[i]]));
CloseFile(f);
FileMode := fmOpenRead;
if not GLForm1.OpenNode(fnm) then
GLForm1.ScriptOutputMemo.Lines.Add('NODECREATE Unable to load node named "'+fnm+'"')
else
GLForm1.ScriptOutputMemo.Lines.Add('NODECREATE created "'+fnm+'"')
end;
procedure NODESIZE(size: single; varies: boolean);
begin
GLForm1.nodeScaleTrack.Position := round(size * 10);
GLForm1.NodeSizeVariesCheck.checked := varies;
GLForm1.NodePrefChange(nil);
end;
procedure MESHCOLOR (R,G,B: byte);
begin
gPrefs.ObjColor := RGBToColor(R,G,B);
GLForm1.GLBoxRequestUpdate(nil);
end;
procedure CLIP (DEPTH: single);
begin
GLForm1.ClipTrack.position := round(Depth * GLForm1.ClipTrack.Max);
end;
procedure CLIPAZIMUTHELEVATION (DEPTH,AZI,ELEV: single);
begin
GLForm1.ClipTrack.position := round(Depth * GLForm1.ClipTrack.Max);
GLForm1.ClipAziTrack.position := round(Azi);
GLForm1.ClipElevTrack.position := round(Elev);
end;
procedure COLORBARPOSITION(P: integer);
begin
gPrefs.ColorBarPosition:= P;
GLForm1.SetColorBarPosition;
GLForm1.GLBoxRequestUpdate(nil);
end;
procedure COLORBARVISIBLE (VISIBLE: boolean);
begin
gPrefs.Colorbar := VISIBLE;
GLForm1.ColorBarVisibleMenu.Checked := VISIBLE;
GLForm1.GLBoxRequestUpdate(nil);
end;
procedure COLORBARCOLOR (COLOR: integer);
begin
gPrefs.ColorbarColor := COLOR;
GLForm1.ClrbarClr(gPrefs.ColorbarColor);
if (gPrefs.ColorbarColor = GLForm1.WhiteClrbarMenu.tag) then GLForm1.WhiteClrbarMenu.checked := true;
if (gPrefs.ColorbarColor = GLForm1.TransWhiteClrbarMenu.tag) then GLForm1.TransWhiteClrbarMenu.checked := true;
if (gPrefs.ColorbarColor = GLForm1.BlackClrbarMenu.tag) then GLForm1.BlackClrbarMenu.checked := true;
if (gPrefs.ColorbarColor = GLForm1.TransBlackClrbarMenu.tag) then GLForm1.TransBlackClrbarMenu.checked := true;
GLForm1.GLBoxRequestUpdate(nil);
end;
procedure OVERLAYADDITIVE (ADD: boolean);
begin
if ADD <> GLForm1.AdditiveOverlayMenu.Checked then
GLForm1.AdditiveOverlayMenu.Click;
end;
procedure OVERLAYEXTREME (lOverlay, lMode: integer);
begin
GLForm1.OVERLAYEXTREME(lOverlay, lMode);
end;
procedure OVERLAYMINMAX (lOverlay: integer; lMin,lMax: single);
begin
GLForm1.OVERLAYMINMAX(lOverlay, lMin,lMax);
end;
procedure OVERLAYTRANSPARENCYONBACKGROUND(lPct: integer);
begin
if lPct < 12 then
GLForm1.Transparency0.Click
else if lPct < 37 then
GLForm1.Transparency25.Click
else if lPct < 62 then
GLForm1.Transparency50.Click
else
GLForm1.Transparency75.Click;
end;
procedure OVERLAYINVERT(lOverlay: integer; INVERT: boolean);
begin
GLForm1.OverlayInvert(lOverlay, INVERT);
end;
procedure OVERLAYOVERLAPOVERWRITE (OVERWRITE: boolean);
begin
if (gMesh.OverlappingOverlaysOverwrite <> OVERWRITE) then GLForm1.OverlayTimer.Enabled := true;
gMesh.OverlappingOverlaysOverwrite := OVERWRITE;
end;
procedure OVERLAYSMOOTHVOXELWISEDATA (SMOOTH: boolean);
begin
gPrefs.SmoothVoxelwiseData:= SMOOTH;
end;
procedure OVERLAYTRANSLUCENT(lOverlay: integer; TRANSLUCENT: boolean);
begin
if TRANSLUCENT then
GLForm1.OverlayVisible(lOverlay, kLUTtranslucent)
else
GLForm1.OverlayVisible(lOverlay, kLUTopaque);
end;
procedure OVERLAYOPACITY(lOverlay: integer; OPACITY: byte);
begin
if OPACITY > 100 then
OPACITY := 100;
GLForm1.OverlayVisible(lOverlay, OPACITY);
end;
procedure OVERLAYVISIBLE(lOverlay: integer; VISIBLE: boolean);
begin
if VISIBLE then
GLForm1.OverlayVisible(lOverlay, kLUTopaque)
else
GLForm1.OverlayVisible(lOverlay, kLUTinvisible);
end;
procedure OVERLAYCOLOR(lOverlay: integer; rLo, gLo, bLo, rHi, gHi, bHi: byte);
begin
GLForm1.OVERLAYCOLOR(lOverlay, rLo, gLo, bLo, rHi, gHi, bHi);
end;
procedure OVERLAYCOLORNAME(lOverlay: integer; lFilename: string);
begin
GLForm1.OVERLAYCOLORNAME(lOverlay, lFilename);
end;
procedure OVERLAYCLOSEALL;
begin
GLForm1.CloseOverlaysMenuClick(nil);
end;
procedure ORIENTCUBEVISIBLE (VISIBLE: boolean);
begin
if GLForm1.OrientCubeMenu.Checked <> VISIBLE then
GLForm1.OrientCubeMenu.Click;
end;
procedure TRACKCLOSE;
begin
GLForm1.CloseTracksMenuClick(nil);
end;
procedure NODECLOSE;
begin
GLForm1.CloseNodesMenuClick(nil);
end;
procedure CLOSEALL;
begin
GLForm1.CloseMenuClick(nil);
end;
procedure QUIT;
begin
GLForm1.Close;
end;
(*procedure HaltScript;
begin
ScriptForm.Memo2.Lines.Add('Script stopped due to errors.');
ScriptForm.Stop1Click(nil);
end; *)
procedure WAIT (MSEC: integer);
var
{$IFDEF FPC} lEND: QWord; {$ELSE}lEND : DWord;{$ENDIF}
// var MemoryStatus: TMemoryStatus;
begin
//MemoryStatus.dwLength := SizeOf(MemoryStatus) ;
// GlobalMemoryStatus(MemoryStatus) ;
//GLForm1.Caption := IntToStr(MemoryStatus.dwMemoryLoad) +' Available bytes in paging file';
GLForm1.GLInvalidate;
if MSEC < 0 then exit;
{$IFDEF FPC} lEND := GetTickCount64+DWord(MSEC);{$ELSE}lEND := GetTickCount+DWord(MSEC);{$ENDIF}
//FinishRender;//June 09
if MSEC <= 0 then exit;
repeat
//Application.HandleMessage;
Application.ProcessMessages;//HandleMessage
{$IFDEF FPC}until (GetTickCount64 >= lEnd); {$ELSE}until (GetTickCount >= lEnd);{$ENDIF}
end;
end.
| 33.527322 | 171 | 0.71013 |
6ab116af7137c1a2300ae13885959f74d9068870 | 3,123 | pas | Pascal | zlog/UScratchSheet.pas | jr8ppg/zLog | bbf51080f426e1b62df9a96cdea9623668e75124 | [
"MIT"
]
| 8 | 2019-10-29T14:43:45.000Z | 2021-09-27T13:17:17.000Z | zlog/UScratchSheet.pas | jr8ppg/zLog | bbf51080f426e1b62df9a96cdea9623668e75124 | [
"MIT"
]
| 205 | 2020-11-06T01:12:48.000Z | 2022-03-16T23:44:49.000Z | zlog/UScratchSheet.pas | jr8ppg/zLog | bbf51080f426e1b62df9a96cdea9623668e75124 | [
"MIT"
]
| 10 | 2019-11-06T13:00:34.000Z | 2022-01-13T07:32:08.000Z | unit UScratchSheet;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
UConsolePad, StdCtrls, ExtCtrls, Menus, System.UITypes;
type
TScratchSheet = class(TConsolePad)
PopupMenu: TPopupMenu;
LocalOnly: TMenuItem;
Clear1: TMenuItem;
procedure EditKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure LocalOnlyClick(Sender: TObject);
procedure Clear1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private
{ Private declarations }
Buffer : TStringList;
public
procedure AddBuffer(S : string);
procedure AddLine(S : string); override;
procedure UpdateData;
{ Public declarations }
end;
implementation
uses Main, UZLinkForm;
{$R *.DFM}
procedure TScratchSheet.AddBuffer(S: string);
begin
Buffer.Add(S);
end;
procedure TScratchSheet.EditKeyPress(Sender: TObject; var Key: Char);
begin
case Key of
Char(vkReturn): begin
// AddLine(Edit.Text);
Buffer.Add('&' + Edit.Text);
MainForm.ZLinkForm.SendScratchMessage(Edit.Text);
UpdateData;
Edit.Text := '';
// MainForm.ProcessConsoleCommand(str);
Key := #0;
end;
Char(vkEscape): begin
Key := #0;
end;
end;
end;
procedure TScratchSheet.AddLine(S: string);
// var _VisRows, _TopRow : integer;
begin
inherited;
end;
procedure TScratchSheet.FormCreate(Sender: TObject);
begin
inherited;
MaxLines := 25;
Buffer := TStringList.Create;
end;
procedure TScratchSheet.FormDestroy(Sender: TObject);
begin
inherited;
Buffer.Free();
end;
procedure TScratchSheet.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
case Key of
VK_ESCAPE:
MainForm.LastFocus.SetFocus;
end;
end;
procedure TScratchSheet.UpdateData;
var
i, _VisRows, _TopRow: integer;
str: string;
count: integer;
begin
ListBox.Clear;
count := 0;
for i := Buffer.count - 1 downto 0 do begin
str := Buffer[i];
if LocalOnly.Checked then begin
if str <> '' then begin
if str[1] = '&' then begin
Delete(str, 1, 1);
inc(count);
ListBox.Items.Insert(0, str);
end;
end;
end
else begin
if str <> '' then
if str[1] = '&' then
Delete(str, 1, 1);
ListBox.Items.Insert(0, str);
inc(count);
end;
if count >= MaxLines then
break;
end;
_VisRows := ListBox.ClientHeight div ListBox.ItemHeight;
_TopRow := ListBox.Items.count - _VisRows + 1;
if _TopRow > 0 then
ListBox.TopIndex := _TopRow
else
ListBox.TopIndex := 0;
end;
procedure TScratchSheet.LocalOnlyClick(Sender: TObject);
begin
// inherited;
LocalOnly.Checked := Not(LocalOnly.Checked);
UpdateData;
end;
procedure TScratchSheet.Clear1Click(Sender: TObject);
begin
inherited;
Buffer.Clear;
UpdateData;
end;
end.
| 21.839161 | 88 | 0.642651 |
f1d4da1a065bca24f5e3f416ce7193437d4ce55b | 215 | pas | Pascal | ExerciciosPascal/023ValorH_JoaoPorath.pas | joaofilipeporath/Introducao-Programacao | 20d97c0280fc43f6fa2324e17943130041af2783 | [
"MIT"
]
| null | null | null | ExerciciosPascal/023ValorH_JoaoPorath.pas | joaofilipeporath/Introducao-Programacao | 20d97c0280fc43f6fa2324e17943130041af2783 | [
"MIT"
]
| null | null | null | ExerciciosPascal/023ValorH_JoaoPorath.pas | joaofilipeporath/Introducao-Programacao | 20d97c0280fc43f6fa2324e17943130041af2783 | [
"MIT"
]
| null | null | null | program valorH;
uses crt;
var
h : real;
i, j : integer;
begin
h:=0;
j:=1;
for i:=1 to 50 do
begin
h:= h + j/i;
j:=j+2;
end;
writeln('Valor de H = ', h:2:2);
readln;
end. | 10.75 | 32 | 0.460465 |
47e84be20fa80a263688f872410b21c32914bc1f | 3,381 | pas | Pascal | ide/prefsunit.pas | alb42/MUIClass | 4223b4f456b770d40f9542707705cd94af612cd9 | [
"Unlicense"
]
| 3 | 2018-02-16T17:44:03.000Z | 2018-12-01T20:59:17.000Z | ide/prefsunit.pas | alb42/MUIClass | 4223b4f456b770d40f9542707705cd94af612cd9 | [
"Unlicense"
]
| null | null | null | ide/prefsunit.pas | alb42/MUIClass | 4223b4f456b770d40f9542707705cd94af612cd9 | [
"Unlicense"
]
| null | null | null | unit PrefsUnit;
{$mode objfpc}{$H+}
interface
uses
SysUtils, inifiles;
// Default Editor to use for editing Eventhandlers
const
{$ifdef AROS}
DEFEDITOR = 'sys:EdiSyn/EdiSyn';
EDITORMSG = 0;
{$else}
{$ifdef Amiga68k}
DEFEDITOR = 'sys:Tools/EditPad';
EDITORMSG = 0;
{$else}
{$ifdef MorphOS}
DEFEDITOR = 'sys:Applications/Scribble/Scribble';
EDITORMSG = 1;
{$else}
DEFEDITOR = 'c:ed';
EDITORMSG = 0;
{$endif}
{$endif}
{$endif}
type
TPrefsType = (ptString, ptInteger, ptBoolean);
TPrefsInit = record
Name: string;
ValType: TPrefsType;
DefaultStr: string;
ValueStr: string;
DefaultInt: Integer;
Value: Integer;
end;
const
NumSettings= 2;
var
PrefsInit: array[0..NumSettings - 1] of TPrefsInit =
(
// 0
(Name: 'Editor';
ValType: ptString;
DefaultStr: DEFEDITOR;
ValueStr: DEFEDITOR;
DefaultInt: 0;
Value: 0),
// 1
(Name: 'EditorMessage';
ValType: ptBoolean;
DefaultStr: '';
ValueStr: '';
DefaultInt: EDITORMSG;
Value: EDITORMSG)
);
type
TIDEPrefs = class
private
PrefsName: string;
IniFile: TIniFile;
function GetBoolItem(Idx: Integer): Boolean;
procedure SetBoolItem(Idx: Integer; AValue: Boolean);
function GetStrItem(Idx: Integer): string;
procedure SetStrItem(Idx: Integer; AValue: string);
public
constructor Create; virtual;
destructor Destroy; override;
property Editor: string index 0 read GetStrItem write SetStrItem;
property EditorMsg: Boolean index 1 read GetBoolItem write SetBoolItem;
end;
var
IDEPrefs: TIDEPrefs;
implementation
constructor TIDEPrefs.Create;
var
i: Integer;
begin
PrefsName := ChangeFileExt(ParamStr(0), '.ini');
IniFile := TIniFile.Create(PrefsName);
for i := 0 to High(PrefsInit) do
begin
case PrefsInit[i].ValType of
ptString: PrefsInit[i].ValueStr := IniFile.ReadString('General', PrefsInit[i].Name, PrefsInit[i].DefaultStr);
ptInteger, ptBoolean: PrefsInit[i].Value := IniFile.ReadInteger('General', PrefsInit[i].Name, PrefsInit[i].DefaultInt);
end;
end;
end;
destructor TIDEPrefs.Destroy;
var
i: Integer;
begin
for i := 0 to High(PrefsInit) do
begin
case PrefsInit[i].ValType of
ptString: IniFile.WriteString('General', PrefsInit[i].Name, PrefsInit[i].ValueStr);
ptInteger, ptBoolean: IniFile.WriteInteger('General', PrefsInit[i].Name, PrefsInit[i].Value);
end;
end;
IniFile.UpdateFile;
IniFile.Free;
inherited;
end;
function TIDEPrefs.GetBoolItem(Idx: Integer): Boolean;
begin
Result := False;
writeln('get index ', Idx);
if (Idx >= 0) and (Idx <= High(PrefsInit)) then
Result := PrefsInit[Idx].Value <> 0;
writeln('Idx is ', Result);
end;
procedure TIDEPrefs.SetBoolItem(Idx: Integer; AValue: Boolean);
begin
if (Idx >= 0) and (Idx <= High(PrefsInit)) then
PrefsInit[Idx].Value := Integer(AValue);
end;
function TIDEPrefs.GetStrItem(Idx: Integer): string;
begin
Result := '';
if (Idx >= 0) and (Idx <= High(PrefsInit)) then
Result := PrefsInit[Idx].ValueStr;
end;
procedure TIDEPrefs.SetStrItem(Idx: Integer; AValue: string);
begin
if (Idx >= 0) and (Idx <= High(PrefsInit)) then
PrefsInit[Idx].ValueStr := AValue;
end;
initialization
IDEPrefs := TIDEPrefs.Create;
finalization
IDEPrefs.Free;
end. | 22.844595 | 126 | 0.669329 |
47f37dd586296b5b7e22dab5947e72e2ade74b52 | 698 | pas | Pascal | code/ooFS.Command.Intf.pas | VencejoSoftware/ooFileSystem | fd1e8937326e648bfb371f7d9f13edcb0bad4ad6 | [
"BSD-3-Clause"
]
| null | null | null | code/ooFS.Command.Intf.pas | VencejoSoftware/ooFileSystem | fd1e8937326e648bfb371f7d9f13edcb0bad4ad6 | [
"BSD-3-Clause"
]
| null | null | null | code/ooFS.Command.Intf.pas | VencejoSoftware/ooFileSystem | fd1e8937326e648bfb371f7d9f13edcb0bad4ad6 | [
"BSD-3-Clause"
]
| 2 | 2019-11-21T03:19:12.000Z | 2021-01-26T04:52:12.000Z | {$REGION 'documentation'}
{
Copyright (c) 2016, Vencejo Software
Distributed under the terms of the Modified BSD License
The full license is distributed with this software
}
{
Interface for all file system commands
@created(10/02/2016)
@author Vencejo Software <www.vencejosoft.com>
}
{$ENDREGION}
unit ooFS.Command.Intf;
interface
type
{$REGION 'documentation'}
{
@abstract(Interface for all file system commands)
Define an structure for fs commands
@member(
Execute Run the command
@return(A generic type to implements)
)
}
{$ENDREGION}
IFSCommand<T> = interface
['{B6D2E46E-EC2D-4852-9FDA-046D7561AC21}']
function Execute: T;
end;
implementation
end.
| 19.388889 | 57 | 0.727794 |
17f179593cf04389fa6cf33f5723269349627742 | 38,161 | dfm | Pascal | HWScontrol/source/ugaleriadefotos.dfm | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| 1 | 2022-02-28T11:28:18.000Z | 2022-02-28T11:28:18.000Z | HWScontrol/source/ugaleriadefotos.dfm | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | HWScontrol/source/ugaleriadefotos.dfm | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | object galeriadefotos: Tgaleriadefotos
Left = 210
Top = 184
BorderStyle = bsNone
ClientHeight = 392
ClientWidth = 743
Color = 16119285
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
OnMouseDown = FormMouseDown
OnMouseMove = FormMouseMove
OnMouseUp = FormMouseUp
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object pn_tit: TPanel
Left = 0
Top = 0
Width = 743
Height = 20
Align = alTop
Color = 14540253
TabOrder = 0
object Image3: TImage
Left = 1
Top = 1
Width = 741
Height = 18
Align = alClient
Stretch = True
OnMouseDown = Image3MouseDown
end
object biSystemMenu: TImage
Left = 4
Top = 3
Width = 15
Height = 14
Proportional = True
Stretch = True
Transparent = True
end
object bt_sobre: TSpeedButton
Left = 679
Top = 3
Width = 14
Height = 14
Hint = 'Sobre'
Caption = '?'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_sobreClick
end
object bt_minimize: TSpeedButton
Left = 695
Top = 3
Width = 14
Height = 14
Hint = 'Minimizar janela'
Caption = '-'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_minimizeClick
end
object bt_maximiza: TSpeedButton
Left = 710
Top = 3
Width = 14
Height = 14
Hint = 'Maximizar'
Caption = #143
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_maximizaClick
end
object bt_fechar: TSpeedButton
Left = 725
Top = 3
Width = 14
Height = 14
Hint = 'Fechar janela'
Caption = 'X'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = bt_fecharClick
end
object tb_mnt: TLabel
Left = 24
Top = 3
Width = 4
Height = 13
Font.Charset = DEFAULT_CHARSET
Font.Color = 5979648
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
Transparent = True
end
object Label12: TLabel
Left = 24
Top = 3
Width = 91
Height = 13
Caption = 'Galeria de fotos'
Font.Charset = DEFAULT_CHARSET
Font.Color = 5979648
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
ParentFont = False
Transparent = True
end
end
object pn_status: TPanel
Left = 0
Top = 375
Width = 743
Height = 17
Align = alBottom
BorderStyle = bsSingle
Color = 14540253
TabOrder = 1
object Image4: TImage
Left = 1
Top = 1
Width = 737
Height = 11
Align = alClient
Stretch = True
end
end
object pn_editor: TPanel
Left = 0
Top = 20
Width = 743
Height = 355
Align = alClient
BevelInner = bvRaised
BevelOuter = bvLowered
Color = 16119285
TabOrder = 2
object Splitter1: TSplitter
Left = 2
Top = 177
Width = 739
Height = 3
Cursor = crVSplit
Align = alTop
end
object GroupBox1: TGroupBox
Left = 2
Top = 2
Width = 739
Height = 175
Align = alTop
Caption = 'Lista de '#225'lbuns:'
Color = 16119285
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
ParentColor = False
ParentFont = False
TabOrder = 0
object db_cds: TDBGrid
Left = 2
Top = 14
Width = 310
Height = 159
TabStop = False
Align = alClient
Color = clWhite
DataSource = dm.source_sql
FixedColor = 15066597
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgCancelOnExit]
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clBlack
TitleFont.Height = -9
TitleFont.Name = 'Verdana'
TitleFont.Style = [fsBold]
OnCellClick = db_cdsCellClick
OnKeyDown = db_cdsKeyDown
OnKeyUp = db_cdsKeyUp
end
object Panel2: TPanel
Left = 312
Top = 14
Width = 425
Height = 159
Align = alRight
Color = 16119285
TabOrder = 1
object Panel3: TPanel
Left = 1
Top = 131
Width = 423
Height = 27
Align = alBottom
BevelInner = bvRaised
BevelOuter = bvLowered
Color = 16119285
TabOrder = 0
object ToolBar2: TToolBar
Left = 193
Top = 2
Width = 228
Height = 23
Align = alRight
AutoSize = True
Caption = 'pn_barra'
EdgeBorders = []
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
TabOrder = 0
object SpeedButton8: TSpeedButton
Left = 0
Top = 2
Width = 75
Height = 22
Hint = 'Adicionar novo CD'
Caption = 'Novo'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
9E020000424D9E02000000000000360100002800000012000000120000000100
08000000000068010000120B0000120B00004000000000000000835C36005A85
AD0000FF0000F2D4B100E1C9AB004E7BA60000CCFF009966660082FEFE009999
9900EDF1F100CCFFFF008A633D00AE885E008DA6BD003253760033CCFF00FDF1
DD00E1C7A300FBE9C400FEFCF100C6A584009E794D00B0B6B500FEF8EF00FDF0
D700E4D1BC00956E4700FEF6E600A5835F00FFFFFF00B8956A00FCEED00042D5
FE00E9D8C300E2D3B900FFF7DE00FEFAF600E4D3B900816039008B664000B18A
63008CAAC500537CA50095744D008F6B4300FEFCF700F4D3B200E9D8BD00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000313131313131
3131313131313131313131310000313131313131090909090909090909093131
00003131313131161B1B2D282828272700093131000031313131311D11111120
2013131300093131000031313131311D1C111111202020130009313100003131
3131310D1C1C1C111120202000093131000031313131312918181C1C11111120
0009313100003131313131291818181C1C111111000931310000313131313107
252518181C222204000931310000310605311E072E0E0B182315152C00093131
0000310A062B0807010B2E2E2614141200093131000031310B06100F081E1E2E
1A252F00093131310000312B2B101E100101012A1A0300093131313100001E1E
101E1E1E10080B1E1F1F173131313131000031312B101E100605313131313131
313131310000312B0831212B08062B3131313131313131310000310A31311E2B
310A063131313131313131310000313131311E31313131313131313131313131
0000}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton8Click
end
object SpeedButton7: TSpeedButton
Left = 75
Top = 2
Width = 75
Height = 22
Hint = 'Excluir CD selecionado'
Caption = 'Excluir'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
9E020000424D9E02000000000000360100002800000012000000120000000100
08000000000068010000120B0000120B0000400000000000000012148A0000FF
0000999999003130E4002E2CC5008485F3005B5BEF004240ED002326DF009495
F7006865F1003C3CCE005354F80017128B003B3BE7007976FB007372F7006668
F6003C3CEE00151587003333CC009B9DF5008588F100494AEE006869F7001115
8B003A42E6005D5FF3003F3ECA008D8FF50017158C002826DE003131C3009599
F8004447EF006866F5009999FF00FFFFFF000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000252525252525
2525252525252525252525250000252525252525252525252525252525252525
00002525252502132525252525250200252525250000252525021E101F252525
250213180425252500002525021910081F032525020D230E0920252500002525
250213061F0303021311120920252525000025252525021306030E0011120920
252525250000252525252502131B0E0E071D2025252525250000252525252525
02001112072025252525252500002525252525021E11120A2222142525252525
000025252525021E110E05141017170B2525252500002525250200110E052002
00100C0C0B252525000025250219100E1604252502130F0C210B252500002525
25021E1520252525250213211C252525000025252525021E2525252525250219
2525252500002525252525252525252525252525252525250000252525252525
2525252525252525252525250000252525252525252525252525252525252525
0000}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton7Click
end
object SpeedButton5: TSpeedButton
Left = 150
Top = 2
Width = 78
Height = 22
Hint = 'Gravar dados do CD'
Caption = 'Gravar'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
1E020000424D1E02000000000000B60000002800000014000000120000000100
08000000000068010000120B0000120B00002000000000000000FFFFFF00FFF9
EC00EDEDED00F7ECD800F2E7D300F0E4D000EBD8B600D9C8AB00C7B49200C2AF
8D00BFAC8A00BAA78500B7A48200B4A17F0099999900AF9C7A00A18E6C008673
5100A06C4800806D4B006D5A38006E502F005C4927004E392100140D0000FFFF
FF00000000000000000000000000000000000000000000000000191919191919
1919191919191919191919191919191919191919190E0E0E0E0E0E0E0E0E0E0E
0E191919191919191217171515151515151717170E19191919191919120B0F00
0202020202160C170E19191919191919120B0F00130A000202160C170E191919
190E0E0E120A0D001413000202160C170E1919191217171512090D0000000000
00160C170E191919120B0F001208080C0C0C0C0C0C0C0C170E191919120B0F00
120801030303030405110C170E191919120A0D00120801030303030405110717
0E19191912090D001208010303030304051810170E1919191208080C12060101
0101010101140B170E1919191208010312121212121212121212121219191919
1208010303030304051107170E19191919191919120801030303030405181017
0E19191919191919120601010101010101140B170E1919191919191912121212
1212121212121212191919191919191919191919191919191919191919191919
1919}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton5Click
end
end
object ToolBar3: TToolBar
Left = 2
Top = 2
Width = 139
Height = 23
Align = alLeft
AutoSize = True
Caption = 'pn_barra'
EdgeBorders = []
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
TabOrder = 1
object SpeedButton4: TSpeedButton
Left = 0
Top = 2
Width = 69
Height = 22
Hint = 'Importar capa'
Caption = 'Abrir'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
E6030000424DE603000000000000360200002800000017000000120000000100
080000000000B0010000120B0000120B00008000000000000000FFFFFF00D0FA
FF00CEFBFE00CEFAFE00B7FCFF00CDFAFD0092FAFF0091FAFF0092F9FF0091F9
FF0096F8FF0091F9FE0094F9FE0090F8FD00A9F1FF008AF2FE00A6F0FF0086F2
FE0088F2FD0087F0FE0088F0FF0087EFFE0085EEFF0088EEFF0087EEFF0086EC
FF0083EAFF0085E9FF007CE7FE007BE7FE007DE7FF007FE7FF00A1E6F5007EE7
FD007DE7FE007DE6FD00FFE8CB007AE6FE0078E7FC007BE6FF007DE6FF007DE6
FE007BE6FE0080E5FF007DE5FE007CE5FE007CE4FE007EE5FE007CE5FF0074DD
FE0072DDFF0075DDFE0073DDFE0076DCFF0073DCFF0074DCFE00BDD8E40075DA
EC00FFD9A90065CBE00064C9E1005EC4E00052BBE40067B7DD0083B4C800B7B5
B200B4B0AD0066C582005DACD40000D16E0049ACCC0042A8CC003199CE00319A
CB003399CE003399CD003597CD0066B066002D92C6002C92C30000AF42002287
BB002187B8002187BB002489B400288F8D00009F2F00009E2C001275A7006D6D
6C006767670065666A0003649300646667006567670068666600666765006467
6500646666006665670065646600007C000002466700114053000B2D62000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000006A6A6A6A6A6A
6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A006A6A6A6A6A6A4242424242424242
4242424242426A6A6A006A6A6A6A6A405B5B5B5B5B5B5B5B5B5B5B595C426A6A
6A006A6A6A6A6A5C3C1A2121212121212121093958426A6A6A006A6A6A6A4054
08080808080808080808084658426A6A6A006A6A6A6A5C3B0F0F0F0F0F0F0F0F
0F1818585C426A6A6A006A6A6A4054132A2A2A2A2A2A2A2A2A16476766426A6A
6A006A6A6A5C3D2F33333333333333333333583869426A6A6A006A6A40540404
0404040404040404043E55000069416A6A006A6A5C5353535353535353535353
535856000000696A6A006A6A6A6A6A53196900003A4550506857004300696A6A
6A006A6A6A6A6A4E1919690024564550574D000069426A6A6A006A6A6A6A6A4B
201B1B6900245665574D00695C426A6A6A006A6A6A6A6A4810031E1E6900243A
24006952526A6A6A6A006A6A6A6A6A443F0E05050569002400696A6A6A6A6A6A
6A006A6A6A6A6A6A44494C4C4F6A6900696A6A6A6A6A6A6A6A006A6A6A6A6A6A
6A6A6A6A6A6A6A696A6A6A6A6A6A6A6A6A006A6A6A6A6A6A6A6A6A6A6A6A6A6A
6A6A6A6A6A6A6A6A6A00}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton4Click
end
object SpeedButton6: TSpeedButton
Left = 69
Top = 2
Width = 70
Height = 22
Hint = 'Limpar capa'
Caption = 'Limpar'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
56010000424D5601000000000000560000002800000010000000100000000100
08000000000000010000120B0000120B00000800000000000000FFFFFF0000FF
FF000000FF000000990000000000FFFFFF000000000000000000000000000000
0000000000000000000000020004040404040404040404040202000202040100
0100010001000102020000000202000100010001000102030000000000030200
0100010001020204000000000004020200010001020201040000000000040102
0200010202010004000000000004000102020202010001040000000000040100
0102020200010004000000000004000100020202020001040000000000040100
0202010002020004000000000004000202010001040202040000000000040202
0100010004010203000000000003020100010001040404020200000002020404
0404040404040000020200020200000000000000000000000002}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton6Click
end
end
end
object Panel4: TPanel
Left = 1
Top = 1
Width = 423
Height = 130
Align = alClient
BevelOuter = bvNone
Color = 16119285
TabOrder = 1
object Panel5: TPanel
Left = 0
Top = 0
Width = 135
Height = 130
Align = alClient
BevelInner = bvRaised
BevelOuter = bvLowered
Caption = '<sem foto>'
Color = 16119285
TabOrder = 0
object Imagebase: TImage
Left = 2
Top = 2
Width = 131
Height = 126
Align = alClient
Center = True
Proportional = True
Stretch = True
end
end
object Panel8: TPanel
Left = 135
Top = 0
Width = 288
Height = 130
Align = alRight
BevelInner = bvRaised
BevelOuter = bvLowered
Color = 16119285
TabOrder = 1
object Label1: TLabel
Left = 18
Top = 8
Width = 39
Height = 12
Alignment = taRightJustify
Caption = 'C'#243'digo:'
end
object Label3: TLabel
Left = 4
Top = 29
Width = 55
Height = 12
Alignment = taRightJustify
Caption = 'Descri'#231#227'o:'
end
object Label4: TLabel
Left = 10
Top = 70
Width = 49
Height = 12
Alignment = taRightJustify
Caption = 'Detalhes:'
end
object ab_cod: TLabel
Left = 62
Top = 8
Width = 6
Height = 12
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
end
object Label2: TLabel
Left = 19
Top = 51
Width = 40
Height = 12
Alignment = taRightJustify
Caption = 'Modelo:'
end
object ab_titulo: TEdit
Left = 61
Top = 27
Width = 223
Height = 20
TabOrder = 1
end
object ab_detalhes: TMemo
Left = 61
Top = 69
Width = 223
Height = 57
ScrollBars = ssVertical
TabOrder = 3
end
object ab_default: TCheckBox
Left = 152
Top = 6
Width = 129
Height = 17
Caption = 'Visualizar na galeria'
Checked = True
State = cbChecked
TabOrder = 0
end
object ComboBox_model: TComboBox
Left = 61
Top = 48
Width = 223
Height = 20
ItemHeight = 12
TabOrder = 2
end
end
end
end
end
object GroupBox2: TGroupBox
Left = 2
Top = 180
Width = 739
Height = 173
Align = alClient
Caption = 'Lista de fotos:'
Color = 16119285
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
ParentColor = False
ParentFont = False
TabOrder = 1
object db_musics: TDBGrid
Left = 2
Top = 14
Width = 310
Height = 157
TabStop = False
Align = alClient
Color = clWhite
FixedColor = 15066597
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = []
Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgCancelOnExit]
ParentFont = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clBlack
TitleFont.Height = -9
TitleFont.Name = 'Verdana'
TitleFont.Style = [fsBold]
OnCellClick = db_musicsCellClick
OnKeyDown = db_musicsKeyDown
OnKeyUp = db_musicsKeyUp
end
object Panel6: TPanel
Left = 312
Top = 14
Width = 425
Height = 157
Align = alRight
Color = 16119285
TabOrder = 1
object Panel7: TPanel
Left = 1
Top = 129
Width = 423
Height = 27
Align = alBottom
BevelInner = bvRaised
BevelOuter = bvLowered
Color = 16119285
TabOrder = 0
object SpeedButton9: TSpeedButton
Left = 0
Top = 2
Width = 69
Height = 22
Hint = 'Importar capa'
Caption = 'Abrir'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
E6030000424DE603000000000000360200002800000017000000120000000100
080000000000B0010000120B0000120B00008000000000000000FFFFFF00D0FA
FF00CEFBFE00CEFAFE00B7FCFF00CDFAFD0092FAFF0091FAFF0092F9FF0091F9
FF0096F8FF0091F9FE0094F9FE0090F8FD00A9F1FF008AF2FE00A6F0FF0086F2
FE0088F2FD0087F0FE0088F0FF0087EFFE0085EEFF0088EEFF0087EEFF0086EC
FF0083EAFF0085E9FF007CE7FE007BE7FE007DE7FF007FE7FF00A1E6F5007EE7
FD007DE7FE007DE6FD00FFE8CB007AE6FE0078E7FC007BE6FF007DE6FF007DE6
FE007BE6FE0080E5FF007DE5FE007CE5FE007CE4FE007EE5FE007CE5FF0074DD
FE0072DDFF0075DDFE0073DDFE0076DCFF0073DCFF0074DCFE00BDD8E40075DA
EC00FFD9A90065CBE00064C9E1005EC4E00052BBE40067B7DD0083B4C800B7B5
B200B4B0AD0066C582005DACD40000D16E0049ACCC0042A8CC003199CE00319A
CB003399CE003399CD003597CD0066B066002D92C6002C92C30000AF42002287
BB002187B8002187BB002489B400288F8D00009F2F00009E2C001275A7006D6D
6C006767670065666A0003649300646667006567670068666600666765006467
6500646666006665670065646600007C000002466700114053000B2D62000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000006A6A6A6A6A6A
6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A6A006A6A6A6A6A6A4242424242424242
4242424242426A6A6A006A6A6A6A6A405B5B5B5B5B5B5B5B5B5B5B595C426A6A
6A006A6A6A6A6A5C3C1A2121212121212121093958426A6A6A006A6A6A6A4054
08080808080808080808084658426A6A6A006A6A6A6A5C3B0F0F0F0F0F0F0F0F
0F1818585C426A6A6A006A6A6A4054132A2A2A2A2A2A2A2A2A16476766426A6A
6A006A6A6A5C3D2F33333333333333333333583869426A6A6A006A6A40540404
0404040404040404043E55000069416A6A006A6A5C5353535353535353535353
535856000000696A6A006A6A6A6A6A53196900003A4550506857004300696A6A
6A006A6A6A6A6A4E1919690024564550574D000069426A6A6A006A6A6A6A6A4B
201B1B6900245665574D00695C426A6A6A006A6A6A6A6A4810031E1E6900243A
24006952526A6A6A6A006A6A6A6A6A443F0E05050569002400696A6A6A6A6A6A
6A006A6A6A6A6A6A44494C4C4F6A6900696A6A6A6A6A6A6A6A006A6A6A6A6A6A
6A6A6A6A6A6A6A696A6A6A6A6A6A6A6A6A006A6A6A6A6A6A6A6A6A6A6A6A6A6A
6A6A6A6A6A6A6A6A6A00}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton9Click
end
object SpeedButton10: TSpeedButton
Left = 69
Top = 2
Width = 70
Height = 22
Hint = 'Limpar capa'
Caption = 'Limpar'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
56010000424D5601000000000000560000002800000010000000100000000100
08000000000000010000120B0000120B00000800000000000000FFFFFF0000FF
FF000000FF000000990000000000FFFFFF000000000000000000000000000000
0000000000000000000000020004040404040404040404040202000202040100
0100010001000102020000000202000100010001000102030000000000030200
0100010001020204000000000004020200010001020201040000000000040102
0200010202010004000000000004000102020202010001040000000000040100
0102020200010004000000000004000100020202020001040000000000040100
0202010002020004000000000004000202010001040202040000000000040202
0100010004010203000000000003020100010001040404020200000002020404
0404040404040000020200020200000000000000000000000002}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton10Click
end
object ToolBar4: TToolBar
Left = 193
Top = 2
Width = 228
Height = 23
Align = alRight
AutoSize = True
Caption = 'pn_barra'
EdgeBorders = []
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
TabOrder = 0
object SpeedButton1: TSpeedButton
Left = 0
Top = 2
Width = 75
Height = 22
Hint = 'Adicionar nova m'#250'sica'
Caption = 'Nova'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
9E020000424D9E02000000000000360100002800000012000000120000000100
08000000000068010000120B0000120B00004000000000000000835C36005A85
AD0000FF0000F2D4B100E1C9AB004E7BA60000CCFF009966660082FEFE009999
9900EDF1F100CCFFFF008A633D00AE885E008DA6BD003253760033CCFF00FDF1
DD00E1C7A300FBE9C400FEFCF100C6A584009E794D00B0B6B500FEF8EF00FDF0
D700E4D1BC00956E4700FEF6E600A5835F00FFFFFF00B8956A00FCEED00042D5
FE00E9D8C300E2D3B900FFF7DE00FEFAF600E4D3B900816039008B664000B18A
63008CAAC500537CA50095744D008F6B4300FEFCF700F4D3B200E9D8BD00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000313131313131
3131313131313131313131310000313131313131090909090909090909093131
00003131313131161B1B2D282828272700093131000031313131311D11111120
2013131300093131000031313131311D1C111111202020130009313100003131
3131310D1C1C1C111120202000093131000031313131312918181C1C11111120
0009313100003131313131291818181C1C111111000931310000313131313107
252518181C222204000931310000310605311E072E0E0B182315152C00093131
0000310A062B0807010B2E2E2614141200093131000031310B06100F081E1E2E
1A252F00093131310000312B2B101E100101012A1A0300093131313100001E1E
101E1E1E10080B1E1F1F173131313131000031312B101E100605313131313131
313131310000312B0831212B08062B3131313131313131310000310A31311E2B
310A063131313131313131310000313131311E31313131313131313131313131
0000}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton1Click
end
object SpeedButton2: TSpeedButton
Left = 75
Top = 2
Width = 75
Height = 22
Hint = 'Excluir m'#250'sica selecionada'
Caption = 'Excluir'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
9E020000424D9E02000000000000360100002800000012000000120000000100
08000000000068010000120B0000120B0000400000000000000012148A0000FF
0000999999003130E4002E2CC5008485F3005B5BEF004240ED002326DF009495
F7006865F1003C3CCE005354F80017128B003B3BE7007976FB007372F7006668
F6003C3CEE00151587003333CC009B9DF5008588F100494AEE006869F7001115
8B003A42E6005D5FF3003F3ECA008D8FF50017158C002826DE003131C3009599
F8004447EF006866F5009999FF00FFFFFF000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000252525252525
2525252525252525252525250000252525252525252525252525252525252525
00002525252502132525252525250200252525250000252525021E101F252525
250213180425252500002525021910081F032525020D230E0920252500002525
250213061F0303021311120920252525000025252525021306030E0011120920
252525250000252525252502131B0E0E071D2025252525250000252525252525
02001112072025252525252500002525252525021E11120A2222142525252525
000025252525021E110E05141017170B2525252500002525250200110E052002
00100C0C0B252525000025250219100E1604252502130F0C210B252500002525
25021E1520252525250213211C252525000025252525021E2525252525250219
2525252500002525252525252525252525252525252525250000252525252525
2525252525252525252525250000252525252525252525252525252525252525
0000}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton2Click
end
object SpeedButton3: TSpeedButton
Left = 150
Top = 2
Width = 78
Height = 22
Hint = 'Gravar dados da m'#250'sica'
Caption = 'Gravar'
Flat = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Verdana'
Font.Style = []
Glyph.Data = {
1E020000424D1E02000000000000B60000002800000014000000120000000100
08000000000068010000120B0000120B00002000000000000000FFFFFF00FFF9
EC00EDEDED00F7ECD800F2E7D300F0E4D000EBD8B600D9C8AB00C7B49200C2AF
8D00BFAC8A00BAA78500B7A48200B4A17F0099999900AF9C7A00A18E6C008673
5100A06C4800806D4B006D5A38006E502F005C4927004E392100140D0000FFFF
FF00000000000000000000000000000000000000000000000000191919191919
1919191919191919191919191919191919191919190E0E0E0E0E0E0E0E0E0E0E
0E191919191919191217171515151515151717170E19191919191919120B0F00
0202020202160C170E19191919191919120B0F00130A000202160C170E191919
190E0E0E120A0D001413000202160C170E1919191217171512090D0000000000
00160C170E191919120B0F001208080C0C0C0C0C0C0C0C170E191919120B0F00
120801030303030405110C170E191919120A0D00120801030303030405110717
0E19191912090D001208010303030304051810170E1919191208080C12060101
0101010101140B170E1919191208010312121212121212121212121219191919
1208010303030304051107170E19191919191919120801030303030405181017
0E19191919191919120601010101010101140B170E1919191919191912121212
1212121212121212191919191919191919191919191919191919191919191919
1919}
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = SpeedButton3Click
end
end
end
object Panel9: TPanel
Left = 1
Top = 1
Width = 423
Height = 128
Align = alClient
BevelOuter = bvNone
Color = 16119285
TabOrder = 1
object Panel11: TPanel
Left = 135
Top = 0
Width = 288
Height = 128
Align = alRight
BevelInner = bvRaised
BevelOuter = bvLowered
Color = 16119285
TabOrder = 0
object Label6: TLabel
Left = 17
Top = 8
Width = 39
Height = 12
Alignment = taRightJustify
Caption = 'C'#243'digo:'
end
object Label8: TLabel
Left = 3
Top = 29
Width = 55
Height = 12
Alignment = taRightJustify
Caption = 'Descri'#231#227'o:'
end
object Label9: TLabel
Left = 9
Top = 49
Width = 49
Height = 12
Alignment = taRightJustify
Caption = 'Detalhes:'
end
object ms_cod: TLabel
Left = 59
Top = 8
Width = 6
Height = 12
Caption = '0'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -9
Font.Name = 'Verdana'
Font.Style = [fsBold]
ParentFont = False
end
object ms_musica: TEdit
Left = 61
Top = 27
Width = 223
Height = 20
TabOrder = 0
end
object ms_detalhes: TMemo
Left = 61
Top = 48
Width = 223
Height = 76
ScrollBars = ssVertical
TabOrder = 1
end
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 135
Height = 128
Align = alClient
BevelInner = bvRaised
BevelOuter = bvLowered
Caption = '<sem foto>'
Color = 16119285
TabOrder = 1
object Imagebase2: TImage
Left = 2
Top = 2
Width = 131
Height = 124
Align = alClient
Center = True
Proportional = True
Stretch = True
end
end
end
end
end
end
object OpenPictureDialog1: TOpenPictureDialog
DefaultExt = 'jpg'
Filter =
'All (*.jpg;*.jpeg)|*.jpg;*.jpeg|JPEG Image File (*.jpg)|*.jpg|JP' +
'EG Image File (*.jpeg)|*.jpeg'
Title = 'Importar imagem'
Left = 5
Top = 360
end
object SavePictureDialog1: TSavePictureDialog
DefaultExt = 'jpg'
Filter =
'All (*.jpg;*.jpeg)|*.jpg;*.jpeg|JPEG Image File (*.jpg)|*.jpg|JP' +
'EG Image File (*.jpeg)|*.jpeg'
Title = 'Exportar imagem'
Left = 40
Top = 360
end
object OpenDialog_mp3: TOpenDialog
Filter =
'Arquivo de audio (*.mp3)|*.mp3|Flash (*swf)|*.swf|Todos os Arqui' +
'vos (*.*)|*.*'
Title = 'Importar mp3'
Left = 74
Top = 360
end
end
| 37.745796 | 141 | 0.605828 |
47c6cc0e77a5b04b88d7f74207afe3e986a76d2d | 278 | dpr | Pascal | PrimitiveRegistrationDemo.dpr | NickHodges/diidcode | fcba7769fddb930536e6b087d43522aab63ccc6b | [
"CC0-1.0"
]
| 1 | 2021-08-03T05:24:45.000Z | 2021-08-03T05:24:45.000Z | PrimitiveRegistrationDemo.dpr | NickHodges/diidcode | fcba7769fddb930536e6b087d43522aab63ccc6b | [
"CC0-1.0"
]
| null | null | null | PrimitiveRegistrationDemo.dpr | NickHodges/diidcode | fcba7769fddb930536e6b087d43522aab63ccc6b | [
"CC0-1.0"
]
| 1 | 2021-08-03T05:24:46.000Z | 2021-08-03T05:24:46.000Z | program PrimitiveRegistrationDemo;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
uPrimitiveConstructorInjection in 'uPrimitiveConstructorInjection.pas';
begin
try
Main;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
| 14.631579 | 73 | 0.705036 |
617ae6db421743a1a6f13cbedf9148a713d43064 | 1,282 | pas | Pascal | Retornar ip/RetornarIp.pas | noelsonneres/ReturnIP | de2e315652742ea49e1871f376f8996a337e8a67 | [
"MIT"
]
| null | null | null | Retornar ip/RetornarIp.pas | noelsonneres/ReturnIP | de2e315652742ea49e1871f376f8996a337e8a67 | [
"MIT"
]
| null | null | null | Retornar ip/RetornarIp.pas | noelsonneres/ReturnIP | de2e315652742ea49e1871f376f8996a337e8a67 | [
"MIT"
]
| null | null | null | unit RetornarIp;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Winsock, IdIPWatch,
IdBaseComponent, IdComponent;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
IdIPWatch1: TIdIPWatch;
Label1: TLabel;
Edit2: TEdit;
Button2: TButton;
function GetIP: string;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text := idipwatch1.LocalIP;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit2.Text := GetIP;
end;
function TForm1.GetIP: string;
var
WSAData: TWSAData;
HostEnt: PHostEnt;
Name: string;
begin
WSAStartup(2, WSAData);
SetLength(Name, 255);
Gethostname(PansiChar(Name), 255);
SetLength(Name, StrLen(PWideChar(Name)));
HostEnt := gethostbyname(PansiChar(Name));
with HostEnt^ do
Result := Format('%d.%d.%d.%d', [Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr
^[2]), Byte(h_addr^[3])]);
WSACleanup;
end;
end.
| 18.57971 | 87 | 0.694228 |
47d31881e89273610579f0c0f15b53ec55dc4481 | 199 | dpr | Pascal | SHA-256/src/Project1.dpr | NigrumAquila/subject_cryptography | 4e417ee8c06cfc5fac55e71e65a998179bdf88c5 | [
"MIT"
]
| null | null | null | SHA-256/src/Project1.dpr | NigrumAquila/subject_cryptography | 4e417ee8c06cfc5fac55e71e65a998179bdf88c5 | [
"MIT"
]
| null | null | null | SHA-256/src/Project1.dpr | NigrumAquila/subject_cryptography | 4e417ee8c06cfc5fac55e71e65a998179bdf88c5 | [
"MIT"
]
| null | null | null | program Project1;
{%File 'Package1.dpk'}
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| 12.4375 | 40 | 0.693467 |
47438e77ccb2d428883de6931348922e8e446578 | 3,789 | dfm | Pascal | Demo/Source/UMainTest.dfm | YWtheGod/SVGIconImageList | 76090ecd0a2972ccdfcd6c53cf46e22288e386a1 | [
"Apache-2.0"
]
| null | null | null | Demo/Source/UMainTest.dfm | YWtheGod/SVGIconImageList | 76090ecd0a2972ccdfcd6c53cf46e22288e386a1 | [
"Apache-2.0"
]
| null | null | null | Demo/Source/UMainTest.dfm | YWtheGod/SVGIconImageList | 76090ecd0a2972ccdfcd6c53cf46e22288e386a1 | [
"Apache-2.0"
]
| null | null | null | object MainForm: TMainForm
Left = 916
Top = 169
Caption =
'SVG Icon ImageList Demo - Copyright (c) Ethea S.r.l. - Apache 2.' +
'0 Open Source License'
ClientHeight = 340
ClientWidth = 739
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
ShowHint = True
OnCreate = FormCreate
DesignSize = (
739
340)
PixelsPerInch = 96
TextHeight = 13
object SVGIconImage: TSVGIconImage
Left = 224
Top = 55
Width = 201
Height = 187
Hint = 'Click to show SVGText property editor'
AutoSize = False
Center = False
ImageList = SVGIconImageList1
ImageIndex = 0
OnClick = SVGIconImageClick
end
object PaintBox1: TPaintBox
Left = 447
Top = 37
Width = 279
Height = 293
Anchors = [akLeft, akTop, akRight, akBottom]
OnPaint = PaintBox1Paint
ExplicitWidth = 274
ExplicitHeight = 290
end
object CategoryButtons1: TCategoryButtons
Left = 32
Top = 55
Width = 169
Height = 187
ButtonFlow = cbfVertical
ButtonHeight = 50
ButtonWidth = 40
ButtonOptions = [boFullSize, boShowCaptions, boCaptionOnlyBorder]
Categories = <
item
Caption = 'Category 1'
Color = 15466474
Collapsed = False
Items = <
item
Caption = 'caption 1'
ImageIndex = 0
end
item
Caption = 'Caption 2'
ImageIndex = 1
end>
end>
Images = SVGIconImageList1
RegularButtonColor = clWhite
SelectedButtonColor = 15132390
TabOrder = 0
end
object ToolBar1: TToolBar
Left = 0
Top = 0
Width = 739
Height = 31
AutoSize = True
ButtonHeight = 31
ButtonWidth = 32
Caption = 'ToolBar1'
Images = SVGIconImageList1
TabOrder = 1
object ToolButton1: TToolButton
Left = 0
Top = 0
Caption = 'ToolButton1'
ImageIndex = 0
end
object ToolButton2: TToolButton
Left = 32
Top = 0
Caption = 'ToolButton2'
ImageIndex = 0
end
object ToolButton3: TToolButton
Left = 64
Top = 0
Caption = 'ToolButton3'
ImageIndex = 0
end
object ToolButton4: TToolButton
Left = 96
Top = 0
Caption = 'ToolButton4'
ImageIndex = 0
end
end
object SVGIconImageList1: TSVGIconImageList
Size = 25
SVGIconItems = <
item
SVGText =
'<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">'#13#10 +
' <circle cx="50" cy="50" r="48" stroke="black" stroke-width="4"' +
' fill="red" />'#13#10'</svg>'#13#10
end
item
SVGText =
'<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">'#13#10 +
' <!-- No translation -->'#13#10' <rect x="5" y="5" width="40" height' +
'="40" fill="green" />'#13#10' '#13#10' <!-- Horizontal translation -->'#13#10' <' +
'rect x="5" y="5" width="40" height="40" fill="blue"'#13#10' tra' +
'nsform="translate(50)" />'#13#10' '#13#10' <!-- Vertical translation -->'#13#10' ' +
' <rect x="5" y="5" width="40" height="40" fill="red"'#13#10' tr' +
'ansform="translate(0 50)" />'#13#10' '#13#10' <!-- Both horizontal and vert' +
'ical translation -->'#13#10' <rect x="5" y="5" width="40" height="40"' +
' fill="yellow"'#13#10' transform="translate(50,50)" />'#13#10'</svg>' +
#13#10
end>
Scaled = True
Left = 384
Top = 160
end
end
| 27.656934 | 97 | 0.543415 |
4796e5c5edf7a90b23bb6d62b1f24e5b3d89b27a | 316 | dpr | Pascal | Demo/D10_3/IconPickerFMX.dpr | MazighusDZ/SVGIconImageList | 6c821b1817c260d665e95942cd21fc8496cd4177 | [
"Apache-2.0"
]
| 201 | 2020-05-24T13:50:03.000Z | 2022-03-26T18:23:43.000Z | Demo/D10_3/IconPickerFMX.dpr | MazighusDZ/SVGIconImageList | 6c821b1817c260d665e95942cd21fc8496cd4177 | [
"Apache-2.0"
]
| 186 | 2020-05-25T18:33:48.000Z | 2022-03-29T14:57:45.000Z | Demo/D10_3/IconPickerFMX.dpr | MazighusDZ/SVGIconImageList | 6c821b1817c260d665e95942cd21fc8496cd4177 | [
"Apache-2.0"
]
| 64 | 2020-05-25T08:28:12.000Z | 2022-03-18T17:13:10.000Z | program IconPickerFMX;
uses
System.StartUpCopy,
FMX.Forms,
UIconPickerFMX in '..\Source\UIconPickerFMX.pas' {IconPicker},
BitmapCodecSVG in '..\..\Svg\BitmapCodecSVG.pas';
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TIconPicker, IconPicker);
Application.Run;
end.
| 19.75 | 65 | 0.705696 |
f108674019faa42be4370c59dc584223da657d57 | 232 | dpr | Pascal | Src/Demo.dpr | danielmarschall/calllib | dd0bf9be5e5c7c1f950b536cd2027a0626ec6347 | [
"Apache-2.0"
]
| null | null | null | Src/Demo.dpr | danielmarschall/calllib | dd0bf9be5e5c7c1f950b536cd2027a0626ec6347 | [
"Apache-2.0"
]
| null | null | null | Src/Demo.dpr | danielmarschall/calllib | dd0bf9be5e5c7c1f950b536cd2027a0626ec6347 | [
"Apache-2.0"
]
| 1 | 2021-01-28T02:27:26.000Z | 2021-01-28T02:27:26.000Z | program Demo;
uses
Forms,
DemoMain in 'DemoMain.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| 15.466667 | 41 | 0.676724 |
f1c0217a3bba2bb30e67a2cde597e443aebacad8 | 1,900 | pas | Pascal | TestBed/TestBedShared/Tests/UConveyorBelt.pas | FMXExpress/box2d-firemonkey | 56ef507717fcaadbfa4353429788f938c1d78eaf | [
"MIT"
]
| 19 | 2015-01-04T10:52:35.000Z | 2021-08-09T19:12:33.000Z | TestBed/TestBedShared/Tests/UConveyorBelt.pas | amikey/box2d-firemonkey | 56ef507717fcaadbfa4353429788f938c1d78eaf | [
"MIT"
]
| 1 | 2016-10-28T10:14:23.000Z | 2016-10-28T10:14:23.000Z | TestBed/TestBedShared/Tests/UConveyorBelt.pas | amikey/box2d-firemonkey | 56ef507717fcaadbfa4353429788f938c1d78eaf | [
"MIT"
]
| 13 | 2015-05-03T07:14:42.000Z | 2021-08-09T18:06:58.000Z | unit UConveyorBelt;
interface
{$I ..\..\Physics2D\Physics2D.inc}
uses
uTestBed,
UPhysics2DTypes, UPhysics2D, SysUtils;
type
TConveyorBelt = class(TTester)
public
m_platform: Tb2Fixture;
constructor Create; override;
procedure PreSolve(var contact: Tb2Contact; const oldManifold: Tb2Manifold); override;
end;
implementation
{ TConveyorBelt }
constructor TConveyorBelt.Create;
var
i: Integer;
bd: Tb2BodyDef;
ground, body: Tb2Body;
shape: Tb2EdgeShape;
pshape: Tb2PolygonShape;
fd: Tb2FixtureDef;
begin
inherited;
// Ground
bd := Tb2BodyDef.Create;
ground := m_world.CreateBody(bd);
shape := Tb2EdgeShape.Create;
shape.SetVertices(MakeVector(-20.0, 0.0), MakeVector(20.0, 0.0));
ground.CreateFixture(shape, 0.0);
// Platform
bd := Tb2BodyDef.Create;
SetValue(bd.position, -5.0, 5.0);
body := m_world.CreateBody(bd);
pshape := Tb2PolygonShape.Create;
pshape.SetAsBox(10.0, 0.5);
fd := Tb2FixtureDef.Create;
fd.shape := pshape;
fd.friction := 0.8;
m_platform := body.CreateFixture(fd);
// Boxes
bd := Tb2BodyDef.Create;
bd.bodyType := b2_dynamicBody;
pshape := Tb2PolygonShape.Create;
pshape.SetAsBox(0.5, 0.5);
for i := 0 to 4 do
begin
SetValue(bd.position, -10.0 + 2.0 * i, 7.0);
body := m_world.CreateBody(bd, False);
body.CreateFixture(pshape, 20.0, False);
end;
bd.Free;
pshape.Free;
end;
procedure TConveyorBelt.PreSolve(var contact: Tb2Contact;
const oldManifold: Tb2Manifold);
var
fixtureA, fixtureB: Tb2Fixture;
begin
inherited;
fixtureA := contact.m_fixtureA;
fixtureB := contact.m_fixtureB;
if fixtureA = m_platform then
contact.m_tangentSpeed := 5.0;
if fixtureB = m_platform then
contact.m_tangentSpeed := -5.0;
end;
initialization
RegisterTestEntry('Conveyor Belt', TConveyorBelt);
end.
| 20.652174 | 92 | 0.677895 |
f143544072710e7d20370d5b437c8b8d82bd1c93 | 4,004 | pas | Pascal | rx/Units/rxMaxmin.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 6 | 2019-02-15T02:47:02.000Z | 2021-08-02T22:34:34.000Z | rx/Units/rxMaxmin.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| null | null | null | rx/Units/rxMaxmin.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 7 | 2020-05-04T21:44:13.000Z | 2021-04-02T12:42:23.000Z | {*******************************************************}
{ }
{ Delphi VCL Extensions (RX) }
{ }
{ Copyright (c) 1996 AO ROSNO }
{ }
{*******************************************************}
{$I RX.INC}
{$N+}
unit rxMaxMin;
interface
function Max(A, B: Longint): Longint;
function Min(A, B: Longint): Longint;
function MaxInteger(const Values: array of Longint): Longint;
function MinInteger(const Values: array of Longint): Longint;
{$IFDEF RX_D4}
function MaxInt64(const Values: array of int64): int64;
function MinInt64(const Values: array of int64): int64;
{$ENDIF}
function MaxFloat(const Values: array of Extended): Extended;
function MinFloat(const Values: array of Extended): Extended;
function MaxDateTime(const Values: array of TDateTime): TDateTime;
function MinDateTime(const Values: array of TDateTime): TDateTime;
function MaxOf(const Values: array of Variant): Variant;
function MinOf(const Values: array of Variant): Variant;
procedure SwapLong(var Int1, Int2: Longint);
procedure SwapInt(var Int1, Int2: Integer);
{$IFDEF RX_D4}
procedure SwapInt64(var Int1, Int2: Int64);
{$ENDIF}
implementation
procedure SwapInt(var Int1, Int2: Integer);
var
I: Integer;
begin
I := Int1;
Int1 := Int2;
Int2 := I;
end;
{$IFDEF RX_D4}
procedure SwapInt64(var Int1, Int2: Int64);
var
I: Int64;
begin
I := Int1;
Int1 := Int2;
Int2 := I;
end;
{$ENDIF}
procedure SwapLong(var Int1, Int2: Longint);
var
I: Longint;
begin
I := Int1;
Int1 := Int2;
Int2 := I;
end;
function Max(A, B: Longint): Longint;
begin
if A > B then
Result := A
else
Result := B;
end;
function Min(A, B: Longint): Longint;
begin
if A < B then
Result := A
else
Result := B;
end;
function MaxInteger(const Values: array of Longint): Longint;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] > Result then
Result := Values[I];
end;
function MinInteger(const Values: array of Longint): Longint;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] < Result
then Result := Values[I];
end;
{$IFDEF RX_D4}
function MaxInt64(const Values: array of int64): int64;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] > Result then
Result := Values[I];
end;
function MinInt64(const Values: array of int64): int64;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] < Result then
Result := Values[I];
end;
{$ENDIF RX_D4}
function MaxFloat(const Values: array of Extended): Extended;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] > Result then
Result := Values[I];
end;
function MinFloat(const Values: array of Extended): Extended;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] < Result then
Result := Values[I];
end;
function MaxDateTime(const Values: array of TDateTime): TDateTime;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] < Result then
Result := Values[I];
end;
function MinDateTime(const Values: array of TDateTime): TDateTime;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] < Result then
Result := Values[I];
end;
function MaxOf(const Values: array of Variant): Variant;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] > Result then
Result := Values[I];
end;
function MinOf(const Values: array of Variant): Variant;
var
I: Cardinal;
begin
Result := Values[0];
for I := 0 to High(Values) do
if Values[I] < Result then
Result := Values[I];
end;
end. | 21.185185 | 66 | 0.614136 |
47adc74d27476f0dbc55a73c94a4334dfba3fb34 | 52,565 | dfm | Pascal | Server/dEngineering.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Server/dEngineering.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Server/dEngineering.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| 3 | 2021-06-30T10:11:17.000Z | 2021-07-01T09:13:29.000Z | inherited dmEngineering: TdmEngineering
OldCreateOrder = False
Height = 303
Width = 508
object prvEngineeringOrder: TDataSetProvider
DataSet = qryEngineeringOrder
Options = [poPropogateChanges]
UpdateMode = upWhereKeyOnly
BeforeUpdateRecord = prvEngineeringOrderBeforeUpdateRecord
BeforeApplyUpdates = prvEngineeringOrderBeforeApplyUpdates
AfterApplyUpdates = prvEngineeringOrderAfterApplyUpdates
Left = 64
Top = 8
end
object qryEngineeringOrder: TAbmesSQLQuery
MaxBlobSize = -1
Params = <
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_CODE'
ParamType = ptInput
end>
SQL.Strings = (
'select'
' eo.ENGINEERING_ORDER_CODE,'
' eo.ENGINEERING_ORDER_BRANCH_CODE,'
' eo.ENGINEERING_ORDER_NO,'
' eo.ENGINEERING_ORDER_TYPE_CODE,'
' eo.DOC_BRANCH_CODE, '
' eo.DOC_CODE,'
' %HAS_DOC_ITEMS[eo] as HAS_DOC_ITEMS,'
' eo.PRIORITY_CODE, '
' eo.ORDER_DEPT_CODE, '
' eo.PRODUCT_CODE,'
''
' ( select'
' p.PARENT_CODE'
' from'
' PRODUCTS p'
' where'
' (p.PRODUCT_CODE = eo.PRODUCT_CODE)'
' ) as PRODUCT_PARENT_CODE,'
''
' eo.THOROUGHLY_ENG_PRODUCT_CODE, '
' eo.ENGINEERING_PLAN_END_DATE, '
' eo.ENGINEERING_DEPT_CODE, '
' eo.ENGINEERING_EMPLOYEE_CODE, '
' eo.ENGINEERING_PLAN_WORKDAYS, '
' eo.ACTIVATE_EMPLOYEE_CODE, '
' eo.ACTIVATE_DATE, '
' eo.ACTIVATE_TIME, '
' eo.CLOSE_EMPLOYEE_CODE, '
' eo.CLOSE_DATE, '
' eo.CLOSE_TIME, '
' eo.ANNUL_EMPLOYEE_CODE, '
' eo.ANNUL_DATE, '
' eo.ANNUL_TIME, '
' eo.CREATE_EMPLOYEE_CODE, '
' eo.CREATE_DATE, '
' eo.CREATE_TIME, '
' eo.CHANGE_EMPLOYEE_CODE, '
' eo.CHANGE_DATE, '
' eo.CHANGE_TIME, '
' eo.CHANGE_COUNT,'
''
' eo.PARENT_ENGINEERING_ORDER_CODE,'
' peo.ENGINEERING_ORDER_BRANCH_CODE as PARENT_ENG_ORDER_BRANCH_C' +
'ODE,'
' peo.ENGINEERING_ORDER_NO as PARENT_ENG_ORDER_NO,'
' Nvl2(eo.PARENT_ENGINEERING_ORDER_CODE, 1, 0) as HAS_PARENT_ENG' +
'INEERING_ORDER,'
''
''
' ( select'
' Sign(Count(*))'
' from'
' ENGINEERING_ORDERS ceo'
' where'
' (ceo.PARENT_ENGINEERING_ORDER_CODE = eo.ENGINEERING_ORDER_' +
'CODE)'
' ) as HAS_CHILD_ENGINEERING_ORDERS,'
''
' eo.NOTES'
''
'from'
' ENGINEERING_ORDERS eo,'
' ENGINEERING_ORDERS peo'
''
'where'
' (eo.PARENT_ENGINEERING_ORDER_CODE = peo.ENGINEERING_ORDER_CODE' +
'(+)) and'
''
' (eo.ENGINEERING_ORDER_CODE = :ENGINEERING_ORDER_CODE)')
SQLConnection = SQLConn
Macros = <
item
DataType = ftWideString
Name = 'HAS_DOC_ITEMS[eo]'
ParamType = ptInput
Value = '1'
end>
MacroParams = <>
CustomParams = <>
TableName = 'ENGINEERING_ORDERS_FOR_EDIT'
AfterProviderStartTransaction = qryEngineeringOrderAfterProviderStartTransaction
Left = 64
Top = 56
object qryEngineeringOrderENGINEERING_ORDER_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_CODE'
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
end
object qryEngineeringOrderENGINEERING_ORDER_BRANCH_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_BRANCH_CODE'
end
object qryEngineeringOrderENGINEERING_ORDER_NO: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_NO'
end
object qryEngineeringOrderENGINEERING_ORDER_TYPE_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_TYPE_CODE'
end
object qryEngineeringOrderDOC_BRANCH_CODE: TAbmesFloatField
FieldName = 'DOC_BRANCH_CODE'
end
object qryEngineeringOrderDOC_CODE: TAbmesFloatField
FieldName = 'DOC_CODE'
end
object qryEngineeringOrderHAS_DOC_ITEMS: TAbmesFloatField
FieldName = 'HAS_DOC_ITEMS'
ProviderFlags = []
end
object qryEngineeringOrderPRIORITY_CODE: TAbmesFloatField
FieldName = 'PRIORITY_CODE'
end
object qryEngineeringOrderORDER_DEPT_CODE: TAbmesFloatField
FieldName = 'ORDER_DEPT_CODE'
end
object qryEngineeringOrderPRODUCT_CODE: TAbmesFloatField
FieldName = 'PRODUCT_CODE'
end
object qryEngineeringOrderPRODUCT_PARENT_CODE: TAbmesFloatField
FieldName = 'PRODUCT_PARENT_CODE'
ProviderFlags = []
end
object qryEngineeringOrderTHOROUGHLY_ENG_PRODUCT_CODE: TAbmesFloatField
FieldName = 'THOROUGHLY_ENG_PRODUCT_CODE'
end
object qryEngineeringOrderENGINEERING_PLAN_END_DATE: TAbmesSQLTimeStampField
FieldName = 'ENGINEERING_PLAN_END_DATE'
end
object qryEngineeringOrderENGINEERING_DEPT_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_DEPT_CODE'
end
object qryEngineeringOrderENGINEERING_EMPLOYEE_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_EMPLOYEE_CODE'
end
object qryEngineeringOrderENGINEERING_PLAN_WORKDAYS: TAbmesFloatField
FieldName = 'ENGINEERING_PLAN_WORKDAYS'
end
object qryEngineeringOrderACTIVATE_EMPLOYEE_CODE: TAbmesFloatField
FieldName = 'ACTIVATE_EMPLOYEE_CODE'
end
object qryEngineeringOrderACTIVATE_DATE: TAbmesSQLTimeStampField
FieldName = 'ACTIVATE_DATE'
end
object qryEngineeringOrderACTIVATE_TIME: TAbmesSQLTimeStampField
FieldName = 'ACTIVATE_TIME'
end
object qryEngineeringOrderCLOSE_EMPLOYEE_CODE: TAbmesFloatField
FieldName = 'CLOSE_EMPLOYEE_CODE'
end
object qryEngineeringOrderCLOSE_DATE: TAbmesSQLTimeStampField
FieldName = 'CLOSE_DATE'
end
object qryEngineeringOrderCLOSE_TIME: TAbmesSQLTimeStampField
FieldName = 'CLOSE_TIME'
end
object qryEngineeringOrderANNUL_EMPLOYEE_CODE: TAbmesFloatField
FieldName = 'ANNUL_EMPLOYEE_CODE'
end
object qryEngineeringOrderANNUL_DATE: TAbmesSQLTimeStampField
FieldName = 'ANNUL_DATE'
end
object qryEngineeringOrderANNUL_TIME: TAbmesSQLTimeStampField
FieldName = 'ANNUL_TIME'
end
object qryEngineeringOrderCREATE_EMPLOYEE_CODE: TAbmesFloatField
FieldName = 'CREATE_EMPLOYEE_CODE'
end
object qryEngineeringOrderCREATE_DATE: TAbmesSQLTimeStampField
FieldName = 'CREATE_DATE'
end
object qryEngineeringOrderCREATE_TIME: TAbmesSQLTimeStampField
FieldName = 'CREATE_TIME'
end
object qryEngineeringOrderCHANGE_EMPLOYEE_CODE: TAbmesFloatField
FieldName = 'CHANGE_EMPLOYEE_CODE'
end
object qryEngineeringOrderCHANGE_DATE: TAbmesSQLTimeStampField
FieldName = 'CHANGE_DATE'
end
object qryEngineeringOrderCHANGE_TIME: TAbmesSQLTimeStampField
FieldName = 'CHANGE_TIME'
end
object qryEngineeringOrderCHANGE_COUNT: TAbmesFloatField
FieldName = 'CHANGE_COUNT'
end
object qryEngineeringOrderPARENT_ENGINEERING_ORDER_CODE: TAbmesFloatField
FieldName = 'PARENT_ENGINEERING_ORDER_CODE'
end
object qryEngineeringOrderPARENT_ENG_ORDER_BRANCH_CODE: TAbmesFloatField
FieldName = 'PARENT_ENG_ORDER_BRANCH_CODE'
ProviderFlags = []
end
object qryEngineeringOrderPARENT_ENG_ORDER_NO: TAbmesFloatField
FieldName = 'PARENT_ENG_ORDER_NO'
ProviderFlags = []
end
object qryEngineeringOrderHAS_PARENT_ENGINEERING_ORDER: TAbmesFloatField
FieldName = 'HAS_PARENT_ENGINEERING_ORDER'
ProviderFlags = []
end
object qryEngineeringOrderHAS_CHILD_ENGINEERING_ORDERS: TAbmesFloatField
FieldName = 'HAS_CHILD_ENGINEERING_ORDERS'
ProviderFlags = []
end
object qryEngineeringOrderNOTES: TAbmesWideStringField
FieldName = 'NOTES'
Size = 250
end
end
object prvProductEngineering: TDataSetProvider
DataSet = qryProductEngineering
Options = [poReadOnly]
Left = 208
Top = 8
end
object qryProductEngineering: TAbmesSQLQuery
MaxBlobSize = -1
Params = <
item
DataType = ftFloat
Name = 'PRODUCT_CODE'
ParamType = ptInput
end>
SQL.Strings = (
'select'
' Decode('
' p.IS_COMMON,'
' 1, 2,'
' ( select'
' Decode(Sign(Count(*)), 0, 1, 3 + p.IS_THOROUGHLY_ENGINEER' +
'ED)'
' from'
' CONCRETE_PRODUCTS cp,'
' DEFINITE_PRODUCTS dp'
' where'
' (cp.PRODUCT_CODE = p.PRODUCT_CODE) and'
' (dp.PRODUCT_CODE = p.PRODUCT_CODE) and'
' (dp.COMMON_PRODUCT_CODE is not null)'
' )'
' ) as COMMON_STATUS_CODE,'
''
' ( select'
' NullIf(Count(*), 0)'
' from'
' DEFINITE_PRODUCTS dp2'
' start with'
' (dp2.PRODUCT_CODE = Nvl2(cp.PRODUCT_CODE, dp.COMMON_PRODUC' +
'T_CODE, p.PRODUCT_CODE))'
' connect by'
' (dp2.PRODUCT_CODE = prior dp2.COMMON_PRODUCT_CODE)'
' ) as COMMON_PRODUCTS_LEVEL_NO,'
''
' ( select'
' Max(level) - 1'
' from'
' DEFINITE_PRODUCTS dp2'
' start with'
' (dp2.PRODUCT_CODE = Nvl2(cp.PRODUCT_CODE, dp.COMMON_PRODUC' +
'T_CODE, p.PRODUCT_CODE))'
' connect by'
' (dp2.COMMON_PRODUCT_CODE = prior dp2.PRODUCT_CODE)'
' ) as COMMON_PRODUCTS_SUB_LEVELS,'
' '
' %SPEC_STATE[p.PRODUCT_CODE~null~null~null~null] as SPEC_STATE_' +
'CODE,'
' '
' ( select'
' sp.CREATE_DATE'
' from'
' SPECS sp '
' where'
' (sp.SPEC_PRODUCT_CODE = p.PRODUCT_CODE)'
' ) as SPEC_CREATE_DATE,'
' '
' ( select'
' sp.CHANGE_DATE'
' from'
' SPECS sp'
' where'
' (sp.SPEC_PRODUCT_CODE = p.PRODUCT_CODE)'
' ) as SPEC_CHANGE_DATE'
''
'from'
' PRODUCTS p,'
' DEFINITE_PRODUCTS dp,'
' CONCRETE_PRODUCTS cp'
''
'where'
' (p.PRODUCT_CODE = :PRODUCT_CODE) and'
' (p.PRODUCT_CODE = dp.PRODUCT_CODE(+)) and'
' (p.PRODUCT_CODE = cp.PRODUCT_CODE(+))')
SQLConnection = SQLConn
Macros = <
item
DataType = ftWideString
Name = 'SPEC_STATE[p.PRODUCT_CODE~null~null~null~null]'
ParamType = ptInput
Value = '1'
end>
MacroParams = <>
CustomParams = <>
Left = 208
Top = 56
object qryProductEngineeringCOMMON_STATUS_CODE: TAbmesFloatField
FieldName = 'COMMON_STATUS_CODE'
end
object qryProductEngineeringCOMMON_PRODUCTS_LEVEL_NO: TAbmesFloatField
FieldName = 'COMMON_PRODUCTS_LEVEL_NO'
end
object qryProductEngineeringCOMMON_PRODUCTS_SUB_LEVELS: TAbmesFloatField
FieldName = 'COMMON_PRODUCTS_SUB_LEVELS'
end
object qryProductEngineeringSPEC_STATE_CODE: TAbmesFloatField
FieldName = 'SPEC_STATE_CODE'
end
object qryProductEngineeringSPEC_CREATE_DATE: TAbmesSQLTimeStampField
FieldName = 'SPEC_CREATE_DATE'
end
object qryProductEngineeringSPEC_CHANGE_DATE: TAbmesSQLTimeStampField
FieldName = 'SPEC_CHANGE_DATE'
end
end
object qryNewEngineeringOrderNo: TAbmesSQLQuery
MaxBlobSize = -1
Params = <>
SQL.Strings = (
'select'
' (Coalesce(Max(eo.ENGINEERING_ORDER_NO), 0) + 1) as NEW_ENGINEE' +
'RING_ORDER_NO'
'from'
' ENGINEERING_ORDERS eo'
'')
SQLConnection = SQLConn
Macros = <>
MacroParams = <>
CustomParams = <>
Left = 64
Top = 176
object qryNewEngineeringOrderNoNEW_ENGINEERING_ORDER_NO: TAbmesFloatField
FieldName = 'NEW_ENGINEERING_ORDER_NO'
end
end
object qryNewEngineeringOrderCode: TAbmesSQLQuery
MaxBlobSize = -1
Params = <>
SQL.Strings = (
'select'
' seq_ENGINEERING_ORDERS.NextVal as NEW_ENGINEERING_ORDER_CODE'
'from'
' DUAL'
'')
SQLConnection = SQLConn
Macros = <>
MacroParams = <>
CustomParams = <>
Left = 64
Top = 128
object qryNewEngineeringOrderCodeNEW_ENGINEERING_ORDER_CODE: TAbmesFloatField
FieldName = 'NEW_ENGINEERING_ORDER_CODE'
end
end
object prvEngineeringOrderTypes: TDataSetProvider
DataSet = qryEngineeringOrderTypes
Options = [poPropogateChanges]
UpdateMode = upWhereKeyOnly
BeforeUpdateRecord = prvEngineeringOrderTypesBeforeUpdateRecord
Left = 360
Top = 8
end
object qryEngineeringOrderTypes: TAbmesSQLQuery
MaxBlobSize = -1
Params = <>
SQL.Strings = (
'select'
' eot.ENGINEERING_ORDER_TYPE_CODE,'
' eot.ENGINEERING_ORDER_TYPE_NAME,'
' eot.ENGINEERING_ORDER_TYPE_ABBREV'
'from'
' ENGINEERING_ORDER_TYPES eot'
'order by'
' eot.ENGINEERING_ORDER_TYPE_CODE')
SQLConnection = SQLConn
Macros = <>
MacroParams = <>
CustomParams = <>
Left = 360
Top = 56
object qryEngineeringOrderTypesENGINEERING_ORDER_TYPE_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_TYPE_CODE'
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
end
object qryEngineeringOrderTypesENGINEERING_ORDER_TYPE_NAME: TAbmesWideStringField
FieldName = 'ENGINEERING_ORDER_TYPE_NAME'
Size = 50
end
object qryEngineeringOrderTypesENGINEERING_ORDER_TYPE_ABBREV: TAbmesWideStringField
FieldName = 'ENGINEERING_ORDER_TYPE_ABBREV'
Size = 5
end
end
object qryNewEngineeringOrderTypeCode: TAbmesSQLQuery
MaxBlobSize = -1
Params = <>
SQL.Strings = (
'select'
' (Coalesce(Max(eot.ENGINEERING_ORDER_TYPE_CODE), 0) + 1) as NEW' +
'_ENG_ORDER_TYPE_CODE '
'from'
' ENGINEERING_ORDER_TYPES eot'
'')
SQLConnection = SQLConn
Macros = <>
MacroParams = <>
CustomParams = <>
Left = 360
Top = 112
object qryNewEngineeringOrderTypeCodeNEW_ENG_ORDER_TYPE_CODE: TAbmesFloatField
FieldName = 'NEW_ENG_ORDER_TYPE_CODE'
end
end
object qryThorughlyEngineeredProduct: TAbmesSQLQuery
MaxBlobSize = -1
Params = <
item
DataType = ftFloat
Name = 'PRODUCT_CODE'
ParamType = ptInput
end>
SQL.Strings = (
'select'
' p.PRODUCT_CODE'
''
'from'
' DEFINITE_PRODUCTS dp,'
' PRODUCTS p'
''
'where'
' (dp.COMMON_PRODUCT_CODE = '
' ( select'
' Coalesce(dp2.COMMON_PRODUCT_CODE, dp2.PRODUCT_CODE)'
' from'
' DEFINITE_PRODUCTS dp2'
' where'
' (dp2.PRODUCT_CODE = :PRODUCT_CODE)'
' )'
' ) and'
''
' (p.PRODUCT_CODE = dp.PRODUCT_CODE) and'
' (p.IS_THOROUGHLY_ENGINEERED = 1)')
SQLConnection = SQLConn
Macros = <>
MacroParams = <>
CustomParams = <>
Left = 64
Top = 224
object qryThorughlyEngineeredProductPRODUCT_CODE: TAbmesFloatField
FieldName = 'PRODUCT_CODE'
end
end
object prvEngineeringOrders: TDataSetProvider
DataSet = qryEngineeringOrders
OnGetData = prvEngineeringOrdersGetData
Left = 376
Top = 176
end
object qryEngineeringOrders: TAbmesSQLQuery
BeforeOpen = qryEngineeringOrdersBeforeOpen
AfterClose = qryEngineeringOrdersAfterClose
MaxBlobSize = -1
Params = <
item
DataType = ftFloat
Name = 'TREE_ENGINEERING_ORDER_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'MIN_EO_STATE_CODE'
ParamType = ptInput
Value = '1'
end
item
DataType = ftFloat
Name = 'MAX_EO_STATE_CODE'
ParamType = ptInput
Value = '6'
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_BRANCH_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_BRANCH_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_NO'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_NO'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_TYPE_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_TYPE_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_PRIORITY_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_PRIORITY_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_PRIORITY_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'END_PRIORITY_CODE'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_BEGIN_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_BEGIN_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_BEGIN_DATE_END'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_BEGIN_DATE_END'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_ENG_START_DATE_DIFF'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_ENG_START_DATE_DIFF'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'END_ENG_START_DATE_DIFF'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'END_ENG_START_DATE_DIFF'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ALL_FILTERED_DEPTS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ALL_FILTERED_DEPTS_2'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_EMPLOYEE_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_EMPLOYEE_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_ENG_REAL_WORKDAYS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_ENG_REAL_WORKDAYS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'END_ENG_REAL_WORKDAYS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'END_ENG_REAL_WORKDAYS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ALL_FILTERED_PRODUCTS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'MIN_SPEC_STATE_CODE'
ParamType = ptInput
Value = '0'
end
item
DataType = ftFloat
Name = 'MAX_SPEC_STATE_CODE'
ParamType = ptInput
Value = '6'
end
item
DataType = ftFloat
Name = 'MIN_SPEC_STATE_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'MAX_SPEC_STATE_CODE'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_END_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_END_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_END_DATE_END'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ENG_PLAN_END_DATE_END'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'CLOSE_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'CLOSE_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'CLOSE_DATE_END'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'CLOSE_DATE_END'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ACTIVATE_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ACTIVATE_DATE_BEGIN'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ACTIVATE_DATE_END'
ParamType = ptInput
end
item
DataType = ftTimeStamp
Name = 'ACTIVATE_DATE_END'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'THOROUGHLY_ENG_PRODUCT_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'THOROUGHLY_ENG_PRODUCT_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'COMMON_PRODUCT_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'COMMON_PRODUCT_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'HAS_PARENT_ENGINEERING_ORDER'
ParamType = ptInput
Value = '1'
end
item
DataType = ftFloat
Name = 'HAS_PARENT_ENGINEERING_ORDER'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'HAS_PARENT_ENGINEERING_ORDER'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'PARENT_ENG_ORDER_BRANCH_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'PARENT_ENG_ORDER_BRANCH_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'PARENT_ENG_ORDER_NO'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'PARENT_ENG_ORDER_NO'
ParamType = ptInput
end>
SQL.Strings = (
'with eo_tree as'
' ( select'
' *'
' from'
' ( select'
' *'
' from'
' ENGINEERING_ORDERS eo2'
' start with'
' (%GET_ENGINEERING_ORDERS_TREE = 1) and'
' ( eo2.ENGINEERING_ORDER_CODE ='
' ( select'
' eo4.ENGINEERING_ORDER_CODE'
' from'
' ( select'
' eo3.ENGINEERING_ORDER_CODE,'
' eo3.PARENT_ENGINEERING_ORDER_CODE'
' from'
' ENGINEERING_ORDERS eo3'
' start with'
' (%GET_ENGINEERING_ORDERS_TREE = 1) and'
' (eo3.ENGINEERING_ORDER_CODE = :TREE_ENGINEER' +
'ING_ORDER_CODE)'
' connect by'
' (eo3.ENGINEERING_ORDER_CODE = prior eo3.PARE' +
'NT_ENGINEERING_ORDER_CODE)'
' ) eo4'
' where'
' (%GET_ENGINEERING_ORDERS_TREE = 1) and'
' (eo4.PARENT_ENGINEERING_ORDER_CODE is null)'
' )'
' )'
' connect by'
' (eo2.PARENT_ENGINEERING_ORDER_CODE = prior eo2.ENGINEE' +
'RING_ORDER_CODE)'
' ) eo5'
' where'
' (%GET_ENGINEERING_ORDERS_TREE = 1) and'
' (eo5.ANNUL_EMPLOYEE_CODE is null)'
' )'
'select'
' eo.ENGINEERING_ORDER_CODE,'
''
' eo.DOC_BRANCH_CODE,'
' eo.DOC_CODE,'
' %HAS_DOC_ITEMS[eo] as HAS_DOC_ITEMS,'
''
' %SPEC_STATE[eo.PRODUCT_CODE~null~null~null~null] as SPEC_STATE' +
'_CODE,'
''
' %EO_STATE_CODE[eo] as EO_STATE_CODE,'
''
' ( ( select'
' d.CUSTOM_CODE'
' from'
' DEPTS d'
' where'
' (d.DEPT_CODE = eo.ENGINEERING_ORDER_BRANCH_CODE)'
' ) ||'
' '#39'/'#39' || eo.ENGINEERING_ORDER_NO || '#39'/'#39' ||'
' ( select'
' eot.ENGINEERING_ORDER_TYPE_ABBREV'
' from'
' ENGINEERING_ORDER_TYPES eot'
' where'
' (eot.ENGINEERING_ORDER_TYPE_CODE = eo.ENGINEERING_ORDER_' +
'TYPE_CODE)'
' )'
' ) as ENGINEERING_ORDER_IDENTIFIER,'
''
' ( select'
' ('
' ( select'
' d.CUSTOM_CODE'
' from'
' DEPTS d'
' where'
' (d.DEPT_CODE = parent_eo.ENGINEERING_ORDER_BRANCH_CO' +
'DE)'
' ) ||'
' '#39'/'#39' || parent_eo.ENGINEERING_ORDER_NO || '#39'/'#39' ||'
' ( select'
' eot.ENGINEERING_ORDER_TYPE_ABBREV'
' from'
' ENGINEERING_ORDER_TYPES eot'
' where'
' (eot.ENGINEERING_ORDER_TYPE_CODE = parent_eo.ENGINEE' +
'RING_ORDER_TYPE_CODE)'
' )'
' )'
' from'
' ENGINEERING_ORDERS parent_eo'
' where'
' (parent_eo.ENGINEERING_ORDER_CODE = eo.PARENT_ENGINEERING_' +
'ORDER_CODE)'
' ) as PARENT_ENG_ORDER_IDENTIFIER,'
''
' ( select'
' pr.PRIORITY_NO'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = eo.PRIORITY_CODE)'
' ) as PRIORITY_NO,'
' ( select'
' (pr.PRIORITY_NO || '#39' '#39' || pr.PRIORITY_NAME)'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = eo.PRIORITY_CODE)'
' ) as PRIORITY_FULL_NAME,'
' ( select'
' pr.PRIORITY_COLOR'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = eo.PRIORITY_CODE)'
' ) as PRIORITY_COLOR,'
' ( select'
' pr.PRIORITY_BACKGROUND_COLOR'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = eo.PRIORITY_CODE)'
' ) as PRIORITY_BACKGROUND_COLOR,'
''
' ( select'
' d.NAME'
' from'
' DEPTS d'
' where'
' (d.DEPT_CODE = eo.ORDER_DEPT_CODE)'
' ) as ORDER_DEPT_NAME,'
''
' p.PRODUCT_CODE,'
' p.PARENT_CODE as PRODUCT_PARENT_CODE,'
' p.NAME as PRODUCT_NAME,'
' %HAS_DOC_ITEMS[p] as PRODUCT_HAS_DOC_ITEMS,'
''
' Nvl2(eo.THOROUGHLY_ENG_PRODUCT_CODE, 1, 0) as HAS_THOROUGHLY_E' +
'NG_PRODUCT,'
''
' Decode('
' p.IS_COMMON,'
' 1, 2,'
' Nvl2(cp.PRODUCT_CODE + dp.COMMON_PRODUCT_CODE, 3 + p.IS_THOR' +
'OUGHLY_ENGINEERED, 1)'
' ) as COMMON_STATUS_CODE,'
''
' ( ( select'
' Decode(Count(*), 0, To_Char(null), (Count(*) || '#39';'#39'))'
' from'
' DEFINITE_PRODUCTS dp2'
' start with'
' (dp2.PRODUCT_CODE = Nvl2(cp.PRODUCT_CODE, dp.COMMON_PROD' +
'UCT_CODE, p.PRODUCT_CODE))'
' connect by'
' (dp2.PRODUCT_CODE = prior dp2.COMMON_PRODUCT_CODE)'
' ) ||'
' ( select'
' Max(level) - 1'
' from'
' DEFINITE_PRODUCTS dp2'
' start with'
' (dp2.PRODUCT_CODE = Nvl2(cp.PRODUCT_CODE, dp.COMMON_PROD' +
'UCT_CODE, p.PRODUCT_CODE))'
' connect by'
' (dp2.COMMON_PRODUCT_CODE = prior dp2.PRODUCT_CODE)'
' )'
' ) as COMMON_PRODUCT_LEVELS,'
''
' ( ( select'
' Count(*)'
' from'
' DEFINITE_PRODUCTS dp2'
' where'
' (dp2.COMMON_PRODUCT_CODE = Coalesce(dp.COMMON_PRODUCT_CO' +
'DE, p.PRODUCT_CODE))'
' ) || '#39'/'#39' ||'
' ( select'
' Count(*)'
' from'
' PRODUCTS p2'
' where'
' (p2.PARENT_CODE = p.PARENT_CODE) and'
''
' exists('
' select'
' 1'
' from'
' DEFINITE_PRODUCTS dp2'
' where'
' (dp2.PRODUCT_CODE = p2.PRODUCT_CODE) and'
' (dp2.COMMON_PRODUCT_CODE is not null)'
' )'
' )'
' ) as JOINED_SIBLINGS,'
''
' eo.ENGINEERING_PLAN_END_DATE,'
' (eo.ENGINEERING_PLAN_END_DATE - Coalesce(eo.CLOSE_DATE, Contex' +
'tDate)) as ENGINEERING_FINAL_DATE_DIFF,'
''
' %INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE + 1)~(-eo.' +
'ENGINEERING_PLAN_WORKDAYS)] as ENGINEERING_PLAN_BEGIN_DATE,'
' (%INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE + 1)~(-eo' +
'.ENGINEERING_PLAN_WORKDAYS)] - Coalesce(eo.ACTIVATE_DATE, Contex' +
'tDate)) as ENGINEERING_START_DATE_DIFF,'
''
' ( select'
' (dt.DEPT_TYPE_ABBREV || d.CUSTOM_CODE || d.SUFFIX_LETTER)'
' from'
' DEPTS d,'
' DEPT_TYPES dt'
' where'
' (d.DEPT_CODE = eo.ENGINEERING_DEPT_CODE) and'
' (d.DEPT_TYPE_CODE = dt.DEPT_TYPE_CODE(+))'
' ) as ENGINEERING_DEPT_IDENTIFIER,'
''
' ( select'
' e.ABBREV'
' from'
' EMPLOYEES e'
' where'
' (e.EMPLOYEE_CODE = eo.ENGINEERING_EMPLOYEE_CODE)'
' ) as ENGINEERING_EMPLOYEE_ABBREV,'
' '
' eo.ENGINEERING_PLAN_WORKDAYS,'
''
' %COUNT_WORKDAYS['
' eo.ACTIVATE_DATE~'
' Coalesce(eo.CLOSE_DATE, ContextDate)'
' ] as ENGINEERING_REAL_WORKDAYS,'
''
' To_Number(null) as ENGINEERING_WORKDAYS_DIFF, -- smiata se v' +
' servera'
' To_Number(null) as ENGINEERING_WORKDAYS_DIFF_PCT, -- smiata ' +
'se v servera'
''
' eo.CREATE_DATE,'
' eo.CREATE_TIME,'
' ( select'
' e.ABBREV'
' from'
' EMPLOYEES e'
' where'
' (e.EMPLOYEE_CODE = eo.CREATE_EMPLOYEE_CODE)'
' ) as CREATE_EMPLOYEE_ABBREV,'
''
' eo.CHANGE_DATE,'
' eo.CHANGE_TIME,'
' ( select'
' e.ABBREV'
' from'
' EMPLOYEES e'
' where'
' (e.EMPLOYEE_CODE = eo.CHANGE_EMPLOYEE_CODE)'
' ) as CHANGE_EMPLOYEE_ABBREV,'
''
' eo.ACTIVATE_DATE,'
' eo.ACTIVATE_TIME,'
' ( select'
' e.ABBREV'
' from'
' EMPLOYEES e'
' where'
' (e.EMPLOYEE_CODE = eo.ACTIVATE_EMPLOYEE_CODE)'
' ) as ACTIVATE_EMPLOYEE_ABBREV,'
''
' eo.CLOSE_DATE,'
' eo.CLOSE_TIME,'
' ( select'
' e.ABBREV'
' from'
' EMPLOYEES e'
' where'
' (e.EMPLOYEE_CODE = eo.CLOSE_EMPLOYEE_CODE)'
' ) as CLOSE_EMPLOYEE_ABBREV,'
''
' eo.ANNUL_DATE,'
' eo.ANNUL_TIME,'
' ( select'
' e.ABBREV'
' from'
' EMPLOYEES e'
' where'
' (e.EMPLOYEE_CODE = eo.ANNUL_EMPLOYEE_CODE)'
' ) as ANNUL_EMPLOYEE_ABBREV,'
''
' Nvl2(eo.PARENT_ENGINEERING_ORDER_CODE, 1, 0) as HAS_PARENT_ENG' +
'INEERING_ORDER,'
''
' ( select'
' Sign(Count(*))'
' from'
' ENGINEERING_ORDERS eo2'
' where'
' (eo2.PARENT_ENGINEERING_ORDER_CODE = eo.ENGINEERING_ORDER_' +
'CODE)'
' ) as HAS_CHILDREN,'
''
' p.PARTNER_PRODUCT_NAMES,'
''
' eo.PARENT_ENGINEERING_ORDER_CODE,'
' eo.NOTES,'
''
' 0 as HAS_NOTCLOSED_ORDERS'
''
'from'
' %EO_TABLE_OR_TREE eo,'
' PRODUCTS p,'
' DEFINITE_PRODUCTS dp,'
' CONCRETE_PRODUCTS cp'
''
'where'
' -- za da byde spomenato eo_tree. inache kogato e ENGINEERING_O' +
'RDERS wmesto eo_tree rewe'
' ( (1 = 1) or'
' (exists'
' ( select'
' 1'
' from'
' eo_tree'
' )'
' )'
' ) and'
''
' (eo.PRODUCT_CODE = p.PRODUCT_CODE) and'
' (p.PRODUCT_CODE = dp.PRODUCT_CODE(+)) and'
' (p.PRODUCT_CODE = cp.PRODUCT_CODE(+)) and'
''
' ( (%GET_ENGINEERING_ORDERS_TREE = 1) or'
''
' ( (%EO_STATE_CODE[eo] between :MIN_EO_STATE_CODE and :MAX_EO' +
'_STATE_CODE) and'
''
' ( (:ENGINEERING_ORDER_BRANCH_CODE is null ) or'
' (:ENGINEERING_ORDER_BRANCH_CODE = eo.ENGINEERING_ORDER_B' +
'RANCH_CODE)'
' ) and'
''
' ( (:ENGINEERING_ORDER_NO is null) or'
' (:ENGINEERING_ORDER_NO = eo.ENGINEERING_ORDER_NO)'
' ) and'
''
' ( (:ENGINEERING_ORDER_TYPE_CODE is null) or'
' (:ENGINEERING_ORDER_TYPE_CODE = eo.ENGINEERING_ORDER_TYP' +
'E_CODE)'
' ) and'
''
' ( (:BEGIN_PRIORITY_CODE is null) or'
' ( ( select'
' pr.PRIORITY_NO'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = eo.PRIORITY_CODE)'
' ) >='
' ( select'
' pr.PRIORITY_NO'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = :BEGIN_PRIORITY_CODE)'
' )'
' )'
' ) and'
''
' ( (:BEGIN_PRIORITY_CODE is null) or'
' ( ( select'
' pr.PRIORITY_NO'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = eo.PRIORITY_CODE)'
' ) <='
' ( select'
' pr.PRIORITY_NO'
' from'
' PRIORITIES pr'
' where'
' (pr.PRIORITY_CODE = :END_PRIORITY_CODE)'
' )'
' )'
' ) and'
''
' ( (:ENG_PLAN_BEGIN_DATE_BEGIN is null) or'
' (%INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE + 1' +
')~(-eo.ENGINEERING_PLAN_WORKDAYS)] >= :ENG_PLAN_BEGIN_DATE_BEGIN' +
') ) and'
''
' ( (:ENG_PLAN_BEGIN_DATE_END is null) or'
' (%INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE + 1' +
')~(-eo.ENGINEERING_PLAN_WORKDAYS)] <= :ENG_PLAN_BEGIN_DATE_END) ' +
') and'
''
' ( (:BEGIN_ENG_START_DATE_DIFF is null) or'
' ( (%INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE +' +
' 1)~(-eo.ENGINEERING_PLAN_WORKDAYS)] - Coalesce(eo.ACTIVATE_DATE' +
', ContextDate) ) >= :BEGIN_ENG_START_DATE_DIFF )'
' ) and'
''
' ( (:END_ENG_START_DATE_DIFF is null) or'
' ( (%INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE +' +
' 1)~(-eo.ENGINEERING_PLAN_WORKDAYS)] - Coalesce(eo.ACTIVATE_DATE' +
', ContextDate)) <= :END_ENG_START_DATE_DIFF )'
' ) and'
''
' ( (:ALL_FILTERED_DEPTS = 1) or'
' (exists'
' ( select'
' 1'
' from'
' TEMP_FILTERED_DEPTS tfd'
' where'
' (tfd.DEPT_CODE = eo.ORDER_DEPT_CODE)'
' )'
' )'
' ) and'
''
' ( (:ALL_FILTERED_DEPTS_2 = 1) or'
' (exists'
' ( select'
' 1'
' from'
' TEMP_FILTERED_DEPTS_2 tfd2'
' where'
' (tfd2.DEPT_CODE = eo.ENGINEERING_DEPT_CODE)'
' )'
' )'
' ) and'
''
' ( (:ENGINEERING_EMPLOYEE_CODE is null) or'
' (eo.ENGINEERING_EMPLOYEE_CODE = :ENGINEERING_EMPLOYEE_CO' +
'DE) ) and'
''
' ( (:BEGIN_ENG_REAL_WORKDAYS is null) or'
' ( %COUNT_WORKDAYS['
' eo.ACTIVATE_DATE~'
' Coalesce(eo.CLOSE_DATE, ContextDate)'
' ] >= :BEGIN_ENG_REAL_WORKDAYS'
' )'
' ) and'
''
' ( (:END_ENG_REAL_WORKDAYS is null) or'
' ( %COUNT_WORKDAYS['
' eo.ACTIVATE_DATE~'
' Coalesce(eo.CLOSE_DATE, ContextDate)'
' ] <= :END_ENG_REAL_WORKDAYS'
' )'
' ) and'
''
' -- filtera po otklonenie se pravi v servera'
''
' ( (:ALL_FILTERED_PRODUCTS = 1) or'
' (exists'
' ( select'
' 1'
' from'
' TEMP_FILTERED_PRODUCTS tfp'
' where'
' (tfp.PRODUCT_CODE = eo.PRODUCT_CODE)'
' )'
' )'
' ) and'
''
' ( ( (:MIN_SPEC_STATE_CODE = 1) and'
' (:MAX_SPEC_STATE_CODE = 5)'
' ) or'
' (%SPEC_STATE[eo.PRODUCT_CODE~null~null~null~null] betwee' +
'n :MIN_SPEC_STATE_CODE and :MAX_SPEC_STATE_CODE)'
' ) and'
''
' ( (:ENG_PLAN_END_DATE_BEGIN is null) or'
' (eo.ENGINEERING_PLAN_END_DATE >= :ENG_PLAN_END_DATE_BEGI' +
'N) ) and'
''
' ( (:ENG_PLAN_END_DATE_END is null) or'
' (eo.ENGINEERING_PLAN_END_DATE <= :ENG_PLAN_END_DATE_END)' +
' ) and'
''
' ( (:CLOSE_DATE_BEGIN is null) or'
' (eo.CLOSE_DATE >= :CLOSE_DATE_BEGIN) ) and'
''
' ( (:CLOSE_DATE_END is null) or'
' (eo.CLOSE_DATE <= :CLOSE_DATE_END) ) and'
''
' ( (:ACTIVATE_DATE_BEGIN is null) or'
' (eo.ACTIVATE_DATE >= :ACTIVATE_DATE_BEGIN) ) and'
''
' ( (:ACTIVATE_DATE_END is null) or'
' (eo.ACTIVATE_DATE <= :ACTIVATE_DATE_END) ) and'
''
' ( (:THOROUGHLY_ENG_PRODUCT_CODE is null) or'
' (exists'
' ( select'
' 1'
' from'
' PRODUCT_RELATIONS pr'
' where'
' (pr.ANCESTOR_PRODUCT_CODE = :THOROUGHLY_ENG_PRODUC' +
'T_CODE) and'
' (pr.DESCENDANT_PRODUCT_CODE = eo.THOROUGHLY_ENG_PR' +
'ODUCT_CODE)'
' )'
' )'
' ) and'
''
' ( (:COMMON_PRODUCT_CODE is null) or'
' (exists'
' ( select'
' 1'
' from'
' DEFINITE_PRODUCTS dp2'
' where'
' (dp2.PRODUCT_CODE = eo.PRODUCT_CODE)'
' start with'
' (dp2.PRODUCT_CODE = :COMMON_PRODUCT_CODE)'
' connect by'
' (dp2.COMMON_PRODUCT_CODE = prior dp2.PRODUCT_CODE)'
' )'
' )'
' ) and'
''
' ( (:HAS_PARENT_ENGINEERING_ORDER = 1) or'
''
' ( (:HAS_PARENT_ENGINEERING_ORDER = 2) and'
' (eo.PARENT_ENGINEERING_ORDER_CODE is null)'
' ) or'
''
' ( (:HAS_PARENT_ENGINEERING_ORDER = 3) and'
' exists('
' select'
' 1'
' from'
' ENGINEERING_ORDERS peo'
' where'
' (peo.ENGINEERING_ORDER_CODE = eo.PARENT_ENGINEERIN' +
'G_ORDER_CODE) and'
''
' ( (:PARENT_ENG_ORDER_BRANCH_CODE is null) or'
' (peo.ENGINEERING_ORDER_BRANCH_CODE = :PARENT_ENG' +
'_ORDER_BRANCH_CODE) ) and'
''
' ( (:PARENT_ENG_ORDER_NO is null) or'
' (peo.ENGINEERING_ORDER_NO = :PARENT_ENG_ORDER_NO' +
') )'
' )'
' )'
' )'
' )'
' )'
'')
SQLConnection = SQLConn
Macros = <
item
DataType = ftWideString
Name = 'GET_ENGINEERING_ORDERS_TREE'
ParamType = ptInput
Value = '0'
end
item
DataType = ftWideString
Name = 'HAS_DOC_ITEMS[eo]'
ParamType = ptInput
Value = '1'
end
item
DataType = ftWideString
Name = 'SPEC_STATE[eo.PRODUCT_CODE~null~null~null~null]'
ParamType = ptInput
Value = '1'
end
item
DataType = ftWideString
Name = 'EO_STATE_CODE[eo]'
ParamType = ptInput
Value = '1'
end
item
DataType = ftWideString
Name = 'HAS_DOC_ITEMS[p]'
ParamType = ptInput
Value = '1'
end
item
DataType = ftWideString
Name =
'INC_DATE_BY_WORKDAYS[(eo.ENGINEERING_PLAN_END_DATE + 1)~(-eo.ENG' +
'INEERING_PLAN_WORKDAYS)]'
ParamType = ptInput
Value = 'ContextDate'
end
item
DataType = ftWideString
Name =
'COUNT_WORKDAYS['#13#10' eo.ACTIVATE_DATE~'#13#10' Coalesce(eo.CLOSE_DA' +
'TE, ContextDate)'#13#10' ]'
ParamType = ptInput
Value = '1'
end
item
DataType = ftWideString
Name = 'EO_TABLE_OR_TREE'
ParamType = ptInput
Value = 'ENGINEERING_ORDERS'
end
item
DataType = ftWideString
Name =
'COUNT_WORKDAYS['#13#10' eo.ACTIVATE_DATE~'#13#10' Coal' +
'esce(eo.CLOSE_DATE, ContextDate)'#13#10' ]'
ParamType = ptInput
Value = '1'
end>
MacroParams = <>
CustomParams = <
item
DataType = ftFloat
Name = 'BEGIN_ENG_WORKDAYS_DIFF_PCT'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'END_ENG_WORKDAYS_DIFF_PCT'
ParamType = ptInput
end
item
DataType = ftWideString
Name = 'CHOSEN_ORDER_DEPTS'
ParamType = ptInput
end
item
DataType = ftWideString
Name = 'CHOSEN_ENGINEERING_DEPTS'
ParamType = ptInput
end
item
DataType = ftWideString
Name = 'CHOSEN_PRODUCTS'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'BEGIN_ENG_FINAL_DATE_DIFF'
ParamType = ptUnknown
end
item
DataType = ftFloat
Name = 'END_ENG_FINAL_DATE_DIFF'
ParamType = ptUnknown
end
item
DataType = ftFloat
Name = 'GET_ENGINEERING_ORDERS_TREE'
ParamType = ptUnknown
Value = '0'
end>
Left = 376
Top = 224
object qryEngineeringOrdersENGINEERING_ORDER_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_CODE'
end
object qryEngineeringOrdersDOC_BRANCH_CODE: TAbmesFloatField
FieldName = 'DOC_BRANCH_CODE'
end
object qryEngineeringOrdersDOC_CODE: TAbmesFloatField
FieldName = 'DOC_CODE'
end
object qryEngineeringOrdersHAS_DOC_ITEMS: TAbmesFloatField
FieldName = 'HAS_DOC_ITEMS'
end
object qryEngineeringOrdersSPEC_STATE_CODE: TAbmesFloatField
FieldName = 'SPEC_STATE_CODE'
end
object qryEngineeringOrdersEO_STATE_CODE: TAbmesFloatField
FieldName = 'EO_STATE_CODE'
end
object qryEngineeringOrdersENGINEERING_ORDER_IDENTIFIER: TAbmesWideStringField
FieldName = 'ENGINEERING_ORDER_IDENTIFIER'
Size = 93
end
object qryEngineeringOrdersPARENT_ENG_ORDER_IDENTIFIER: TAbmesWideStringField
FieldName = 'PARENT_ENG_ORDER_IDENTIFIER'
Size = 93
end
object qryEngineeringOrdersPRIORITY_NO: TAbmesFloatField
FieldName = 'PRIORITY_NO'
end
object qryEngineeringOrdersPRIORITY_FULL_NAME: TAbmesWideStringField
FieldName = 'PRIORITY_FULL_NAME'
Size = 93
end
object qryEngineeringOrdersPRIORITY_COLOR: TAbmesFloatField
FieldName = 'PRIORITY_COLOR'
end
object qryEngineeringOrdersPRIORITY_BACKGROUND_COLOR: TAbmesFloatField
FieldName = 'PRIORITY_BACKGROUND_COLOR'
end
object qryEngineeringOrdersORDER_DEPT_NAME: TAbmesWideStringField
FieldName = 'ORDER_DEPT_NAME'
Size = 100
end
object qryEngineeringOrdersPRODUCT_CODE: TAbmesFloatField
FieldName = 'PRODUCT_CODE'
end
object qryEngineeringOrdersPRODUCT_PARENT_CODE: TAbmesFloatField
FieldName = 'PRODUCT_PARENT_CODE'
end
object qryEngineeringOrdersPRODUCT_NAME: TAbmesWideStringField
FieldName = 'PRODUCT_NAME'
Size = 100
end
object qryEngineeringOrdersPRODUCT_HAS_DOC_ITEMS: TAbmesFloatField
FieldName = 'PRODUCT_HAS_DOC_ITEMS'
end
object qryEngineeringOrdersHAS_THOROUGHLY_ENG_PRODUCT: TAbmesFloatField
FieldName = 'HAS_THOROUGHLY_ENG_PRODUCT'
end
object qryEngineeringOrdersCOMMON_STATUS_CODE: TAbmesFloatField
FieldName = 'COMMON_STATUS_CODE'
end
object qryEngineeringOrdersCOMMON_PRODUCT_LEVELS: TAbmesWideStringField
FieldName = 'COMMON_PRODUCT_LEVELS'
Size = 81
end
object qryEngineeringOrdersJOINED_SIBLINGS: TAbmesWideStringField
FieldName = 'JOINED_SIBLINGS'
Size = 81
end
object qryEngineeringOrdersENGINEERING_PLAN_END_DATE: TAbmesSQLTimeStampField
FieldName = 'ENGINEERING_PLAN_END_DATE'
end
object qryEngineeringOrdersENGINEERING_FINAL_DATE_DIFF: TAbmesFloatField
FieldName = 'ENGINEERING_FINAL_DATE_DIFF'
end
object qryEngineeringOrdersENGINEERING_PLAN_BEGIN_DATE: TAbmesSQLTimeStampField
FieldName = 'ENGINEERING_PLAN_BEGIN_DATE'
end
object qryEngineeringOrdersENGINEERING_START_DATE_DIFF: TAbmesFloatField
FieldName = 'ENGINEERING_START_DATE_DIFF'
end
object qryEngineeringOrdersENGINEERING_DEPT_IDENTIFIER: TAbmesWideStringField
FieldName = 'ENGINEERING_DEPT_IDENTIFIER'
Size = 46
end
object qryEngineeringOrdersENGINEERING_EMPLOYEE_ABBREV: TAbmesWideStringField
FieldName = 'ENGINEERING_EMPLOYEE_ABBREV'
Size = 5
end
object qryEngineeringOrdersENGINEERING_PLAN_WORKDAYS: TAbmesFloatField
FieldName = 'ENGINEERING_PLAN_WORKDAYS'
end
object qryEngineeringOrdersENGINEERING_REAL_WORKDAYS: TAbmesFloatField
FieldName = 'ENGINEERING_REAL_WORKDAYS'
end
object qryEngineeringOrdersENGINEERING_WORKDAYS_DIFF: TAbmesFloatField
FieldName = 'ENGINEERING_WORKDAYS_DIFF'
end
object qryEngineeringOrdersENGINEERING_WORKDAYS_DIFF_PCT: TAbmesFloatField
FieldName = 'ENGINEERING_WORKDAYS_DIFF_PCT'
end
object qryEngineeringOrdersCREATE_DATE: TAbmesSQLTimeStampField
FieldName = 'CREATE_DATE'
end
object qryEngineeringOrdersCREATE_TIME: TAbmesSQLTimeStampField
FieldName = 'CREATE_TIME'
end
object qryEngineeringOrdersCREATE_EMPLOYEE_ABBREV: TAbmesWideStringField
FieldName = 'CREATE_EMPLOYEE_ABBREV'
Size = 5
end
object qryEngineeringOrdersCHANGE_DATE: TAbmesSQLTimeStampField
FieldName = 'CHANGE_DATE'
end
object qryEngineeringOrdersCHANGE_TIME: TAbmesSQLTimeStampField
FieldName = 'CHANGE_TIME'
end
object qryEngineeringOrdersCHANGE_EMPLOYEE_ABBREV: TAbmesWideStringField
FieldName = 'CHANGE_EMPLOYEE_ABBREV'
Size = 5
end
object qryEngineeringOrdersACTIVATE_DATE: TAbmesSQLTimeStampField
FieldName = 'ACTIVATE_DATE'
end
object qryEngineeringOrdersACTIVATE_TIME: TAbmesSQLTimeStampField
FieldName = 'ACTIVATE_TIME'
end
object qryEngineeringOrdersACTIVATE_EMPLOYEE_ABBREV: TAbmesWideStringField
FieldName = 'ACTIVATE_EMPLOYEE_ABBREV'
Size = 5
end
object qryEngineeringOrdersCLOSE_DATE: TAbmesSQLTimeStampField
FieldName = 'CLOSE_DATE'
end
object qryEngineeringOrdersCLOSE_TIME: TAbmesSQLTimeStampField
FieldName = 'CLOSE_TIME'
end
object qryEngineeringOrdersCLOSE_EMPLOYEE_ABBREV: TAbmesWideStringField
FieldName = 'CLOSE_EMPLOYEE_ABBREV'
Size = 5
end
object qryEngineeringOrdersANNUL_DATE: TAbmesSQLTimeStampField
FieldName = 'ANNUL_DATE'
end
object qryEngineeringOrdersANNUL_TIME: TAbmesSQLTimeStampField
FieldName = 'ANNUL_TIME'
end
object qryEngineeringOrdersANNUL_EMPLOYEE_ABBREV: TAbmesWideStringField
FieldName = 'ANNUL_EMPLOYEE_ABBREV'
Size = 5
end
object qryEngineeringOrdersHAS_PARENT_ENGINEERING_ORDER: TAbmesFloatField
FieldName = 'HAS_PARENT_ENGINEERING_ORDER'
end
object qryEngineeringOrdersHAS_CHILDREN: TAbmesFloatField
FieldName = 'HAS_CHILDREN'
ProviderFlags = []
end
object qryEngineeringOrdersPARTNER_PRODUCT_NAMES: TAbmesWideStringField
FieldName = 'PARTNER_PRODUCT_NAMES'
Size = 250
end
object qryEngineeringOrdersPARENT_ENGINEERING_ORDER_CODE: TAbmesFloatField
FieldName = 'PARENT_ENGINEERING_ORDER_CODE'
end
object qryEngineeringOrdersNOTES: TAbmesWideStringField
FieldName = 'NOTES'
Size = 250
end
object qryEngineeringOrdersHAS_NOTCLOSED_ORDERS: TAbmesFloatField
FieldName = 'HAS_NOTCLOSED_ORDERS'
end
end
object qryGetEngineeringOrderCode: TAbmesSQLQuery
MaxBlobSize = -1
Params = <
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_BRANCH_CODE'
ParamType = ptInput
end
item
DataType = ftFloat
Name = 'ENGINEERING_ORDER_NO'
ParamType = ptInput
end>
SQL.Strings = (
'select'
' eo.ENGINEERING_ORDER_CODE'
''
'from'
' ENGINEERING_ORDERS eo'
''
'where'
' (eo.ENGINEERING_ORDER_BRANCH_CODE = :ENGINEERING_ORDER_BRANCH_' +
'CODE) and'
' (eo.ENGINEERING_ORDER_NO = :ENGINEERING_ORDER_NO)')
SQLConnection = SQLConn
Macros = <>
MacroParams = <>
CustomParams = <>
Left = 216
Top = 176
object qryGetEngineeringOrderCodeENGINEERING_ORDER_CODE: TAbmesFloatField
FieldName = 'ENGINEERING_ORDER_CODE'
end
end
end
| 30.938788 | 91 | 0.551736 |
f1604607ddf6f7dd3c9a8702f6545e1c211e6cde | 4,029 | pas | Pascal | windows/src/global/delphi/general/Windows8LanguageList.pas | ermshiperete/keyman | 0eeef1b5794fd698447584e531e2a6c1ef4c05aa | [
"MIT"
]
| 1 | 2021-03-08T09:31:47.000Z | 2021-03-08T09:31:47.000Z | windows/src/global/delphi/general/Windows8LanguageList.pas | ermshiperete/keyman | 0eeef1b5794fd698447584e531e2a6c1ef4c05aa | [
"MIT"
]
| null | null | null | windows/src/global/delphi/general/Windows8LanguageList.pas | ermshiperete/keyman | 0eeef1b5794fd698447584e531e2a6c1ef4c05aa | [
"MIT"
]
| null | null | null | unit Windows8LanguageList;
interface
uses
System.Generics.Collections,
BCP47Tag;
type
TWindows8Language = class
private
FLangID: Integer;
FLocaleName: string;
FBCP47Tag: string;
FTag: TBCP47Tag;
public
constructor Create(const ABCP47Tag: string);
destructor Destroy; override;
property BCP47Tag: string read FBCP47Tag;
property Tag: TBCP47Tag read FTag;
property LocaleName: string read FLocaleName;
property LangID: Integer read FLangID;
end;
TWindows8LanguageList = class(TObjectList<TWindows8Language>)
private
FIsSupported: Boolean;
public
constructor Create(ARefresh: Boolean = True);
procedure Refresh;
property IsSupported: Boolean read FIsSupported;
function FindClosestByBCP47Tag(var BCP47Tag: string): TWindows8Language;
function FindByBCP47Tag(BCP47Tag: string): TWindows8Language;
end;
implementation
uses
System.Classes,
System.SysUtils,
System.Win.Registry,
RegistryKeys,
utilsystem;
constructor TWindows8LanguageList.Create(ARefresh: Boolean = True);
begin
inherited Create;
if ARefresh then Refresh;
end;
function TWindows8LanguageList.FindByBCP47Tag(BCP47Tag: string): TWindows8Language;
var
i: Integer;
begin
for i := 0 to Count - 1 do
if SameText(BCP47Tag, Items[i].BCP47Tag) then
Exit(Items[i]);
Result := nil;
end;
function TWindows8LanguageList.FindClosestByBCP47Tag(var BCP47Tag: string): TWindows8Language;
var
tag: TBCP47Tag;
begin
Result := nil;
tag := TBCP47Tag.Create(BCP47Tag);
try
// Find tag by identical match
Result := FindByBCP47Tag(tag.Tag);
if Assigned(Result) then Exit;
// Suppress the script
tag.Script := '';
Result := FindByBCP47Tag(tag.Tag);
if Assigned(Result) then Exit;
// Finally, suppress the region
tag.Region := '';
Result := FindByBCP47Tag(tag.Tag);
finally
if Assigned(Result) then
BCP47Tag := tag.Tag;
tag.Free;
end;
end;
procedure TWindows8LanguageList.Refresh;
var
i, j: Integer;
Language: TWindows8Language;
FValueNames: TStringList;
FLanguageNames: TStringList;
begin
Clear;
with TRegistry.Create do
try
FIsSupported := OpenKeyReadOnly('Control Panel\International\User Profile') and ValueExists('Languages');
if FIsSupported then
begin
FLanguageNames := TStringList.Create;
FValueNames := TStringList.Create;
try
ReadMultiString('Languages', FLanguageNames);
for i := 0 to FLanguageNames.Count - 1 do
begin
Language := TWindows8Language.Create(FLanguageNames[i]);
Add(Language);
if OpenKeyReadOnly('\Control Panel\International\User Profile\'+FLanguageNames[i]) then
begin
if ValueExists('TransientLangId') then
Language.FLangId := ReadInteger('TransientLangId');
if ValueExists('CachedLanguageName') then
Language.FLocaleName := LoadIndirectString(ReadString('CachedLanguageName'));
if Language.FLangId = 0 then
begin
FValueNames.Clear;
GetValueNames(FValueNames);
for j := 0 to FValueNames.Count - 1 do
if (GetDataType(FValueNames[j]) = rdInteger) and
(Copy(FValueNames[j],5,1) = ':') then
begin
Language.FLangID := StrToIntDef('$'+Copy(FValueNames[j],1,4),0);
Break;
end;
end;
end;
end;
finally
FLanguageNames.Free;
FValueNames.Free;
end;
end;
finally
Free;
end;
end;
{ TWindows8Language }
constructor TWindows8Language.Create(const ABCP47Tag: string);
begin
FBCP47Tag := ABCP47Tag;
FTag := TBCP47Tag.Create(ABCP47Tag);
end;
destructor TWindows8Language.Destroy;
begin
FreeAndNil(FTag);
inherited Destroy;
end;
{function TWindows8Language.BCP47TagMatches(const ATag: string): Boolean;
begin
Result := SameText(Copy(FBCP47Tag, 1, Length(ATag)), ATag);
end;}
end.
| 25.18125 | 109 | 0.674361 |
474c805721a7f5cb9b3afeb89e3062fab6dc4653 | 57,812 | pas | Pascal | src/gui-classic/UFRMOperation.pas | SkybuckFlying/PascalCoinRestructured | 6c51befc91cdea058834d9146ef2e51892c3e1a1 | [
"MIT"
]
| 1 | 2019-02-05T18:33:02.000Z | 2019-02-05T18:33:02.000Z | src/gui-classic/UFRMOperation.pas | SkybuckFlying/PascalCoinRestructured | 6c51befc91cdea058834d9146ef2e51892c3e1a1 | [
"MIT"
]
| 1 | 2018-07-20T21:18:54.000Z | 2018-07-20T21:18:54.000Z | src/gui-classic/UFRMOperation.pas | SkybuckFlying/PascalCoinRestructured | 6c51befc91cdea058834d9146ef2e51892c3e1a1 | [
"MIT"
]
| null | null | null | unit UFRMOperation;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
{ Copyright (c) 2016 by Albert Molina
Distributed under the MIT software license, see the accompanying file LICENSE
or visit http://www.opensource.org/licenses/mit-license.php.
This unit is a part of Pascal Coin, a P2P crypto currency without need of
historical operations.
If you like it, consider a donation using BitCoin:
16K3HCZRhFUtM8GdWRcfKeaa6KsuyxZaYk
}
interface
uses
{$IFnDEF FPC}
Windows,
{$ELSE}
LCLIntf, LCLType, LMessages,
{$ENDIF}
Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, UNode, UWallet, UCrypto, Buttons, UBlockChain,
UAccounts, UFRMAccountSelect, ActnList, ComCtrls, Types, UFRMMemoText,
System.Actions, UOrderedCardinalList, UAccount, UAccountKey;
Const
CM_PC_WalletKeysChanged = WM_USER + 1;
type
{ TFRMOperation }
TFRMOperation = class(TForm)
ebChangeName: TEdit;
ebChangeType: TEdit;
ebSignerAccount: TEdit;
lblSignerAccount: TLabel;
lblAccountCaption: TLabel;
bbExecute: TBitBtn;
bbCancel: TBitBtn;
lblAccountBalance: TLabel;
lblChangeType: TLabel;
lblChangeName: TLabel;
lblBalanceCaption: TLabel;
ebSenderAccount: TEdit;
lblChangeInfoErrors: TLabel;
PageControlLocked: TPageControl;
sbSearchBuyAccount: TSpeedButton;
sbSearchListerSellerAccount: TSpeedButton;
sbSearchDestinationAccount: TSpeedButton;
sbSearchSignerAccount: TSpeedButton;
tsChangeInfo: TTabSheet;
tsOperation: TTabSheet;
gbPayload: TGroupBox;
lblEncryptPassword: TLabel;
Label4: TLabel;
lblEncryptionErrors: TLabel;
lblPayloadLength: TLabel;
rbEncryptedWithEC: TRadioButton;
rbEncrptedWithPassword: TRadioButton;
rbNotEncrypted: TRadioButton;
ebEncryptPassword: TEdit;
memoPayload: TMemo;
rbEncryptedWithOldEC: TRadioButton;
ActionList: TActionList;
actExecute: TAction;
tsGlobalError: TTabSheet;
lblGlobalErrors: TLabel;
bbPassword: TBitBtn;
memoAccounts: TMemo;
lblAccountsCount: TLabel;
lblFee: TLabel;
ebFee: TEdit;
PageControlOpType: TPageControl;
tsTransaction: TTabSheet;
lblDestAccount: TLabel;
lblAmount: TLabel;
lblTransactionErrors: TLabel;
ebDestAccount: TEdit;
ebAmount: TEdit;
tsChangePrivateKey: TTabSheet;
gbChangeKey: TGroupBox;
lblNewPrivateKey: TLabel;
lblNewOwnerPublicKey: TLabel;
lblNewOwnerErrors: TLabel;
lblChangeKeyErrors: TLabel;
rbChangeKeyWithAnother: TRadioButton;
cbNewPrivateKey: TComboBox;
ebNewPublicKey: TEdit;
bbChangePrivateKeyKeys: TBitBtn;
rbChangeKeyTransferAccountToNewOwner: TRadioButton;
tsListForSale: TTabSheet;
gbSaleType: TGroupBox;
Label1: TLabel;
Label3: TLabel;
lblSaleNewOwnerPublicKey: TLabel;
lblSaleLockedUntilBlock: TLabel;
rbListAccountForPublicSale: TRadioButton;
rbListAccountForPrivateSale: TRadioButton;
ebSalePrice: TEdit;
ebSellerAccount: TEdit;
ebSaleNewOwnerPublicKey: TEdit;
ebSaleLockedUntilBlock: TEdit;
tsDelist: TTabSheet;
tsBuyAccount: TTabSheet;
lblListAccountErrors: TLabel;
lblAccountToBuy: TLabel;
ebAccountToBuy: TEdit;
lblBuyAmount: TLabel;
ebBuyAmount: TEdit;
lblBuyAccountErrors: TLabel;
lblBuyNewKey: TLabel;
cbBuyNewKey: TComboBox;
bbBuyNewKey: TBitBtn;
Label2: TLabel;
lblDelistErrors: TLabel;
procedure ebNewPublicKeyExit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure memoPayloadClick(Sender: TObject);
procedure ebEncryptPasswordChange(Sender: TObject);
procedure bbChangePrivateKeyKeysClick(Sender: TObject);
procedure actExecuteExecute(Sender: TObject);
procedure ebSenderAccountExit(Sender: TObject);
procedure ebSenderAccountKeyPress(Sender: TObject; var Key: Char);
procedure bbPasswordClick(Sender: TObject);
procedure PageControlOpTypeChange(Sender: TObject);
procedure sbSearchBuyAccountClick(Sender: TObject);
procedure sbSearchDestinationAccountClick(Sender: TObject);
procedure sbSearchListerSellerAccountClick(Sender: TObject);
procedure sbSearchSignerAccountClick(Sender: TObject);
procedure updateInfoClick(Sender: TObject);
procedure bbBuyNewKeyClick(Sender: TObject);
procedure ebAccountNumberExit(Sender: TObject);
procedure ebCurrencyExit(Sender: TObject);
private
FNode : TNode;
FWalletKeys: TWalletKeys;
FDefaultFee: Int64;
FEncodedPayload : TRawBytes;
FDisabled : Boolean;
FSenderAccounts: TOrderedCardinalList; // TODO: TOrderedCardinalList should be replaced with a "TCardinalList" since signer account should be processed last
procedure SetWalletKeys(const Value: TWalletKeys);
Procedure UpdateWalletKeys;
{ Private declarations }
Procedure UpdateAccountsInfo;
Function UpdateFee(var Fee : Int64; errors : AnsiString) : Boolean;
Function UpdateOperationOptions(var errors : AnsiString) : Boolean;
Function UpdatePayload(Const SenderAccount : TAccount; var errors : AnsiString) : Boolean;
Function UpdateOpTransaction(Const SenderAccount : TAccount; var DestAccount : TAccount; var amount : Int64; var errors : AnsiString) : Boolean;
Function UpdateOpChangeKey(Const TargetAccount : TAccount; var SignerAccount : TAccount; var NewPublicKey : TAccountKey; var errors : AnsiString) : Boolean;
Function UpdateOpListForSale(Const TargetAccount : TAccount; var SalePrice : Int64; var SellerAccount,SignerAccount : TAccount; var NewOwnerPublicKey : TAccountKey; var LockedUntilBlock : Cardinal; var errors : AnsiString) : Boolean;
Function UpdateOpDelist(Const TargetAccount : TAccount; var SignerAccount : TAccount; var errors : AnsiString) : Boolean;
Function UpdateOpBuyAccount(Const SenderAccount : TAccount; var AccountToBuy : TAccount; var amount : Int64; var NewPublicKey : TAccountKey; var errors : AnsiString) : Boolean;
Function UpdateOpChangeInfo(Const TargetAccount : TAccount; var SignerAccount : TAccount; var changeName : Boolean; var newName : AnsiString; var changeType : Boolean; var newType : Word; var errors : AnsiString) : Boolean;
procedure SetDefaultFee(const Value: Int64);
Procedure OnSenderAccountsChanged(Sender : TObject);
procedure OnWalletKeysChanged(Sender : TObject);
procedure CM_WalletChanged(var Msg: TMessage); message CM_PC_WalletKeysChanged;
Function GetDefaultSenderAccount : TAccount;
procedure ebAccountKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
protected
procedure searchAccount(editBox : TCustomEdit);
public
{ Public declarations }
Property SenderAccounts : TOrderedCardinalList read FSenderAccounts;
Property WalletKeys : TWalletKeys read FWalletKeys write SetWalletKeys;
Property DefaultFee : Int64 read FDefaultFee write SetDefaultFee;
end;
implementation
uses
UECIES, UConst, UOpTransaction, UFRMNewPrivateKeyType, UAES, UFRMWalletKeys, UOperationsHashTree, UPCOperation, UECDSA_Public, UCardinalsArray, UAccountComp,
UPtrInt, UPascalCoinSafeBox;
{$IFnDEF FPC}
{$R *.dfm}
{$ELSE}
{$R *.lfm}
{$ENDIF}
Type
{ Created by Herman Schoenfeld as TArrayTool in v2.0
Moved here from UCommon.pas and renamed in order to be Delphi specific (Delphi will no longer use UCommon.pas) }
TArrayTool_internal<T> = class
public
class procedure Swap(var Values : array of T; Item1Index, Item2Index : Integer);
end;
{ TArrayTool_internal }
class procedure TArrayTool_internal<T>.Swap(var Values : array of T; Item1Index, Item2Index : Integer);
var temp : T; len, recSize : Integer; itemSize : Integer;
begin
len := Length(Values);
recSize := SizeOf(T);
if (Item1Index < 0) OR (Item1Index > len) then Raise Exception.Create('Invalid Parameter: Item1Index out of bounds');
if (Item2Index < 0) OR (Item2Index > len) then Raise Exception.Create('Invalid Parameter: Item2Index out of bounds');
temp := Values[Item1Index];
Values[Item1Index] := Values[Item2Index];
Values[Item2Index] := temp;
end;
{ TFRMOperation }
procedure TFRMOperation.actExecuteExecute(Sender: TObject);
Var errors : AnsiString;
P : PAccount;
i,iAcc : Integer;
wk : TWalletKey;
ops : TOperationsHashTree;
op : TPCOperation;
account,signerAccount,destAccount,accountToBuy : TAccount;
operation_to_string, operationstxt, auxs : String;
_amount,_fee, _totalamount, _totalfee, _totalSignerFee, _salePrice : Int64;
_lockedUntil, _signer_n_ops : Cardinal;
dooperation : Boolean;
_newOwnerPublicKey : TECDSA_Public;
_newName : TRawBytes;
_newType : Word;
_changeName, _changeType, _V2, _executeSigner : Boolean;
_senderAccounts : TCardinalsArray;
label loop_start;
begin
if Not Assigned(WalletKeys) then raise Exception.Create('No wallet keys');
If Not UpdateOperationOptions(errors) then raise Exception.Create(errors);
ops := TOperationsHashTree.Create;
Try
_V2 := PascalCoinSafeBox.CurrentProtocol >= CT_PROTOCOL_2;
_totalamount := 0;
_totalfee := 0;
_totalSignerFee := 0;
_signer_n_ops := 0;
operationstxt := '';
operation_to_string := '';
// Compile FSenderAccounts into a reorderable array
_senderAccounts := FSenderAccounts.ToArray;
// Loop through each sender account
for iAcc := 0 to Length(_senderAccounts) - 1 do begin
loop_start:
op := Nil;
account := FNode.Operations.SafeBoxTransaction.Account(_senderAccounts[iAcc]);
If Not UpdatePayload(account, errors) then
raise Exception.Create('Error encoding payload of sender account '+TAccountComp.AccountNumberToAccountTxtNumber(account.account)+': '+errors);
i := WalletKeys.IndexOfAccountKey(account.accountInfo.accountKey);
if i<0 then begin
Raise Exception.Create('Sender account private key not found in Wallet');
end;
wk := WalletKeys.Key[i];
dooperation := true;
// Default fee
if account.balance > uint64(DefaultFee) then _fee := DefaultFee else _fee := account.balance;
// Determine which operation type it is
if PageControlOpType.ActivePage = tsTransaction then begin
{%region Operation: Transaction}
if Not UpdateOpTransaction(account,destAccount,_amount,errors) then raise Exception.Create(errors);
if Length(_senderAccounts) > 1 then begin
if account.balance>0 then begin
if account.balance>DefaultFee then begin
_amount := account.balance - DefaultFee;
_fee := DefaultFee;
end else begin
_amount := account.balance;
_fee := 0;
end;
end else dooperation := false;
end else begin
end;
if dooperation then begin
op := TOpTransaction.CreateTransaction(account.account,account.n_operation+1,destAccount.account,wk.PrivateKey,_amount,_fee,FEncodedPayload);
_totalamount := _totalamount + _amount;
_totalfee := _totalfee + _fee;
end;
operationstxt := 'Transaction to '+TAccountComp.AccountNumberToAccountTxtNumber(destAccount.account);
{%endregion}
end else if (PageControlOpType.ActivePage = tsChangePrivateKey) then begin
{%region Operation: Change Private Key}
if Not UpdateOpChangeKey(account,signerAccount,_newOwnerPublicKey,errors) then raise Exception.Create(errors);
if _V2 then begin
// must ensure is Signer account last if included in sender accounts (not necessarily ordered enumeration)
if (iAcc < Length(_senderAccounts) - 1) AND (account.account = signerAccount.account) then begin
TArrayTool_internal<Cardinal>.Swap(_senderAccounts, iAcc, Length(_senderAccounts) - 1); // ensure signer account processed last
goto loop_start; // TODO: remove ugly hack with refactoring!
end;
// Maintain correct signer fee distribution
if uint64(_totalSignerFee) >= signerAccount.balance then _fee := 0
else if signerAccount.balance - uint64(_totalSignerFee) > uint64(DefaultFee) then _fee := DefaultFee
else _fee := signerAccount.balance - uint64(_totalSignerFee);
op := TOpChangeKeySigned.Create(signerAccount.account,signerAccount.n_operation+_signer_n_ops+1,account.account,wk.PrivateKey,_newOwnerPublicKey,_fee,FEncodedPayload);
inc(_signer_n_ops);
_totalSignerFee := _totalSignerFee + _fee;
end else begin
op := TOpChangeKey.Create(account.account,account.n_operation+1,account.account,wk.PrivateKey,_newOwnerPublicKey,_fee,FEncodedPayload);
end;
_totalfee := _totalfee + _fee;
operationstxt := 'Change private key to '+TAccountComp.GetECInfoTxt(_newOwnerPublicKey.EC_OpenSSL_NID);
{%endregion}
end else if (PageControlOpType.ActivePage = tsListForSale) then begin
{%region Operation: List For Sale}
If Not UpdateOpListForSale(account,_salePrice,destAccount,signerAccount,_newOwnerPublicKey,_lockedUntil,errors) then raise Exception.Create(errors);
// Special fee account:
if signerAccount.balance>DefaultFee then _fee := DefaultFee
else _fee := signerAccount.balance;
if (rbListAccountForPublicSale.Checked) then begin
op := TOpListAccountForSale.CreateListAccountForSale(signerAccount.account,signerAccount.n_operation+1+iAcc, account.account,_salePrice,_fee,destAccount.account,CT_TECDSA_Public_Nul,0,wk.PrivateKey,FEncodedPayload);
end else if (rbListAccountForPrivateSale.Checked) then begin
op := TOpListAccountForSale.CreateListAccountForSale(signerAccount.account,signerAccount.n_operation+1+iAcc, account.account,_salePrice,_fee,destAccount.account,_newOwnerPublicKey,_lockedUntil,wk.PrivateKey,FEncodedPayload);
end else raise Exception.Create('Select Sale type');
{%endregion}
end else if (PageControlOpType.ActivePage = tsDelist) then begin
{%region Operation: Delist For Sale}
if Not UpdateOpDelist(account,signerAccount,errors) then raise Exception.Create(errors);
// Special fee account:
if signerAccount.balance>DefaultFee then _fee := DefaultFee
else _fee := signerAccount.balance;
op := TOpDelistAccountForSale.CreateDelistAccountForSale(signerAccount.account,signerAccount.n_operation+1+iAcc,account.account,_fee,wk.PrivateKey,FEncodedPayload);
{%endregion}
end else if (PageControlOpType.ActivePage = tsBuyAccount) then begin
{%region Operation: Buy Account}
if Not UpdateOpBuyAccount(account,accountToBuy,_amount,_newOwnerPublicKey,errors) then raise Exception.Create(errors);
op := TOpBuyAccount.CreateBuy(account.account,account.n_operation+1,accountToBuy.account,accountToBuy.accountInfo.account_to_pay,
accountToBuy.accountInfo.price,_amount,_fee,_newOwnerPublicKey,wk.PrivateKey,FEncodedPayload);
{%endregion}
end else if (PageControlOpType.ActivePage = tsChangeInfo) then begin
{%region Operation: Change Info}
if not UpdateOpChangeInfo(account,signerAccount,_changeName,_newName,_changeType,_newType,errors) then begin
If Length(_senderAccounts)=1 then raise Exception.Create(errors);
end else begin
if signerAccount.balance>DefaultFee then _fee := DefaultFee
else _fee := signerAccount.balance;
op := TOpChangeAccountInfo.CreateChangeAccountInfo(signerAccount.account,signerAccount.n_operation+1,account.account,wk.PrivateKey,false,CT_TECDSA_Public_Nul,
_changeName,_newName,_changeType,_newType,_fee,FEncodedPayload);
end;
{%endregion}
end else begin
raise Exception.Create('No operation selected');
end;
if Assigned(op) And (dooperation) then begin
ops.AddOperationToHashTree(op);
if operation_to_string<>'' then operation_to_string := operation_to_string + #10;
operation_to_string := operation_to_string + op.ToString;
end;
FreeAndNil(op);
end;
if (ops.OperationsCount=0) then raise Exception.Create('No valid operation to execute');
if (Length(_senderAccounts)>1) then begin
if PageControlOpType.ActivePage = tsTransaction then auxs := 'Total amount that dest will receive: '+TAccountComp.FormatMoney(_totalamount)+#10
else auxs:='';
if Application.MessageBox(PChar('Execute '+Inttostr(Length(_senderAccounts))+' operations?'+#10+
'Operation: '+operationstxt+#10+
auxs+
'Total fee: '+TAccountComp.FormatMoney(_totalfee)+#10+#10+'Note: This operation will be transmitted to the network!'),
PChar(Application.Title),MB_YESNO+MB_ICONINFORMATION+MB_DEFBUTTON2)<>IdYes then exit;
end else begin
if Application.MessageBox(PChar('Execute this operation:'+#10+#10+operation_to_string+#10+#10+'Note: This operation will be transmitted to the network!'),
PChar(Application.Title),MB_YESNO+MB_ICONINFORMATION+MB_DEFBUTTON2)<>IdYes then exit;
end;
i := FNode.AddOperations(nil,ops,Nil,errors);
if (i=ops.OperationsCount) then begin
operationstxt := 'Successfully executed '+inttostr(i)+' operations!'+#10+#10+operation_to_string;
If i>1 then begin
With TFRMMemoText.Create(Self) do
Try
InitData(Application.Title,operationstxt);
ShowModal;
finally
Free;
end;
end else begin
Application.MessageBox(PChar('Successfully executed '+inttostr(i)+' operations!'+#10+#10+operation_to_string),PChar(Application.Title),MB_OK+MB_ICONINFORMATION);
end;
ModalResult := MrOk;
end else if (i>0) then begin
operationstxt := 'One or more of your operations has not been executed:'+#10+
'Errors:'+#10+
errors+#10+#10+
'Total successfully executed operations: '+inttostr(i);
With TFRMMemoText.Create(Self) do
Try
InitData(Application.Title,operationstxt);
ShowModal;
finally
Free;
end;
ModalResult := MrOk;
end else begin
raise Exception.Create(errors);
end;
Finally
ops.Free;
End;
end;
procedure TFRMOperation.bbBuyNewKeyClick(Sender: TObject);
Var FRM : TFRMWalletKeys;
begin
FRM := TFRMWalletKeys.Create(Self);
Try
FRM.WalletKeys := WalletKeys;
FRM.ShowModal;
cbBuyNewKey.SetFocus;
UpdateWalletKeys;
Finally
FRM.Free;
End;
end;
procedure TFRMOperation.bbChangePrivateKeyKeysClick(Sender: TObject);
Var FRM : TFRMWalletKeys;
begin
FRM := TFRMWalletKeys.Create(Self);
Try
FRM.WalletKeys := WalletKeys;
FRM.ShowModal;
rbChangeKeyWithAnother.Checked := true;
cbNewPrivateKey.SetFocus;
UpdateWalletKeys;
Finally
FRM.Free;
End;
end;
procedure TFRMOperation.bbPasswordClick(Sender: TObject);
Var s : String;
errors : AnsiString;
begin
if FWalletKeys.IsValidPassword then begin
end else begin
s := '';
Repeat
if Not InputQuery('Wallet password','Enter wallet password',s) then exit;
FWalletKeys.WalletPassword := s;
Until FWalletKeys.IsValidPassword;
SetWalletKeys(WalletKeys);
UpdateOperationOptions(errors);
end;
end;
procedure TFRMOperation.CM_WalletChanged(var Msg: TMessage);
begin
UpdateWalletKeys;
end;
procedure TFRMOperation.ebAccountNumberExit(Sender: TObject);
Var an : Cardinal;
eb : TEdit;
begin
if (Not assigned(Sender)) then exit;
if (Not (Sender is TEdit)) then exit;
eb := TEdit(Sender);
If TAccountComp.AccountTxtNumberToAccountNumber(eb.Text,an) then begin
eb.Text := TAccountComp.AccountNumberToAccountTxtNumber(an);
end else begin
eb.Text := '';
end;
updateInfoClick(Nil);
end;
procedure TFRMOperation.ebCurrencyExit(Sender: TObject);
Var m : Int64;
eb : TEdit;
begin
if (Not assigned(Sender)) then exit;
if (Not (Sender is TEdit)) then exit;
eb := TEdit(Sender);
If Not (eb.ReadOnly) then begin
if Not TAccountComp.TxtToMoney(eb.Text,m) then m:=0;
eb.Text := TAccountComp.FormatMoney(m);
updateInfoClick(Nil);
end;
end;
procedure TFRMOperation.ebEncryptPasswordChange(Sender: TObject);
begin
if FDisabled then exit;
rbEncrptedWithPassword.Checked := true;
memoPayloadClick(Nil);
end;
procedure TFRMOperation.ebSenderAccountExit(Sender: TObject);
Var an : Cardinal;
begin
If TAccountComp.AccountTxtNumberToAccountNumber(ebSenderAccount.Text,an) then begin
SenderAccounts.Disable;
try
SenderAccounts.Clear;
SenderAccounts.Add(an);
finally
SenderAccounts.Enable;
end;
ebSenderAccount.Text := TAccountComp.AccountNumberToAccountTxtNumber(an);
end else begin
if SenderAccounts.Count=1 then begin
ebSenderAccount.Text := TAccountComp.AccountNumberToAccountTxtNumber(SenderAccounts.Get(0));
end else begin
ebSenderAccount.Text := '';
end;
end;
end;
procedure TFRMOperation.ebSenderAccountKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then ebSenderAccountExit(Nil);
end;
procedure TFRMOperation.FormCreate(Sender: TObject);
begin
FDisabled := false;
FWalletKeys := Nil;
FSenderAccounts := TOrderedCardinalList.Create;
FSenderAccounts.OnListChanged := OnSenderAccountsChanged;
FDisabled := true;
ebSenderAccount.OnKeyDown:=ebAccountKeyDown;
ebSenderAccount.Tag:=CT_AS_MyAccounts;
ebSignerAccount.Text:='';
ebSignerAccount.OnChange := updateInfoClick;
ebSignerAccount.OnExit := ebAccountNumberExit;
ebSignerAccount.OnKeyDown := ebAccountKeyDown;
ebSignerAccount.tag := CT_AS_MyAccounts;
sbSearchSignerAccount.OnClick := sbSearchSignerAccountClick;
//
lblTransactionErrors.Caption := '';
ebDestAccount.Text := '';
ebDestAccount.OnChange := updateInfoClick;
ebDestAccount.OnExit := ebAccountNumberExit;
ebDestAccount.OnKeyDown := ebAccountKeyDown;
ebAmount.Text := TAccountComp.FormatMoney(0);
ebAmount.OnChange := updateInfoClick;
ebAmount.OnExit := ebCurrencyExit;
//
lblChangeKeyErrors.Caption := '';
lblNewOwnerErrors.Caption := '';
rbChangeKeyWithAnother.OnClick := updateInfoClick;
rbChangeKeyTransferAccountToNewOwner.OnClick := updateInfoClick;
cbNewPrivateKey.OnChange := updateInfoClick;
//
lblListAccountErrors.Caption := '';
rbListAccountForPublicSale.OnClick := updateInfoClick;
rbListAccountForPrivateSale.OnClick := updateInfoClick;
ebSalePrice.Text := TAccountComp.FormatMoney(0);
ebSalePrice.OnChange := updateInfoClick;
ebSalePrice.OnExit := ebCurrencyExit;
ebSellerAccount.Text := '';
ebSellerAccount.OnChange := updateInfoClick;
ebSellerAccount.OnExit := ebAccountNumberExit;
ebSellerAccount.OnKeyDown := ebAccountKeyDown;
ebSellerAccount.tag := CT_AS_MyAccounts;
ebSaleNewOwnerPublicKey.Text := '';
ebSaleNewOwnerPublicKey.OnChange := updateInfoClick;
ebSaleLockedUntilBlock.Text := '';
ebSaleLockedUntilBlock.OnChange := updateInfoClick;
//
lblDelistErrors.Caption := '';
//
lblBuyAccountErrors.Caption := '';
ebAccountToBuy.Text := '';
ebAccountToBuy.OnChange := updateInfoClick;
ebAccountToBuy.OnExit := ebAccountNumberExit;
ebAccountToBuy.OnKeyDown := ebAccountKeyDown;
ebAccountToBuy.tag := CT_AS_OnlyForSale;
ebBuyAmount.Text := TAccountComp.FormatMoney(0);
ebBuyAmount.OnChange := updateInfoClick;
ebBuyAmount.OnExit := ebCurrencyExit;
//
ebChangeName.OnChange:=updateInfoClick;
ebChangeType.OnChange:=updateInfoClick;
//
sbSearchDestinationAccount.OnClick := sbSearchDestinationAccountClick;
sbSearchListerSellerAccount.OnClick := sbSearchListerSellerAccountClick;
sbSearchBuyAccount.OnClick := sbSearchBuyAccountClick;
//
ebFee.Text := TAccountComp.FormatMoney(0);
ebFee.OnExit:= ebCurrencyExit;
memoAccounts.Lines.Clear;
PageControlOpType.ActivePage := tsTransaction;
end;
procedure TFRMOperation.ebNewPublicKeyExit(Sender: TObject);
var errors : AnsiString;
begin
UpdateOperationOptions(errors);
end;
procedure TFRMOperation.FormDestroy(Sender: TObject);
begin
if Assigned(FWalletKeys) then FWalletKeys.OnChanged.Remove(OnWalletKeysChanged);
FreeAndNil(FSenderAccounts);
end;
function TFRMOperation.GetDefaultSenderAccount: TAccount;
begin
if FSenderAccounts.Count>=1 then Result := FNode.Operations.SafeBoxTransaction.Account( FSenderAccounts.Get(0) )
else Result := CT_Account_NUL;
end;
procedure TFRMOperation.ebAccountKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
Var eb : TCustomEdit;
begin
If (key <> VK_F2) then exit;
If Not Assigned(Sender) then exit;
if Not (Sender is TCustomEdit) then exit;
eb := TCustomEdit(Sender);
searchAccount(eb);
end;
procedure TFRMOperation.searchAccount(editBox: TCustomEdit);
Var F : TFRMAccountSelect;
c : Cardinal;
begin
F := TFRMAccountSelect.Create(Self);
try
F.WalletKeys := FWalletKeys;
F.Filters:=editBox.Tag;
If TAccountComp.AccountTxtNumberToAccountNumber(editBox.Text,c) then F.DefaultAccount := c;
F.AllowSelect:=True;
If F.ShowModal=MrOk then begin
editBox.Text := TAccountComp.AccountNumberToAccountTxtNumber(F.GetSelected);
end;
finally
F.Free;
end;
end;
procedure TFRMOperation.memoPayloadClick(Sender: TObject);
Var errors : AnsiString;
begin
if SenderAccounts.Count>0 then begin
UpdatePayload(PascalCoinSafeBox.Account(SenderAccounts.Get(0)),errors);
end;
end;
procedure TFRMOperation.OnSenderAccountsChanged(Sender: TObject);
Var errors : AnsiString;
begin
if SenderAccounts.Count>1 then begin
ebAmount.Text := 'ALL BALANCE';
ebAmount.font.Style := [fsBold];
ebAmount.ReadOnly := true;
end else begin
ebAmount.Text := TAccountComp.FormatMoney(0);
ebAmount.ReadOnly := false;
ebAmount.Enabled := true;
end;
If SenderAccounts.Count>=1 then begin
ebSignerAccount.text := TAccountComp.AccountNumberToAccountTxtNumber(SenderAccounts.Get(0));
ebChangeName.Text := FNode.Operations.SafeBoxTransaction.Account(SenderAccounts.Get(0)).name;
ebChangeType.Text := IntToStr(FNode.Operations.SafeBoxTransaction.Account(SenderAccounts.Get(0)).account_type);
end else begin
ebSignerAccount.text := '';
ebChangeName.Text := '';
ebChangeType.Text := '';
end;
UpdateAccountsInfo;
UpdateOperationOptions(errors);
end;
procedure TFRMOperation.OnWalletKeysChanged(Sender: TObject);
begin
PostMessage(Self.Handle,CM_PC_WalletKeysChanged,0,0);
end;
procedure TFRMOperation.PageControlOpTypeChange(Sender: TObject);
var errors : AnsiString;
begin
UpdateOperationOptions(errors);
end;
procedure TFRMOperation.sbSearchBuyAccountClick(Sender: TObject);
begin
searchAccount(ebAccountToBuy);
end;
procedure TFRMOperation.sbSearchDestinationAccountClick(Sender: TObject);
begin
searchAccount(ebDestAccount);
end;
procedure TFRMOperation.sbSearchListerSellerAccountClick(Sender: TObject);
begin
searchAccount(ebSellerAccount);
end;
procedure TFRMOperation.sbSearchSignerAccountClick(Sender: TObject);
begin
searchAccount(ebSignerAccount);
end;
procedure TFRMOperation.SetDefaultFee(const Value: Int64);
var wd : Boolean;
begin
if FDefaultFee = Value then exit;
wd := FDisabled;
try
FDisabled := true;
FDefaultFee := Value;
ebFee.Text := TAccountComp.FormatMoney(value);
finally
FDisabled := wd;
end;
end;
procedure TFRMOperation.SetWalletKeys(const Value: TWalletKeys);
begin
Try
if FWalletKeys=Value then exit;
if Assigned(FWalletKeys) then FWalletKeys.OnChanged.Remove(OnWalletKeysChanged);
FWalletKeys := Value;
if Assigned(FWalletKeys) then begin
FWalletKeys.OnChanged.Add(OnWalletKeysChanged);
end;
Finally
UpdateWalletKeys;
End;
end;
procedure TFRMOperation.UpdateAccountsInfo;
Var ld : Boolean;
i : Integer;
balance : int64;
acc : TAccount;
accountstext : String;
begin
ld := FDisabled;
FDisabled := true;
Try
lblAccountCaption.Caption := 'Account';
lblAccountsCount.Visible := false;
lblAccountsCount.caption := inttostr(senderAccounts.Count)+' accounts';
balance := 0;
if SenderAccounts.Count<=0 then begin
ebSenderAccount.Text := '';
memoAccounts.Visible := false;
ebSenderAccount.Visible := true;
end else if SenderAccounts.Count=1 then begin
ebSenderAccount.Text := TAccountComp.AccountNumberToAccountTxtNumber(SenderAccounts.Get(0));
memoAccounts.Visible := false;
ebSenderAccount.Visible := true;
balance := PascalCoinNode.Operations.SafeBoxTransaction.Account(SenderAccounts.Get(0)).balance;
end else begin
// Multiple sender accounts
lblAccountCaption.Caption := 'Accounts';
lblAccountsCount.Visible := true;
ebSenderAccount.Visible := false;
accountstext := '';
for i := 0 to SenderAccounts.Count - 1 do begin
acc := PascalCoinNode.Operations.SafeBoxTransaction.Account(SenderAccounts.Get(i));
balance := balance + acc.balance;
if (accountstext<>'') then accountstext:=accountstext+'; ';
accountstext := accountstext+TAccountComp.AccountNumberToAccountTxtNumber(acc.account)+' ('+TAccountComp.FormatMoney(acc.balance)+')';
end;
memoAccounts.Lines.Text := accountstext;
memoAccounts.Visible := true;
end;
ebSenderAccount.Enabled := ebSenderAccount.Visible;
lblAccountBalance.Caption := TAccountComp.FormatMoney(balance);
Finally
FDisabled := ld;
End;
end;
function TFRMOperation.UpdateFee(var Fee: Int64; errors: AnsiString): Boolean;
begin
errors := '';
if trim(ebFee.Text)<>'' then begin
Result := TAccountComp.TxtToMoney(Trim(ebFee.Text),Fee);
if not Result then errors := 'Invalid fee value "'+ebFee.Text+'"';
end else begin
Fee := 0;
Result := true;
end;
end;
procedure TFRMOperation.updateInfoClick(Sender: TObject);
Var errors : AnsiString;
begin
UpdateOperationOptions(errors);
end;
function TFRMOperation.UpdateOpBuyAccount(const SenderAccount: TAccount; var AccountToBuy: TAccount; var amount: Int64; var NewPublicKey: TAccountKey; var errors: AnsiString): Boolean;
var c : Cardinal;
i : Integer;
begin
//
lblBuyAccountErrors.Caption := ''; c:=0;
errors := '';
Try
if SenderAccounts.Count<>1 then begin
errors := 'Cannot buy accounts with multioperations. Use only 1 account';
exit;
end;
If (Not TAccountComp.AccountTxtNumberToAccountNumber(ebAccountToBuy.Text,c)) then begin
errors := 'Invalid account to buy '+ebAccountToBuy.Text;
exit;
end;
If (c<0) Or (c>=PascalCoinSafeBox.AccountsCount) Or (c=SenderAccount.account) then begin
errors := 'Invalid account number';
exit;
end;
AccountToBuy := FNode.Operations.SafeBoxTransaction.Account(c);
If not TAccountComp.IsAccountForSale(AccountToBuy.accountInfo) then begin
errors := 'Account '+TAccountComp.AccountNumberToAccountTxtNumber(c)+' is not for sale';
exit;
end;
If Not TAccountComp.TxtToMoney(ebBuyAmount.Text,amount) then begin
errors := 'Invalid amount value';
exit;
end;
if (AccountToBuy.accountInfo.price>amount) then begin
errors := 'Account price '+TAccountComp.FormatMoney(AccountToBuy.accountInfo.price);
exit;
end;
if (amount+DefaultFee > SenderAccount.balance) then begin
errors := 'Insufficient funds';
exit;
end;
if cbBuyNewKey.ItemIndex<0 then begin
errors := 'Must select a new private key';
exit;
end;
i := PtrInt(cbBuyNewKey.Items.Objects[cbBuyNewKey.ItemIndex]);
if (i<0) Or (i>=WalletKeys.Count) then raise Exception.Create('Invalid selected key');
NewPublicKey := WalletKeys.Key[i].AccountKey;
If (PascalCoinSafeBox.CurrentProtocol=CT_PROTOCOL_1) then begin
errors := 'This operation needs PROTOCOL 2 active';
exit;
end;
Finally
Result := errors = '';
lblBuyAccountErrors.Caption := errors;
End;
end;
function TFRMOperation.UpdateOpChangeInfo(const TargetAccount: TAccount; var SignerAccount : TAccount;
var changeName : Boolean; var newName: AnsiString; var changeType : Boolean; var newType: Word; var errors: AnsiString): Boolean;
var auxC : Cardinal;
i : Integer;
errCode : Integer;
begin
Result := false;
errors := '';
lblChangeInfoErrors.Caption:='';
if not (PageControlOpType.ActivePage=tsChangeInfo) then exit;
try
if (TAccountComp.IsAccountLocked(TargetAccount.accountInfo,PascalCoinSafeBox.BlocksCount)) then begin
errors := 'Account '+TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account)+' is locked until block '+IntToStr(TargetAccount.accountInfo.locked_until_block);
exit;
end;
// Signer:
if SenderAccounts.Count=1 then begin
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSignerAccount.Text,auxC) then begin
errors := 'Invalid signer account';
exit;
end;
end else begin
auxC := TargetAccount.account;
end;
if (auxC<0) Or (auxC >= PascalCoinSafeBox.AccountsCount) then begin
errors := 'Signer account does not exists '+TAccountComp.AccountNumberToAccountTxtNumber(auxC);
exit;
end;
SignerAccount := FNode.Operations.SafeBoxTransaction.Account(auxC);
if (TAccountComp.IsAccountLocked(SignerAccount.accountInfo,PascalCoinSafeBox.BlocksCount)) then begin
errors := 'Signer account '+TAccountComp.AccountNumberToAccountTxtNumber(SignerAccount.account)+' is locked until block '+IntToStr(SignerAccount.accountInfo.locked_until_block);
exit;
end;
if (Not TAccountComp.EqualAccountKeys(SignerAccount.accountInfo.accountKey,TargetAccount.accountInfo.accountKey)) then begin
errors := 'Signer account '+TAccountComp.AccountNumberToAccountTxtNumber(SignerAccount.account)+' is not ower of account '+TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account);
exit;
end;
If (PascalCoinSafeBox.CurrentProtocol=CT_PROTOCOL_1) then begin
errors := 'This operation needs PROTOCOL 2 active';
exit;
end;
// New name and type (only when single operation)
If (SenderAccounts.Count=1) then begin
newName := LowerCase( Trim(ebChangeName.Text) );
If newName<>TargetAccount.name then begin
changeName:=True;
If newName<>'' then begin
if (Not TPCSafeBox.ValidAccountName(newName,errors)) then begin
errors := '"'+newName+'" is not a valid name: '+errors;
Exit;
end;
i := (PascalCoinSafeBox.FindAccountByName(newName));
if (i>=0) then begin
errors := 'Name "'+newName+'" is used by account '+TAccountComp.AccountNumberToAccountTxtNumber(i);
Exit;
end;
end;
end else changeName := False;
end else changeName := False;
val(ebChangeType.Text,newType,errCode);
if (errCode>0) then begin
errors := 'Invalid type '+ebChangeType.text;
Exit;
end;
changeType := TargetAccount.account_type<>newType;
//
If (SenderAccounts.Count=1) And (newName=TargetAccount.name) And (newType=TargetAccount.account_type) then begin
errors := 'Account name and type are the same. Not changed';
Exit;
end;
finally
Result := errors = '';
if Not Result then begin
lblChangeInfoErrors.Font.Color := clRed;
lblChangeInfoErrors.Caption := errors;
end else begin
lblChangeInfoErrors.Font.Color := clGreen;
If (SenderAccounts.Count=1) then
lblChangeInfoErrors.Caption := TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account)+' can be updated'
else lblChangeInfoErrors.Caption := IntToStr(SenderAccounts.Count)+' accounts can be updated'
end;
end;
end;
function TFRMOperation.UpdateOpChangeKey(Const TargetAccount : TAccount; var SignerAccount : TAccount; var NewPublicKey: TAccountKey; var errors: AnsiString): Boolean;
var i : Integer;
auxC : Cardinal;
begin
Result := false;
errors := '';
lblChangeKeyErrors.Caption := '';
lblNewOwnerErrors.Caption := '';
if not (PageControlOpType.ActivePage=tsChangePrivateKey) then exit;
try
if rbChangeKeyWithAnother.Checked then begin
if cbNewPrivateKey.ItemIndex<0 then begin
errors := 'Must select a new private key';
lblChangeKeyErrors.Caption := errors;
exit;
end;
i := PtrInt(cbNewPrivateKey.Items.Objects[cbNewPrivateKey.ItemIndex]);
if (i<0) Or (i>=WalletKeys.Count) then raise Exception.Create('Invalid selected key');
NewPublicKey := WalletKeys.Key[i].AccountKey;
end else if rbChangeKeyTransferAccountToNewOwner.Checked then begin
If Not TAccountComp.AccountKeyFromImport(ebNewPublicKey.Text,NewPublicKey,errors) then begin
lblNewOwnerErrors.Caption := errors;
lblNewOwnerErrors.Font.Color := clRed;
exit;
end else begin
lblNewOwnerErrors.Caption := 'New key type: '+TAccountComp.GetECInfoTxt(NewPublicKey.EC_OpenSSL_NID);
lblNewOwnerErrors.Font.Color := clGreen;
end;
end else begin
errors := 'Select a change type';
lblChangeKeyErrors.Caption := errors;
exit;
end;
If PascalCoinSafeBox.CurrentProtocol>=1 then begin
// Signer:
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSignerAccount.Text,auxC) then begin
errors := 'Invalid signer account';
exit;
end;
if (auxC<0) Or (auxC >= PascalCoinSafeBox.AccountsCount) then begin
errors := 'Signer account does not exists '+TAccountComp.AccountNumberToAccountTxtNumber(auxC);
exit;
end;
SignerAccount := FNode.Operations.SafeBoxTransaction.Account(auxC);
if (TAccountComp.IsAccountLocked(SignerAccount.accountInfo,PascalCoinSafeBox.BlocksCount)) then begin
errors := 'Signer account '+TAccountComp.AccountNumberToAccountTxtNumber(SignerAccount.account)+' is locked until block '+IntToStr(SignerAccount.accountInfo.locked_until_block);
exit;
end;
if (Not TAccountComp.EqualAccountKeys(SignerAccount.accountInfo.accountKey,TargetAccount.accountInfo.accountKey)) then begin
errors := 'Signer account '+TAccountComp.AccountNumberToAccountTxtNumber(SignerAccount.account)+' is not ower of account '+TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account);
exit;
end;
end else SignerAccount := TargetAccount;
if (TAccountComp.EqualAccountKeys(TargetAccount.accountInfo.accountKey,NewPublicKey)) then begin
errors := 'New public key is the same public key';
lblChangeKeyErrors.Caption := errors;
lblNewOwnerErrors.Caption := errors;
exit;
end;
finally
Result := errors = '';
end;
end;
function TFRMOperation.UpdateOpDelist(const TargetAccount : TAccount; var SignerAccount : TAccount; var errors: AnsiString): Boolean;
Var auxC : Cardinal;
begin
lblDelistErrors.Caption := '';
errors := '';
Result := false;
if not (PageControlOpType.ActivePage=tsDelist) then exit;
try
if Not TAccountComp.IsAccountForSale(TargetAccount.accountInfo) then begin
errors := 'Account '+TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account)+' is not for sale';
exit;
end;
if (TAccountComp.IsAccountLocked(TargetAccount.accountInfo,PascalCoinSafeBox.BlocksCount)) then begin
errors := 'Account '+TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account)+' is locked until block '+IntToStr(TargetAccount.accountInfo.locked_until_block);
exit;
end;
// Signer:
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSignerAccount.Text,auxC) then begin
errors := 'Invalid signer account';
exit;
end;
if (auxC<0) Or (auxC >= PascalCoinSafeBox.AccountsCount) then begin
errors := 'Signer account does not exists '+TAccountComp.AccountNumberToAccountTxtNumber(auxC);
exit;
end;
SignerAccount := FNode.Operations.SafeBoxTransaction.Account(auxC);
if (TAccountComp.IsAccountLocked(SignerAccount.accountInfo,PascalCoinSafeBox.BlocksCount)) then begin
errors := 'Signer account '+TAccountComp.AccountNumberToAccountTxtNumber(SignerAccount.account)+' is locked until block '+IntToStr(SignerAccount.accountInfo.locked_until_block);
exit;
end;
if (Not TAccountComp.EqualAccountKeys(SignerAccount.accountInfo.accountKey,TargetAccount.accountInfo.accountKey)) then begin
errors := 'Signer account '+TAccountComp.AccountNumberToAccountTxtNumber(SignerAccount.account)+' is not ower of delisted account '+TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account);
exit;
end;
If (PascalCoinSafeBox.CurrentProtocol=CT_PROTOCOL_1) then begin
errors := 'This operation needs PROTOCOL 2 active';
exit;
end;
finally
Result := errors = '';
if Not Result then begin
lblDelistErrors.Font.Color := clRed;
lblDelistErrors.Caption := errors;
end else begin
lblDelistErrors.Font.Color := clGreen;
lblDelistErrors.Caption := TAccountComp.AccountNumberToAccountTxtNumber(TargetAccount.account)+' can be delisted';
end;
end;
end;
function TFRMOperation.UpdateOperationOptions(var errors : AnsiString) : Boolean;
Var
iWallet,iAcc : Integer;
wk : TWalletKey;
e : AnsiString;
sender_account,dest_account,seller_account, account_to_buy, signer_account : TAccount;
publicKey : TAccountKey;
salePrice, amount : Int64;
auxC : Cardinal;
changeName,changeType : Boolean;
newName : AnsiString;
newType : Word;
begin
Result := false;
sender_account := CT_Account_NUL;
errors := '';
if Not UpdateFee(FDefaultFee,errors) then exit;
try
bbPassword.Visible := false;
bbPassword.Enabled := false;
if Not Assigned(WalletKeys) then begin
errors := 'No wallet keys';
lblGlobalErrors.Caption := errors;
exit;
end;
if SenderAccounts.Count=0 then begin
errors := 'No sender account';
lblGlobalErrors.Caption := errors;
exit;
end else begin
for iAcc := 0 to SenderAccounts.Count - 1 do begin
sender_account := PascalCoinSafeBox.Account(SenderAccounts.Get(iAcc));
iWallet := WalletKeys.IndexOfAccountKey(sender_account.accountInfo.accountKey);
if (iWallet<0) then begin
errors := 'Private key of account '+TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account)+' not found in wallet';
lblGlobalErrors.Caption := errors;
exit;
end;
wk := WalletKeys.Key[iWallet];
if not assigned(wk.PrivateKey) then begin
if wk.CryptedKey<>'' then begin
errors := 'Wallet is password protected. Need password';
bbPassword.Visible := true;
bbPassword.Enabled := true;
end else begin
errors := 'Only public key of account '+TAccountComp.AccountNumberToAccountTxtNumber(sender_account.account)+' found in wallet. You cannot operate with this account';
end;
lblGlobalErrors.Caption := errors;
exit;
end;
end;
end;
lblGlobalErrors.Caption := '';
Finally
if lblGlobalErrors.Caption<>'' then begin
tsGlobalError.visible := true;
tsGlobalError.tabvisible := {$IFDEF LINUX}true{$ELSE}false{$ENDIF};
tsOperation.TabVisible := false;
PageControlLocked.ActivePage := tsGlobalError;
if bbPassword.CanFocus then begin
ActiveControl := bbPassword;
end;
end else begin
tsOperation.visible := true;
tsOperation.tabvisible := {$IFDEF LINUX}true{$ELSE}false{$ENDIF};
tsGlobalError.TabVisible := false;
PageControlLocked.ActivePage := tsOperation;
end;
End;
if (PageControlOpType.ActivePage = tsTransaction) then begin
Result := UpdateOpTransaction(GetDefaultSenderAccount,dest_account,amount,errors);
end else if (PageControlOpType.ActivePage = tsChangePrivateKey) then begin
Result := UpdateOpChangeKey(GetDefaultSenderAccount,signer_account,publicKey,errors);
end else if (PageControlOpType.ActivePage = tsListForSale) then begin
Result := UpdateOpListForSale(GetDefaultSenderAccount,salePrice,seller_account,signer_account,publicKey,auxC,errors);
end else if (PageControlOpType.ActivePage = tsDelist) then begin
Result := UpdateOpDelist(GetDefaultSenderAccount,signer_account,errors);
end else if (PageControlOpType.ActivePage = tsBuyAccount) then begin
Result := UpdateOpBuyAccount(GetDefaultSenderAccount,account_to_buy,amount,publicKey,errors);
end else if (PageControlOpType.ActivePage = tsChangeInfo) then begin
Result := UpdateOpChangeInfo(GetDefaultSenderAccount,signer_account,changeName,newName,changeType,newType,errors);
end else begin
errors := 'Must select an operation';
end;
if (PageControlOpType.ActivePage=tsTransaction) then begin
rbEncryptedWithOldEC.Caption := 'Encrypted with sender public key';
rbEncryptedWithEC.Caption := 'Encrypted with destination public key';
end else if (PageControlOpType.ActivePage=tsChangePrivateKey) then begin
rbEncryptedWithOldEC.Caption := 'Encrypted with old public key';
rbEncryptedWithEC.Caption := 'Encrypted with new public key';
end else if ((PageControlOpType.ActivePage=tsListForSale) Or (PageControlOpType.ActivePage=tsDelist)) then begin
rbEncryptedWithOldEC.Caption := 'Encrypted with target public key';
rbEncryptedWithEC.Caption := 'Encrypted with signer public key';
end else if (PageControlOpType.ActivePage=tsBuyAccount) then begin
rbEncryptedWithOldEC.Caption := 'Encrypted with buyer public key';
rbEncryptedWithEC.Caption := 'Encrypted with target public key';
end;
ebSignerAccount.Enabled:= ((PageControlOpType.ActivePage=tsChangePrivateKey) And (PascalCoinSafeBox.CurrentProtocol>=CT_PROTOCOL_2))
Or ((PageControlOpType.ActivePage=tsChangeInfo) And (SenderAccounts.Count=1))
Or (PageControlOpType.ActivePage=tsListForSale)
Or (PageControlOpType.ActivePage=tsDelist);
sbSearchSignerAccount.Enabled:=ebSignerAccount.Enabled;
lblSignerAccount.Enabled := ebSignerAccount.Enabled;
lblChangeName.Enabled:= (PageControlOpType.ActivePage=tsChangeInfo) And (SenderAccounts.Count=1);
ebChangeName.Enabled:= lblChangeName.Enabled;
//
UpdatePayload(sender_account, e);
end;
function TFRMOperation.UpdateOpListForSale(const TargetAccount: TAccount;
var SalePrice: Int64; var SellerAccount, SignerAccount: TAccount;
var NewOwnerPublicKey: TAccountKey; var LockedUntilBlock: Cardinal;
var errors: AnsiString): Boolean;
var auxC : Cardinal;
begin
Result := False;
SalePrice := 0; SellerAccount := CT_Account_NUL;
NewOwnerPublicKey := CT_TECDSA_Public_Nul;
LockedUntilBlock := 0; errors := '';
if (PageControlOpType.ActivePage <> tsListForSale) then exit;
lblListAccountErrors.Caption := '';
Try
if (rbListAccountForPublicSale.Checked) Or (rbListAccountForPrivateSale.Checked) then begin
if rbListAccountForPublicSale.Checked then begin
lblSaleNewOwnerPublicKey.Enabled := false;
ebSaleNewOwnerPublicKey.Enabled := false;
ebSaleLockedUntilBlock.Enabled := false;
lblSaleLockedUntilBlock.Enabled := false;
end else if rbListAccountForPrivateSale.Checked then begin
lblSaleNewOwnerPublicKey.Enabled := true;
ebSaleNewOwnerPublicKey.Enabled := true;
ebSaleLockedUntilBlock.Enabled := true;
lblSaleLockedUntilBlock.Enabled := true;
end;
if not TAccountComp.TxtToMoney(ebSalePrice.Text,salePrice) then begin
errors := 'Invalid price';
exit;
end;
// Signer:
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSignerAccount.Text,auxC) then begin
errors := 'Invalid signer account';
exit;
end;
if (auxC<0) Or (auxC >= PascalCoinSafeBox.AccountsCount) then begin
errors := 'Signer account does not exists '+TAccountComp.AccountNumberToAccountTxtNumber(auxC);
exit;
end;
SignerAccount := FNode.Operations.SafeBoxTransaction.Account(auxC);
// Seller
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSellerAccount.Text,auxC) then begin
errors := 'Invalid seller account';
exit;
end;
if (auxC<0) Or (auxC >= PascalCoinSafeBox.AccountsCount) then begin
errors := 'Seller account does not exists '+TAccountComp.AccountNumberToAccountTxtNumber(auxC);
exit;
end;
if (auxC=TargetAccount.account) then begin
errors := 'Seller account cannot be same account';
exit;
end;
SellerAccount := FNode.Operations.SafeBoxTransaction.Account(auxC);
if rbListAccountForPrivateSale.Checked then begin
lblSaleNewOwnerPublicKey.Enabled := true;
ebSaleNewOwnerPublicKey.Enabled := true;
ebSaleLockedUntilBlock.Enabled := true;
lblSaleLockedUntilBlock.Enabled := true;
If Not TAccountComp.AccountKeyFromImport(ebSaleNewOwnerPublicKey.Text,NewOwnerPublicKey,errors) then begin
errors := 'Public key: '+errors;
exit;
end else begin
lblListAccountErrors.Font.Color := clGreen;
lblListAccountErrors.Caption := 'New key type: '+TAccountComp.GetECInfoTxt(NewOwnerPublicKey.EC_OpenSSL_NID);
end;
if TAccountComp.EqualAccountKeys(NewOwnerPublicKey,TargetAccount.accountInfo.accountKey) then begin
errors := 'New public key for private sale is the same public key';
Exit;
end;
LockedUntilBlock := StrToIntDef(ebSaleLockedUntilBlock.Text,0);
if LockedUntilBlock=0 then begin
errors := 'Insert locking block';
exit;
end;
end;
If (PascalCoinSafeBox.CurrentProtocol=CT_PROTOCOL_1) then begin
errors := 'This operation needs PROTOCOL 2 active';
exit;
end;
end else begin
lblSaleNewOwnerPublicKey.Enabled := false;
ebSaleNewOwnerPublicKey.Enabled := false;
ebSaleLockedUntilBlock.Enabled := false;
lblSaleLockedUntilBlock.Enabled := false;
errors := 'Select a sale type';
exit;
end;
Finally
Result := errors='';
if errors<>'' then begin
lblListAccountErrors.Caption := errors;
lblListAccountErrors.Font.Color := clRed;
end;
End;
end;
function TFRMOperation.UpdateOpTransaction(const SenderAccount: TAccount; var DestAccount: TAccount; var amount: Int64; var errors: AnsiString): Boolean;
Var c : Cardinal;
begin
Result := False;
errors := '';
lblTransactionErrors.Caption := '';
if PageControlOpType.ActivePage<>tsTransaction then exit;
if not (TAccountComp.AccountTxtNumberToAccountNumber(ebDestAccount.Text,c)) then begin
errors := 'Invalid dest. account ('+ebDestAccount.Text+')';
lblTransactionErrors.Caption := errors;
exit;
end;
if (c<0) Or (c>=PascalCoinSafeBox.AccountsCount) then begin
errors := 'Invalid dest. account ('+TAccountComp.AccountNumberToAccountTxtNumber(c)+')';
lblTransactionErrors.Caption := errors;
exit;
end;
DestAccount := PascalCoinNode.Operations.SafeBoxTransaction.Account(c);
if SenderAccounts.Count=1 then begin
if not TAccountComp.TxtToMoney(ebAmount.Text,amount) then begin
errors := 'Invalid amount ('+ebAmount.Text+')';
lblTransactionErrors.Caption := errors;
exit;
end;
end else amount := 0; // ALL BALANCE
if DestAccount.account=SenderAccount.account then begin
errors := 'Sender and dest account are the same';
lblTransactionErrors.Caption := errors;
exit;
end;
if (SenderAccounts.Count=1) then begin
if (SenderAccount.balance<(amount+FDefaultFee)) then begin
errors := 'Insufficient funds';
lblTransactionErrors.Caption := errors;
exit;
end;
end;
Result := True;
end;
function TFRMOperation.UpdatePayload(const SenderAccount: TAccount;
var errors: AnsiString): Boolean;
Var payload_u : AnsiString;
payload_encrypted : TRawBytes;
account : TAccount;
public_key : TAccountKey;
dest_account_number : Cardinal;
i : Integer;
valid : Boolean;
wk : TWalletKey;
begin
valid := false;
payload_encrypted := '';
FEncodedPayload := '';
errors := 'Unknown error';
payload_u := memoPayload.Lines.Text;
try
if (payload_u='') then begin
valid := true;
exit;
end;
if (rbEncryptedWithOldEC.Checked) then begin
// Use sender
errors := 'Error encrypting';
account := FNode.Operations.SafeBoxTransaction.Account(SenderAccount.account);
payload_encrypted := ECIESEncrypt(account.accountInfo.accountKey,payload_u);
valid := payload_encrypted<>'';
end else if (rbEncryptedWithEC.Checked) then begin
errors := 'Error encrypting';
if (PageControlOpType.ActivePage=tsTransaction) or (PageControlOpType.ActivePage=tsListForSale) or (PageControlOpType.ActivePage=tsDelist)
or (PageControlOpType.ActivePage=tsBuyAccount) then begin
// With dest public key
If (PageControlOpType.ActivePage=tsTransaction) then begin
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebDestAccount.Text,dest_account_number) then begin
errors := 'Invalid dest account number';
exit;
end;
end else if (PageControlOpType.ActivePage=tsListForSale) then begin
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSignerAccount.Text,dest_account_number) then begin
errors := 'Invalid signer account number';
exit;
end;
end else if (PageControlOpType.ActivePage=tsDelist) then begin
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebSignerAccount.Text,dest_account_number) then begin
errors := 'Invalid signer account number';
exit;
end;
end else if (PageControlOpType.ActivePage=tsBuyAccount) then begin
If Not TAccountComp.AccountTxtNumberToAccountNumber(ebAccountToBuy.Text,dest_account_number) then begin
errors := 'Invalid account to buy number';
exit;
end;
end else begin
errors := 'ERROR DEV 20170512-1';
exit;
end;
if (dest_account_number<0) or (dest_account_number>=PascalCoinSafeBox.AccountsCount) then begin
errors := 'Invalid payload encrypted account number: '+TAccountComp.AccountNumberToAccountTxtNumber(dest_account_number);
exit;
end;
account := FNode.Operations.SafeBoxTransaction.Account(dest_account_number);
payload_encrypted := ECIESEncrypt(account.accountInfo.accountKey,payload_u);
valid := payload_encrypted<>'';
end else if (PageControlOpType.ActivePage=tsChangePrivateKey) then begin
if (rbChangeKeyWithAnother.Checked) then begin
// With new key generated
if (cbNewPrivateKey.ItemIndex>=0) then begin
i := PtrInt(cbNewPrivateKey.Items.Objects[cbNewPrivateKey.ItemIndex]);
if (i>=0) then public_key := WalletKeys.Key[i].AccountKey;
end else begin
errors := 'Must select a private key';
exit;
end;
end else if (rbChangeKeyTransferAccountToNewOwner.Checked) then begin
If Not TAccountComp.AccountKeyFromImport(ebNewPublicKey.Text,public_key,errors) then begin
errors := 'Public key: '+errors;
exit;
end;
end else begin
errors := 'Must select change type';
exit;
end;
if public_key.EC_OpenSSL_NID<>CT_Account_NUL.accountInfo.accountKey.EC_OpenSSL_NID then begin
payload_encrypted := ECIESEncrypt(public_key,payload_u);
valid := payload_encrypted<>'';
end else begin
valid := false;
errors := 'Selected private key is not valid to encode';
exit;
end;
end else begin
errors := 'This operation does not allow this kind of payload';
end;
end else if (rbEncrptedWithPassword.Checked) then begin
payload_encrypted := TAESComp.EVP_Encrypt_AES256(payload_u,ebEncryptPassword.Text);
valid := payload_encrypted<>'';
end else if (rbNotEncrypted.Checked) then begin
payload_encrypted := payload_u;
valid := true;
end else begin
errors := 'Must select an encryption option for payload';
end;
finally
if valid then begin
if length(payload_encrypted)>CT_MaxPayloadSize then begin
valid := false;
errors := 'Payload size is bigger than '+inttostr(CT_MaxPayloadSize)+' ('+Inttostr(length(payload_encrypted))+')';
end;
end;
if valid then begin
lblEncryptionErrors.Caption := '';
lblPayloadLength.Caption := Format('(%db -> %db)',[length(payload_u),length(payload_encrypted)]);
end else begin
lblEncryptionErrors.Caption := errors;
lblPayloadLength.Caption := Format('(%db -> ?)',[length(payload_u)]);
end;
FEncodedPayload := payload_encrypted;
Result := valid;
end;
end;
procedure TFRMOperation.UpdateWalletKeys;
Var i : Integer;
wk : TWalletKey;
s : String;
begin
cbNewPrivateKey.items.BeginUpdate;
cbBuyNewKey.Items.BeginUpdate;
Try
cbNewPrivateKey.Items.Clear;
cbBuyNewKey.Items.Clear;
if Not Assigned(FWalletKeys) then exit;
For i:=0 to FWalletKeys.Count-1 do begin
wk := FWalletKeys.Key[i];
if (wk.Name='') then begin
s := TCrypto.ToHexaString( TAccountComp.AccountKey2RawString(wk.AccountKey));
end else begin
s := wk.Name;
end;
if Not Assigned(wk.PrivateKey) then s := s + '(*)';
cbNewPrivateKey.Items.AddObject(s,TObject(i));
cbBuyNewKey.Items.AddObject(s,TObject(i));
end;
cbNewPrivateKey.Sorted := true;
cbBuyNewKey.Sorted := true;
Finally
cbNewPrivateKey.Items.EndUpdate;
cbBuyNewKey.Items.EndUpdate;
End;
updateInfoClick(Nil);
memoPayloadClick(Nil);
end;
end.
| 39.925414 | 237 | 0.722532 |
47b2236586f7a81aab0ec97a3c2fca753abe3f62 | 990 | dfm | Pascal | Demo/02 - OpenGroup/u_main.dfm | NickTucker42/ISNDS | 98f620c10ca41ce0e307e39faccea97646730a8e | [
"MIT"
]
| null | null | null | Demo/02 - OpenGroup/u_main.dfm | NickTucker42/ISNDS | 98f620c10ca41ce0e307e39faccea97646730a8e | [
"MIT"
]
| null | null | null | Demo/02 - OpenGroup/u_main.dfm | NickTucker42/ISNDS | 98f620c10ca41ce0e307e39faccea97646730a8e | [
"MIT"
]
| 1 | 2021-06-19T15:34:08.000Z | 2021-06-19T15:34:08.000Z | object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 117
ClientWidth = 470
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 24
Width = 58
Height = 13
Caption = 'Group name'
end
object eGroupname: TEdit
Left = 88
Top = 21
Width = 355
Height = 21
TabOrder = 0
Text = 'CN=Agroup,OU=SomeOU,DC=SomeDomain,DC=NET'
end
object btnOpenGroup: TButton
Left = 78
Top = 64
Width = 75
Height = 25
Caption = 'Open Group'
TabOrder = 1
OnClick = btnOpenGroupClick
end
object NTADS21: TNTADS2
Logon.Logon = False
Search.SearchSubs = False
Lasterror = 0
Provider = 'LDAP://'
QuietEnum = False
Left = 192
Top = 64
end
end
| 19.8 | 54 | 0.587879 |
6a8816c767321801d7060e1e60086f08495fdf45 | 2,022 | pas | Pascal | Vue.js/Demo/forms/form1.pas | soinalastudio/quartex-pascal-wrappers | a897a4ecde027585c3fb1d210e1c83080549858e | [
"MIT"
]
| 4 | 2021-01-29T14:33:36.000Z | 2021-04-12T16:30:44.000Z | Vue.js/Demo/forms/form1.pas | soinalastudio/quartex-pascal-wrappers | a897a4ecde027585c3fb1d210e1c83080549858e | [
"MIT"
]
| null | null | null | Vue.js/Demo/forms/form1.pas | soinalastudio/quartex-pascal-wrappers | a897a4ecde027585c3fb1d210e1c83080549858e | [
"MIT"
]
| null | null | null | unit form1;
interface
uses
qtx.time,
qtx.sysutils,
qtx.classes,
qtx.dom.widgets,
qtx.dom.types,
qtx.dom.events,
qtx.dom.graphics,
qtx.dom.application,
qtx.dom.forms,
qtx.dom.control.common,
qtx.dom.control.ContentBox,
qtx.dom.control.label,
qtx.dom.control.panel,
qtx.dom.stylesheet,
tor.vuejs.wrapper;
type
TMyForm = class(TQTXForm)
private
FLabel: TQTXLabel;
FPanel: TQTXPanel;
protected
procedure InitializeObject; override;
procedure FinalizeObject; override;
procedure StyleObject; override;
public
property Panel: TQTXPanel read FPanel;
property Label: TQTXLabel read FLabel;
end;
var
vueapp: Variant;
implementation
//#############################################################################
// TMyForm
//#############################################################################
procedure TMyForm.StyleObject;
begin
inherited;
PositionMode := TQTXWidgetPositionMode.cpInitial;
DisplayMode := TQTXWidgetDisplayMode.cdBlock;
Border.Padding := 2;
Background.Color := clSilver;
end;
procedure TMyForm.InitializeObject;
begin
inherited;
ShowMessage(TVue(vueapp).el.innerHTML);
/*FPanel := TQTXPanel.Create(self, procedure (Panel: TQTXPanel)
begin
Panel.PositionMode := TQTXWidgetPositionMode.cpInitial;
Panel.DisplayMode := TQTXWidgetDisplayMode.cdBlock;
Panel.Border.Padding := 2;
Panel.Background.Color := clwhite;
Panel.Font.Family := "Segoe UI";
Panel.Font.Size.&Type := TQTXSizeType.stPt;
Panel.Font.Size.Value := 11;
FLabel := TQTXLabel.Create(Panel,
procedure (Label: TQTXLabel)
begin
Label.PositionMode := TQTXWidgetPositionMode.cpInitial;
label.Caption :="This is a label with vertical and horizontal alignment";
Label.AlignH := chCenter;
Label.AlignV := cvMiddle;
end);
FLabel.Border.Bottom.Margin := 2;
end); */
end;
procedure TMyForm.FinalizeObject;
begin
FLabel.free;
FPanel.free;
inherited;
end;
end.
| 20.845361 | 79 | 0.65183 |
83176657a4883130fd702fd069310d23b349de06 | 6,660 | pas | Pascal | package/HWSSimpleDataSet/HWSSimpleDataSet.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| 1 | 2022-02-28T11:28:18.000Z | 2022-02-28T11:28:18.000Z | package/HWSSimpleDataSet/HWSSimpleDataSet.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | package/HWSSimpleDataSet/HWSSimpleDataSet.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| null | null | null | { *************************************************************************** }
{ }
{ Kylix and Delphi Cross-Platform Visual Component Library - DBExpress }
{ }
{ Copyright (c) 1999, 2002 Borland Software Corporation }
{ Recodificado 2005 HWS }
{ }
{ *************************************************************************** }
unit HWSSimpleDataSet;
interface
uses
SysUtils, Variants, Classes, DB, DBCommon, DBXpress, DBClient, Provider,
SqlExpr, SqlTimSt, SQLConst;
type
{ TInternalSQLDataSet }
TInternalSQLDataSet = class(TCustomSQLDataSet)
published
property CommandText;
property CommandType;
property DataSource;
property GetMetaData default False;
property MaxBlobSize default 0;
property ParamCheck;
property Params;
property SortFieldNames;
end;
{ TSimpleDataSet }
THWSSimpleDataSet = class(TCustomClientDataSet)
private
xFCommandText: string;
FConnection: TSQLConnection;
FInternalConnection: TSQLConnection; { Always points to internal if present }
FDataSet: TInternalSQLDataSet;
FProvider: TDataSetProvider;
protected
procedure AllocConnection; virtual;
procedure AllocDataSet; virtual;
procedure AllocProvider; virtual;
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure OpenCursor(InfoQuery: Boolean); override;
procedure SetConnection(Value: TSQLConnection); virtual;
procedure xSetCommandText(Value: string); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Active;
property Aggregates;
property AggregatesActive;
property AutoCalcFields;
property Connection: TSQLConnection read FConnection write SetConnection;
property CommandText: string read xFCommandText write xSetCommandText;
property DataSet: TInternalSQLDataSet read FDataSet;
property Constraints;
property DisableStringTrim;
property FileName;
property Filter;
property Filtered;
property FilterOptions;
property FieldDefs;
property IndexDefs;
property IndexFieldNames;
property IndexName;
property FetchOnDemand;
property MasterFields;
property MasterSource;
property ObjectView;
property PacketRecords;
property Params;
property ReadOnly;
property StoreDefs;
property BeforeOpen;
property AfterOpen;
property BeforeClose;
property AfterClose;
property BeforeInsert;
property AfterInsert;
property BeforeEdit;
property AfterEdit;
property BeforePost;
property AfterPost;
property BeforeCancel;
property AfterCancel;
property BeforeDelete;
property AfterDelete;
property BeforeScroll;
property AfterScroll;
property BeforeRefresh;
property AfterRefresh;
property OnCalcFields;
property OnDeleteError;
property OnEditError;
property OnFilterRecord;
property OnNewRecord;
property OnPostError;
property OnReconcileError;
property BeforeApplyUpdates;
property AfterApplyUpdates;
property BeforeGetRecords;
property AfterGetRecords;
property BeforeRowRequest;
property AfterRowRequest;
property BeforeExecute;
property AfterExecute;
property BeforeGetParams;
property AfterGetParams;
end;
procedure Register;
implementation
{ THWSSimpleDataSet }
procedure Register;
begin
RegisterComponents('HWS', [THWSSimpleDataSet]);
end;
constructor THWSSimpleDataSet.Create(AOwner: TComponent);
begin
inherited;
AllocProvider;
AllocDataSet;
AllocConnection;
end;
destructor THWSSimpleDataSet.Destroy;
begin
inherited; { Reserved }
end;
procedure THWSSimpleDataSet.Loaded;
begin
inherited;
{ Internal connection can now be safely deleted if needed }
if FInternalConnection <> FConnection then
FreeAndNil(FInternalConnection);
end;
procedure THWSSimpleDataSet.AllocConnection;
begin
FConnection := TSQLConnection.Create(Self);
FInternalConnection := FConnection;
FConnection.Name := 'InternalConnection'; { Do not localize }
FConnection.SetSubComponent(True);
FDataSet.SQLConnection := FConnection;
end;
procedure THWSSimpleDataSet.AllocDataSet;
begin
FDataSet := TInternalSQLDataSet.Create(Self);
FDataSet.Name := 'InternalDataSet'; { Do not localize }
FDataSet.SQLConnection := FConnection;
FDataSet.SetSubComponent(True);
FProvider.DataSet := FDataSet;
end;
procedure THWSSimpleDataSet.AllocProvider;
begin
FProvider := TDataSetProvider.Create(Self);
FProvider.DataSet := FDataSet;
FProvider.Name := 'InternalProvider'; { Do not localize }
FProvider.SetSubComponent(True);
SetProvider(FProvider);
end;
procedure THWSSimpleDataSet.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited;
if not (csDestroying in ComponentState ) and (Operation = opRemove) and
(AComponent = FConnection) and (AComponent.Owner <> Self) then
AllocConnection;
end;
procedure THWSSimpleDataSet.OpenCursor(InfoQuery: Boolean);
begin
if Assigned(FProvider) then
SetProvider(FProvider);
if FProvider.DataSet = Self then
raise Exception.Create(SCircularProvider);
inherited;
end;
procedure THWSSimpleDataSet.SetConnection(Value: TSQLConnection);
begin
{ Assigning existing value or clearing internal connection is a NOP }
if (Value = FConnection) or ((Value = nil) and Assigned(FInternalConnection)) then
Exit;
{ Remove FreeNotification from existing external reference }
if FConnection <> FInternalConnection then
FConnection.RemoveFreeNotification(Self);
{ Reference to external connection was cleared, recreate internal }
if (Value = nil) then
AllocConnection
else
begin
{ Free the internal connection when assigning an external connection }
if Assigned(FInternalConnection) and
{ but not if we are streaming in, then wait until loaded is called }
not (csLoading in FInternalConnection.ComponentState) then
FreeAndNil(FInternalConnection);
FConnection := Value;
FConnection.FreeNotification(Self);
FDataSet.CommandText:= CommandText;
FDataSet.SQLConnection := FConnection;
end;
end;
procedure THWSSimpleDataSet.xSetCommandText(Value: string);
begin
xFCommandText:= Value;
DataSet.CommandText:=Value;
end;
end.
| 29.469027 | 88 | 0.704805 |
4777109216f5681e3bd98e08623da5dfbfdb7f87 | 17,623 | pas | Pascal | src/DataSet.Serialize.Export.pas | cybersmurf/dataset-serialize | b39b395c50e1062d92bfd815e628d94f20d4a381 | [
"MIT"
]
| 1 | 2020-06-04T05:36:25.000Z | 2020-06-04T05:36:25.000Z | src/DataSet.Serialize.Export.pas | cybersmurf/dataset-serialize | b39b395c50e1062d92bfd815e628d94f20d4a381 | [
"MIT"
]
| null | null | null | src/DataSet.Serialize.Export.pas | cybersmurf/dataset-serialize | b39b395c50e1062d92bfd815e628d94f20d4a381 | [
"MIT"
]
| null | null | null | unit DataSet.Serialize.Export;
{$IF DEFINED(FPC)}
{$MODE DELPHI}{$H+}
{$ENDIF}
interface
uses
{$IF DEFINED(FPC)}
DB, fpjson;
{$ELSE}
Data.DB, System.JSON;
{$ENDIF}
type
TDataSetSerialize = class
private
FDataSet: TDataSet;
FOnlyUpdatedRecords: Boolean;
FChildRecord: Boolean;
/// <summary>
/// Creates a JSON object with the data from the current record of DataSet.
/// </summary>
/// <param name="ADataSet">
/// Refers to the DataSet that you want to export the record.
/// </param>
/// <returns>
/// Returns a JSON object containing the record data.
/// </returns>
/// <remarks>
/// Invisible or null fields will not be exported.
/// </remarks>
function DataSetToJSONObject(const ADataSet: TDataSet): TJSONObject;
/// <summary>
/// Creates an array of JSON objects with all DataSet records.
/// </summary>
/// <param name="ADataSet">
/// Refers to the DataSet that you want to export the records.
/// </param>
/// <returns>
/// Returns a JSONArray with all records from the DataSet.
/// </returns>
/// <remarks>
/// Invisible or null fields will not be exported.
/// </remarks>
function DataSetToJSONArray(const ADataSet: TDataSet; const IsChild: Boolean = False): TJSONArray;
/// <summary>
/// Encrypts a blob field in Base64.
/// </summary>
/// <param name="AField">
/// Refers to the field of type Blob or similar.
/// </param>
/// <returns>
/// Returns a string with the cryptogrammed content in Base64.
/// </returns>
function EncodingBlobField(const AField: TField): string;
{$IF NOT DEFINED(FPC)}
/// <summary>
/// Verifiy if a DataSet has detail dataset and if has child modification.
/// </summary>
function HasChildModification(const ADataSet: TDataSet): Boolean;
{$ENDIF}
public
/// <summary>
/// Responsible for creating a new instance of TDataSetSerialize class.
/// </summary>
constructor Create(const ADataSet: TDataSet; const AOnlyUpdatedRecords: Boolean = False; const AChildRecords: Boolean = True);
/// <summary>
/// Creates an array of JSON objects with all DataSet records.
/// </summary>
/// <returns>
/// Returns a JSONArray with all records from the DataSet.
/// </returns>
/// <remarks>
/// Invisible or null fields will not be generated.
/// </remarks>
function ToJSONArray: TJSONArray;
/// <summary>
/// Creates a JSON object with the data from the current record of DataSet.
/// </summary>
/// <returns>
/// Returns a JSON object containing the record data.
/// </returns>
/// <remarks>
/// Invisible or null fields will not be generated.
/// </remarks>
function ToJSONObject: TJSONObject;
/// <summary>
/// Responsible for exporting the structure of a DataSet in JSON Array format.
/// </summary>
/// <returns>
/// Returns a JSON array with all fields of the DataSet.
/// </returns>
/// <remarks>
/// Invisible fields will not be generated.
/// </remarks>
function SaveStructure: TJSONArray;
end;
implementation
uses
{$IF DEFINED(FPC)}
DateUtils, SysUtils, Classes, FmtBCD, TypInfo, base64,
{$ELSE}
System.DateUtils, Data.FmtBcd, System.SysUtils, System.TypInfo, System.Classes, System.NetEncoding, System.Generics.Collections,
FireDAC.Comp.DataSet,
{$ENDIF}
DataSet.Serialize.Utils, DataSet.Serialize.Consts, DataSet.Serialize.UpdatedStatus, DataSet.Serialize.Config;
{ TDataSetSerialize }
function TDataSetSerialize.ToJSONObject: TJSONObject;
begin
Result := DataSetToJSONObject(FDataSet);
end;
function TDataSetSerialize.DataSetToJSONArray(const ADataSet: TDataSet; const IsChild: Boolean): TJSONArray;
var
LBookMark: TBookmark;
begin
Result := TJSONArray.Create;
if ADataSet.IsEmpty then
Exit;
try
LBookMark := ADataSet.BookMark;
ADataSet.First;
while not ADataSet.Eof do
begin
{$IF DEFINED(FPC)}
Result.Add(DataSetToJSONObject(ADataSet));
{$ELSE}
if IsChild and FOnlyUpdatedRecords then
if (ADataSet.UpdateStatus = TUpdateStatus.usUnmodified) and not(HasChildModification(ADataSet)) then
begin
ADataSet.Next;
Continue;
end;
if (ADataSet.FieldCount = 1) then
begin
case ADataSet.Fields[0].DataType of
TFieldType.ftBoolean:
Result.Add(ADataSet.Fields[0].AsBoolean);
TFieldType.ftInteger, TFieldType.ftSmallint, TFieldType.ftShortint:
Result.Add(ADataSet.Fields[0].AsInteger);
TFieldType.ftLongWord, TFieldType.ftAutoInc, TFieldType.ftString, TFieldType.ftWideString, TFieldType.ftMemo, TFieldType.ftWideMemo, TFieldType.ftGuid:
Result.Add(ADataSet.Fields[0].AsWideString);
TFieldType.ftLargeint:
Result.Add(ADataSet.Fields[0].AsLargeInt);
TFieldType.ftSingle, TFieldType.ftFloat:
Result.Add(ADataSet.Fields[0].AsFloat);
TFieldType.ftDateTime:
Result.Add(FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', ADataSet.Fields[0].AsDateTime));
TFieldType.ftTimeStamp:
Result.Add(DateToISO8601(ADataSet.Fields[0].AsDateTime, TDataSetSerializeConfig.GetInstance.DateInputIsUTC));
TFieldType.ftTime:
Result.Add(FormatDateTime('hh:mm:ss.zzz', ADataSet.Fields[0].AsDateTime));
TFieldType.ftDate:
Result.Add(FormatDateTime(TDataSetSerializeConfig.GetInstance.Export.FormatDate, ADataSet.Fields[0].AsDateTime));
TFieldType.ftCurrency:
begin
if TDataSetSerializeConfig.GetInstance.Export.FormatCurrency.Trim.IsEmpty then
Result.Add(ADataSet.Fields[0].AsCurrency)
else
Result.Add(FormatCurr(TDataSetSerializeConfig.GetInstance.Export.FormatCurrency, ADataSet.Fields[0].AsCurrency));
end;
TFieldType.ftFMTBcd, TFieldType.ftBCD:
Result.Add(BcdToDouble(ADataSet.Fields[0].AsBcd));
TFieldType.ftGraphic, TFieldType.ftBlob, TFieldType.ftOraBlob, TFieldType.ftStream:
Result.Add(EncodingBlobField(ADataSet.Fields[0]));
else
raise EDataSetSerializeException.CreateFmt(FIELD_TYPE_NOT_FOUND, [ADataSet.Fields[0].FieldName]);
end;
end
else
Result.AddElement(DataSetToJSONObject(ADataSet));
{$ENDIF}
ADataSet.Next;
end;
finally
if ADataSet.BookmarkValid(LBookMark) then
ADataSet.GotoBookmark(LBookMark);
ADataSet.FreeBookmark(LBookMark);
end;
end;
function TDataSetSerialize.DataSetToJSONObject(const ADataSet: TDataSet): TJSONObject;
var
LKey: string;
{$IF NOT DEFINED(FPC)}
LNestedDataSet: TDataSet;
LDataSetDetails: TList<TDataSet>;
{$ENDIF}
LField: TField;
begin
Result := TJSONObject.Create;
if not Assigned(ADataSet) or ADataSet.IsEmpty then
Exit;
for LField in ADataSet.Fields do
begin
if TDataSetSerializeConfig.GetInstance.Export.ExportOnlyFieldsVisible then
if not(LField.Visible) then
Continue;
LKey := TDataSetSerializeUtils.NameToLowerCamelCase(LField.FieldName);
if LField.IsNull then
begin
if TDataSetSerializeConfig.GetInstance.Export.ExportNullValues then
if TDataSetSerializeConfig.GetInstance.Export.ExportNullAsEmptyString then
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, '')
else
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONNull.Create);
Continue;
end;
case LField.DataType of
TFieldType.ftBoolean:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TDataSetSerializeUtils.BooleanToJSON(LField.AsBoolean));
TFieldType.ftInteger, TFieldType.ftSmallint{$IF NOT DEFINED(FPC)}, TFieldType.ftShortint{$ENDIF}:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, {$IF DEFINED(FPC)}LField.AsInteger{$ELSE}TJSONNumber.Create(LField.AsInteger){$ENDIF});
{$IF NOT DEFINED(FPC)}TFieldType.ftLongWord, {$ENDIF}TFieldType.ftAutoInc:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, {$IF DEFINED(FPC)}LField.AsWideString{$ELSE}TJSONNumber.Create(LField.AsWideString){$ENDIF});
TFieldType.ftLargeint:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, {$IF DEFINED(FPC)}LField.AsLargeInt{$ELSE}TJSONNumber.Create(LField.AsLargeInt){$ENDIF});
{$IF NOT DEFINED(FPC)}TFieldType.ftSingle, {$ENDIF}TFieldType.ftFloat:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, {$IF DEFINED(FPC)}LField.AsFloat{$ELSE}TJSONNumber.Create(LField.AsFloat){$ENDIF});
TFieldType.ftString, TFieldType.ftWideString, TFieldType.ftMemo, TFieldType.ftWideMemo, TFieldType.ftGuid:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(LField.AsWideString));
TFieldType.ftDateTime:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(FormatDateTime('yyyy-mm-dd hh:mm:ss.zzz', LField.AsDateTime)));
TFieldType.ftTimeStamp:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(DateToISO8601(LField.AsDateTime, TDataSetSerializeConfig.GetInstance.DateInputIsUTC)));
TFieldType.ftTime:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(FormatDateTime('hh:mm:ss.zzz', LField.AsDateTime)));
TFieldType.ftDate:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(FormatDateTime(TDataSetSerializeConfig.GetInstance.Export.FormatDate, LField.AsDateTime)));
TFieldType.ftCurrency:
begin
if TDataSetSerializeConfig.GetInstance.Export.FormatCurrency.Trim.IsEmpty then
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, {$IF DEFINED(FPC)}LField.AsCurrency{$ELSE}TJSONNumber.Create(LField.AsCurrency){$ENDIF})
else
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(FormatCurr(TDataSetSerializeConfig.GetInstance.Export.FormatCurrency, LField.AsCurrency)));
end;
TFieldType.ftFMTBcd, TFieldType.ftBCD:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, {$IF DEFINED(FPC)}BcdToDouble(LField.AsBcd){$ELSE}TJSONNumber.Create(BcdToDouble(LField.AsBcd)){$ENDIF});
{$IF NOT DEFINED(FPC)}
TFieldType.ftDataSet:
begin
LNestedDataSet := TDataSetField(LField).NestedDataSet;
Result.AddPair(LKey, DataSetToJSONArray(LNestedDataSet));
end;
{$ENDIF}
TFieldType.ftGraphic, TFieldType.ftBlob, TFieldType.ftOraBlob{$IF NOT DEFINED(FPC)}, TFieldType.ftStream{$ENDIF}:
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(LKey, TJSONString.Create(EncodingBlobField(LField)));
else
raise EDataSetSerializeException.CreateFmt(FIELD_TYPE_NOT_FOUND, [LKey]);
end;
end;
if (FOnlyUpdatedRecords) and (FDataSet <> ADataSet) then
begin
if TDataSetSerializeConfig.GetInstance.LowerCamelCase then
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('objectState', TJSONString.Create(ADataSet.UpdateStatus.ToString))
else
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('object_state', TJSONString.Create(ADataSet.UpdateStatus.ToString));
end;
{$IF NOT DEFINED(FPC)}
if FChildRecord then
begin
LDataSetDetails := TList<TDataSet>.Create;
try
ADataSet.GetDetailDataSets(LDataSetDetails);
for LNestedDataSet in LDataSetDetails do
begin
if FOnlyUpdatedRecords then
TFDDataSet(LNestedDataSet).FilterChanges := [rtInserted, rtModified, rtDeleted, rtUnmodified];
if TDataSetSerializeConfig.GetInstance.Export.ExportEmptyDataSet or (LNestedDataSet.RecordCount > 0) then
if TDataSetSerializeConfig.GetInstance.Export.ExportChildDataSetAsJsonObject and (LNestedDataSet.RecordCount = 1) then
Result.AddPair(TDataSetSerializeUtils.FormatDataSetName(LNestedDataSet.Name), DataSetToJsonObject(LNestedDataSet))
else
Result.AddPair(TDataSetSerializeUtils.FormatDataSetName(LNestedDataSet.Name), DataSetToJSONArray(LNestedDataSet, True));
if FOnlyUpdatedRecords then
TFDDataSet(LNestedDataSet).FilterChanges := [rtInserted, rtModified, rtUnmodified];
end;
finally
LDataSetDetails.Free;
end;
end;
{$ENDIF}
end;
function TDataSetSerialize.EncodingBlobField(const AField: TField): string;
var
LMemoryStream: TMemoryStream;
LStringStream: TStringStream;
{$IF NOT DEFINED(FPC)}
LBase64Encoding: TBase64Encoding;
{$ENDIF}
begin
LMemoryStream := TMemoryStream.Create;
LStringStream := TStringStream.Create;
try
TBlobField(AField).SaveToStream(LMemoryStream);
LMemoryStream.Position := 0;
{$IF DEFINED(FPC)}
LStringStream.LoadFromStream(LMemoryStream);
Result := EncodeStringBase64(LStringStream.DataString);
{$ELSE}
LBase64Encoding := TBase64Encoding.Create(0);
try
LBase64Encoding.Encode(LMemoryStream, LStringStream);
finally
LBase64Encoding.Free;
end;
Result := LStringStream.DataString;
{$ENDIF}
finally
LStringStream.Free;
LMemoryStream.Free;
end;
end;
{$IF NOT DEFINED(FPC)}
function TDataSetSerialize.HasChildModification(const ADataSet: TDataSet): Boolean;
var
LMasterSource: TDataSource;
LDataSetDetails: TList<TDataSet>;
LNestedDataSet: TDataSet;
begin
Result := False;
LDataSetDetails := TList<TDataSet>.Create;
try
ADataSet.GetDetailDataSets(LDataSetDetails);
for LNestedDataSet in LDataSetDetails do
begin
Result := HasChildModification(LNestedDataSet);
if Result then
Break;
if not (LNestedDataSet is TFDDataSet) then
Continue;
LMasterSource := TFDDataSet(LNestedDataSet).MasterSource;
try
TFDDataSet(LNestedDataSet).MasterSource := nil;
TFDDataSet(LNestedDataSet).FilterChanges := [rtInserted, rtModified, rtDeleted];
Result := TFDDataSet(LNestedDataSet).RecordCount > 0;
if Result then
Break;
finally
TFDDataSet(LNestedDataSet).FilterChanges := [rtInserted, rtModified, rtUnmodified];
TFDDataSet(LNestedDataSet).MasterSource := LMasterSource;
end;
end;
finally
LDataSetDetails.Free;
end;
end;
{$ENDIF}
function TDataSetSerialize.SaveStructure: TJSONArray;
var
LField: TField;
LJSONObject: TJSONObject;
begin
Result := TJSONArray.Create;
if FDataSet.FieldCount <= 0 then
Exit;
for LField in FDataSet.Fields do
begin
LJSONObject := TJSONObject.Create;
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_ALIGNMENT, TJSONString.Create(GetEnumName(TypeInfo(TAlignment), Ord(LField.Alignment))));
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_FIELD_NAME, TJSONString.Create(LField.FieldName));
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_DISPLAY_LABEL, TJSONString.Create(LField.DisplayLabel));
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_DATA_TYPE, TJSONString.Create(GetEnumName(TypeInfo(TFieldType), Integer(LField.DataType))));
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_SIZE, {$IF DEFINED(FPC)}LField.Size{$ELSE}TJSONNumber.Create(LField.Size){$ENDIF});
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_ORIGIN, TJSONString.Create(LField.ORIGIN));
if IsPublishedProp(LField, 'Precision') then
LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}(FIELD_PROPERTY_PRECISION, {$IF DEFINED(FPC)}TFloatField(LField).Precision{$ELSE}TJSONNumber.Create(TFloatField(LField).Precision){$ENDIF});
{$IF DEFINED(FPC)}
LJSONObject.Add(FIELD_PROPERTY_KEY, pfInKey in LField.ProviderFlags);
LJSONObject.Add(FIELD_PROPERTY_REQUIRED, LField.Required);
LJSONObject.Add(FIELD_PROPERTY_VISIBLE, LField.Visible);
LJSONObject.Add(FIELD_PROPERTY_READ_ONLY, LField.ReadOnly);
{$ELSE}
{$IF COMPILERVERSION <= 29}
LJSONObject.AddPair(FIELD_PROPERTY_KEY, TJSONString.Create(BoolToStr(pfInKey in LField.ProviderFlags)));
LJSONObject.AddPair(FIELD_PROPERTY_REQUIRED, TJSONString.Create(BoolToStr(LField.Required)));
LJSONObject.AddPair(FIELD_PROPERTY_VISIBLE, TJSONString.Create(BoolToStr(LField.Visible)));
LJSONObject.AddPair(FIELD_PROPERTY_READ_ONLY, TJSONString.Create(BoolToStr(LField.ReadOnly)));
{$ELSE}
LJSONObject.AddPair(FIELD_PROPERTY_KEY, TJSONBool.Create(pfInKey in LField.ProviderFlags));
LJSONObject.AddPair(FIELD_PROPERTY_REQUIRED, TJSONBool.Create(LField.Required));
LJSONObject.AddPair(FIELD_PROPERTY_VISIBLE, TJSONBool.Create(LField.Visible));
LJSONObject.AddPair(FIELD_PROPERTY_READ_ONLY, TJSONBool.Create(LField.ReadOnly));
{$ENDIF}
{$ENDIF}
{$IF NOT DEFINED(FPC)}
LJSONObject.AddPair(FIELD_PROPERTY_AUTO_GENERATE_VALUE, TJSONString.Create(GetEnumName(TypeInfo(TAutoRefreshFlag), Integer(LField.AutoGenerateValue))));
{$ENDIF}
Result.{$IF DEFINED(FPC)}Add{$ELSE}AddElement{$ENDIF}(LJSONObject);
end;
end;
constructor TDataSetSerialize.Create(const ADataSet: TDataSet; const AOnlyUpdatedRecords: Boolean = False; const AChildRecords: Boolean = True);
begin
FDataSet := ADataSet;
FOnlyUpdatedRecords := AOnlyUpdatedRecords;
FChildRecord := AChildRecords;
end;
function TDataSetSerialize.ToJSONArray: TJSONArray;
begin
Result := DataSetToJSONArray(FDataSet);
end;
end.
| 42.261391 | 201 | 0.706633 |
83e13d84211c2996db73481a6197d71f55fefeaa | 314 | pas | Pascal | Test/SimpleScripts/array_dynamic2.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/SimpleScripts/array_dynamic2.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/SimpleScripts/array_dynamic2.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | var a : array of array of Integer;
var i, j : Integer;
a.SetLength(3);
for i:=a.Low to High(a) do begin
a[i].SetLength(4);
for j:=Low(a[i]) to a[i].High do begin
a[i][j]:=(i+1)*10+j;
end;
end;
for i:=0 to 2 do begin
for j:=0 to 3 do
Print(a[i][j]);
PrintLn('');
end; | 17.444444 | 42 | 0.519108 |
f1a3f9f66f4f3e4889394bd86bffd0b651612a22 | 469 | pas | Pascal | Chapter 03/CustomBrush/Forms.Main.pas | atkins126/Delphi-GUI-Programming-with-FireMonkey- | d92b32d143762eb274f05e237c4a1b1876592add | [
"MIT"
]
| 24 | 2020-10-29T20:58:47.000Z | 2022-01-12T13:49:09.000Z | Chapter 03/CustomBrush/Forms.Main.pas | atkins126/Delphi-GUI-Programming-with-FireMonkey- | d92b32d143762eb274f05e237c4a1b1876592add | [
"MIT"
]
| 1 | 2021-05-22T07:00:36.000Z | 2021-05-22T07:00:36.000Z | Chapter 03/CustomBrush/Forms.Main.pas | atkins126/Delphi-GUI-Programming-with-FireMonkey- | d92b32d143762eb274f05e237c4a1b1876592add | [
"MIT"
]
| 7 | 2020-11-06T20:01:18.000Z | 2021-11-06T14:31:06.000Z | unit Forms.Main;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects;
type
TForm1 = class(TForm)
StyleBook1: TStyleBook;
Rectangle1: TRectangle;
Circle1: TCircle;
Rectangle2: TRectangle;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
end.
| 16.172414 | 81 | 0.705757 |
474e779e2ad657481173bb089ef25021d3e10bc7 | 698 | dpr | Pascal | MouseHOOK.dpr | macbury/myszometer | 611fb6bb0d87326de732996907578b17f5bf37d3 | [
"Unlicense"
]
| 1 | 2019-06-27T08:12:33.000Z | 2019-06-27T08:12:33.000Z | MouseHOOK.dpr | macbury/myszometer | 611fb6bb0d87326de732996907578b17f5bf37d3 | [
"Unlicense"
]
| null | null | null | MouseHOOK.dpr | macbury/myszometer | 611fb6bb0d87326de732996907578b17f5bf37d3 | [
"Unlicense"
]
| null | null | null | library MouseHOOK;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes;
{$R *.res}
begin
end.
| 33.238095 | 73 | 0.752149 |
47d15b75b7519dfe7de02e47de95bb977fbd9e14 | 10,091 | dpr | Pascal | tests/DelphiSpecificationUtilsTests.dpr | codejanovic/Delphi-SpecificationUtils | 79d955122acccb0838ce23bc3f9dc39ba310feb8 | [
"MIT"
]
| 7 | 2016-08-25T23:11:42.000Z | 2020-10-17T00:08:54.000Z | tests/DelphiSpecificationUtilsTests.dpr | codejanovic/Delphi-SpecificationUtils | 79d955122acccb0838ce23bc3f9dc39ba310feb8 | [
"MIT"
]
| 1 | 2016-09-12T18:57:03.000Z | 2016-09-13T14:17:45.000Z | tests/DelphiSpecificationUtilsTests.dpr | codejanovic/Delphi-SpecificationUtils | 79d955122acccb0838ce23bc3f9dc39ba310feb8 | [
"MIT"
]
| 4 | 2016-09-12T16:32:52.000Z | 2019-06-24T05:13:09.000Z | program DelphiSpecificationUtilsTests;
{$IFNDEF TESTINSIGHT}
{$APPTYPE CONSOLE}
{$ENDIF}{$STRONGLINKTYPES ON}
uses
SysUtils,
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX,
{$ENDIF }
DUnitX.Loggers.Console,
DUnitX.Loggers.Xml.NUnit,
DUnitX.TestFramework,
Tests.Delphi.SpecificationUtils.Strings.Contains.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.Contains.CaseSensitive.pas',
Delphi.SpecificationUtils in '..\Delphi.SpecificationUtils.pas',
Delphi.SpecificationUtils.Strings.CaseSensitive in '..\Delphi.SpecificationUtils.Strings.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.Contains.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.Contains.CaseInsensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.Equals.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.Equals.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.Equals.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.Equals.CaseInsensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.ContainsAny.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.ContainsAny.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.ContainsAny.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.ContainsAny.CaseInsensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.EqualsAny.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.EqualsAny.CaseSensitive.pas',
Delphi.SpecificationUtils.Strings.IgnoreCase in '..\Delphi.SpecificationUtils.Strings.IgnoreCase.pas',
Tests.Delphi.SpecificationUtils.Strings.StartsWith.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.StartsWith.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.StartsWith.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.StartsWith.CaseInsensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.StartsWithAny.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.StartsWithAny.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.EndsWith.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.EndsWith.CaseInsensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.EndsWith.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.EndsWith.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.EndsWithAny.CaseSensitive in 'Tests.Delphi.SpecificationUtils.Strings.EndsWithAny.CaseSensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.StartsWithAny.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.StartsWithAny.CaseInsensitive.pas',
Tests.Delphi.SpecificationUtils.Strings.EndsWithAny.CaseInsensitive in 'Tests.Delphi.SpecificationUtils.Strings.EndsWithAny.CaseInsensitive.pas',
Delphi.SpecificationUtils.Strings in '..\Delphi.SpecificationUtils.Strings.pas',
Tests.Delphi.SpecificationUtils.Strings.Length in 'Tests.Delphi.SpecificationUtils.Strings.Length.pas',
Tests.Delphi.SpecificationUtils.Strings.IsEmpty in 'Tests.Delphi.SpecificationUtils.Strings.IsEmpty.pas',
Delphi.SpecificationUtils.Helper.Strings in '..\Delphi.SpecificationUtils.Helper.Strings.pas',
Tests.Delphi.SpecificationUtils.Helper.Strings in 'Tests.Delphi.SpecificationUtils.Helper.Strings.pas',
Delphi.SpecificationUtils.Helper.TGUID in '..\Delphi.SpecificationUtils.Helper.TGUID.pas',
Delphi.SpecificationUtils.TGUID in '..\Delphi.SpecificationUtils.TGUID.pas',
Tests.Helper.SysUtilsAccess in 'Tests.Helper.SysUtilsAccess.pas',
Tests.Delphi.SpecificationUtils.Helper.TGUID in 'Tests.Delphi.SpecificationUtils.Helper.TGUID.pas',
Delphi.SpecificationUtils.Arrays in '..\Delphi.SpecificationUtils.Arrays.pas',
Tests.Delphi.SpecificationUtils.Arrays.Length in 'Tests.Delphi.SpecificationUtils.Arrays.Length.pas',
Tests.Delphi.SpecificationUtils.Arrays.IsEmpty in 'Tests.Delphi.SpecificationUtils.Arrays.IsEmpty.pas',
Tests.Delphi.SpecificationUtils.Arrays.Contains in 'Tests.Delphi.SpecificationUtils.Arrays.Contains.pas',
Tests.Delphi.SpecificationUtils.Arrays.ContainsAny in 'Tests.Delphi.SpecificationUtils.Arrays.ContainsAny.pas',
Tests.Delphi.SpecificationUtils.Arrays.Equals in 'Tests.Delphi.SpecificationUtils.Arrays.Equals.pas',
Tests.Delphi.SpecificationUtils.Arrays.EqualsInSequence in 'Tests.Delphi.SpecificationUtils.Arrays.EqualsInSequence.pas',
Tests.Delphi.SpecificationUtils.Arrays.EqualsInLength in 'Tests.Delphi.SpecificationUtils.Arrays.EqualsInLength.pas',
Delphi.SpecificationUtils.Helper.Boolean in '..\Delphi.SpecificationUtils.Helper.Boolean.pas',
Delphi.SpecificationUtils.Helper.DateTime in '..\Delphi.SpecificationUtils.Helper.DateTime.pas',
Delphi.SpecificationUtils.DateTime in '..\Delphi.SpecificationUtils.DateTime.pas',
Tests.Delphi.SpecificationUtils.Helper.DateTime in 'Tests.Delphi.SpecificationUtils.Helper.DateTime.pas',
Delphi.SpecificationUtils.DateTime.Types in '..\Delphi.SpecificationUtils.DateTime.Types.pas',
Delphi.SpecificationUtils.Helper.Integer in '..\Delphi.SpecificationUtils.Helper.Integer.pas',
Tests.Delphi.SpecificationUtils.Helper.Integer in 'Tests.Delphi.SpecificationUtils.Helper.Integer.pas',
Tests.Delphi.SpecificationUtils.Helper.Boolean in 'Tests.Delphi.SpecificationUtils.Helper.Boolean.pas',
Delphi.SpecificationUtils.Arrays.Factory in '..\Delphi.SpecificationUtils.Arrays.Factory.pas',
Delphi.SpecificationUtils.Strings.Factory in '..\Delphi.SpecificationUtils.Strings.Factory.pas',
Delphi.SpecificationUtils.TGUID.Factory in '..\Delphi.SpecificationUtils.TGUID.Factory.pas',
Delphi.SpecificationUtils.DateTime.Factory in '..\Delphi.SpecificationUtils.DateTime.Factory.pas',
Tests.Delphi.SpecificationUtils.Strings.Matches in 'Tests.Delphi.SpecificationUtils.Strings.Matches.pas',
Delphi.SpecificationUtils.Reflection.TRttiType in '..\Delphi.SpecificationUtils.Reflection.TRttiType.pas',
Tests.Delphi.SpecificationUtils.RttiType in 'Tests.Delphi.SpecificationUtils.RttiType.pas',
Tests.Delphi.SpecificationUtils.RttiType.Attribute in 'Tests.Delphi.SpecificationUtils.RttiType.Attribute.pas',
Delphi.SpecificationUtils.Reflection.Instance in '..\Delphi.SpecificationUtils.Reflection.Instance.pas',
Delphi.SpecificationUtils.Common in '..\Delphi.SpecificationUtils.Common.pas',
Tests.Delphi.SpecificationUtils.Common.IsNull in 'Tests.Delphi.SpecificationUtils.Common.IsNull.pas',
Delphi.SpecificationUtils.Reflection.TRttiMember in '..\Delphi.SpecificationUtils.Reflection.TRttiMember.pas',
Delphi.SpecificationUtils.Reflection.TRttiNamedObject in '..\Delphi.SpecificationUtils.Reflection.TRttiNamedObject.pas',
Delphi.SpecificationUtils.Reflection.TValue in '..\Delphi.SpecificationUtils.Reflection.TValue.pas',
Delphi.SpecificationUtils.Reflection.TRttiProperty in '..\Delphi.SpecificationUtils.Reflection.TRttiProperty.pas',
Delphi.SpecificationUtils.Reflection.TRttiField in '..\Delphi.SpecificationUtils.Reflection.TRttiField.pas',
Delphi.SpecificationUtils.Reflection.Factory in '..\Delphi.SpecificationUtils.Reflection.Factory.pas',
Delphi.SpecificationUtils.Reflection.Instance.Factory in '..\Delphi.SpecificationUtils.Reflection.Instance.Factory.pas',
Delphi.SpecificationUtils.Reflection.TRttiField.Factory in '..\Delphi.SpecificationUtils.Reflection.TRttiField.Factory.pas',
Delphi.SpecificationUtils.Reflection.TRttiMember.Factory in '..\Delphi.SpecificationUtils.Reflection.TRttiMember.Factory.pas',
Delphi.SpecificationUtils.Reflection.TRttiNamedObject.Factory in '..\Delphi.SpecificationUtils.Reflection.TRttiNamedObject.Factory.pas',
Delphi.SpecificationUtils.Reflection.TRttiProperty.Factory in '..\Delphi.SpecificationUtils.Reflection.TRttiProperty.Factory.pas',
Delphi.SpecificationUtils.Reflection.TRttiType.Factory in '..\Delphi.SpecificationUtils.Reflection.TRttiType.Factory.pas',
Delphi.SpecificationUtils.Reflection.TValue.Factory in '..\Delphi.SpecificationUtils.Reflection.TValue.Factory.pas',
Tests.Delphi.SpecificationUtils.Reflection.Instance.Inherits in 'Tests.Delphi.SpecificationUtils.Reflection.Instance.Inherits.pas',
Delphi.SpecificationUtils.Reflection.TClass in '..\Delphi.SpecificationUtils.Reflection.TClass.pas',
Delphi.SpecificationUtils.Reflection.TRttiInstanceType in '..\Delphi.SpecificationUtils.Reflection.TRttiInstanceType.pas',
Tests.Delphi.SpecificationUtils.Reflection.Instance.Implements in 'Tests.Delphi.SpecificationUtils.Reflection.Instance.Implements.pas',
Delphi.SpecificationUtils.Integers in '..\Delphi.SpecificationUtils.Integers.pas',
Delphi.SpecificationUtils.Integers.Factory in '..\Delphi.SpecificationUtils.Integers.Factory.pas',
Delphi.SpecificationUtils.Common.Factory in '..\Delphi.SpecificationUtils.Common.Factory.pas',
Delphi.SpecificationUtils.Helper.TObject in '..\Delphi.SpecificationUtils.Helper.TObject.pas';
var
runner : ITestRunner;
results : IRunResults;
logger : ITestLogger;
nunitLogger : ITestLogger;
begin
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX.RunRegisteredTests;
exit;
{$ENDIF}
try
ReportMemoryLeaksOnShutdown := true;
//Check command line options, will exit if invalid
TDUnitX.CheckCommandLine;
//Create the test runner
runner := TDUnitX.CreateRunner;
//Tell the runner to use RTTI to find Fixtures
runner.UseRTTI := True;
//tell the runner how we will log things
//Log to the console window
logger := TDUnitXConsoleLogger.Create(true);
runner.AddLogger(logger);
//Generate an NUnit compatible XML File
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
runner.AddLogger(nunitLogger);
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
//Run tests
results := runner.Execute;
if not results.AllPassed then
System.ExitCode := EXIT_ERRORS;
{$IFNDEF CI}
//We don't want this happening when running under CI.
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
begin
System.Write('Done.. press <Enter> key to quit.');
System.Readln;
end;
{$ENDIF}
except
on E: Exception do
System.Writeln(E.ClassName, ': ', E.Message);
end;
end.
| 74.748148 | 151 | 0.820236 |
47b477a9f6d395a5c4436cbd88ab1f53ccbc4c33 | 1,099 | pas | Pascal | source/Class/Class_RecipeRow.pas | thesoncriel/shutter-test | 59687695174e8723ba5677e317ec33e4de6d9f87 | [
"MIT"
]
| null | null | null | source/Class/Class_RecipeRow.pas | thesoncriel/shutter-test | 59687695174e8723ba5677e317ec33e4de6d9f87 | [
"MIT"
]
| null | null | null | source/Class/Class_RecipeRow.pas | thesoncriel/shutter-test | 59687695174e8723ba5677e317ec33e4de6d9f87 | [
"MIT"
]
| null | null | null | unit Class_RecipeRow;
interface
uses
Classes;
type
IRecipeRow = interface(IInterface)
['{2F5566B6-BD2C-4246-B793-4897AAC14597}']
function Cols(columnIndex: Integer): Variant; stdcall;
function Count: Integer; stdcall;
procedure SetRowData(strings: TStrings); stdcall;
end;
TRecipeRow = class(TInterfacedObject, IRecipeRow)
public
Operation: boolean;
Delay: Integer;
constructor Create(strings: TStrings);
function Cols(columnIndex: Integer): Variant; stdcall;
procedure SetRowData(strings: TStrings); stdcall;
function Count: Integer; stdcall;
end;
implementation
uses
SysUtils;
function TRecipeRow.Cols(columnIndex: Integer): Variant;
begin
case columnIndex of
0: Result := Operation;
1: Result := Delay;
end;
end;
function TRecipeRow.Count: Integer;
begin
Result := 2;
end;
constructor TRecipeRow.Create(strings: TStrings);
begin
SetRowData( strings );
end;
procedure TRecipeRow.SetRowData(strings: TStrings);
begin
Operation := LowerCase( strings[ 0 ] ) = 'open';
Delay := StrToInt( strings[ 1 ] );
end;
end.
| 18.948276 | 58 | 0.717925 |
f1efece40838939ed4ca7b6e2e3625ffc7e722d2 | 195,058 | pas | Pascal | Source/UnicodeMixedLib.pas | a200332/zChinese | 668447815659b03b969dbb28b185e223ac1c900c | [
"Apache-2.0"
]
| null | null | null | Source/UnicodeMixedLib.pas | a200332/zChinese | 668447815659b03b969dbb28b185e223ac1c900c | [
"Apache-2.0"
]
| null | null | null | Source/UnicodeMixedLib.pas | a200332/zChinese | 668447815659b03b969dbb28b185e223ac1c900c | [
"Apache-2.0"
]
| null | null | null | { ****************************************************************************** }
{ * MixedLibrary,writen by QQ 600585@qq.com * }
{ * https://zpascal.net * }
{ * https://github.com/PassByYou888/zAI * }
{ * https://github.com/PassByYou888/ZServer4D * }
{ * https://github.com/PassByYou888/PascalString * }
{ * https://github.com/PassByYou888/zRasterization * }
{ * https://github.com/PassByYou888/CoreCipher * }
{ * https://github.com/PassByYou888/zSound * }
{ * https://github.com/PassByYou888/zChinese * }
{ * https://github.com/PassByYou888/zExpression * }
{ * https://github.com/PassByYou888/zGameWare * }
{ * https://github.com/PassByYou888/zAnalysis * }
{ * https://github.com/PassByYou888/FFMPEG-Header * }
{ * https://github.com/PassByYou888/zTranslate * }
{ * https://github.com/PassByYou888/InfiniteIoT * }
{ * https://github.com/PassByYou888/FastMD5 * }
{ ****************************************************************************** }
{
*
* Unit Name: MixedLibrary
* Purpose : mixed Low Level Function Library
*
}
(*
update history
2017-11-26 fixed UmlMD5Stream and umlMD5 calculate x64 and x86,ARM platform more than 4G memory Support QQ600585
*)
unit UnicodeMixedLib;
{$INCLUDE zDefine.inc}
interface
uses
{$IFDEF FPC}
Dynlibs,
{$IFDEF MSWINDOWS} Windows, {$ENDIF MSWINDOWS}
{$ELSE FPC}
{$IFDEF MSWINDOWS} Windows, {$ENDIF MSWINDOWS}
System.IOUtils,
{$ENDIF FPC}
SysUtils, Types, Math, Variants, CoreClasses, PascalStrings, ListEngine;
const
C_Max_UInt32 = $FFFFFFFF;
C_Address_Size = SizeOf(Pointer);
C_Pointer_Size = C_Address_Size;
C_Integer_Size = 4;
C_Int64_Size = 8;
C_UInt64_Size = 8;
C_Single_Size = 4;
C_Double_Size = 8;
C_Small_Int_Size = 2;
C_Byte_Size = 1;
C_Short_Int_Size = 1;
C_Word_Size = 2;
C_DWord_Size = 4;
C_Cardinal_Size = 4;
C_Boolean_Size = 1;
C_Bool_Size = 1;
C_MD5_Size = 16;
C_PrepareReadCacheSize = 512;
C_MaxBufferFragmentSize = $F000;
C_StringError = -911;
C_SeekError = -910;
C_FileWriteError = -909;
C_FileReadError = -908;
C_FileHandleError = -907;
C_OpenFileError = -905;
C_NotOpenFile = -904;
C_CreateFileError = -903;
C_FileIsActive = -902;
C_NotFindFile = -901;
C_NotError = -900;
type
U_SystemString = SystemString;
U_String = TPascalString;
P_String = PPascalString;
U_Char = SystemChar;
U_StringArray = array of U_SystemString;
U_Bytes = TBytes;
TSR = TSearchRec;
U_Stream = TCoreClassStream;
TReliableFileStream = class(TCoreClassStream)
protected
SourceIO, BackupFileIO: TCoreClassFileStream;
FActivted: Boolean;
FFileName, FBackupFileName: SystemString;
procedure InitIO;
procedure FreeIO;
procedure SetSize(const NewSize: Int64); overload; override;
procedure SetSize(NewSize: longint); overload; override;
public
constructor Create(const FileName_: SystemString; IsNew_, IsWrite_: Boolean);
destructor Destroy; override;
function write(const buffer; Count: longint): longint; override;
function read(var buffer; Count: longint): longint; override;
function Seek(const Offset: Int64; origin: TSeekOrigin): Int64; override;
property FileName: SystemString read FFileName;
property BackupFileName: SystemString read FBackupFileName;
property Activted: Boolean read FActivted;
end;
PIOHnd = ^TIOHnd;
TIOHnd = record
public
IsOnlyRead: Boolean;
IsOpen: Boolean;
AutoFree: Boolean;
Handle: U_Stream;
Time: TDateTime;
Size: Int64;
Position: Int64;
FileName: U_String;
FlushBuff: U_Stream;
FlushPosition: Int64;
PrepareReadPosition: Int64;
PrepareReadBuff: U_Stream;
IORead, IOWrite: Int64;
WriteStated: Boolean;
FixedStringL: Byte;
Data: Pointer;
Return: Integer;
function FixedString2Pascal(s: TBytes): TPascalString;
procedure Pascal2FixedString(var n: TPascalString; var out_: TBytes);
function CheckFixedStringLoss(s: TPascalString): Boolean;
end;
U_ByteArray = array [0 .. MaxInt div SizeOf(Byte) - 1] of Byte;
P_ByteArray = ^U_ByteArray;
function umlBytesOf(const s: TPascalString): TBytes;
function umlStringOf(const s: TBytes): TPascalString; overload;
function umlNewString(const s: TPascalString): P_String;
procedure umlFreeString(const p: P_String);
function umlComparePosStr(const s: TPascalString; Offset: Integer; const t: TPascalString): Boolean;
function umlPos(const SubStr, s: TPascalString; const Offset: Integer = 1): Integer;
function umlVarToStr(const v: Variant; const Base64Conver: Boolean): TPascalString; overload;
function umlVarToStr(const v: Variant): TPascalString; overload;
function umlStrToVar(const s: TPascalString): Variant;
function umlMax(const v1, v2: UInt64): UInt64; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Cardinal): Cardinal; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Word): Word; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Byte): Byte; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Int64): Int64; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Integer): Integer; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: SmallInt): SmallInt; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: ShortInt): ShortInt; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Double): Double; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMax(const v1, v2: Single): Single; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: UInt64): UInt64; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Cardinal): Cardinal; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Word): Word; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Byte): Byte; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Int64): Int64; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Integer): Integer; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: SmallInt): SmallInt; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: ShortInt): ShortInt; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Double): Double; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlMin(const v1, v2: Single): Single; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: UInt64): UInt64; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: Cardinal): Cardinal; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: Word): Word; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: Byte): Byte; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: Int64): Int64; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: SmallInt): SmallInt; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: ShortInt): ShortInt; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: Double): Double; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlClamp(const v, min_, max_: Single): Single; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: UInt64): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: Cardinal): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: Word): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: Byte): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: SmallInt): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: ShortInt): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: Double): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlInRange(const v, min_, max_: Single): Boolean; {$IFDEF INLINE_ASM} inline; {$ENDIF} overload;
function umlGetResourceStream(const FileName: TPascalString): TCoreClassStream;
function umlSameVarValue(const v1, v2: Variant): Boolean;
function umlSameVariant(const v1, v2: Variant): Boolean;
function umlRandom(const rnd: TMT19937Random): Integer; overload;
function umlRandom: Integer; overload;
function umlRandomRange64(const rnd: TMT19937Random; const min_, max_: Int64): Int64; overload;
function umlRandomRange(const rnd: TMT19937Random; const min_, max_: Integer): Integer; overload;
function umlRandomRangeS(const rnd: TMT19937Random; const min_, max_: Single): Single; overload;
function umlRandomRangeD(const rnd: TMT19937Random; const min_, max_: Double): Double; overload;
function umlRandomRangeF(const rnd: TMT19937Random; const min_, max_: Double): Double; overload;
function umlRandomRange64(const min_, max_: Int64): Int64; overload;
function umlRandomRange(const min_, max_: Integer): Integer; overload;
function umlRandomRangeS(const min_, max_: Single): Single; overload;
function umlRandomRangeD(const min_, max_: Double): Double; overload;
function umlRandomRangeF(const min_, max_: Double): Double; overload;
function umlDefaultTime: Double;
function umlNow: Double;
function umlDefaultAttrib: Integer;
function umlBoolToStr(const Value: Boolean): TPascalString;
function umlStrToBool(const Value: TPascalString): Boolean;
function umlFileExists(const FileName: TPascalString): Boolean;
function umlDirectoryExists(const DirectoryName: TPascalString): Boolean;
function umlCreateDirectory(const DirectoryName: TPascalString): Boolean;
function umlCurrentDirectory: TPascalString;
function umlCurrentPath: TPascalString;
function umlGetCurrentPath: TPascalString;
procedure umlSetCurrentPath(ph: TPascalString);
function umlFindFirstFile(const FileName: TPascalString; var SR: TSR): Boolean;
function umlFindNextFile(var SR: TSR): Boolean;
function umlFindFirstDir(const DirName: TPascalString; var SR: TSR): Boolean;
function umlFindNextDir(var SR: TSR): Boolean;
procedure umlFindClose(var SR: TSR);
function umlGetFileList(const FullPath: TPascalString; AsLst: TCoreClassStrings): Integer; overload;
function umlGetDirList(const FullPath: TPascalString; AsLst: TCoreClassStrings): Integer; overload;
function umlGetFileList(const FullPath: TPascalString; AsLst: TPascalStringList): Integer; overload;
function umlGetDirList(const FullPath: TPascalString; AsLst: TPascalStringList): Integer; overload;
function umlGetFileListWithFullPath(const FullPath: TPascalString): U_StringArray;
function umlGetDirListWithFullPath(const FullPath: TPascalString): U_StringArray;
function umlGetFileListPath(const FullPath: TPascalString): U_StringArray;
function umlGetDirListPath(const FullPath: TPascalString): U_StringArray;
function umlCombinePath(const s1, s2: TPascalString): TPascalString;
function umlCombineFileName(const pathName, FileName: TPascalString): TPascalString;
function umlCombineUnixPath(const s1, s2: TPascalString): TPascalString;
function umlCombineUnixFileName(const pathName, FileName: TPascalString): TPascalString;
function umlCombineWinPath(const s1, s2: TPascalString): TPascalString;
function umlCombineWinFileName(const pathName, FileName: TPascalString): TPascalString;
function umlGetFileName(const s: TPascalString): TPascalString;
function umlGetFilePath(const s: TPascalString): TPascalString;
function umlChangeFileExt(const s, ext: TPascalString): TPascalString;
function umlGetFileExt(const s: TPascalString): TPascalString;
procedure InitIOHnd(var IOHnd: TIOHnd);
function umlFileCreateAsStream(const FileName: TPascalString; stream: U_Stream; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean; overload;
function umlFileCreateAsStream(const FileName: TPascalString; stream: U_Stream; var IOHnd: TIOHnd): Boolean; overload;
function umlFileCreateAsStream(stream: U_Stream; var IOHnd: TIOHnd): Boolean; overload;
function umlFileCreateAsStream(stream: U_Stream; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean; overload;
function umlFileOpenAsStream(const FileName: TPascalString; stream: U_Stream; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean;
function umlFileCreateAsMemory(var IOHnd: TIOHnd): Boolean;
function umlFileCreate(const FileName: TPascalString; var IOHnd: TIOHnd): Boolean;
function umlFileOpen(const FileName: TPascalString; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean;
function umlFileClose(var IOHnd: TIOHnd): Boolean;
function umlFileUpdate(var IOHnd: TIOHnd): Boolean;
function umlFileTest(var IOHnd: TIOHnd): Boolean;
procedure umlResetPrepareRead(var IOHnd: TIOHnd);
function umlFilePrepareRead(var IOHnd: TIOHnd; Size: Int64; var buff): Boolean;
function umlFileRead(var IOHnd: TIOHnd; const Size: Int64; var buff): Boolean;
function umlBlockRead(var IOHnd: TIOHnd; var buff; const Size: Int64): Boolean;
function umlFilePrepareWrite(var IOHnd: TIOHnd): Boolean;
function umlFileFlushWrite(var IOHnd: TIOHnd): Boolean;
function umlFileWrite(var IOHnd: TIOHnd; const Size: Int64; var buff): Boolean;
function umlBlockWrite(var IOHnd: TIOHnd; var buff; const Size: Int64): Boolean;
function umlFileWriteFixedString(var IOHnd: TIOHnd; var Value: TPascalString): Boolean;
function umlFileReadFixedString(var IOHnd: TIOHnd; var Value: TPascalString): Boolean;
function umlFileSeek(var IOHnd: TIOHnd; Pos_: Int64): Boolean;
function umlFileGetPOS(var IOHnd: TIOHnd): Int64;
function umlFileSetSize(var IOHnd: TIOHnd; siz_: Int64): Boolean;
function umlFilePOS(var IOHnd: TIOHnd): Int64;
function umlFileGetSize(var IOHnd: TIOHnd): Int64;
function umlFileSize(var IOHnd: TIOHnd): Int64;
function umlGetFileTime(const FileName: TPascalString): TDateTime;
procedure umlSetFileTime(const FileName: TPascalString; newTime: TDateTime);
function umlGetFileSize(const FileName: TPascalString): Int64;
function umlGetFileCount(const FileName: TPascalString): Integer;
function umlGetFileDateTime(const FileName: TPascalString): TDateTime;
function umlDeleteFile(const FileName: TPascalString; const _VerifyCheck: Boolean): Boolean; overload;
function umlDeleteFile(const FileName: TPascalString): Boolean; overload;
function umlCopyFile(const SourFile, DestFile: TPascalString): Boolean;
function umlRenameFile(const OldName, NewName: TPascalString): Boolean;
procedure umlSetLength(var sVal: TPascalString; Len: Integer); overload;
procedure umlSetLength(var sVal: U_Bytes; Len: Integer); overload;
procedure umlSetLength(var sVal: TArrayPascalString; Len: Integer); overload;
function umlGetLength(const sVal: TPascalString): Integer; overload;
function umlGetLength(const sVal: U_Bytes): Integer; overload;
function umlGetLength(const sVal: TArrayPascalString): Integer; overload;
function umlUpperCase(const s: TPascalString): TPascalString;
function umlLowerCase(const s: TPascalString): TPascalString;
function umlCopyStr(const sVal: TPascalString; MainPosition, LastPosition: Integer): TPascalString;
function umlSameText(const s1, s2: TPascalString): Boolean;
function umlDeleteChar(const SText, Ch: TPascalString): TPascalString; overload;
function umlDeleteChar(const SText: TPascalString; const SomeChars: array of SystemChar): TPascalString; overload;
function umlDeleteChar(const SText: TPascalString; const SomeCharsets: TOrdChars): TPascalString; overload;
function umlGetNumberCharInText(const n: TPascalString): TPascalString;
function umlMatchChar(CharValue: U_Char; cVal: P_String): Boolean; overload;
function umlMatchChar(CharValue: U_Char; cVal: TPascalString): Boolean; overload;
function umlExistsChar(StrValue: TPascalString; cVal: TPascalString): Boolean;
function umlTrimChar(const s, trim_s: TPascalString): TPascalString;
function umlGetFirstStr(const sVal, trim_s: TPascalString): TPascalString;
function umlGetLastStr(const sVal, trim_s: TPascalString): TPascalString;
function umlDeleteFirstStr(const sVal, trim_s: TPascalString): TPascalString;
function umlDeleteLastStr(const sVal, trim_s: TPascalString): TPascalString;
function umlGetIndexStrCount(const sVal, trim_s: TPascalString): Integer;
function umlGetIndexStr(const sVal: TPascalString; trim_s: TPascalString; index: Integer): TPascalString;
procedure umlGetSplitArray(const sour: TPascalString; var dest: TArrayPascalString; const splitC: TPascalString); overload;
procedure umlGetSplitArray(const sour: TPascalString; var dest: U_StringArray; const splitC: TPascalString); overload;
function ArrayStringToText(var ary: TArrayPascalString; const splitC: TPascalString): TPascalString;
function umlStringsToSplitText(lst: TCoreClassStrings; const splitC: TPascalString): TPascalString; overload;
function umlStringsToSplitText(lst: TListPascalString; const splitC: TPascalString): TPascalString; overload;
function umlGetFirstStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
function umlDeleteFirstStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
function umlGetLastStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
function umlDeleteLastStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
function umlGetIndexStrCount_Discontinuity(const sVal, trim_s: TPascalString): Integer;
function umlGetIndexStr_Discontinuity(const sVal: TPascalString; trim_s: TPascalString; index: Integer): TPascalString;
function umlGetFirstTextPos(const s: TPascalString; const TextArry: TArrayPascalString; var OutText: TPascalString): Integer;
function umlDeleteText(const sour: TPascalString; const bToken, eToken: TArrayPascalString; ANeedBegin, ANeedEnd: Boolean): TPascalString;
function umlGetTextContent(const sour: TPascalString; const bToken, eToken: TArrayPascalString): TPascalString;
type
TTextType = (ntBool, ntInt, ntInt64, ntUInt64, ntWord, ntByte, ntSmallInt, ntShortInt, ntUInt, ntSingle, ntDouble, ntCurrency, ntUnknow);
function umlGetNumTextType(const s: TPascalString): TTextType;
function umlIsHex(const sVal: TPascalString): Boolean;
function umlIsNumber(const sVal: TPascalString): Boolean;
function umlIsIntNumber(const sVal: TPascalString): Boolean;
function umlIsFloatNumber(const sVal: TPascalString): Boolean;
function umlIsBool(const sVal: TPascalString): Boolean;
function umlNumberCount(const sVal: TPascalString): Integer;
function umlPercentageToFloat(OriginMax, OriginMin, ProcressParameter: Double): Double;
function umlPercentageToInt64(OriginParameter, ProcressParameter: Int64): Integer;
function umlPercentageToInt(OriginParameter, ProcressParameter: Integer): Integer;
function umlPercentageToStr(OriginParameter, ProcressParameter: Integer): TPascalString;
function umlSmartSizeToStr(Size: Int64): TPascalString;
function umlIntToStr(Parameter: Single): TPascalString; overload;
function umlIntToStr(Parameter: Double): TPascalString; overload;
function umlIntToStr(Parameter: Int64): TPascalString; overload;
function umlPointerToStr(param: Pointer): TPascalString;
function umlMBPSToStr(Size: Int64): TPascalString;
function umlSizeToStr(Parameter: Int64): TPascalString;
function umlDateTimeToStr(t: TDateTime): TPascalString;
function umlTimeTickToStr(const t: TTimeTick): TPascalString;
function umlTimeToStr(t: TDateTime): TPascalString;
function umlDateToStr(t: TDateTime): TPascalString;
function umlFloatToStr(const f: Double): TPascalString;
function umlShortFloatToStr(const f: Double): TPascalString;
function umlStrToInt(const _V: TPascalString): Integer; overload;
function umlStrToInt(const _V: TPascalString; _Def: Integer): Integer; overload;
function umlStrToInt64(const _V: TPascalString; _Def: Int64): Int64; overload;
function umlStrToFloat(const _V: TPascalString; _Def: Double): Double; overload;
function umlStrToFloat(const _V: TPascalString): Double; overload;
function umlMultipleMatch(IgnoreCase: Boolean; const SourceStr, TargetStr, umlMultipleString, umlMultipleCharacter: TPascalString): Boolean; overload;
function umlMultipleMatch(IgnoreCase: Boolean; const SourceStr, TargetStr: TPascalString): Boolean; overload;
function umlMultipleMatch(const SourceStr, TargetStr: TPascalString): Boolean; overload;
function umlMultipleMatch(const ValueCheck: array of TPascalString; const Value: TPascalString): Boolean; overload;
function umlSearchMatch(const SourceStr, TargetStr: TPascalString): Boolean; overload;
function umlSearchMatch(const ValueCheck: TArrayPascalString; Value: TPascalString): Boolean; overload;
// <prefix>.<postfix> formula, match sour -> dest
// example: <prefix>.*
// example: *.<postfix>
function umlMatchFileInfo(const exp_, sour_, dest_: TPascalString): Boolean;
function umlGetDateTimeStr(NowDateTime: TDateTime): TPascalString;
function umlDecodeTimeToStr(NowDateTime: TDateTime): TPascalString;
function umlMakeRanName: TPascalString;
function umlStringReplace(const s, OldPattern, NewPattern: TPascalString; IgnoreCase: Boolean): TPascalString;
function umlReplaceString(const s, OldPattern, NewPattern: TPascalString; IgnoreCase: Boolean): TPascalString;
function umlCharReplace(const s: TPascalString; OldPattern, NewPattern: U_Char): TPascalString;
function umlReplaceChar(const s: TPascalString; OldPattern, NewPattern: U_Char): TPascalString;
function umlEncodeText2HTML(const psSrc: TPascalString): TPascalString;
function umlURLEncode(const Data: TPascalString): TPascalString;
function umlURLDecode(const Data: TPascalString; FormEncoded: Boolean): TPascalString;
type
TBase64Context = record
Tail: array [0 .. 3] of Byte;
TailBytes: Integer;
LineWritten: Integer;
LineSize: Integer;
TrailingEol: Boolean;
PutFirstEol: Boolean;
LiberalMode: Boolean;
fEOL: array [0 .. 3] of Byte;
EOLSize: Integer;
OutBuf: array [0 .. 3] of Byte;
EQUCount: Integer;
UseUrlAlphabet: Boolean;
end;
TBase64EOLMarker = (emCRLF, emCR, emLF, emNone);
TBase64ByteArray = array [0 .. MaxInt div SizeOf(Byte) - 1] of Byte;
PBase64ByteArray = ^TBase64ByteArray;
const
BASE64_DECODE_OK = 0;
BASE64_DECODE_INVALID_CHARACTER = 1;
BASE64_DECODE_WRONG_DATA_SIZE = 2;
BASE64_DECODE_NOT_ENOUGH_SPACE = 3;
Base64Symbols: array [0 .. 63] of Byte = (
$41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F, $50,
$51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $61, $62, $63, $64, $65, $66,
$67, $68, $69, $6A, $6B, $6C, $6D, $6E, $6F, $70, $71, $72, $73, $74, $75, $76,
$77, $78, $79, $7A, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $2B, $2F);
Base64Values: array [0 .. 255] of Byte = (
$FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FE, $FE, $FF, $FF, $FE, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FE, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $3E, $FF, $FF, $FF, $3F,
$34, $35, $36, $37, $38, $39, $3A, $3B, $3C, $3D, $FF, $FF, $FF, $FD, $FF, $FF,
$FF, $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E,
$0F, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $FF, $FF, $FF, $FF, $FF,
$FF, $1A, $1B, $1C, $1D, $1E, $1F, $20, $21, $22, $23, $24, $25, $26, $27, $28,
$29, $2A, $2B, $2C, $2D, $2E, $2F, $30, $31, $32, $33, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF,
$FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF);
function B64EstimateEncodedSize(Ctx: TBase64Context; InSize: Integer): Integer;
function B64InitializeDecoding(var Ctx: TBase64Context; LiberalMode: Boolean): Boolean;
function B64InitializeEncoding(var Ctx: TBase64Context; LineSize: Integer; fEOL: TBase64EOLMarker; TrailingEol: Boolean): Boolean;
function B64Encode(var Ctx: TBase64Context; buffer: PByte; Size: Integer; OutBuffer: PByte; var OutSize: Integer): Boolean;
function B64Decode(var Ctx: TBase64Context; buffer: PByte; Size: Integer; OutBuffer: PByte; var OutSize: Integer): Boolean;
function B64FinalizeEncoding(var Ctx: TBase64Context; OutBuffer: PByte; var OutSize: Integer): Boolean;
function B64FinalizeDecoding(var Ctx: TBase64Context; OutBuffer: PByte; var OutSize: Integer): Boolean;
function umlBase64Encode(InBuffer: PByte; InSize: Integer; OutBuffer: PByte; var OutSize: Integer; WrapLines: Boolean): Boolean;
function umlBase64Decode(InBuffer: PByte; InSize: Integer; OutBuffer: PByte; var OutSize: Integer; LiberalMode: Boolean): Integer;
procedure umlBase64EncodeBytes(var sour, dest: TBytes); overload;
procedure umlBase64DecodeBytes(var sour, dest: TBytes); overload;
procedure umlBase64EncodeBytes(var sour: TBytes; var dest: TPascalString); overload;
procedure umlBase64DecodeBytes(const sour: TPascalString; var dest: TBytes); overload;
procedure umlDecodeLineBASE64(const buffer: TPascalString; var output: TPascalString);
procedure umlEncodeLineBASE64(const buffer: TPascalString; var output: TPascalString);
procedure umlDecodeStreamBASE64(const buffer: TPascalString; output: TCoreClassStream);
procedure umlEncodeStreamBASE64(buffer: TCoreClassStream; var output: TPascalString);
function umlDivisionBase64Text(const buffer: TPascalString; width: Integer; DivisionAsPascalString: Boolean): TPascalString;
function umlTestBase64(const text: TPascalString): Boolean;
type
PMD5 = ^TMD5;
TMD5 = array [0 .. 15] of Byte;
const
NullMD5: TMD5 = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
ZeroMD5: TMD5 = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
function umlMD5(const buffPtr: PByte; bufSiz: NativeUInt): TMD5;
function umlMD5Char(const buffPtr: PByte; const BuffSize: NativeUInt): TPascalString;
function umlMD5String(const buffPtr: PByte; const BuffSize: NativeUInt): TPascalString;
function umlStreamMD5(stream: TCoreClassStream; StartPos, EndPos: Int64): TMD5; overload;
function umlStreamMD5(stream: TCoreClassStream): TMD5; overload;
function umlStreamMD5Char(stream: TCoreClassStream): TPascalString; overload;
function umlStreamMD5String(stream: TCoreClassStream): TPascalString; overload;
function umlStringMD5(const Value: TPascalString): TPascalString;
function umlFileMD5___(FileName: TPascalString): TMD5; overload;
function umlFileMD5(FileName: TPascalString; StartPos, EndPos: Int64): TMD5; overload;
function umlCombineMD5(const m1: TMD5): TMD5; overload;
function umlCombineMD5(const m1, m2: TMD5): TMD5; overload;
function umlCombineMD5(const m1, m2, m3: TMD5): TMD5; overload;
function umlCombineMD5(const m1, m2, m3, m4: TMD5): TMD5; overload;
function umlCombineMD5(const buff: array of TMD5): TMD5; overload;
function umlMD5ToStr(md5: TMD5): TPascalString; overload;
function umlMD5ToString(md5: TMD5): TPascalString; overload;
function umlMD52String(md5: TMD5): TPascalString; overload;
function umlMD5Compare(const m1, m2: TMD5): Boolean;
function umlCompareMD5(const m1, m2: TMD5): Boolean;
function umlIsNullMD5(m: TMD5): Boolean;
function umlWasNullMD5(m: TMD5): Boolean;
{$REGION 'crc16define'}
const
CRC16Table: array [0 .. 255] of Word = (
$0000, $C0C1, $C181, $0140, $C301, $03C0, $0280, $C241, $C601, $06C0, $0780,
$C741, $0500, $C5C1, $C481, $0440, $CC01, $0CC0, $0D80, $CD41, $0F00, $CFC1,
$CE81, $0E40, $0A00, $CAC1, $CB81, $0B40, $C901, $09C0, $0880, $C841, $D801,
$18C0, $1980, $D941, $1B00, $DBC1, $DA81, $1A40, $1E00, $DEC1, $DF81, $1F40,
$DD01, $1DC0, $1C80, $DC41, $1400, $D4C1, $D581, $1540, $D701, $17C0, $1680,
$D641, $D201, $12C0, $1380, $D341, $1100, $D1C1, $D081, $1040, $F001, $30C0,
$3180, $F141, $3300, $F3C1, $F281, $3240, $3600, $F6C1, $F781, $3740, $F501,
$35C0, $3480, $F441, $3C00, $FCC1, $FD81, $3D40, $FF01, $3FC0, $3E80, $FE41,
$FA01, $3AC0, $3B80, $FB41, $3900, $F9C1, $F881, $3840, $2800, $E8C1, $E981,
$2940, $EB01, $2BC0, $2A80, $EA41, $EE01, $2EC0, $2F80, $EF41, $2D00, $EDC1,
$EC81, $2C40, $E401, $24C0, $2580, $E541, $2700, $E7C1, $E681, $2640, $2200,
$E2C1, $E381, $2340, $E101, $21C0, $2080, $E041, $A001, $60C0, $6180, $A141,
$6300, $A3C1, $A281, $6240, $6600, $A6C1, $A781, $6740, $A501, $65C0, $6480,
$A441, $6C00, $ACC1, $AD81, $6D40, $AF01, $6FC0, $6E80, $AE41, $AA01, $6AC0,
$6B80, $AB41, $6900, $A9C1, $A881, $6840, $7800, $B8C1, $B981, $7940, $BB01,
$7BC0, $7A80, $BA41, $BE01, $7EC0, $7F80, $BF41, $7D00, $BDC1, $BC81, $7C40,
$B401, $74C0, $7580, $B541, $7700, $B7C1, $B681, $7640, $7200, $B2C1, $B381,
$7340, $B101, $71C0, $7080, $B041, $5000, $90C1, $9181, $5140, $9301, $53C0,
$5280, $9241, $9601, $56C0, $5780, $9741, $5500, $95C1, $9481, $5440, $9C01,
$5CC0, $5D80, $9D41, $5F00, $9FC1, $9E81, $5E40, $5A00, $9AC1, $9B81, $5B40,
$9901, $59C0, $5880, $9841, $8801, $48C0, $4980, $8941, $4B00, $8BC1, $8A81,
$4A40, $4E00, $8EC1, $8F81, $4F40, $8D01, $4DC0, $4C80, $8C41, $4400, $84C1,
$8581, $4540, $8701, $47C0, $4680, $8641, $8201, $42C0, $4380, $8341, $4100,
$81C1, $8081, $4040
);
{$ENDREGION 'crc16define'}
function umlCRC16(const Value: PByte; const Count: NativeUInt): Word;
function umlStringCRC16(const Value: TPascalString): Word;
function umlStreamCRC16(stream: U_Stream; StartPos, EndPos: Int64): Word; overload;
function umlStreamCRC16(stream: U_Stream): Word; overload;
{$REGION 'crc32define'}
const
CRC32Table: array [0 .. 255] of Cardinal = (
$00000000, $77073096, $EE0E612C, $990951BA, $076DC419, $706AF48F, $E963A535,
$9E6495A3, $0EDB8832, $79DCB8A4, $E0D5E91E, $97D2D988, $09B64C2B, $7EB17CBD,
$E7B82D07, $90BF1D91, $1DB71064, $6AB020F2, $F3B97148, $84BE41DE, $1ADAD47D,
$6DDDE4EB, $F4D4B551, $83D385C7, $136C9856, $646BA8C0, $FD62F97A, $8A65C9EC,
$14015C4F, $63066CD9, $FA0F3D63, $8D080DF5, $3B6E20C8, $4C69105E, $D56041E4,
$A2677172, $3C03E4D1, $4B04D447, $D20D85FD, $A50AB56B, $35B5A8FA, $42B2986C,
$DBBBC9D6, $ACBCF940, $32D86CE3, $45DF5C75, $DCD60DCF, $ABD13D59, $26D930AC,
$51DE003A, $C8D75180, $BFD06116, $21B4F4B5, $56B3C423, $CFBA9599, $B8BDA50F,
$2802B89E, $5F058808, $C60CD9B2, $B10BE924, $2F6F7C87, $58684C11, $C1611DAB,
$B6662D3D, $76DC4190, $01DB7106, $98D220BC, $EFD5102A, $71B18589, $06B6B51F,
$9FBFE4A5, $E8B8D433, $7807C9A2, $0F00F934, $9609A88E, $E10E9818, $7F6A0DBB,
$086D3D2D, $91646C97, $E6635C01, $6B6B51F4, $1C6C6162, $856530D8, $F262004E,
$6C0695ED, $1B01A57B, $8208F4C1, $F50FC457, $65B0D9C6, $12B7E950, $8BBEB8EA,
$FCB9887C, $62DD1DDF, $15DA2D49, $8CD37CF3, $FBD44C65, $4DB26158, $3AB551CE,
$A3BC0074, $D4BB30E2, $4ADFA541, $3DD895D7, $A4D1C46D, $D3D6F4FB, $4369E96A,
$346ED9FC, $AD678846, $DA60B8D0, $44042D73, $33031DE5, $AA0A4C5F, $DD0D7CC9,
$5005713C, $270241AA, $BE0B1010, $C90C2086, $5768B525, $206F85B3, $B966D409,
$CE61E49F, $5EDEF90E, $29D9C998, $B0D09822, $C7D7A8B4, $59B33D17, $2EB40D81,
$B7BD5C3B, $C0BA6CAD, $EDB88320, $9ABFB3B6, $03B6E20C, $74B1D29A, $EAD54739,
$9DD277AF, $04DB2615, $73DC1683, $E3630B12, $94643B84, $0D6D6A3E, $7A6A5AA8,
$E40ECF0B, $9309FF9D, $0A00AE27, $7D079EB1, $F00F9344, $8708A3D2, $1E01F268,
$6906C2FE, $F762575D, $806567CB, $196C3671, $6E6B06E7, $FED41B76, $89D32BE0,
$10DA7A5A, $67DD4ACC, $F9B9DF6F, $8EBEEFF9, $17B7BE43, $60B08ED5, $D6D6A3E8,
$A1D1937E, $38D8C2C4, $4FDFF252, $D1BB67F1, $A6BC5767, $3FB506DD, $48B2364B,
$D80D2BDA, $AF0A1B4C, $36034AF6, $41047A60, $DF60EFC3, $A867DF55, $316E8EEF,
$4669BE79, $CB61B38C, $BC66831A, $256FD2A0, $5268E236, $CC0C7795, $BB0B4703,
$220216B9, $5505262F, $C5BA3BBE, $B2BD0B28, $2BB45A92, $5CB36A04, $C2D7FFA7,
$B5D0CF31, $2CD99E8B, $5BDEAE1D, $9B64C2B0, $EC63F226, $756AA39C, $026D930A,
$9C0906A9, $EB0E363F, $72076785, $05005713, $95BF4A82, $E2B87A14, $7BB12BAE,
$0CB61B38, $92D28E9B, $E5D5BE0D, $7CDCEFB7, $0BDBDF21, $86D3D2D4, $F1D4E242,
$68DDB3F8, $1FDA836E, $81BE16CD, $F6B9265B, $6FB077E1, $18B74777, $88085AE6,
$FF0F6A70, $66063BCA, $11010B5C, $8F659EFF, $F862AE69, $616BFFD3, $166CCF45,
$A00AE278, $D70DD2EE, $4E048354, $3903B3C2, $A7672661, $D06016F7, $4969474D,
$3E6E77DB, $AED16A4A, $D9D65ADC, $40DF0B66, $37D83BF0, $A9BCAE53, $DEBB9EC5,
$47B2CF7F, $30B5FFE9, $BDBDF21C, $CABAC28A, $53B39330, $24B4A3A6, $BAD03605,
$CDD70693, $54DE5729, $23D967BF, $B3667A2E, $C4614AB8, $5D681B02, $2A6F2B94,
$B40BBE37, $C30C8EA1, $5A05DF1B, $2D02EF8D
);
{$ENDREGION 'crc32define'}
function umlCRC32(const Value: PByte; const Count: NativeUInt): Cardinal;
function umlString2CRC32(const Value: TPascalString): Cardinal;
function umlStreamCRC32(stream: U_Stream; StartPos, EndPos: Int64): Cardinal; overload;
function umlStreamCRC32(stream: U_Stream): Cardinal; overload;
function umlTrimSpace(const s: TPascalString): TPascalString;
function umlSeparatorText(Text_: TPascalString; dest: TCoreClassStrings; SeparatorChar: TPascalString): Integer; overload;
function umlSeparatorText(Text_: TPascalString; dest: THashVariantList; SeparatorChar: TPascalString): Integer; overload;
function umlSeparatorText(Text_: TPascalString; dest: TListPascalString; SeparatorChar: TPascalString): Integer; overload;
function umlStringsMatchText(OriginValue: TCoreClassStrings; DestValue: TPascalString; IgnoreCase: Boolean): Boolean;
function umlStringsInExists(dest: TListPascalString; SText: TPascalString; IgnoreCase: Boolean): Boolean; overload;
function umlStringsInExists(dest: TCoreClassStrings; SText: TPascalString; IgnoreCase: Boolean): Boolean; overload;
function umlStringsInExists(dest: TCoreClassStrings; SText: TPascalString): Boolean; overload;
function umlTextInStrings(const SText: TPascalString; dest: TListPascalString; IgnoreCase: Boolean): Boolean; overload;
function umlTextInStrings(const SText: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Boolean; overload;
function umlTextInStrings(const SText: TPascalString; dest: TCoreClassStrings): Boolean; overload;
function umlAddNewStrTo(SourceStr: TPascalString; dest: TListPascalString; IgnoreCase: Boolean): Boolean; overload;
function umlAddNewStrTo(SourceStr: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Boolean; overload;
function umlAddNewStrTo(SourceStr: TPascalString; dest: TCoreClassStrings): Boolean; overload;
function umlAddNewStrTo(SourceStr, dest: TCoreClassStrings): Integer; overload;
function umlDeleteStrings(const SText: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Integer;
function umlDeleteStringsNot(const SText: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Integer;
function umlMergeStrings(Source, dest: TCoreClassStrings; IgnoreCase: Boolean): Integer; overload;
function umlMergeStrings(Source, dest: TListPascalString; IgnoreCase: Boolean): Integer; overload;
function umlConverStrToFileName(const Value: TPascalString): TPascalString;
function umlSplitTextMatch(const SText, Limit, MatchText: TPascalString; IgnoreCase: Boolean): Boolean;
function umlSplitTextTrimSpaceMatch(const SText, Limit, MatchText: TPascalString; IgnoreCase: Boolean): Boolean;
function umlSplitDeleteText(const SText, Limit, MatchText: TPascalString; IgnoreCase: Boolean): TPascalString;
function umlSplitTextAsList(const SText, Limit: TPascalString; AsLst: TCoreClassStrings): Boolean;
function umlSplitTextAsListAndTrimSpace(const SText, Limit: TPascalString; AsLst: TCoreClassStrings): Boolean;
function umlListAsSplitText(const List: TCoreClassStrings; Limit: TPascalString): TPascalString; overload;
function umlListAsSplitText(const List: TListPascalString; Limit: TPascalString): TPascalString; overload;
function umlDivisionText(const buffer: TPascalString; width: Integer; DivisionAsPascalString: Boolean): TPascalString;
function umlUpdateComponentName(const Name: TPascalString): TPascalString;
function umlMakeComponentName(Owner: TCoreClassComponent; RefrenceName: TPascalString): TPascalString;
procedure umlReadComponent(stream: TCoreClassStream; comp: TCoreClassComponent);
procedure umlWriteComponent(stream: TCoreClassStream; comp: TCoreClassComponent);
procedure umlCopyComponentDataTo(comp, copyto: TCoreClassComponent);
function umlProcessCycleValue(CurrentVal, DeltaVal, StartVal, OverVal: Single; var EndFlag: Boolean): Single;
type
TCSVGetLineCall = procedure(var L: TPascalString; var IsEnd: Boolean);
TCSVSaveCall = procedure(const sour: TPascalString; const king, Data: TArrayPascalString);
TCSVGetLineMethod = procedure(var L: TPascalString; var IsEnd: Boolean) of object;
TCSVSaveMethod = procedure(const sour: TPascalString; const king, Data: TArrayPascalString) of object;
{$IFDEF FPC}
TCSVGetLineProc = procedure(var L: TPascalString; var IsEnd: Boolean) is nested;
TCSVSaveProc = procedure(const sour: TPascalString; const king, Data: TArrayPascalString) is nested;
{$ELSE FPC}
TCSVGetLineProc = reference to procedure(var L: TPascalString; var IsEnd: Boolean);
TCSVSaveProc = reference to procedure(const sour: TPascalString; const king, Data: TArrayPascalString);
{$ENDIF FPC}
procedure ImportCSV_C(const sour: TArrayPascalString; OnNotify: TCSVSaveCall);
procedure CustomImportCSV_C(const OnGetLine: TCSVGetLineCall; OnNotify: TCSVSaveCall);
procedure ImportCSV_M(const sour: TArrayPascalString; OnNotify: TCSVSaveMethod);
procedure CustomImportCSV_M(const OnGetLine: TCSVGetLineMethod; OnNotify: TCSVSaveMethod);
procedure ImportCSV_P(const sour: TArrayPascalString; OnNotify: TCSVSaveProc);
procedure CustomImportCSV_P(const OnGetLine: TCSVGetLineProc; OnNotify: TCSVSaveProc);
function GetExtLib(LibName: SystemString): HMODULE;
function FreeExtLib(LibName: SystemString): Boolean;
function GetExtProc(const LibName, ProcName: SystemString): Pointer;
type
TArrayRawByte = array [0 .. MaxInt - 1] of Byte;
PArrayRawByte = ^TArrayRawByte;
function umlCompareByteString(const s1: TPascalString; const s2: PArrayRawByte): Boolean; overload;
function umlCompareByteString(const s2: PArrayRawByte; const s1: TPascalString): Boolean; overload;
procedure umlSetByteString(const sour: TPascalString; const dest: PArrayRawByte); overload;
procedure umlSetByteString(const dest: PArrayRawByte; const sour: TPascalString); overload;
function umlGetByteString(const sour: PArrayRawByte; const L: Integer): TPascalString;
procedure SaveMemory(p: Pointer; siz: NativeInt; DestFile: TPascalString);
{ fast cache for fileMD5 }
function umlFileMD5(FileName: TPascalString): TMD5; overload;
procedure umlCacheFileMD5(FileName: U_String);
procedure umlCacheFileMD5FromDirectory(Directory_, Filter_: U_String);
implementation
uses
{$IF Defined(WIN32) or Defined(WIN64)}
Fast_MD5,
{$ENDIF}
DoStatusIO, MemoryStream64;
procedure TReliableFileStream.InitIO;
begin
if not FActivted then
exit;
DoStatus(PFormat('Reliable IO Open : %s', [umlGetFileName(FileName).text]));
DoStatus(PFormat('Backup %s size: %s', [umlGetFileName(FileName).text, umlSizeToStr(SourceIO.Size).text]));
BackupFileIO := TCoreClassFileStream.Create(FBackupFileName, fmCreate);
BackupFileIO.Size := SourceIO.Size;
SourceIO.Position := 0;
BackupFileIO.Position := 0;
BackupFileIO.CopyFrom(SourceIO, SourceIO.Size);
BackupFileIO.Position := 0;
DisposeObject(SourceIO);
SourceIO := nil;
end;
procedure TReliableFileStream.FreeIO;
begin
if not FActivted then
exit;
DisposeObject(BackupFileIO);
BackupFileIO := nil;
try
umlDeleteFile(FFileName);
umlRenameFile(FBackupFileName, FileName);
except
end;
DoStatus(PFormat('Reliable IO Close : %s', [umlGetFileName(FileName).text]));
end;
procedure TReliableFileStream.SetSize(const NewSize: Int64);
begin
SourceIO.Size := NewSize;
end;
procedure TReliableFileStream.SetSize(NewSize: longint);
begin
SetSize(Int64(NewSize));
end;
constructor TReliableFileStream.Create(const FileName_: SystemString; IsNew_, IsWrite_: Boolean);
var
m: Word;
begin
inherited Create;
if IsNew_ then
m := fmCreate
else if IsWrite_ then
m := fmOpenReadWrite
else
m := fmOpenRead or fmShareDenyNone;
{$IFDEF ZDB_BACKUP}
FActivted := IsNew_ or IsWrite_;
{$ELSE ZDB_BACKUP}
FActivted := False;
{$ENDIF ZDB_BACKUP}
SourceIO := TCoreClassFileStream.Create(FileName_, m);
BackupFileIO := nil;
FFileName := FileName_;
FBackupFileName := FileName_ + '.save';
umlDeleteFile(FBackupFileName);
InitIO;
end;
destructor TReliableFileStream.Destroy;
begin
DisposeObject(SourceIO);
FreeIO;
inherited Destroy;
end;
function TReliableFileStream.write(const buffer; Count: longint): longint;
begin
if FActivted then
begin
Result := BackupFileIO.write(buffer, Count);
end
else
begin
Result := SourceIO.write(buffer, Count);
end;
end;
function TReliableFileStream.read(var buffer; Count: longint): longint;
begin
if FActivted then
begin
Result := BackupFileIO.read(buffer, Count);
end
else
begin
Result := SourceIO.read(buffer, Count);
end;
end;
function TReliableFileStream.Seek(const Offset: Int64; origin: TSeekOrigin): Int64;
begin
if FActivted then
begin
Result := BackupFileIO.Seek(Offset, origin);
end
else
begin
Result := SourceIO.Seek(Offset, origin);
end;
end;
function TIOHnd.FixedString2Pascal(s: TBytes): TPascalString;
var
buff: TBytes;
begin
if (length(s) > 0) and (s[0] > 0) then
begin
SetLength(buff, s[0]);
CopyPtr(@s[1], @buff[0], length(buff));
Result.Bytes := buff;
SetLength(buff, 0);
end
else
Result := '';
end;
procedure TIOHnd.Pascal2FixedString(var n: TPascalString; var out_: TBytes);
var
buff: TBytes;
begin
while True do
begin
buff := n.Bytes;
if length(buff) > FixedStringL - 1 then
n.DeleteFirst
else
break;
end;
SetLength(out_, FixedStringL);
out_[0] := length(buff);
if out_[0] > 0 then
CopyPtr(@buff[0], @out_[1], out_[0]);
SetLength(buff, 0);
end;
function TIOHnd.CheckFixedStringLoss(s: TPascalString): Boolean;
var
buff: TBytes;
begin
buff := s.Bytes;
Result := length(buff) > FixedStringL - 1;
SetLength(buff, 0);
end;
function umlBytesOf(const s: TPascalString): TBytes;
begin
Result := s.Bytes
end;
function umlStringOf(const s: TBytes): TPascalString;
begin
Result.Bytes := s;
end;
function umlNewString(const s: TPascalString): P_String;
var
p: P_String;
begin
new(p);
p^ := s;
Result := p;
end;
procedure umlFreeString(const p: P_String);
begin
if p <> nil then
begin
p^ := '';
Dispose(p);
end;
end;
function umlComparePosStr(const s: TPascalString; Offset: Integer; const t: TPascalString): Boolean;
begin
Result := s.ComparePos(Offset, @t);
end;
function umlPos(const SubStr, s: TPascalString; const Offset: Integer = 1): Integer;
begin
Result := s.GetPos(SubStr, Offset);
end;
function umlVarToStr(const v: Variant; const Base64Conver: Boolean): TPascalString; overload;
var
n, b64: TPascalString;
begin
try
case VarType(v) of
varSmallInt, varInteger, varShortInt, varByte, varWord, varLongWord: Result := IntToStr(v);
varInt64: Result := IntToStr(Int64(v));
varUInt64: {$IFDEF FPC} Result := IntToStr(UInt64(v)); {$ELSE} Result := UIntToStr(UInt64(v)); {$ENDIF}
varSingle, varDouble, varCurrency, varDate: Result := FloatToStr(v);
varOleStr, varString, varUString:
begin
n.text := VarToStr(v);
if Base64Conver and umlExistsChar(n, #10#13#9#8#0) then
begin
umlEncodeLineBASE64(n, b64);
Result := '___base64:' + b64.text;
end
else
Result := n.text;
end;
varBoolean: Result := umlBoolToStr(v);
else
Result := VarToStr(v);
end;
except
try
Result := VarToStr(v);
except
Result := '';
end;
end;
end;
function umlVarToStr(const v: Variant): TPascalString;
begin
Result := umlVarToStr(v, True);
end;
function umlStrToVar(const s: TPascalString): Variant;
var
b64: TPascalString;
begin
if s.Exists([#10, #13, #9, #8, #0]) then
begin
umlEncodeLineBASE64(s, b64);
Result := '___base64:' + b64.text;
end
else
Result := s.text;
end;
function umlMax(const v1, v2: UInt64): UInt64;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Cardinal): Cardinal;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Word): Word;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Byte): Byte;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Int64): Int64;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Integer): Integer;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: SmallInt): SmallInt;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: ShortInt): ShortInt;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Double): Double;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMax(const v1, v2: Single): Single;
begin
if v1 > v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: UInt64): UInt64;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Cardinal): Cardinal;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Word): Word;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Byte): Byte;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Int64): Int64;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Integer): Integer;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: SmallInt): SmallInt;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: ShortInt): ShortInt;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Double): Double;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlMin(const v1, v2: Single): Single;
begin
if v1 < v2 then
Result := v1
else
Result := v2;
end;
function umlClamp(const v, min_, max_: UInt64): UInt64;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: Cardinal): Cardinal;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: Word): Word;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: Byte): Byte;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: Int64): Int64;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: SmallInt): SmallInt;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: ShortInt): ShortInt;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: Double): Double;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlClamp(const v, min_, max_: Single): Single;
begin
if min_ > max_ then
Result := umlClamp(v, max_, min_)
else if v > max_ then
Result := max_
else if v < min_ then
Result := min_
else
Result := v;
end;
function umlInRange(const v, min_, max_: UInt64): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: Cardinal): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: Word): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: Byte): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: SmallInt): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: ShortInt): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: Double): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlInRange(const v, min_, max_: Single): Boolean;
begin
Result := (v >= umlMin(min_, max_)) and (v <= umlMax(min_, max_));
end;
function umlGetResourceStream(const FileName: TPascalString): TCoreClassStream;
var
n: TPascalString;
begin
if FileName.Exists('.') then
n := umlDeleteLastStr(FileName, '.')
else
n := FileName;
Result := TCoreClassResourceStream.Create(HInstance, n.text, RT_RCDATA);
end;
function umlSameVarValue(const v1, v2: Variant): Boolean;
begin
try
Result := VarSameValue(v1, v2);
except
Result := False;
end;
end;
function umlSameVariant(const v1, v2: Variant): Boolean;
begin
try
Result := VarSameValue(v1, v2);
except
Result := False;
end;
end;
function umlRandom(const rnd: TMT19937Random): Integer;
begin
Result := rnd.Rand32(MaxInt);
end;
function umlRandom: Integer;
begin
Result := MT19937Rand32(MaxInt);
end;
function umlRandomRange64(const rnd: TMT19937Random; const min_, max_: Int64): Int64;
var
mn, mx: Int64;
begin
if min_ = max_ then
begin
Result := min_;
exit;
end;
mn := min_;
mx := max_;
if mn > mx then
inc(mn)
else
inc(mx);
if mn > mx then
Result := rnd.Rand64(mn - mx) + mx
else
Result := rnd.Rand64(mx - mn) + mn;
end;
function umlRandomRange(const rnd: TMT19937Random; const min_, max_: Integer): Integer;
var
mn, mx: Integer;
begin
if min_ = max_ then
begin
Result := min_;
exit;
end;
mn := min_;
mx := max_;
if mn > mx then
inc(mn)
else
inc(mx);
if mn > mx then
Result := rnd.Rand32(mn - mx) + mx
else
Result := rnd.Rand32(mx - mn) + mn;
end;
function umlRandomRangeS(const rnd: TMT19937Random; const min_, max_: Single): Single;
begin
Result := (umlRandomRange64(rnd, Trunc(min_ * 1000), Trunc(max_ * 1000))) * 0.001;
end;
function umlRandomRangeD(const rnd: TMT19937Random; const min_, max_: Double): Double;
begin
Result := (umlRandomRange64(rnd, Trunc(min_ * 10000), Trunc(max_ * 10000))) * 0.0001;
end;
function umlRandomRangeF(const rnd: TMT19937Random; const min_, max_: Double): Double;
begin
Result := (umlRandomRange64(rnd, Trunc(min_ * 10000), Trunc(max_ * 10000))) * 0.0001;
end;
function umlRandomRange64(const min_, max_: Int64): Int64;
var
mn, mx: Int64;
begin
if min_ = max_ then
begin
Result := min_;
exit;
end;
mn := min_;
mx := max_;
if mn > mx then
inc(mn)
else
inc(mx);
if mn > mx then
Result := MT19937Rand64(mn - mx) + mx
else
Result := MT19937Rand64(mx - mn) + mn;
end;
function umlRandomRange(const min_, max_: Integer): Integer;
var
mn, mx: Integer;
begin
if min_ = max_ then
begin
Result := min_;
exit;
end;
mn := min_;
mx := max_;
if mn > mx then
inc(mn)
else
inc(mx);
if mn > mx then
Result := MT19937Rand32(mn - mx) + mx
else
Result := MT19937Rand32(mx - mn) + mn;
end;
function umlRandomRangeS(const min_, max_: Single): Single;
begin
Result := (umlRandomRange64(Trunc(min_ * 1000), Trunc(max_ * 1000))) * 0.001;
end;
function umlRandomRangeD(const min_, max_: Double): Double;
begin
Result := (umlRandomRange64(Trunc(min_ * 10000), Trunc(max_ * 10000))) * 0.0001;
end;
function umlRandomRangeF(const min_, max_: Double): Double;
begin
Result := (umlRandomRange64(Trunc(min_ * 10000), Trunc(max_ * 10000))) * 0.0001;
end;
function umlDefaultTime: Double;
begin
Result := Now;
end;
function umlNow: Double;
begin
Result := Now;
end;
function umlDefaultAttrib: Integer;
begin
Result := 0;
end;
function umlBoolToStr(const Value: Boolean): TPascalString;
begin
if Value then
Result := 'True'
else
Result := 'False';
end;
function umlStrToBool(const Value: TPascalString): Boolean;
var
NewValue: TPascalString;
begin
NewValue := umlTrimSpace(Value);
if NewValue.Same('Yes') then
Result := True
else if NewValue.Same('No') then
Result := False
else if NewValue.Same('True') then
Result := True
else if NewValue.Same('False') then
Result := False
else if NewValue.Same('1') then
Result := True
else if NewValue.Same('0') then
Result := False
else
Result := False;
end;
function umlFileExists(const FileName: TPascalString): Boolean;
begin
if FileName.Len > 0 then
Result := FileExists(FileName.text)
else
Result := False;
end;
function umlDirectoryExists(const DirectoryName: TPascalString): Boolean;
begin
if DirectoryName.Len > 0 then
Result := DirectoryExists(DirectoryName.text)
else
Result := False;
end;
function umlCreateDirectory(const DirectoryName: TPascalString): Boolean;
begin
Result := umlDirectoryExists(DirectoryName);
if Result then
exit;
try
Result := ForceDirectories(DirectoryName.text);
except
try
Result := CreateDir(DirectoryName.text);
except
Result := False;
end;
end;
end;
function umlCurrentDirectory: TPascalString;
begin
Result.text := GetCurrentDir;
end;
function umlCurrentPath: TPascalString;
begin
Result.text := GetCurrentDir;
case CurrentPlatform of
epWin32, epWin64: if (Result.Len = 0) or (Result.Last <> '\') then
Result := Result.text + '\';
else
if (Result.Len = 0) or (Result.Last <> '/') then
Result := Result.text + '/';
end;
end;
function umlGetCurrentPath: TPascalString;
begin
Result := umlCurrentPath();
end;
procedure umlSetCurrentPath(ph: TPascalString);
begin
SetCurrentDir(ph.text);
end;
function umlFindFirstFile(const FileName: TPascalString; var SR: TSR): Boolean;
label SearchPoint;
begin
if FindFirst(FileName.text, faAnyFile, SR) <> 0 then
begin
Result := False;
exit;
end;
if ((SR.Attr and faDirectory) <> faDirectory) then
begin
Result := True;
exit;
end;
SearchPoint:
if FindNext(SR) <> 0 then
begin
Result := False;
exit;
end;
if ((SR.Attr and faDirectory) <> faDirectory) then
begin
Result := True;
exit;
end;
goto SearchPoint;
end;
function umlFindNextFile(var SR: TSR): Boolean;
label SearchPoint;
begin
SearchPoint:
if FindNext(SR) <> 0 then
begin
Result := False;
exit;
end;
if ((SR.Attr and faDirectory) <> faDirectory) then
begin
Result := True;
exit;
end;
goto SearchPoint;
end;
function umlFindFirstDir(const DirName: TPascalString; var SR: TSR): Boolean;
label SearchPoint;
begin
if FindFirst(DirName.text, faAnyFile, SR) <> 0 then
begin
Result := False;
exit;
end;
if ((SR.Attr and faDirectory) = faDirectory) and (SR.Name <> '.') and (SR.Name <> '..') then
begin
Result := True;
exit;
end;
SearchPoint:
if FindNext(SR) <> 0 then
begin
Result := False;
exit;
end;
if ((SR.Attr and faDirectory) = faDirectory) and (SR.Name <> '.') and (SR.Name <> '..') then
begin
Result := True;
exit;
end;
goto SearchPoint;
end;
function umlFindNextDir(var SR: TSR): Boolean;
label SearchPoint;
begin
SearchPoint:
if FindNext(SR) <> 0 then
begin
Result := False;
exit;
end;
if ((SR.Attr and faDirectory) = faDirectory) and (SR.Name <> '.') and (SR.Name <> '..') then
begin
Result := True;
exit;
end;
goto SearchPoint;
end;
procedure umlFindClose(var SR: TSR);
begin
FindClose(SR);
end;
function umlGetFileList(const FullPath: TPascalString; AsLst: TCoreClassStrings): Integer;
var
_SR: TSR;
begin
Result := 0;
if umlFindFirstFile(umlCombineFileName(FullPath, '*'), _SR) then
begin
repeat
AsLst.Add(_SR.Name);
inc(Result);
until not umlFindNextFile(_SR);
end;
umlFindClose(_SR);
end;
function umlGetDirList(const FullPath: TPascalString; AsLst: TCoreClassStrings): Integer;
var
_SR: TSR;
begin
Result := 0;
if umlFindFirstDir(umlCombineFileName(FullPath, '*'), _SR) then
begin
repeat
AsLst.Add(_SR.Name);
inc(Result);
until not umlFindNextDir(_SR);
end;
umlFindClose(_SR);
end;
function umlGetFileList(const FullPath: TPascalString; AsLst: TPascalStringList): Integer;
var
_SR: TSR;
begin
Result := 0;
if umlFindFirstFile(umlCombineFileName(FullPath, '*'), _SR) then
begin
repeat
AsLst.Add(_SR.Name);
inc(Result);
until not umlFindNextFile(_SR);
end;
umlFindClose(_SR);
end;
function umlGetDirList(const FullPath: TPascalString; AsLst: TPascalStringList): Integer;
var
_SR: TSR;
begin
Result := 0;
if umlFindFirstDir(umlCombineFileName(FullPath, '*'), _SR) then
begin
repeat
AsLst.Add(_SR.Name);
inc(Result);
until not umlFindNextDir(_SR);
end;
umlFindClose(_SR);
end;
function umlGetFileListWithFullPath(const FullPath: TPascalString): U_StringArray;
var
ph: TPascalString;
ns: TPascalStringList;
i: Integer;
begin
ph := FullPath;
ns := TPascalStringList.Create;
umlGetFileList(FullPath, ns);
SetLength(Result, ns.Count);
for i := 0 to ns.Count - 1 do
Result[i] := umlCombineFileName(ph, ns[i]).text;
DisposeObject(ns);
end;
function umlGetDirListWithFullPath(const FullPath: TPascalString): U_StringArray;
var
ph: TPascalString;
ns: TPascalStringList;
i: Integer;
begin
ph := FullPath;
ns := TPascalStringList.Create;
umlGetDirList(FullPath, ns);
SetLength(Result, ns.Count);
for i := 0 to ns.Count - 1 do
Result[i] := umlCombinePath(ph, ns[i]).text;
DisposeObject(ns);
end;
function umlGetFileListPath(const FullPath: TPascalString): U_StringArray;
var
ph: TPascalString;
ns: TPascalStringList;
i: Integer;
begin
ph := FullPath;
ns := TPascalStringList.Create;
umlGetFileList(FullPath, ns);
SetLength(Result, ns.Count);
for i := 0 to ns.Count - 1 do
Result[i] := ns[i];
DisposeObject(ns);
end;
function umlGetDirListPath(const FullPath: TPascalString): U_StringArray;
var
ph: TPascalString;
ns: TPascalStringList;
i: Integer;
begin
ph := FullPath;
ns := TPascalStringList.Create;
umlGetDirList(FullPath, ns);
SetLength(Result, ns.Count);
for i := 0 to ns.Count - 1 do
Result[i] := ns[i];
DisposeObject(ns);
end;
function umlCombinePath(const s1, s2: TPascalString): TPascalString;
begin
if CurrentPlatform in [epWin32, epWin64] then
Result := umlCombineWinPath(s1, s2)
else
Result := umlCombineUnixPath(s1, s2);
end;
function umlCombineFileName(const pathName, FileName: TPascalString): TPascalString;
begin
if CurrentPlatform in [epWin32, epWin64] then
Result := umlCombineWinFileName(pathName, FileName)
else
Result := umlCombineUnixFileName(pathName, FileName);
end;
function umlCombineUnixPath(const s1, s2: TPascalString): TPascalString;
var
n1, n2, n: TPascalString;
begin
n1 := umlTrimSpace(s1);
n2 := umlTrimSpace(s2);
n1 := umlCharReplace(n1, '\', '/');
n2 := umlCharReplace(n2, '\', '/');
if (n2.Len > 0) and (n2.First = '/') then
n2.DeleteFirst;
if n1.Len > 0 then
begin
if n1.Last = '/' then
Result := n1.text + n2.text
else
Result := n1.text + '/' + n2.text;
end
else
Result := n2;
repeat
n := Result;
Result := umlStringReplace(Result, '//', '/', True);
until Result.Same(n);
if (Result.Len > 0) and (Result.Last <> '/') then
Result.Append('/');
end;
function umlCombineUnixFileName(const pathName, FileName: TPascalString): TPascalString;
var
pn, fn, n: TPascalString;
begin
pn := umlTrimSpace(pathName);
fn := umlTrimSpace(FileName);
pn := umlCharReplace(pn, '\', '/');
fn := umlCharReplace(fn, '\', '/');
if (fn.Len > 0) and (fn.First = '/') then
fn.DeleteFirst;
if (fn.Len > 0) and (fn.Last = '/') then
fn.DeleteLast;
if pn.Len > 0 then
begin
if pn.Last = '/' then
Result := pn.text + fn.text
else
Result := pn.text + '/' + fn.text;
end
else
Result := fn;
repeat
n := Result;
Result := umlStringReplace(Result, '//', '/', True);
until Result.Same(n);
end;
function umlCombineWinPath(const s1, s2: TPascalString): TPascalString;
var
n1, n2, n: TPascalString;
begin
n1 := umlTrimSpace(s1);
n2 := umlTrimSpace(s2);
n1 := umlCharReplace(n1, '/', '\');
n2 := umlCharReplace(n2, '/', '\');
if (n2.Len > 0) and (n2.First = '\') then
n2.DeleteFirst;
if n1.Len > 0 then
begin
if n1.Last = '\' then
Result := n1.text + n2.text
else
Result := n1.text + '\' + n2.text;
end
else
Result := n2;
repeat
n := Result;
Result := umlStringReplace(Result, '\\', '\', True);
until Result.Same(n);
if (Result.Len > 0) and (Result.Last <> '\') then
Result.Append('\');
end;
function umlCombineWinFileName(const pathName, FileName: TPascalString): TPascalString;
var
pn, fn, n: TPascalString;
begin
pn := umlTrimSpace(pathName);
fn := umlTrimSpace(FileName);
pn := umlCharReplace(pn, '/', '\');
fn := umlCharReplace(fn, '/', '\');
if (fn.Len > 0) and (fn.First = '\') then
fn.DeleteFirst;
if (fn.Len > 0) and (fn.Last = '\') then
fn.DeleteLast;
if pn.Len > 0 then
begin
if pn.Last = '\' then
Result := pn.text + fn.text
else
Result := pn.text + '\' + fn.text;
end
else
Result := fn;
repeat
n := Result;
Result := umlStringReplace(Result, '\\', '\', True);
until Result.Same(n);
if Result.Last = '\' then
Result.DeleteLast;
end;
function umlGetFileName(const s: TPascalString): TPascalString;
var
n: TPascalString;
begin
case CurrentPlatform of
epWin32, epWin64:
begin
n := umlCharReplace(umlTrimSpace(s), '/', '\');
if n.Len = 0 then
Result := ''
else if (n.Last = '\') then
Result := ''
else if n.Exists('\') then
Result := umlGetLastStr(n, '\')
else
Result := n;
end;
else
begin
n := umlCharReplace(umlTrimSpace(s), '\', '/');
if n.Len = 0 then
Result := ''
else if (n.Last = '/') then
Result := ''
else if n.Exists('/') then
Result := umlGetLastStr(n, '/')
else
Result := n;
end;
end;
end;
function umlGetFilePath(const s: TPascalString): TPascalString;
var
n: TPascalString;
begin
case CurrentPlatform of
epWin32, epWin64:
begin
n := umlCharReplace(umlTrimSpace(s), '/', '\');
if n.Len = 0 then
Result := ''
else if not n.Exists('\') then
Result := ''
else if (n.Last <> '\') then
Result := umlDeleteLastStr(n, '\')
else
Result := n;
if umlMultipleMatch('?:', Result) then
Result.Append('\');
end;
else
begin
n := umlCharReplace(umlTrimSpace(s), '\', '/');
if n.Len = 0 then
Result := ''
else if not n.Exists('/') then
Result := ''
else if (n.Last <> '/') then
Result := umlDeleteLastStr(n, '/')
else
Result := n;
end;
end;
end;
function umlChangeFileExt(const s, ext: TPascalString): TPascalString;
var
ph, fn: TPascalString;
n: TPascalString;
begin
if s.Len = 0 then
begin
Result := ext;
exit;
end;
ph := umlGetFilePath(s);
fn := umlGetFileName(s);
n := ext;
if (n.Len > 0) and (n.First <> '.') then
n.text := '.' + n.text;
if umlExistsChar(fn, '.') then
Result := umlDeleteLastStr(fn, '.') + n
else
Result := fn + n;
if ph.Len > 0 then
Result := umlCombineFileName(ph, Result);
end;
function umlGetFileExt(const s: TPascalString): TPascalString;
begin
if (s.Len > 0) and (umlExistsChar(s, '.')) then
Result := '.' + umlGetLastStr(s, '.')
else
Result := '';
end;
procedure InitIOHnd(var IOHnd: TIOHnd);
begin
IOHnd.IsOnlyRead := True;
IOHnd.IsOpen := False;
IOHnd.AutoFree := False;
IOHnd.Handle := nil;
IOHnd.Time := 0;
IOHnd.Size := 0;
IOHnd.Position := 0;
IOHnd.FileName := '';
IOHnd.FlushBuff := nil;
IOHnd.FlushPosition := -1;
IOHnd.PrepareReadPosition := -1;
IOHnd.PrepareReadBuff := nil;
IOHnd.IORead := 0;
IOHnd.IOWrite := 0;
IOHnd.WriteStated := False;
IOHnd.FixedStringL := 64 + 1;
IOHnd.Data := nil;
IOHnd.Return := C_NotError;
end;
function umlFileCreateAsStream(const FileName: TPascalString; stream: U_Stream; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean;
begin
if IOHnd.IsOpen = True then
begin
IOHnd.Return := C_FileIsActive;
Result := False;
exit;
end;
stream.Position := 0;
IOHnd.Handle := stream;
IOHnd.Return := C_NotError;
IOHnd.Size := stream.Size;
IOHnd.Position := stream.Position;
IOHnd.Time := umlDefaultTime;
IOHnd.FileName := FileName;
IOHnd.IsOpen := True;
IOHnd.IsOnlyRead := OnlyRead_;
IOHnd.AutoFree := False;
Result := True;
end;
function umlFileCreateAsStream(const FileName: TPascalString; stream: U_Stream; var IOHnd: TIOHnd): Boolean;
begin
Result := umlFileCreateAsStream(FileName, stream, IOHnd, False);
end;
function umlFileCreateAsStream(stream: U_Stream; var IOHnd: TIOHnd): Boolean;
begin
Result := umlFileCreateAsStream('', stream, IOHnd, False);
end;
function umlFileCreateAsStream(stream: U_Stream; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean;
begin
Result := umlFileCreateAsStream('', stream, IOHnd, False);
end;
function umlFileOpenAsStream(const FileName: TPascalString; stream: U_Stream; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean;
begin
if IOHnd.IsOpen = True then
begin
IOHnd.Return := C_FileIsActive;
Result := False;
exit;
end;
stream.Position := 0;
IOHnd.Handle := stream;
IOHnd.Return := C_NotError;
IOHnd.Size := stream.Size;
IOHnd.Position := stream.Position;
IOHnd.Time := umlDefaultTime;
IOHnd.FileName := FileName;
IOHnd.IsOpen := True;
IOHnd.IsOnlyRead := OnlyRead_;
IOHnd.AutoFree := False;
Result := True;
end;
function umlFileCreateAsMemory(var IOHnd: TIOHnd): Boolean;
begin
if IOHnd.IsOpen = True then
begin
IOHnd.Return := C_FileIsActive;
Result := False;
exit;
end;
IOHnd.Handle := TMemoryStream64.CustomCreate(8192);
IOHnd.Return := C_NotError;
IOHnd.Size := IOHnd.Handle.Size;
IOHnd.Position := IOHnd.Handle.Position;
IOHnd.Time := umlDefaultTime;
IOHnd.FileName := 'Memory';
IOHnd.IsOpen := True;
IOHnd.IsOnlyRead := False;
IOHnd.AutoFree := True;
Result := True;
end;
function umlFileCreate(const FileName: TPascalString; var IOHnd: TIOHnd): Boolean;
begin
if IOHnd.IsOpen = True then
begin
IOHnd.Return := C_FileIsActive;
Result := False;
exit;
end;
try
IOHnd.Handle := TReliableFileStream.Create(FileName.text, True, True);
except
IOHnd.Handle := nil;
IOHnd.Return := C_CreateFileError;
Result := False;
exit;
end;
IOHnd.Return := C_NotError;
IOHnd.Size := 0;
IOHnd.Position := 0;
IOHnd.Time := Now;
IOHnd.FileName := FileName;
IOHnd.IsOpen := True;
IOHnd.IsOnlyRead := False;
IOHnd.AutoFree := True;
Result := True;
end;
function umlFileOpen(const FileName: TPascalString; var IOHnd: TIOHnd; OnlyRead_: Boolean): Boolean;
begin
if IOHnd.IsOpen = True then
begin
IOHnd.Return := C_FileIsActive;
Result := False;
exit;
end;
if not umlFileExists(FileName) then
begin
IOHnd.Return := C_NotFindFile;
Result := False;
exit;
end;
try
IOHnd.Handle := TReliableFileStream.Create(FileName.text, False, not OnlyRead_);
except
IOHnd.Handle := nil;
IOHnd.Return := C_OpenFileError;
Result := False;
exit;
end;
IOHnd.IsOnlyRead := OnlyRead_;
IOHnd.Return := C_NotError;
IOHnd.Size := IOHnd.Handle.Size;
IOHnd.Position := 0;
IOHnd.Time := umlGetFileTime(FileName);
IOHnd.FileName := FileName;
IOHnd.IsOpen := True;
IOHnd.AutoFree := True;
Result := True;
end;
function umlFileClose(var IOHnd: TIOHnd): Boolean;
begin
if IOHnd.IsOpen = False then
begin
IOHnd.Return := C_NotOpenFile;
Result := False;
exit;
end;
if IOHnd.Handle = nil then
begin
IOHnd.Return := C_FileHandleError;
Result := False;
exit;
end;
umlFileFlushWrite(IOHnd);
if IOHnd.PrepareReadBuff <> nil then
DisposeObject(IOHnd.PrepareReadBuff);
IOHnd.PrepareReadBuff := nil;
IOHnd.PrepareReadPosition := -1;
try
if IOHnd.AutoFree then
DisposeObject(IOHnd.Handle)
else
IOHnd.Handle := nil;
except
end;
IOHnd.Handle := nil;
IOHnd.Return := C_NotError;
IOHnd.Time := umlDefaultTime;
IOHnd.FileName := '';
IOHnd.IsOpen := False;
IOHnd.WriteStated := False;
Result := True;
end;
function umlFileUpdate(var IOHnd: TIOHnd): Boolean;
begin
if (IOHnd.IsOpen = False) or (IOHnd.Handle = nil) then
begin
IOHnd.Return := C_FileHandleError;
Result := False;
exit;
end;
umlFileFlushWrite(IOHnd);
umlResetPrepareRead(IOHnd);
IOHnd.WriteStated := False;
Result := True;
end;
function umlFileTest(var IOHnd: TIOHnd): Boolean;
begin
if (IOHnd.IsOpen = False) or (IOHnd.Handle = nil) then
begin
IOHnd.Return := C_FileHandleError;
Result := False;
exit;
end;
IOHnd.Return := C_NotError;
Result := True;
end;
procedure umlResetPrepareRead(var IOHnd: TIOHnd);
begin
if IOHnd.PrepareReadBuff <> nil then
DisposeObject(IOHnd.PrepareReadBuff);
IOHnd.PrepareReadBuff := nil;
IOHnd.PrepareReadPosition := -1;
end;
function umlFilePrepareRead(var IOHnd: TIOHnd; Size: Int64; var buff): Boolean;
var
m64: TMemoryStream64;
preRedSiz: Int64;
begin
Result := False;
if not(IOHnd.Handle.InheritsFrom(TCoreClassFileStream) or IOHnd.Handle.InheritsFrom(TReliableFileStream)) then
exit;
if Size > C_PrepareReadCacheSize then
begin
umlResetPrepareRead(IOHnd);
IOHnd.Handle.Position := IOHnd.Position;
exit;
end;
if IOHnd.PrepareReadBuff = nil then
IOHnd.PrepareReadBuff := TMemoryStream64.Create;
m64 := TMemoryStream64(IOHnd.PrepareReadBuff);
if (IOHnd.Position < IOHnd.PrepareReadPosition) or (IOHnd.PrepareReadPosition + m64.Size < IOHnd.Position + Size) then
begin
// prepare read buffer
IOHnd.Handle.Position := IOHnd.Position;
IOHnd.PrepareReadPosition := IOHnd.Position;
m64.Clear;
IOHnd.PrepareReadPosition := IOHnd.Handle.Position;
if IOHnd.Handle.Size - IOHnd.Handle.Position >= C_PrepareReadCacheSize then
begin
Result := m64.CopyFrom(IOHnd.Handle, C_PrepareReadCacheSize) = C_PrepareReadCacheSize;
inc(IOHnd.IORead, C_PrepareReadCacheSize);
end
else
begin
preRedSiz := IOHnd.Handle.Size - IOHnd.Handle.Position;
Result := m64.CopyFrom(IOHnd.Handle, preRedSiz) = preRedSiz;
inc(IOHnd.IORead, preRedSiz);
end;
end;
if (IOHnd.Position >= IOHnd.PrepareReadPosition) and (IOHnd.PrepareReadPosition + m64.Size >= IOHnd.Position + Size) then
begin
CopyPtr(Pointer(NativeUInt(m64.Memory) + (IOHnd.Position - IOHnd.PrepareReadPosition)), @buff, Size);
inc(IOHnd.Position, Size);
Result := True;
end
else
begin
// safe process
umlResetPrepareRead(IOHnd);
IOHnd.Handle.Position := IOHnd.Position;
exit;
end;
end;
function umlFileRead(var IOHnd: TIOHnd; const Size: Int64; var buff): Boolean;
var
BuffPointer: Pointer;
i: NativeInt;
BuffInt: NativeUInt;
begin
if not umlFileFlushWrite(IOHnd) then
begin
Result := False;
exit;
end;
if Size = 0 then
begin
IOHnd.Return := C_NotError;
Result := True;
exit;
end;
if umlFilePrepareRead(IOHnd, Size, buff) then
begin
IOHnd.Return := C_NotError;
Result := True;
exit;
end;
try
if Size > C_MaxBufferFragmentSize then
begin
// process Chunk buffer
BuffInt := NativeUInt(@buff);
BuffPointer := Pointer(BuffInt);
for i := 1 to (Size div C_MaxBufferFragmentSize) do
begin
if IOHnd.Handle.read(BuffPointer^, C_MaxBufferFragmentSize) <> C_MaxBufferFragmentSize then
begin
IOHnd.Return := C_FileReadError;
Result := False;
exit;
end;
BuffInt := BuffInt + C_MaxBufferFragmentSize;
BuffPointer := Pointer(BuffInt);
end;
// process buffer rest
i := Size mod C_MaxBufferFragmentSize;
if IOHnd.Handle.read(BuffPointer^, i) <> i then
begin
IOHnd.Return := C_FileReadError;
Result := False;
exit;
end;
inc(IOHnd.Position, Size);
IOHnd.Return := C_NotError;
Result := True;
inc(IOHnd.IORead, Size);
exit;
end;
if IOHnd.Handle.read(buff, Size) <> Size then
begin
IOHnd.Return := C_FileReadError;
Result := False;
exit;
end;
inc(IOHnd.Position, Size);
IOHnd.Return := C_NotError;
Result := True;
inc(IOHnd.IORead, Size);
except
IOHnd.Return := C_FileReadError;
Result := False;
end;
end;
function umlBlockRead(var IOHnd: TIOHnd; var buff; const Size: Int64): Boolean;
begin
Result := umlFileRead(IOHnd, Size, buff);
end;
function umlFilePrepareWrite(var IOHnd: TIOHnd): Boolean;
begin
Result := True;
if not umlFileTest(IOHnd) then
exit;
if IOHnd.FlushBuff <> nil then
exit;
if (IOHnd.Handle is TCoreClassFileStream) or (IOHnd.Handle is TReliableFileStream) then
begin
IOHnd.FlushBuff := TMemoryStream64.CustomCreate(1024 * 1024 * 8);
IOHnd.FlushPosition := IOHnd.Handle.Position;
end;
end;
function umlFileFlushWrite(var IOHnd: TIOHnd): Boolean;
var
m64: TMemoryStream64;
begin
if IOHnd.FlushBuff <> nil then
begin
m64 := TMemoryStream64(IOHnd.FlushBuff);
IOHnd.FlushBuff := nil;
if IOHnd.Handle.write(m64.Memory^, m64.Size) <> m64.Size then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
inc(IOHnd.IOWrite, m64.Size);
DisposeObject(m64);
end;
Result := True;
end;
function umlFileWrite(var IOHnd: TIOHnd; const Size: Int64; var buff): Boolean;
var
BuffPointer: Pointer;
i: NativeInt;
BuffInt: NativeUInt;
begin
if (IOHnd.IsOnlyRead) or (not IOHnd.IsOpen) then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
if Size = 0 then
begin
IOHnd.Return := C_NotError;
Result := True;
exit;
end;
IOHnd.WriteStated := True;
umlResetPrepareRead(IOHnd);
if Size <= $F000 then
umlFilePrepareWrite(IOHnd);
if IOHnd.FlushBuff <> nil then
begin
if TMemoryStream64(IOHnd.FlushBuff).Write64(buff, Size) <> Size then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
inc(IOHnd.Position, Size);
if IOHnd.Position > IOHnd.Size then
IOHnd.Size := IOHnd.Position;
IOHnd.Return := C_NotError;
Result := True;
// 64M flush buffer
if IOHnd.FlushBuff.Size > 64 * 1024 * 1024 then
umlFileFlushWrite(IOHnd);
exit;
end;
try
if Size > C_MaxBufferFragmentSize then
begin
// process buffer chunk
BuffInt := NativeUInt(@buff);
BuffPointer := Pointer(BuffInt);
for i := 1 to (Size div C_MaxBufferFragmentSize) do
begin
if IOHnd.Handle.write(BuffPointer^, C_MaxBufferFragmentSize) <> C_MaxBufferFragmentSize then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
BuffInt := BuffInt + C_MaxBufferFragmentSize;
BuffPointer := Pointer(BuffInt);
end;
// process buffer rest
i := Size mod C_MaxBufferFragmentSize;
if IOHnd.Handle.write(BuffPointer^, i) <> i then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
inc(IOHnd.Position, Size);
if IOHnd.Position > IOHnd.Size then
IOHnd.Size := IOHnd.Position;
IOHnd.Return := C_NotError;
Result := True;
inc(IOHnd.IOWrite, Size);
exit;
end;
if IOHnd.Handle.write(buff, Size) <> Size then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
inc(IOHnd.Position, Size);
if IOHnd.Position > IOHnd.Size then
IOHnd.Size := IOHnd.Position;
IOHnd.Return := C_NotError;
Result := True;
inc(IOHnd.IOWrite, Size);
except
IOHnd.Return := C_FileWriteError;
Result := False;
end;
end;
function umlBlockWrite(var IOHnd: TIOHnd; var buff; const Size: Int64): Boolean;
begin
Result := umlFileWrite(IOHnd, Size, buff);
end;
function umlFileWriteFixedString(var IOHnd: TIOHnd; var Value: TPascalString): Boolean;
var
buff: TBytes;
begin
IOHnd.Pascal2FixedString(Value, buff);
if umlFileWrite(IOHnd, IOHnd.FixedStringL, buff[0]) = False then
begin
IOHnd.Return := C_FileWriteError;
Result := False;
exit;
end;
IOHnd.Return := C_NotError;
Result := True;
end;
function umlFileReadFixedString(var IOHnd: TIOHnd; var Value: TPascalString): Boolean;
var
buff: TBytes;
begin
try
SetLength(buff, IOHnd.FixedStringL);
if umlFileRead(IOHnd, IOHnd.FixedStringL, buff[0]) = False then
begin
IOHnd.Return := C_FileReadError;
Result := False;
exit;
end;
Value := IOHnd.FixedString2Pascal(buff);
SetLength(buff, 0);
IOHnd.Return := C_NotError;
Result := True;
except
Value.text := '';
IOHnd.Return := C_StringError;
Result := False;
end;
end;
function umlFileSeek(var IOHnd: TIOHnd; Pos_: Int64): Boolean;
begin
if (Pos_ <> IOHnd.Position) or (Pos_ <> IOHnd.Handle.Position) then
if not umlFileFlushWrite(IOHnd) then
begin
Result := False;
exit;
end;
IOHnd.Return := C_SeekError;
Result := False;
try
IOHnd.Position := IOHnd.Handle.Seek(Pos_, TSeekOrigin.soBeginning);
Result := IOHnd.Position <> -1;
if Result then
IOHnd.Return := C_NotError;
except
end;
end;
function umlFileGetPOS(var IOHnd: TIOHnd): Int64;
begin
Result := IOHnd.Position;
end;
function umlFileSetSize(var IOHnd: TIOHnd; siz_: Int64): Boolean;
begin
if not umlFileFlushWrite(IOHnd) then
begin
Result := False;
exit;
end;
IOHnd.Handle.Size := siz_;
Result := True;
IOHnd.Return := C_NotError;
end;
function umlFilePOS(var IOHnd: TIOHnd): Int64;
begin
Result := umlFileGetPOS(IOHnd);
end;
function umlFileGetSize(var IOHnd: TIOHnd): Int64;
begin
Result := IOHnd.Size;
end;
function umlFileSize(var IOHnd: TIOHnd): Int64;
begin
Result := umlFileGetSize(IOHnd);
end;
function umlGetFileTime(const FileName: TPascalString): TDateTime;
{$IFDEF MSWINDOWS}
function CovFileDate_(Fd: TFileTime): TDateTime;
var
Tct: _SystemTime;
t: TFileTime;
begin
FileTimeToLocalFileTime(Fd, t);
FileTimeToSystemTime(t, Tct);
CovFileDate_ := SystemTimeToDateTime(Tct);
end;
var
SR: TSR;
begin
if umlFindFirstFile(FileName, SR) then
Result := CovFileDate_(SR.FindData.ftLastWriteTime)
else
Result := 0;
umlFindClose(SR);
end;
{$ELSE MSWINDOWS}
var
f: THandle;
begin
f := FileOpen(FileName.text, fmOpenRead or fmShareDenyNone);
if f <> THandle(-1) then
begin
Result := FileDateToDateTime(FileGetDate(f));
FileClose(f);
end
else
Result := 0;
end;
{$ENDIF MSWINDOWS}
procedure umlSetFileTime(const FileName: TPascalString; newTime: TDateTime);
begin
FileSetDate(FileName.text, DateTimeToFileDate(newTime));
end;
function umlGetFileSize(const FileName: TPascalString): Int64;
var
SR: TSR;
begin
Result := 0;
if umlFindFirstFile(FileName, SR) = True then
begin
Result := SR.Size;
while umlFindNextFile(SR) do
Result := Result + SR.Size;
end;
umlFindClose(SR);
end;
function umlGetFileCount(const FileName: TPascalString): Integer;
var
SR: TSR;
begin
Result := 0;
if umlFindFirstFile(FileName, SR) = True then
begin
Result := Result + 1;
while umlFindNextFile(SR) = True do
Result := Result + 1;
end;
umlFindClose(SR);
end;
function umlGetFileDateTime(const FileName: TPascalString): TDateTime;
begin
if not FileAge(FileName.text, Result, False) then
Result := Now;
end;
function umlDeleteFile(const FileName: TPascalString; const _VerifyCheck: Boolean): Boolean;
var
_SR: TSR;
ph: TPascalString;
begin
if umlExistsChar(FileName, '*?') then
begin
ph := umlGetFilePath(FileName);
if umlFindFirstFile(FileName, _SR) then
begin
repeat
try
DeleteFile(umlCombineFileName(ph, _SR.Name).text);
except
end;
until not umlFindNextFile(_SR);
end;
umlFindClose(_SR);
Result := True;
end
else
begin
try
Result := DeleteFile(FileName.text);
except
Result := False;
end;
if Result and _VerifyCheck then
Result := not umlFileExists(FileName)
else
Result := True;
end;
end;
function umlDeleteFile(const FileName: TPascalString): Boolean;
begin
Result := umlDeleteFile(FileName, False);
end;
function umlCopyFile(const SourFile, DestFile: TPascalString): Boolean;
var
_SH, _DH: TCoreClassFileStream;
begin
Result := False;
_SH := nil;
_DH := nil;
try
if not umlFileExists(SourFile) then
exit;
if umlMultipleMatch(True, ExpandFileName(SourFile.text), ExpandFileName(DestFile.text)) then
exit;
_SH := TCoreClassFileStream.Create(SourFile.text, fmOpenRead or fmShareDenyNone);
_DH := TCoreClassFileStream.Create(DestFile.text, fmCreate);
Result := _DH.CopyFrom(_SH, _SH.Size) = _SH.Size;
DisposeObject(_SH);
DisposeObject(_DH);
umlSetFileTime(DestFile, umlGetFileTime(SourFile));
except
if _SH <> nil then
DisposeObject(_SH);
if _DH <> nil then
DisposeObject(_DH);
end;
end;
function umlRenameFile(const OldName, NewName: TPascalString): Boolean;
begin
Result := RenameFile(OldName.text, NewName.text);
end;
procedure umlSetLength(var sVal: TPascalString; Len: Integer);
begin
sVal.Len := Len;
end;
procedure umlSetLength(var sVal: U_Bytes; Len: Integer);
begin
SetLength(sVal, Len);
end;
procedure umlSetLength(var sVal: TArrayPascalString; Len: Integer);
begin
SetLength(sVal, Len);
end;
function umlGetLength(const sVal: TPascalString): Integer;
begin
Result := sVal.Len;
end;
function umlGetLength(const sVal: U_Bytes): Integer;
begin
Result := length(sVal);
end;
function umlGetLength(const sVal: TArrayPascalString): Integer;
begin
Result := length(sVal);
end;
function umlUpperCase(const s: TPascalString): TPascalString;
begin
Result := s.UpperText;
end;
function umlLowerCase(const s: TPascalString): TPascalString;
begin
Result := s.LowerText;
end;
function umlCopyStr(const sVal: TPascalString; MainPosition, LastPosition: Integer): TPascalString;
begin
Result := sVal.GetString(MainPosition, LastPosition);
end;
function umlSameText(const s1, s2: TPascalString): Boolean;
begin
Result := s1.Same(s2);
end;
function umlDeleteChar(const SText, Ch: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
if SText.Len > 0 then
for i := 1 to SText.Len do
if not CharIn(SText[i], Ch) then
Result.Append(SText[i]);
end;
function umlDeleteChar(const SText: TPascalString; const SomeChars: array of SystemChar): TPascalString;
var
i: Integer;
begin
Result := '';
if SText.Len > 0 then
for i := 1 to SText.Len do
if not CharIn(SText[i], SomeChars) then
Result.Append(SText[i]);
end;
function umlDeleteChar(const SText: TPascalString; const SomeCharsets: TOrdChars): TPascalString; overload;
var
i: Integer;
begin
Result := '';
if SText.Len > 0 then
for i := 1 to SText.Len do
if not CharIn(SText[i], SomeCharsets) then
Result.Append(SText[i]);
end;
function umlGetNumberCharInText(const n: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
i := 0;
if n.Len = 0 then
exit;
while i <= n.Len do
begin
if (not CharIn(n[i], c0to9)) then
begin
if (Result.Len = 0) then
inc(i)
else
exit;
end
else
begin
Result.Append(n[i]);
inc(i);
end;
end;
end;
function umlMatchChar(CharValue: U_Char; cVal: P_String): Boolean;
begin
Result := CharIn(CharValue, cVal);
end;
function umlMatchChar(CharValue: U_Char; cVal: TPascalString): Boolean;
begin
Result := CharIn(CharValue, @cVal);
end;
function umlExistsChar(StrValue: TPascalString; cVal: TPascalString): Boolean;
var
c: SystemChar;
begin
Result := True;
for c in StrValue.buff do
if CharIn(c, @cVal) then
exit;
Result := False;
end;
function umlTrimChar(const s, trim_s: TPascalString): TPascalString;
var
L, bp, EP: Integer;
begin
Result := '';
L := s.Len;
if L > 0 then
begin
bp := 1;
while CharIn(s[bp], @trim_s) do
begin
inc(bp);
if (bp > L) then
begin
Result := '';
exit;
end;
end;
if bp > L then
Result := ''
else
begin
EP := L;
while CharIn(s[EP], @trim_s) do
begin
dec(EP);
if (EP < 1) then
begin
Result := '';
exit;
end;
end;
Result := s.GetString(bp, EP + 1);
end;
end;
end;
function umlGetFirstStr(const sVal, trim_s: TPascalString): TPascalString;
var
umlGetFirstName_PrevPos, umlGetFirstName_Pos: Integer;
begin
Result := sVal;
if Result.Len <= 0 then
begin
exit;
end;
umlGetFirstName_Pos := 1;
while umlMatchChar(Result[umlGetFirstName_Pos], @trim_s) do
begin
if umlGetFirstName_Pos = Result.Len then
exit;
inc(umlGetFirstName_Pos);
end;
umlGetFirstName_PrevPos := umlGetFirstName_Pos;
while not umlMatchChar(Result[umlGetFirstName_Pos], @trim_s) do
begin
if umlGetFirstName_Pos = Result.Len then
begin
Result := umlCopyStr(Result, umlGetFirstName_PrevPos, umlGetFirstName_Pos + 1);
exit;
end;
inc(umlGetFirstName_Pos);
end;
Result := umlCopyStr(Result, umlGetFirstName_PrevPos, umlGetFirstName_Pos);
end;
function umlGetLastStr(const sVal, trim_s: TPascalString): TPascalString;
var
umlGetLastName_PrevPos, umlGetLastName_Pos: Integer;
begin
Result := sVal;
umlGetLastName_Pos := Result.Len;
if umlGetLastName_Pos <= 0 then
begin
exit;
end;
while umlMatchChar(Result[umlGetLastName_Pos], @trim_s) do
begin
if umlGetLastName_Pos = 1 then
exit;
dec(umlGetLastName_Pos);
end;
umlGetLastName_PrevPos := umlGetLastName_Pos;
while not umlMatchChar(Result[umlGetLastName_Pos], @trim_s) do
begin
if umlGetLastName_Pos = 1 then
begin
Result := umlCopyStr(Result, umlGetLastName_Pos, umlGetLastName_PrevPos + 1);
exit;
end;
dec(umlGetLastName_Pos);
end;
Result := umlCopyStr(Result, umlGetLastName_Pos + 1, umlGetLastName_PrevPos + 1);
end;
function umlDeleteFirstStr(const sVal, trim_s: TPascalString): TPascalString;
var
umlMaskFirstName_Pos: Integer;
begin
Result := sVal;
if Result.Len <= 0 then
begin
Result := '';
exit;
end;
umlMaskFirstName_Pos := 1;
while umlMatchChar(Result[umlMaskFirstName_Pos], @trim_s) do
begin
if umlMaskFirstName_Pos = Result.Len then
begin
Result := '';
exit;
end;
inc(umlMaskFirstName_Pos);
end;
while not umlMatchChar(Result[umlMaskFirstName_Pos], @trim_s) do
begin
if umlMaskFirstName_Pos = Result.Len then
begin
Result := '';
exit;
end;
inc(umlMaskFirstName_Pos);
end;
while umlMatchChar(Result[umlMaskFirstName_Pos], @trim_s) do
begin
if umlMaskFirstName_Pos = Result.Len then
begin
Result := '';
exit;
end;
inc(umlMaskFirstName_Pos);
end;
Result := umlCopyStr(Result, umlMaskFirstName_Pos, Result.Len + 1);
end;
function umlDeleteLastStr(const sVal, trim_s: TPascalString): TPascalString;
var
umlMaskLastName_Pos: Integer;
begin
Result := sVal;
umlMaskLastName_Pos := Result.Len;
if umlMaskLastName_Pos <= 0 then
begin
Result := '';
exit;
end;
while umlMatchChar(Result[umlMaskLastName_Pos], @trim_s) do
begin
if umlMaskLastName_Pos = 1 then
begin
Result := '';
exit;
end;
dec(umlMaskLastName_Pos);
end;
while not umlMatchChar(Result[umlMaskLastName_Pos], @trim_s) do
begin
if umlMaskLastName_Pos = 1 then
begin
Result := '';
exit;
end;
dec(umlMaskLastName_Pos);
end;
while umlMatchChar(Result[umlMaskLastName_Pos], @trim_s) do
begin
if umlMaskLastName_Pos = 1 then
begin
Result := '';
exit;
end;
dec(umlMaskLastName_Pos);
end;
umlSetLength(Result, umlMaskLastName_Pos);
end;
function umlGetIndexStrCount(const sVal, trim_s: TPascalString): Integer;
var
s: TPascalString;
Pos_: Integer;
begin
s := sVal;
Result := 0;
if s.Len = 0 then
exit;
Pos_ := 1;
while True do
begin
while umlMatchChar(s[Pos_], @trim_s) do
begin
if Pos_ >= s.Len then
exit;
inc(Pos_);
end;
inc(Result);
while not umlMatchChar(s[Pos_], @trim_s) do
begin
if Pos_ >= s.Len then
exit;
inc(Pos_);
end;
end;
end;
function umlGetIndexStr(const sVal: TPascalString; trim_s: TPascalString; index: Integer): TPascalString;
var
umlGetIndexName_Repeat: Integer;
begin
case index of
- 1:
begin
Result := '';
exit;
end;
0, 1:
begin
Result := umlGetFirstStr(sVal, trim_s);
exit;
end;
end;
if index >= umlGetIndexStrCount(sVal, trim_s) then
begin
Result := umlGetLastStr(sVal, trim_s);
exit;
end;
Result := sVal;
for umlGetIndexName_Repeat := 2 to index do
begin
Result := umlDeleteFirstStr(Result, trim_s);
end;
Result := umlGetFirstStr(Result, trim_s);
end;
procedure umlGetSplitArray(const sour: TPascalString; var dest: TArrayPascalString; const splitC: TPascalString);
var
i, idxCount: Integer;
SText: TPascalString;
begin
SText := sour;
idxCount := umlGetIndexStrCount(SText, splitC);
if (idxCount = 0) and (sour.Len > 0) then
begin
SetLength(dest, 1);
dest[0] := sour;
end
else
begin
SetLength(dest, idxCount);
i := low(dest);
while i < idxCount do
begin
dest[i] := umlGetFirstStr(SText, splitC);
SText := umlDeleteFirstStr(SText, splitC);
inc(i);
end;
end;
end;
procedure umlGetSplitArray(const sour: TPascalString; var dest: U_StringArray; const splitC: TPascalString);
var
i, idxCount: Integer;
SText: TPascalString;
begin
SText := sour;
idxCount := umlGetIndexStrCount(SText, splitC);
if (idxCount = 0) and (sour.Len > 0) then
begin
SetLength(dest, 1);
dest[0] := sour;
end
else
begin
SetLength(dest, idxCount);
i := low(dest);
while i < idxCount do
begin
dest[i] := umlGetFirstStr(SText, splitC);
SText := umlDeleteFirstStr(SText, splitC);
inc(i);
end;
end;
end;
function ArrayStringToText(var ary: TArrayPascalString; const splitC: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
for i := low(ary) to high(ary) do
if i < high(ary) then
Result := Result + ary[i] + splitC
else
Result := Result + ary[i];
end;
function umlStringsToSplitText(lst: TCoreClassStrings; const splitC: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
for i := 0 to lst.Count - 1 do
if i > 0 then
Result.Append(splitC.text + lst[i])
else
Result := lst[i];
end;
function umlStringsToSplitText(lst: TListPascalString; const splitC: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
for i := 0 to lst.Count - 1 do
if i > 0 then
Result.Append(splitC.text + lst[i])
else
Result := lst[i];
end;
function umlGetFirstStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
var
umlGetFirstName_PrevPos, umlGetFirstName_Pos: Integer;
begin
Result := sVal;
if Result.Len <= 0 then
exit;
umlGetFirstName_Pos := 1;
if umlMatchChar(Result[umlGetFirstName_Pos], @trim_s) then
begin
inc(umlGetFirstName_Pos);
umlGetFirstName_PrevPos := umlGetFirstName_Pos;
end
else
begin
umlGetFirstName_PrevPos := umlGetFirstName_Pos;
while not umlMatchChar(Result[umlGetFirstName_Pos], @trim_s) do
begin
if umlGetFirstName_Pos = Result.Len then
begin
Result := umlCopyStr(Result, umlGetFirstName_PrevPos, umlGetFirstName_Pos + 1);
exit;
end;
inc(umlGetFirstName_Pos);
end;
end;
Result := umlCopyStr(Result, umlGetFirstName_PrevPos, umlGetFirstName_Pos);
end;
function umlDeleteFirstStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
var
umlMaskFirstName_Pos: Integer;
begin
Result := sVal;
if Result.Len <= 0 then
begin
Result := '';
exit;
end;
umlMaskFirstName_Pos := 1;
while not umlMatchChar(Result[umlMaskFirstName_Pos], @trim_s) do
begin
if umlMaskFirstName_Pos = Result.Len then
begin
Result := '';
exit;
end;
inc(umlMaskFirstName_Pos);
end;
if umlMatchChar(Result[umlMaskFirstName_Pos], @trim_s) then
inc(umlMaskFirstName_Pos);
Result := umlCopyStr(Result, umlMaskFirstName_Pos, Result.Len + 1);
end;
function umlGetLastStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
var
umlGetLastName_PrevPos, umlGetLastName_Pos: Integer;
begin
Result := sVal;
umlGetLastName_Pos := Result.Len;
if umlGetLastName_Pos <= 0 then
exit;
if Result[umlGetLastName_Pos] = trim_s then
dec(umlGetLastName_Pos);
umlGetLastName_PrevPos := umlGetLastName_Pos;
while not umlMatchChar(Result[umlGetLastName_Pos], @trim_s) do
begin
if umlGetLastName_Pos = 1 then
begin
Result := umlCopyStr(Result, umlGetLastName_Pos, umlGetLastName_PrevPos + 1);
exit;
end;
dec(umlGetLastName_Pos);
end;
Result := umlCopyStr(Result, umlGetLastName_Pos + 1, umlGetLastName_PrevPos + 1);
end;
function umlDeleteLastStr_Discontinuity(const sVal, trim_s: TPascalString): TPascalString;
var
umlMaskLastName_Pos: Integer;
begin
Result := sVal;
umlMaskLastName_Pos := Result.Len;
if umlMaskLastName_Pos <= 0 then
begin
Result := '';
exit;
end;
if umlMatchChar(Result[umlMaskLastName_Pos], @trim_s) then
dec(umlMaskLastName_Pos);
while not umlMatchChar(Result[umlMaskLastName_Pos], @trim_s) do
begin
if umlMaskLastName_Pos = 1 then
begin
Result := '';
exit;
end;
dec(umlMaskLastName_Pos);
end;
umlSetLength(Result, umlMaskLastName_Pos);
end;
function umlGetIndexStrCount_Discontinuity(const sVal, trim_s: TPascalString): Integer;
var
s: TPascalString;
Pos_: Integer;
begin
s := sVal;
Result := 0;
if s.Len = 0 then
exit;
Pos_ := 1;
Result := 1;
while True do
begin
while not umlMatchChar(s[Pos_], @trim_s) do
begin
if Pos_ = s.Len then
exit;
inc(Pos_);
end;
inc(Result);
if Pos_ = s.Len then
exit;
inc(Pos_);
end;
end;
function umlGetIndexStr_Discontinuity(const sVal: TPascalString; trim_s: TPascalString; index: Integer): TPascalString;
var
umlGetIndexName_Repeat: Integer;
begin
case index of
- 1:
begin
Result := '';
exit;
end;
0, 1:
begin
Result := umlGetFirstStr_Discontinuity(sVal, trim_s);
exit;
end;
end;
if index >= umlGetIndexStrCount_Discontinuity(sVal, trim_s) then
begin
Result := umlGetLastStr_Discontinuity(sVal, trim_s);
exit;
end;
Result := sVal;
for umlGetIndexName_Repeat := 2 to index do
Result := umlDeleteFirstStr_Discontinuity(Result, trim_s);
Result := umlGetFirstStr_Discontinuity(Result, trim_s);
end;
function umlGetFirstTextPos(const s: TPascalString; const TextArry: TArrayPascalString; var OutText: TPascalString): Integer;
var
i, j: Integer;
begin
Result := -1;
for i := 1 to s.Len do
begin
for j := low(TextArry) to high(TextArry) do
begin
if s.ComparePos(i, @TextArry[j]) then
begin
OutText := TextArry[j];
Result := i;
exit;
end;
end;
end;
end;
function umlDeleteText(const sour: TPascalString; const bToken, eToken: TArrayPascalString; ANeedBegin, ANeedEnd: Boolean): TPascalString;
var
ABeginPos, AEndPos: Integer;
ABeginText, AEndText, ANewStr: TPascalString;
begin
Result := sour;
if sour.Len > 0 then
begin
ABeginPos := umlGetFirstTextPos(sour, bToken, ABeginText);
if ABeginPos > 0 then
ANewStr := umlCopyStr(sour, ABeginPos + ABeginText.Len, sour.Len + 1)
else if ANeedBegin then
exit
else
ANewStr := sour;
AEndPos := umlGetFirstTextPos(ANewStr, eToken, AEndText);
if AEndPos > 0 then
ANewStr := umlCopyStr(ANewStr, (AEndPos + AEndText.Len), ANewStr.Len + 1)
else if ANeedEnd then
exit
else
ANewStr := '';
if ABeginPos > 0 then
begin
if AEndPos > 0 then
Result := umlCopyStr(sour, 0, ABeginPos - 1) + umlDeleteText(ANewStr, bToken, eToken, ANeedBegin, ANeedEnd)
else
Result := umlCopyStr(sour, 0, ABeginPos - 1) + ANewStr;
end
else if AEndPos > 0 then
Result := ANewStr;
end;
end;
function umlGetTextContent(const sour: TPascalString; const bToken, eToken: TArrayPascalString): TPascalString;
var
ABeginPos, AEndPos: Integer;
ABeginText, AEndText, ANewStr: TPascalString;
begin
Result := '';
if sour.Len > 0 then
begin
ABeginPos := umlGetFirstTextPos(sour, bToken, ABeginText);
if ABeginPos > 0 then
ANewStr := umlCopyStr(sour, ABeginPos + ABeginText.Len, sour.Len + 1)
else
ANewStr := sour;
AEndPos := umlGetFirstTextPos(ANewStr, eToken, AEndText);
if AEndPos > 0 then
Result := umlCopyStr(ANewStr, 0, AEndPos - 1)
else
Result := ANewStr;
end;
end;
function umlGetNumTextType(const s: TPascalString): TTextType;
type
TValSym = (vsSymSub, vsSymAdd, vsSymAddSub, vsSymDollar, vsDot, vsDotBeforNum, vsDotAfterNum, vsNum, vsAtoF, vsE, vsUnknow);
var
cnt: array [TValSym] of Integer;
n: TPascalString;
v: TValSym;
c: SystemChar;
i: Integer;
begin
n := umlTrimSpace(s);
if n.Same('true') or n.Same('false') then
exit(ntBool);
for v := low(TValSym) to high(TValSym) do
cnt[v] := 0;
for i := 1 to n.Len do
begin
c := n[i];
if CharIn(c, [c0to9]) then
begin
inc(cnt[vsNum]);
if cnt[vsDot] > 0 then
inc(cnt[vsDotAfterNum]);
end
else if CharIn(c, [cLoAtoF, cHiAtoF]) then
begin
inc(cnt[vsAtoF]);
if CharIn(c, 'eE') then
inc(cnt[vsE]);
end
else if c = '.' then
begin
inc(cnt[vsDot]);
cnt[vsDotBeforNum] := cnt[vsNum];
end
else if CharIn(c, '-') then
begin
inc(cnt[vsSymSub]);
inc(cnt[vsSymAddSub]);
end
else if CharIn(c, '+') then
begin
inc(cnt[vsSymAdd]);
inc(cnt[vsSymAddSub]);
end
else if CharIn(c, '$') and (i = 1) then
begin
inc(cnt[vsSymDollar]);
if i <> 1 then
exit(ntUnknow);
end
else
exit(ntUnknow);
end;
if cnt[vsDot] > 1 then
exit(ntUnknow);
if cnt[vsSymDollar] > 1 then
exit(ntUnknow);
if (cnt[vsSymDollar] = 0) and (cnt[vsNum] = 0) then
exit(ntUnknow);
if (cnt[vsSymAdd] > 1) and (cnt[vsE] = 0) and (cnt[vsSymDollar] = 0) then
exit(ntUnknow);
if (cnt[vsSymDollar] = 0) and
((cnt[vsDot] = 1) or ((cnt[vsE] = 1) and ((cnt[vsSymAddSub] >= 1) and (cnt[vsSymDollar] = 0)))) then
begin
if cnt[vsSymDollar] > 0 then
exit(ntUnknow);
if (cnt[vsAtoF] <> cnt[vsE]) then
exit(ntUnknow);
if cnt[vsE] = 1 then
begin
Result := ntDouble
end
else if ((cnt[vsDotBeforNum] > 0)) and (cnt[vsDotAfterNum] > 0) then
begin
if cnt[vsDotAfterNum] < 5 then
Result := ntCurrency
else if cnt[vsNum] > 7 then
Result := ntDouble
else
Result := ntSingle;
end
else
exit(ntUnknow);
end
else
begin
if cnt[vsSymDollar] = 1 then
begin
if cnt[vsSymSub] > 0 then
begin
if cnt[vsNum] + cnt[vsAtoF] = 0 then
Result := ntUnknow
else if cnt[vsNum] + cnt[vsAtoF] < 2 then
Result := ntShortInt
else if cnt[vsNum] + cnt[vsAtoF] < 4 then
Result := ntSmallInt
else if cnt[vsNum] + cnt[vsAtoF] < 7 then
Result := ntInt
else if cnt[vsNum] + cnt[vsAtoF] < 13 then
Result := ntInt64
else
Result := ntUnknow;
end
else
begin
if cnt[vsNum] + cnt[vsAtoF] = 0 then
Result := ntUnknow
else if cnt[vsNum] + cnt[vsAtoF] < 3 then
Result := ntByte
else if cnt[vsNum] + cnt[vsAtoF] < 5 then
Result := ntWord
else if cnt[vsNum] + cnt[vsAtoF] < 8 then
Result := ntUInt
else if cnt[vsNum] + cnt[vsAtoF] < 14 then
Result := ntUInt64
else
Result := ntUnknow;
end;
end
else if cnt[vsAtoF] > 0 then
exit(ntUnknow)
else if cnt[vsSymSub] > 0 then
begin
if cnt[vsNum] = 0 then
Result := ntUnknow
else if cnt[vsNum] < 3 then
Result := ntShortInt
else if cnt[vsNum] < 5 then
Result := ntSmallInt
else if cnt[vsNum] < 8 then
Result := ntInt
else if cnt[vsNum] < 15 then
Result := ntInt64
else
Result := ntUnknow;
end
else
begin
if cnt[vsNum] = 0 then
Result := ntUnknow
else if cnt[vsNum] < 3 then
Result := ntByte
else if cnt[vsNum] < 5 then
Result := ntWord
else if cnt[vsNum] < 8 then
Result := ntUInt
else if cnt[vsNum] < 16 then
Result := ntUInt64
else
Result := ntUnknow;
end;
end;
end;
function umlIsHex(const sVal: TPascalString): Boolean;
begin
Result := umlGetNumTextType(sVal) in
[ntInt, ntInt64, ntUInt64, ntWord, ntByte, ntSmallInt, ntShortInt, ntUInt];
end;
function umlIsNumber(const sVal: TPascalString): Boolean;
begin
Result := umlGetNumTextType(sVal) <> ntUnknow;
end;
function umlIsIntNumber(const sVal: TPascalString): Boolean;
begin
Result := umlGetNumTextType(sVal) in
[ntInt, ntInt64, ntUInt64, ntWord, ntByte, ntSmallInt, ntShortInt, ntUInt];
end;
function umlIsFloatNumber(const sVal: TPascalString): Boolean;
begin
Result := umlGetNumTextType(sVal) in [ntSingle, ntDouble, ntCurrency];
end;
function umlIsBool(const sVal: TPascalString): Boolean;
begin
Result := umlGetNumTextType(sVal) = ntBool;
end;
function umlNumberCount(const sVal: TPascalString): Integer;
var
i: Integer;
begin
Result := 0;
for i := 1 to sVal.Len do
if CharIn(sVal[i], [c0to9]) then
inc(Result);
end;
function umlPercentageToFloat(OriginMax, OriginMin, ProcressParameter: Double): Double;
begin
Result := (ProcressParameter - OriginMin) * 100.0 / (OriginMax - OriginMin);
end;
function umlPercentageToInt64(OriginParameter, ProcressParameter: Int64): Integer;
begin
if OriginParameter = 0 then
Result := 0
else
Result := Round((ProcressParameter * 100.0) / OriginParameter);
end;
function umlPercentageToInt(OriginParameter, ProcressParameter: Integer): Integer;
begin
if OriginParameter = 0 then
Result := 0
else
Result := Round((ProcressParameter * 100.0) / OriginParameter);
end;
function umlPercentageToStr(OriginParameter, ProcressParameter: Integer): TPascalString;
begin
Result := IntToStr(umlPercentageToInt(OriginParameter, ProcressParameter)) + '%';
end;
function umlSmartSizeToStr(Size: Int64): TPascalString;
begin
if Size < 1 shl 10 then
Result := Format('%d', [Size])
else if Size < 1 shl 20 then
Result := Format('%fKb', [Size / (1 shl 10)])
else if Size < 1 shl 30 then
Result := Format('%fM', [Size / (1 shl 20)])
else
Result := Format('%fG', [Size / (1 shl 30)])
end;
function umlIntToStr(Parameter: Single): TPascalString;
begin
Result := IntToStr(Round(Parameter));
end;
function umlIntToStr(Parameter: Double): TPascalString;
begin
Result := IntToStr(Round(Parameter));
end;
function umlIntToStr(Parameter: Int64): TPascalString;
begin
Result := IntToStr(Parameter);
end;
function umlPointerToStr(param: Pointer): TPascalString;
begin
Result := '0x' + IntToHex(NativeUInt(param), SizeOf(Pointer) * 2);
end;
function umlMBPSToStr(Size: Int64): TPascalString;
begin
if Size < 1 shl 10 then
Result := Format('%dbps', [Size * 10])
else if Size < 1 shl 20 then
Result := Format('%fKbps', [Size / (1 shl 10) * 10])
else if Size < 1 shl 30 then
Result := Format('%fMbps', [Size / (1 shl 20) * 10])
else
Result := Format('%fGbps', [Size / (1 shl 30) * 10])
end;
function umlSizeToStr(Parameter: Int64): TPascalString;
begin
try
Result := umlSmartSizeToStr(Parameter);
except
Result := IntToStr(Parameter) + ' B';
end;
end;
function umlDateTimeToStr(t: TDateTime): TPascalString;
begin
Result := DateTimeToStr(t);
end;
function umlTimeTickToStr(const t: TTimeTick): TPascalString;
var
tmp, d, h, m, s: TTimeTick;
begin
{$IFDEF FPC}
d := t div C_Tick_Day;
tmp := t mod C_Tick_Day;
h := tmp div C_Tick_Hour;
tmp := t mod C_Tick_Hour;
m := tmp div C_Tick_Minute;
tmp := t mod C_Tick_Minute;
s := tmp div C_Tick_Second;
tmp := t mod C_Tick_Second;
{$ELSE FPC}
DivMod(t, C_Tick_Day, d, tmp);
DivMod(tmp, C_Tick_Hour, h, tmp);
DivMod(tmp, C_Tick_Minute, m, tmp);
DivMod(tmp, C_Tick_Second, s, tmp);
{$ENDIF FPC}
Result := '';
if (d > 0) then
Result.Append(IntToStr(d) + ' day ');
if (Result.Len > 0) or (h > 0) then
Result.Append(IntToStr(h) + ' hour ');
if (Result.Len > 0) or (m > 0) then
Result.Append(IntToStr(m) + ' minute ');
if (Result.Len > 0) or (s > 0) then
Result.Append(PFormat('%2.2f', [s + tmp / 1000]))
else
Result.Append('0');
end;
function umlTimeToStr(t: TDateTime): TPascalString;
begin
Result := TimeToStr(t);
end;
function umlDateToStr(t: TDateTime): TPascalString;
begin
Result := DateToStr(t);
end;
function umlFloatToStr(const f: Double): TPascalString;
begin
Result := FloatToStr(f);
end;
function umlShortFloatToStr(const f: Double): TPascalString;
begin
Result := Format('%f', [f]);
end;
function umlStrToInt(const _V: TPascalString): Integer;
begin
Result := umlStrToInt(_V, 0);
end;
function umlStrToInt(const _V: TPascalString; _Def: Integer): Integer;
begin
if umlIsNumber(_V) then
begin
try
Result := StrToInt(_V.text);
except
Result := _Def;
end;
end
else
Result := _Def;
end;
function umlStrToInt64(const _V: TPascalString; _Def: Int64): Int64;
begin
if umlIsNumber(_V) then
begin
try
Result := StrToInt64(_V.text);
except
Result := _Def;
end;
end
else
Result := _Def;
end;
function umlStrToFloat(const _V: TPascalString; _Def: Double): Double;
begin
if umlIsNumber(_V) then
begin
try
Result := StrToFloat(_V.text);
except
Result := _Def;
end;
end
else
Result := _Def;
end;
function umlStrToFloat(const _V: TPascalString): Double;
begin
Result := umlStrToFloat(_V, 0);
end;
function umlMultipleMatch(IgnoreCase: Boolean; const SourceStr, TargetStr, umlMultipleString, umlMultipleCharacter: TPascalString): Boolean;
label Character_Label, MChar_Label, MString_Label;
var
UpperCaseSourceStr, UpperCaseTargetStr, SwapStr: TPascalString;
SourceChar, TargetChar, SwapChar: U_Char;
SourceIndex, TargetIndex, SwapIndex, SourceLength, TargetLength, SwapLength: Integer;
begin
SourceLength := SourceStr.Len;
if SourceLength = 0 then
begin
Result := True;
exit;
end;
TargetLength := TargetStr.Len;
if TargetLength = 0 then
begin
Result := False;
exit;
end;
if IgnoreCase then
begin
UpperCaseSourceStr := umlUpperCase(SourceStr);
UpperCaseTargetStr := umlUpperCase(TargetStr);
end
else
begin
UpperCaseSourceStr := SourceStr;
UpperCaseTargetStr := TargetStr;
end;
if (not umlExistsChar(SourceStr, umlMultipleCharacter)) and (not umlExistsChar(SourceStr, umlMultipleString)) then
begin
Result := (SourceLength = TargetLength) and (UpperCaseSourceStr = UpperCaseTargetStr);
exit;
end;
if SourceLength = 1 then
begin
if umlMatchChar(UpperCaseSourceStr[1], @umlMultipleString) then
Result := True
else
Result := False;
exit;
end;
SourceIndex := 1;
TargetIndex := 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
TargetChar := UpperCaseTargetStr[TargetIndex];
Character_Label:
while (SourceChar = TargetChar) and (not umlMatchChar(SourceChar, @umlMultipleCharacter)) and (not umlMatchChar(SourceChar, @umlMultipleString)) do
begin
if SourceIndex = SourceLength then
begin
if TargetIndex = TargetLength then
begin
Result := True;
exit;
end;
Result := False;
exit;
end;
if TargetIndex = TargetLength then
begin
SourceIndex := SourceIndex + 1;
if SourceIndex = SourceLength then
begin
SourceChar := UpperCaseSourceStr[SourceIndex];
Result := umlMatchChar(SourceChar, @umlMultipleString) or umlMatchChar(SourceChar, @umlMultipleCharacter);
exit;
end;
Result := False;
exit;
end;
SourceIndex := SourceIndex + 1;
TargetIndex := TargetIndex + 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
TargetChar := UpperCaseTargetStr[TargetIndex];
end;
MChar_Label:
while umlMatchChar(SourceChar, @umlMultipleCharacter) do
begin
if SourceIndex = SourceLength then
begin
if TargetIndex = TargetLength then
begin
Result := True;
exit;
end;
Result := False;
exit;
end;
if TargetIndex = TargetLength then
begin
SourceIndex := SourceIndex + 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
if (SourceIndex = SourceLength) and ((umlMatchChar(SourceChar, @umlMultipleString)) or (umlMatchChar(SourceChar, @umlMultipleCharacter))) then
begin
Result := True;
exit;
end;
Result := False;
exit;
end;
SourceIndex := SourceIndex + 1;
TargetIndex := TargetIndex + 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
TargetChar := UpperCaseTargetStr[TargetIndex];
end;
MString_Label:
if umlMatchChar(SourceChar, @umlMultipleString) then
begin
if SourceIndex = SourceLength then
begin
Result := True;
exit;
end;
SourceIndex := SourceIndex + 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
while (umlMatchChar(SourceChar, @umlMultipleString)) or (umlMatchChar(SourceChar, @umlMultipleCharacter)) do
begin
if SourceIndex = SourceLength then
begin
Result := True;
exit;
end;
SourceIndex := SourceIndex + 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
while umlMatchChar(SourceChar, @umlMultipleCharacter) do
begin
if SourceIndex = SourceLength then
begin
Result := True;
exit;
end;
SourceIndex := SourceIndex + 1;
SourceChar := UpperCaseSourceStr[SourceIndex];
end;
end;
SwapStr := umlCopyStr(UpperCaseSourceStr, SourceIndex, SourceLength + 1);
SwapLength := SwapStr.Len;
if SwapLength = 0 then
begin
Result := (UpperCaseSourceStr[SourceIndex] = umlMultipleString);
exit;
end;
SwapIndex := 1;
SwapChar := SwapStr[SwapIndex];
while (not umlMatchChar(SwapChar, @umlMultipleCharacter)) and (not umlMatchChar(SwapChar, @umlMultipleString)) and (SwapIndex < SwapLength) do
begin
SwapIndex := SwapIndex + 1;
SwapChar := SwapStr[SwapIndex];
end;
if (umlMatchChar(SwapChar, @umlMultipleCharacter)) or (umlMatchChar(SwapChar, @umlMultipleString)) then
SwapStr := umlCopyStr(SwapStr, 1, SwapIndex)
else
begin
SwapStr := umlCopyStr(SwapStr, 1, SwapIndex + 1);
if SwapStr = '' then
begin
Result := False;
exit;
end;
SwapLength := SwapStr.Len;
SwapIndex := 1;
SwapChar := SwapStr[SwapLength];
TargetChar := UpperCaseTargetStr[TargetLength];
while SwapChar = TargetChar do
begin
if SwapIndex = SwapLength then
begin
Result := True;
exit;
end;
if SwapIndex = TargetLength then
begin
Result := False;
exit;
end;
SwapChar := SwapStr[(SwapLength) - SwapIndex];
TargetChar := UpperCaseTargetStr[(TargetLength) - SwapIndex];
SwapIndex := SwapIndex + 1;
end;
Result := False;
exit;
end;
SwapChar := SwapStr[1];
SwapIndex := 1;
SwapLength := SwapStr.Len;
while SwapIndex <= SwapLength do
begin
if (TargetIndex - 1) + SwapIndex > TargetLength then
begin
Result := False;
exit;
end;
SwapChar := SwapStr[SwapIndex];
TargetChar := UpperCaseTargetStr[(TargetIndex - 1) + SwapIndex];
while SwapChar <> TargetChar do
begin
if (TargetIndex + SwapLength) > TargetLength then
begin
Result := False;
exit;
end;
TargetIndex := TargetIndex + 1;
SwapIndex := 1;
SwapChar := SwapStr[SwapIndex];
TargetChar := UpperCaseTargetStr[(TargetIndex - 1) + SwapIndex];
end;
SwapIndex := SwapIndex + 1;
end;
TargetIndex := (TargetIndex - 1) + SwapLength;
SourceIndex := (SourceIndex - 1) + SwapLength;
TargetChar := SwapChar;
SourceChar := SwapChar;
end;
if SourceChar = TargetChar then
goto Character_Label
else if umlMatchChar(SourceChar, @umlMultipleCharacter) then
goto MChar_Label
else if umlMatchChar(SourceChar, @umlMultipleString) then
goto MString_Label
else
Result := False;
end;
function umlMultipleMatch(IgnoreCase: Boolean; const SourceStr, TargetStr: TPascalString): Boolean;
begin
if (SourceStr.Len > 0) and (SourceStr.text <> '*') then
Result := umlMultipleMatch(IgnoreCase, SourceStr, TargetStr, '*', '?')
else
Result := True;
end;
function umlMultipleMatch(const SourceStr, TargetStr: TPascalString): Boolean;
var
fi: TArrayPascalString;
begin
if (SourceStr.Len > 0) and (SourceStr.text <> '*') then
begin
umlGetSplitArray(SourceStr, fi, ';');
Result := umlMultipleMatch(fi, TargetStr);
end
else
Result := True;
end;
function umlMultipleMatch(const ValueCheck: array of TPascalString; const Value: TPascalString): Boolean;
var
i: Integer;
begin
Result := False;
if Value.Len > 0 then
begin
if high(ValueCheck) >= 0 then
begin
Result := False;
for i := low(ValueCheck) to high(ValueCheck) do
begin
Result := umlMultipleMatch(True, ValueCheck[i], Value);
if Result then
exit;
end;
end
else
Result := True;
end;
end;
function umlSearchMatch(const SourceStr, TargetStr: TPascalString): Boolean;
var
fi: TArrayPascalString;
begin
if (SourceStr.Len > 0) and (SourceStr.text <> '*') then
begin
umlGetSplitArray(SourceStr, fi, ';,');
Result := umlSearchMatch(fi, TargetStr);
end
else
Result := True;
end;
function umlSearchMatch(const ValueCheck: TArrayPascalString; Value: TPascalString): Boolean;
var
i: Integer;
begin
Result := False;
if umlGetLength(Value) > 0 then
begin
if high(ValueCheck) >= 0 then
begin
Result := False;
for i := low(ValueCheck) to high(ValueCheck) do
begin
Result := (Value.GetPos(ValueCheck[i]) > 0) or (umlMultipleMatch(True, ValueCheck[i], Value));
if Result then
exit;
end;
end
else
Result := True;
end;
end;
function umlMatchFileInfo(const exp_, sour_, dest_: TPascalString): Boolean;
const
prefix = '<prefix>';
postfix = '<postfix>';
var
sour, dest, dest_prefix, dest_postfix, n: TPascalString;
begin
sour := umlGetFileName(sour_);
dest := umlGetFileName(dest_);
dest_prefix := umlChangeFileExt(dest, '');
dest_postfix := umlGetFileExt(dest);
n := umlStringReplace(exp_, prefix, dest_prefix, True);
n := umlStringReplace(n, postfix, dest_postfix, True);
Result := umlMultipleMatch(n, sour);
sour := '';
dest := '';
dest_prefix := '';
dest_postfix := '';
n := '';
end;
function umlGetDateTimeStr(NowDateTime: TDateTime): TPascalString;
var
Year, Month, Day: Word;
Hour, min_, Sec, MSec: Word;
begin
DecodeDate(NowDateTime, Year, Month, Day);
DecodeTime(NowDateTime, Hour, min_, Sec, MSec);
Result := IntToStr(Year) + '-' + IntToStr(Month) + '-' + IntToStr(Day) + ' ' + IntToStr(Hour) + '-' + IntToStr(min_) + '-' + IntToStr(Sec) + '-' + IntToStr(MSec);
end;
function umlDecodeTimeToStr(NowDateTime: TDateTime): TPascalString;
var
Year, Month, Day: Word;
Hour, min_, Sec, MSec: Word;
begin
DecodeDate(NowDateTime, Year, Month, Day);
DecodeTime(NowDateTime, Hour, min_, Sec, MSec);
Result := IntToHex(Year, 4) + IntToHex(Month, 2) +
IntToHex(Day, 2) + IntToHex(Hour, 1) + IntToHex(min_, 2) +
IntToHex(Sec, 2) + IntToHex(MSec, 3);
end;
function umlMakeRanName: TPascalString;
type
TRanData = packed record
Year, Month, Day: Word;
Hour, min_, Sec, MSec: Word;
end;
var
d: TDateTime;
r: TRanData;
begin
d := umlNow();
with r do
begin
DecodeDate(d, Year, Month, Day);
DecodeTime(d, Hour, min_, Sec, MSec);
end;
Result := umlMD5String(@r, SizeOf(TRanData));
end;
function umlStringReplace(const s, OldPattern, NewPattern: TPascalString; IgnoreCase: Boolean): TPascalString;
var
f: TReplaceFlags;
begin
f := [rfReplaceAll];
if IgnoreCase then
f := f + [rfIgnoreCase];
Result.text := StringReplace(s.text, OldPattern.text, NewPattern.text, f);
end;
function umlReplaceString(const s, OldPattern, NewPattern: TPascalString; IgnoreCase: Boolean): TPascalString;
begin
Result := umlStringReplace(s, OldPattern, NewPattern, IgnoreCase);
end;
function umlCharReplace(const s: TPascalString; OldPattern, NewPattern: U_Char): TPascalString;
var
i: Integer;
begin
Result := s;
if Result.Len > 0 then
begin
for i := 1 to umlGetLength(Result) do
begin
if Result[i] = OldPattern then
Result[i] := NewPattern;
end;
end;
end;
function umlReplaceChar(const s: TPascalString; OldPattern, NewPattern: U_Char): TPascalString;
begin
Result := umlCharReplace(s, OldPattern, NewPattern);
end;
function umlEncodeText2HTML(const psSrc: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
if psSrc.Len > 0 then
begin
i := 1;
while i <= psSrc.Len do
begin
case psSrc[i] of
' ': Result.Append(' ');
'<': Result.Append('<');
'>': Result.Append('>');
'&': Result.Append('&');
'"': Result.Append('"');
#9: Result.Append(' ');
#13:
begin
if i + 1 <= psSrc.Len then
begin
if psSrc[i + 1] = #10 then
inc(i);
Result.Append('<br>');
end
else
begin
Result.Append('<br>');
end;
end;
#10:
begin
if i + 1 <= psSrc.Len then
begin
if psSrc[i + 1] = #13 then
inc(i);
Result.Append('<br>');
end
else
begin
Result.Append('<br>');
end;
end;
else
Result.Append(psSrc[i]);
end;
inc(i);
end;
end;
end;
function umlURLEncode(const Data: TPascalString): TPascalString;
const
EncodeSlash = False;
var
UTF8Src: TBytes;
i: Integer;
b: Byte;
begin
Result := '';
try
UTF8Src := Data.Bytes;
for i := 0 to length(UTF8Src) - 1 do
begin
b := UTF8Src[i];
if ((b >= $41) and (b <= $5A)) or ((b >= $61) and (b <= $7A)) or ((b >= $30) and (b <= $39)) or
(b = $2D) or (b = $2E) or (b = $5F) or (b = $7E) or (b = $2F) or (b = $3A) then
Result := Result + SystemChar(b)
else
Result := Result + '%' + IntToHex(b, 2);
end;
finally
SetLength(UTF8Src, 0);
end;
end;
function umlURLDecode(const Data: TPascalString; FormEncoded: Boolean): TPascalString;
function CombineArry(const Buf1: TBytes; Buf2: Byte): TBytes;
var
L: Integer;
begin
L := length(Buf1);
SetLength(Result, L + 1);
if L > 0 then
CopyPtr(@Buf1[0], @Result[0], L);
Result[0 + L] := Buf2;
end;
procedure FreeArry(var a: TBytes);
begin
SetLength(a, 0);
end;
var
i: Integer;
State: Byte;
b, BV, B1: Byte;
DataArry_, UTF8Str_: TBytes;
tmpBytes: TBytes;
const
STATE_READ_DATA = 0;
STATE_READ_PERCENT_ENCODED_BYTE_1 = 1;
STATE_READ_PERCENT_ENCODED_BYTE_2 = 2;
const
HexCharsHigh: array [0 .. 15] of Byte = ($30, $31, $32, $33, $34, $35, $36, $37, $38, $39, 65, 66, 67, 68, 69, 70);
begin
B1 := 0;
State := STATE_READ_DATA;
SetLength(UTF8Str_, 0);
DataArry_ := Data.Bytes;
for i := 0 to length(DataArry_) - 1 do
begin
b := DataArry_[i];
if State = STATE_READ_DATA then
begin
if b = $25 then
State := STATE_READ_PERCENT_ENCODED_BYTE_1
else if FormEncoded and (b = $2B) then // + sign
begin
tmpBytes := UTF8Str_;
UTF8Str_ := CombineArry(tmpBytes, Byte($20));
FreeArry(tmpBytes);
end
else
begin
tmpBytes := UTF8Str_;
UTF8Str_ := CombineArry(tmpBytes, Byte(Data[FirstCharPos + i]));
FreeArry(tmpBytes);
end;
end
else
if (State = STATE_READ_PERCENT_ENCODED_BYTE_1) or (State = STATE_READ_PERCENT_ENCODED_BYTE_2) then
begin
if (b >= 65) and (b <= 70) then
BV := b - 55
else if (b >= 97) and (b <= 102) then
BV := b - 87
else if (b >= $30) and (b <= $39) then
BV := b - $30
else
raiseInfo('Unexpected character: 0x' + IntToHex(b, 2));
if State = STATE_READ_PERCENT_ENCODED_BYTE_1 then
begin
B1 := BV;
State := STATE_READ_PERCENT_ENCODED_BYTE_2;
end
else
begin
b := (B1 shl 4) or BV;
tmpBytes := UTF8Str_;
UTF8Str_ := CombineArry(tmpBytes, b);
FreeArry(tmpBytes);
State := STATE_READ_DATA;
end;
end;
end;
Result.Bytes := UTF8Str_;
FreeArry(UTF8Str_);
FreeArry(DataArry_);
end;
function B64EstimateEncodedSize(Ctx: TBase64Context; InSize: Integer): Integer;
begin
Result := ((InSize + 2) div 3) shl 2;
if (Ctx.EOLSize > 0) and (Ctx.LineSize > 0) then
begin
Result := Result + ((Result + Ctx.LineSize - 1) div Ctx.LineSize) * Ctx.EOLSize;
if not Ctx.TrailingEol then
Result := Result - Ctx.EOLSize;
end;
end;
function B64InitializeDecoding(var Ctx: TBase64Context; LiberalMode: Boolean): Boolean;
begin
Ctx.TailBytes := 0;
Ctx.EQUCount := 0;
Ctx.LiberalMode := LiberalMode;
Result := True;
end;
function B64InitializeEncoding(var Ctx: TBase64Context; LineSize: Integer; fEOL: TBase64EOLMarker; TrailingEol: Boolean): Boolean;
begin
Result := False;
Ctx.TailBytes := 0;
Ctx.LineSize := LineSize;
Ctx.LineWritten := 0;
Ctx.EQUCount := 0;
Ctx.TrailingEol := TrailingEol;
Ctx.PutFirstEol := False;
if LineSize < 4 then
exit;
case fEOL of
emCRLF:
begin
Ctx.fEOL[0] := $0D;
Ctx.fEOL[1] := $0A;
Ctx.EOLSize := 2;
end;
emCR:
begin
Ctx.fEOL[0] := $0D;
Ctx.EOLSize := 1;
end;
emLF:
begin
Ctx.fEOL[0] := $0A;
Ctx.EOLSize := 1;
end;
else
Ctx.EOLSize := 0;
end;
Result := True;
end;
function B64Encode(var Ctx: TBase64Context; buffer: PByte; Size: Integer; OutBuffer: PByte; var OutSize: Integer): Boolean;
var
EstSize, i, Chunks: Integer;
PreserveLastEol: Boolean;
begin
PreserveLastEol := False;
EstSize := ((Size + Ctx.TailBytes) div 3) shl 2;
if (Ctx.LineSize > 0) and (Ctx.EOLSize > 0) then
begin
if (EstSize > 0) and ((Ctx.LineWritten + EstSize) mod Ctx.LineSize = 0) and
((Ctx.TailBytes + Size) mod 3 = 0) then
PreserveLastEol := True;
EstSize := EstSize + ((EstSize + Ctx.LineWritten) div Ctx.LineSize) * Ctx.EOLSize;
if PreserveLastEol then
EstSize := EstSize - Ctx.EOLSize;
end;
if Ctx.PutFirstEol then
EstSize := EstSize + Ctx.EOLSize;
if OutSize < EstSize then
begin
OutSize := EstSize;
Result := False;
exit;
end;
OutSize := EstSize;
if Ctx.PutFirstEol then
begin
CopyPtr(@Ctx.fEOL[0], OutBuffer, Ctx.EOLSize);
inc(OutBuffer, Ctx.EOLSize);
Ctx.PutFirstEol := False;
end;
if Size + Ctx.TailBytes < 3 then
begin
for i := 0 to Size - 1 do
Ctx.Tail[Ctx.TailBytes + i] := PBase64ByteArray(buffer)^[i];
inc(Ctx.TailBytes, Size);
Result := True;
exit;
end;
if Ctx.TailBytes > 0 then
begin
for i := 0 to 2 - Ctx.TailBytes do
Ctx.Tail[Ctx.TailBytes + i] := PBase64ByteArray(buffer)^[i];
inc(buffer, 3 - Ctx.TailBytes);
dec(Size, 3 - Ctx.TailBytes);
Ctx.TailBytes := 0;
Ctx.OutBuf[0] := Base64Symbols[Ctx.Tail[0] shr 2];
Ctx.OutBuf[1] := Base64Symbols[((Ctx.Tail[0] and 3) shl 4) or (Ctx.Tail[1] shr 4)];
Ctx.OutBuf[2] := Base64Symbols[((Ctx.Tail[1] and $F) shl 2) or (Ctx.Tail[2] shr 6)];
Ctx.OutBuf[3] := Base64Symbols[Ctx.Tail[2] and $3F];
if (Ctx.LineSize = 0) or (Ctx.LineWritten + 4 < Ctx.LineSize) then
begin
CopyPtr(@Ctx.OutBuf[0], OutBuffer, 4);
inc(OutBuffer, 4);
inc(Ctx.LineWritten, 4);
end
else
begin
i := Ctx.LineSize - Ctx.LineWritten;
CopyPtr(@Ctx.OutBuf[0], OutBuffer, i);
inc(OutBuffer, i);
if (Size > 0) or (i < 4) or (not PreserveLastEol) then
begin
CopyPtr(@Ctx.fEOL[0], OutBuffer, Ctx.EOLSize);
inc(OutBuffer, Ctx.EOLSize);
end;
CopyPtr(@Ctx.OutBuf[i], OutBuffer, 4 - i);
inc(OutBuffer, 4 - i);
Ctx.LineWritten := 4 - i;
end;
end;
while Size >= 3 do
begin
if Ctx.LineSize > 0 then
begin
Chunks := (Ctx.LineSize - Ctx.LineWritten) shr 2;
if Chunks > Size div 3 then
Chunks := Size div 3;
end
else
Chunks := Size div 3;
for i := 0 to Chunks - 1 do
begin
OutBuffer^ := Base64Symbols[PBase64ByteArray(buffer)^[0] shr 2];
inc(OutBuffer);
PByte(OutBuffer)^ := Base64Symbols[((PBase64ByteArray(buffer)^[0] and 3) shl 4) or (PBase64ByteArray(buffer)^[1] shr 4)];
inc(OutBuffer);
PByte(OutBuffer)^ := Base64Symbols[((PBase64ByteArray(buffer)^[1] and $F) shl 2) or (PBase64ByteArray(buffer)^[2] shr 6)];
inc(OutBuffer);
PByte(OutBuffer)^ := Base64Symbols[PBase64ByteArray(buffer)^[2] and $3F];
inc(OutBuffer);
inc(buffer, 3);
end;
dec(Size, 3 * Chunks);
if Ctx.LineSize > 0 then
begin
inc(Ctx.LineWritten, Chunks shl 2);
if (Size >= 3) and (Ctx.LineSize - Ctx.LineWritten > 0) then
begin
Ctx.OutBuf[0] := Base64Symbols[PBase64ByteArray(buffer)^[0] shr 2];
Ctx.OutBuf[1] := Base64Symbols[((PBase64ByteArray(buffer)^[0] and 3) shl 4) or (PBase64ByteArray(buffer)^[1] shr 4)];
Ctx.OutBuf[2] := Base64Symbols[((PBase64ByteArray(buffer)^[1] and $F) shl 2) or (PBase64ByteArray(buffer)^[2] shr 6)];
Ctx.OutBuf[3] := Base64Symbols[PBase64ByteArray(buffer)^[2] and $3F];
inc(buffer, 3);
dec(Size, 3);
i := Ctx.LineSize - Ctx.LineWritten;
CopyPtr(@Ctx.OutBuf[0], OutBuffer, i);
inc(OutBuffer, i);
if (Ctx.EOLSize > 0) and ((i < 4) or (Size > 0) or (not PreserveLastEol)) then
begin
CopyPtr(@Ctx.fEOL[0], OutBuffer, Ctx.EOLSize);
inc(OutBuffer, Ctx.EOLSize);
end;
CopyPtr(@Ctx.OutBuf[i], OutBuffer, 4 - i);
inc(OutBuffer, 4 - i);
Ctx.LineWritten := 4 - i;
end
else
if Ctx.LineWritten = Ctx.LineSize then
begin
Ctx.LineWritten := 0;
if (Ctx.EOLSize > 0) and ((Size > 0) or (not PreserveLastEol)) then
begin
CopyPtr(@Ctx.fEOL[0], OutBuffer, Ctx.EOLSize);
inc(OutBuffer, Ctx.EOLSize);
end;
end;
end;
end;
if Size > 0 then
begin
CopyPtr(buffer, @Ctx.Tail[0], Size);
Ctx.TailBytes := Size;
end
else
if PreserveLastEol then
Ctx.PutFirstEol := True;
Result := True;
end;
function B64Decode(var Ctx: TBase64Context; buffer: PByte; Size: Integer; OutBuffer: PByte; var OutSize: Integer): Boolean;
var
i, EstSize, EQUCount: Integer;
BufPtr: PByte;
c: Byte;
begin
if Size = 0 then
begin
Result := True;
OutSize := 0;
exit;
end;
EQUCount := Ctx.EQUCount;
EstSize := Ctx.TailBytes;
BufPtr := buffer;
for i := 0 to Size - 1 do
begin
c := Base64Values[PByte(BufPtr)^];
if c < 64 then
inc(EstSize)
else
if c = $FF then
begin
if not Ctx.LiberalMode then
begin
Result := False;
OutSize := 0;
exit;
end;
end
else
if c = $FD then
begin
if EQUCount > 1 then
begin
Result := False;
OutSize := 0;
exit;
end;
inc(EQUCount);
end;
inc(BufPtr);
end;
EstSize := (EstSize shr 2) * 3;
if OutSize < EstSize then
begin
OutSize := EstSize;
Result := False;
exit;
end;
Ctx.EQUCount := EQUCount;
OutSize := EstSize;
while Size > 0 do
begin
c := Base64Values[PByte(buffer)^];
if c < 64 then
begin
Ctx.Tail[Ctx.TailBytes] := c;
inc(Ctx.TailBytes);
if Ctx.TailBytes = 4 then
begin
PByte(OutBuffer)^ := (Ctx.Tail[0] shl 2) or (Ctx.Tail[1] shr 4);
inc(OutBuffer);
PByte(OutBuffer)^ := ((Ctx.Tail[1] and $F) shl 4) or (Ctx.Tail[2] shr 2);
inc(OutBuffer);
PByte(OutBuffer)^ := ((Ctx.Tail[2] and $3) shl 6) or Ctx.Tail[3];
inc(OutBuffer);
Ctx.TailBytes := 0;
end;
end;
inc(buffer);
dec(Size);
end;
Result := True;
end;
function B64FinalizeEncoding(var Ctx: TBase64Context; OutBuffer: PByte; var OutSize: Integer): Boolean;
var
EstSize: Integer;
begin
if Ctx.TailBytes > 0 then
EstSize := 4
else
EstSize := 0;
if Ctx.TrailingEol then
EstSize := EstSize + Ctx.EOLSize;
if OutSize < EstSize then
begin
OutSize := EstSize;
Result := False;
exit;
end;
OutSize := EstSize;
if Ctx.TailBytes = 0 then
begin
{ writing trailing EOL }
Result := True;
if (Ctx.EOLSize > 0) and Ctx.TrailingEol then
begin
OutSize := Ctx.EOLSize;
CopyPtr(@Ctx.fEOL[0], OutBuffer, Ctx.EOLSize);
end;
exit;
end;
if Ctx.TailBytes = 1 then
begin
PBase64ByteArray(OutBuffer)^[0] := Base64Symbols[Ctx.Tail[0] shr 2];
PBase64ByteArray(OutBuffer)^[1] := Base64Symbols[((Ctx.Tail[0] and 3) shl 4)];
PBase64ByteArray(OutBuffer)^[2] := $3D; // '='
PBase64ByteArray(OutBuffer)^[3] := $3D; // '='
end
else if Ctx.TailBytes = 2 then
begin
PBase64ByteArray(OutBuffer)^[0] := Base64Symbols[Ctx.Tail[0] shr 2];
PBase64ByteArray(OutBuffer)^[1] := Base64Symbols[((Ctx.Tail[0] and 3) shl 4) or (Ctx.Tail[1] shr 4)];
PBase64ByteArray(OutBuffer)^[2] := Base64Symbols[((Ctx.Tail[1] and $F) shl 2)];
PBase64ByteArray(OutBuffer)^[3] := $3D; // '='
end;
if (Ctx.EOLSize > 0) and (Ctx.TrailingEol) then
CopyPtr(@Ctx.fEOL[0], @PBase64ByteArray(OutBuffer)^[4], Ctx.EOLSize);
Result := True;
end;
function B64FinalizeDecoding(var Ctx: TBase64Context; OutBuffer: PByte; var OutSize: Integer): Boolean;
begin
if (Ctx.EQUCount = 0) then
begin
OutSize := 0;
Result := Ctx.TailBytes = 0;
exit;
end
else
if (Ctx.EQUCount = 1) then
begin
if Ctx.TailBytes <> 3 then
begin
Result := False;
OutSize := 0;
exit;
end;
if OutSize < 2 then
begin
OutSize := 2;
Result := False;
exit;
end;
PByte(OutBuffer)^ := (Ctx.Tail[0] shl 2) or (Ctx.Tail[1] shr 4);
inc(OutBuffer);
PByte(OutBuffer)^ := ((Ctx.Tail[1] and $F) shl 4) or (Ctx.Tail[2] shr 2);
OutSize := 2;
Result := True;
end
else if (Ctx.EQUCount = 2) then
begin
if Ctx.TailBytes <> 2 then
begin
Result := False;
OutSize := 0;
exit;
end;
if OutSize < 1 then
begin
OutSize := 1;
Result := False;
exit;
end;
PByte(OutBuffer)^ := (Ctx.Tail[0] shl 2) or (Ctx.Tail[1] shr 4);
OutSize := 1;
Result := True;
end
else
begin
Result := False;
OutSize := 0;
end;
end;
function umlBase64Encode(InBuffer: PByte; InSize: Integer; OutBuffer: PByte; var OutSize: Integer; WrapLines: Boolean): Boolean;
var
Ctx: TBase64Context;
TmpSize: Integer;
begin
if WrapLines then
B64InitializeEncoding(Ctx, 64, emCRLF, False)
else
B64InitializeEncoding(Ctx, 0, emNone, False);
TmpSize := B64EstimateEncodedSize(Ctx, InSize);
if (OutSize < TmpSize) then
begin
OutSize := TmpSize;
Result := False;
exit;
end;
TmpSize := OutSize;
B64Encode(Ctx, InBuffer, InSize, OutBuffer, TmpSize);
OutSize := OutSize - TmpSize;
B64FinalizeEncoding(Ctx, PByte(NativeUInt(OutBuffer) + UInt32(TmpSize)), OutSize);
OutSize := OutSize + TmpSize;
Result := True;
end;
function umlBase64Decode(InBuffer: PByte; InSize: Integer; OutBuffer: PByte; var OutSize: Integer; LiberalMode: Boolean): Integer;
var
i, TmpSize: Integer;
ExtraSyms: Integer;
Ctx: TBase64Context;
begin
ExtraSyms := 0;
try
for i := 0 to InSize - 1 do
if (PBase64ByteArray(InBuffer)^[i] in [$0D, $0A, $0]) then // some buggy software products insert 0x00 characters to BASE64 they produce
inc(ExtraSyms);
except
end;
if not LiberalMode then
begin
if ((InSize - ExtraSyms) and $3) <> 0 then
begin
Result := BASE64_DECODE_WRONG_DATA_SIZE;
OutSize := 0;
exit;
end;
end;
TmpSize := ((InSize - ExtraSyms) shr 2) * 3;
if OutSize < TmpSize then
begin
Result := BASE64_DECODE_NOT_ENOUGH_SPACE;
OutSize := TmpSize;
exit;
end;
B64InitializeDecoding(Ctx, LiberalMode);
TmpSize := OutSize;
if not B64Decode(Ctx, InBuffer, InSize, OutBuffer, TmpSize) then
begin
Result := BASE64_DECODE_INVALID_CHARACTER;
OutSize := 0;
exit;
end;
OutSize := OutSize - TmpSize;
if not B64FinalizeDecoding(Ctx, @PBase64ByteArray(OutBuffer)^[TmpSize], OutSize) then
begin
Result := BASE64_DECODE_INVALID_CHARACTER;
OutSize := 0;
exit;
end;
OutSize := OutSize + TmpSize;
Result := BASE64_DECODE_OK;
end;
procedure umlBase64EncodeBytes(var sour, dest: TBytes);
var
Size: Integer;
begin
if length(sour) = 0 then
exit;
Size := 0;
SetLength(dest, 0);
umlBase64Encode(@sour[0], length(sour), nil, Size, False);
SetLength(dest, Size);
umlBase64Encode(@sour[0], length(sour), @dest[0], Size, False);
SetLength(dest, Size);
end;
procedure umlBase64DecodeBytes(var sour, dest: TBytes);
var
Size: Integer;
begin
if length(sour) = 0 then
begin
SetLength(dest, 0);
exit;
end;
Size := 0;
umlBase64Decode(@sour[0], length(sour), nil, Size, True);
SetLength(dest, Size);
umlBase64Decode(@sour[0], length(sour), @dest[0], Size, True);
SetLength(dest, Size);
end;
procedure umlBase64EncodeBytes(var sour: TBytes; var dest: TPascalString);
var
buff: TBytes;
begin
umlBase64EncodeBytes(sour, buff);
dest.Bytes := buff;
end;
procedure umlBase64DecodeBytes(const sour: TPascalString; var dest: TBytes);
var
buff: TBytes;
begin
buff := sour.Bytes;
umlBase64DecodeBytes(buff, dest);
end;
procedure umlDecodeLineBASE64(const buffer: TPascalString; var output: TPascalString);
var
b, nb: TBytes;
begin
b := umlBytesOf(buffer);
umlBase64DecodeBytes(b, nb);
output := umlStringOf(nb);
end;
procedure umlEncodeLineBASE64(const buffer: TPascalString; var output: TPascalString);
var
b, nb: TBytes;
begin
b := umlBytesOf(buffer);
umlBase64EncodeBytes(b, nb);
output := umlStringOf(nb);
end;
procedure umlDecodeStreamBASE64(const buffer: TPascalString; output: TCoreClassStream);
var
b, nb: TBytes;
bak: Int64;
begin
b := umlBytesOf(buffer);
umlBase64DecodeBytes(b, nb);
bak := output.Position;
output.WriteBuffer(nb[0], length(nb));
output.Position := bak;
end;
procedure umlEncodeStreamBASE64(buffer: TCoreClassStream; var output: TPascalString);
var
b, nb: TBytes;
bak: Int64;
begin
bak := buffer.Position;
buffer.Position := 0;
SetLength(b, buffer.Size);
buffer.ReadBuffer(b[0], buffer.Size);
umlBase64EncodeBytes(b, nb);
output := umlStringOf(nb);
buffer.Position := bak;
end;
function umlDivisionBase64Text(const buffer: TPascalString; width: Integer; DivisionAsPascalString: Boolean): TPascalString;
var
i, n: Integer;
begin
Result := '';
n := 0;
for i := 1 to buffer.Len do
begin
if (DivisionAsPascalString) and (n = 0) then
Result.Append(#39);
Result.Append(buffer[i]);
inc(n);
if n = width then
begin
if DivisionAsPascalString then
Result.Append(#39 + '+' + #13#10)
else
Result.Append(#13#10);
n := 0;
end;
end;
if DivisionAsPascalString then
Result.Append(#39);
end;
function umlTestBase64(const text: TPascalString): Boolean;
var
sour, dest: TBytes;
begin
sour := text.Bytes;
SetLength(dest, 0);
try
umlBase64DecodeBytes(sour, dest);
except
end;
Result := length(dest) > 0;
if Result then
SetLength(dest, 0);
end;
procedure umlTransformMD5(var Accu; var Buf); inline;
function ROL(const x: Cardinal; const n: Byte): Cardinal; inline;
begin
Result := (x shl n) or (x shr (32 - n))
end;
function FF(const a, b, c, d, x: Cardinal; const s: Byte; const AC: Cardinal): Cardinal; inline;
begin
Result := ROL(a + x + AC + (b and c or not b and d), s) + b
end;
function GG(const a, b, c, d, x: Cardinal; const s: Byte; const AC: Cardinal): Cardinal; inline;
begin
Result := ROL(a + x + AC + (b and d or c and not d), s) + b
end;
function HH(const a, b, c, d, x: Cardinal; const s: Byte; const AC: Cardinal): Cardinal; inline;
begin
Result := ROL(a + x + AC + (b xor c xor d), s) + b
end;
function II(const a, b, c, d, x: Cardinal; const s: Byte; const AC: Cardinal): Cardinal; inline;
begin
Result := ROL(a + x + AC + (c xor (b or not d)), s) + b
end;
type
TDigestCardinal = array [0 .. 3] of Cardinal;
TCardinalBuf = array [0 .. 15] of Cardinal;
var
a, b, c, d: Cardinal;
begin
a := TDigestCardinal(Accu)[0];
b := TDigestCardinal(Accu)[1];
c := TDigestCardinal(Accu)[2];
d := TDigestCardinal(Accu)[3];
a := FF(a, b, c, d, TCardinalBuf(Buf)[0], 7, $D76AA478); { 1 }
d := FF(d, a, b, c, TCardinalBuf(Buf)[1], 12, $E8C7B756); { 2 }
c := FF(c, d, a, b, TCardinalBuf(Buf)[2], 17, $242070DB); { 3 }
b := FF(b, c, d, a, TCardinalBuf(Buf)[3], 22, $C1BDCEEE); { 4 }
a := FF(a, b, c, d, TCardinalBuf(Buf)[4], 7, $F57C0FAF); { 5 }
d := FF(d, a, b, c, TCardinalBuf(Buf)[5], 12, $4787C62A); { 6 }
c := FF(c, d, a, b, TCardinalBuf(Buf)[6], 17, $A8304613); { 7 }
b := FF(b, c, d, a, TCardinalBuf(Buf)[7], 22, $FD469501); { 8 }
a := FF(a, b, c, d, TCardinalBuf(Buf)[8], 7, $698098D8); { 9 }
d := FF(d, a, b, c, TCardinalBuf(Buf)[9], 12, $8B44F7AF); { 10 }
c := FF(c, d, a, b, TCardinalBuf(Buf)[10], 17, $FFFF5BB1); { 11 }
b := FF(b, c, d, a, TCardinalBuf(Buf)[11], 22, $895CD7BE); { 12 }
a := FF(a, b, c, d, TCardinalBuf(Buf)[12], 7, $6B901122); { 13 }
d := FF(d, a, b, c, TCardinalBuf(Buf)[13], 12, $FD987193); { 14 }
c := FF(c, d, a, b, TCardinalBuf(Buf)[14], 17, $A679438E); { 15 }
b := FF(b, c, d, a, TCardinalBuf(Buf)[15], 22, $49B40821); { 16 }
a := GG(a, b, c, d, TCardinalBuf(Buf)[1], 5, $F61E2562); { 17 }
d := GG(d, a, b, c, TCardinalBuf(Buf)[6], 9, $C040B340); { 18 }
c := GG(c, d, a, b, TCardinalBuf(Buf)[11], 14, $265E5A51); { 19 }
b := GG(b, c, d, a, TCardinalBuf(Buf)[0], 20, $E9B6C7AA); { 20 }
a := GG(a, b, c, d, TCardinalBuf(Buf)[5], 5, $D62F105D); { 21 }
d := GG(d, a, b, c, TCardinalBuf(Buf)[10], 9, $02441453); { 22 }
c := GG(c, d, a, b, TCardinalBuf(Buf)[15], 14, $D8A1E681); { 23 }
b := GG(b, c, d, a, TCardinalBuf(Buf)[4], 20, $E7D3FBC8); { 24 }
a := GG(a, b, c, d, TCardinalBuf(Buf)[9], 5, $21E1CDE6); { 25 }
d := GG(d, a, b, c, TCardinalBuf(Buf)[14], 9, $C33707D6); { 26 }
c := GG(c, d, a, b, TCardinalBuf(Buf)[3], 14, $F4D50D87); { 27 }
b := GG(b, c, d, a, TCardinalBuf(Buf)[8], 20, $455A14ED); { 28 }
a := GG(a, b, c, d, TCardinalBuf(Buf)[13], 5, $A9E3E905); { 29 }
d := GG(d, a, b, c, TCardinalBuf(Buf)[2], 9, $FCEFA3F8); { 30 }
c := GG(c, d, a, b, TCardinalBuf(Buf)[7], 14, $676F02D9); { 31 }
b := GG(b, c, d, a, TCardinalBuf(Buf)[12], 20, $8D2A4C8A); { 32 }
a := HH(a, b, c, d, TCardinalBuf(Buf)[5], 4, $FFFA3942); { 33 }
d := HH(d, a, b, c, TCardinalBuf(Buf)[8], 11, $8771F681); { 34 }
c := HH(c, d, a, b, TCardinalBuf(Buf)[11], 16, $6D9D6122); { 35 }
b := HH(b, c, d, a, TCardinalBuf(Buf)[14], 23, $FDE5380C); { 36 }
a := HH(a, b, c, d, TCardinalBuf(Buf)[1], 4, $A4BEEA44); { 37 }
d := HH(d, a, b, c, TCardinalBuf(Buf)[4], 11, $4BDECFA9); { 38 }
c := HH(c, d, a, b, TCardinalBuf(Buf)[7], 16, $F6BB4B60); { 39 }
b := HH(b, c, d, a, TCardinalBuf(Buf)[10], 23, $BEBFBC70); { 40 }
a := HH(a, b, c, d, TCardinalBuf(Buf)[13], 4, $289B7EC6); { 41 }
d := HH(d, a, b, c, TCardinalBuf(Buf)[0], 11, $EAA127FA); { 42 }
c := HH(c, d, a, b, TCardinalBuf(Buf)[3], 16, $D4EF3085); { 43 }
b := HH(b, c, d, a, TCardinalBuf(Buf)[6], 23, $04881D05); { 44 }
a := HH(a, b, c, d, TCardinalBuf(Buf)[9], 4, $D9D4D039); { 45 }
d := HH(d, a, b, c, TCardinalBuf(Buf)[12], 11, $E6DB99E5); { 46 }
c := HH(c, d, a, b, TCardinalBuf(Buf)[15], 16, $1FA27CF8); { 47 }
b := HH(b, c, d, a, TCardinalBuf(Buf)[2], 23, $C4AC5665); { 48 }
a := II(a, b, c, d, TCardinalBuf(Buf)[0], 6, $F4292244); { 49 }
d := II(d, a, b, c, TCardinalBuf(Buf)[7], 10, $432AFF97); { 50 }
c := II(c, d, a, b, TCardinalBuf(Buf)[14], 15, $AB9423A7); { 51 }
b := II(b, c, d, a, TCardinalBuf(Buf)[5], 21, $FC93A039); { 52 }
a := II(a, b, c, d, TCardinalBuf(Buf)[12], 6, $655B59C3); { 53 }
d := II(d, a, b, c, TCardinalBuf(Buf)[3], 10, $8F0CCC92); { 54 }
c := II(c, d, a, b, TCardinalBuf(Buf)[10], 15, $FFEFF47D); { 55 }
b := II(b, c, d, a, TCardinalBuf(Buf)[1], 21, $85845DD1); { 56 }
a := II(a, b, c, d, TCardinalBuf(Buf)[8], 6, $6FA87E4F); { 57 }
d := II(d, a, b, c, TCardinalBuf(Buf)[15], 10, $FE2CE6E0); { 58 }
c := II(c, d, a, b, TCardinalBuf(Buf)[6], 15, $A3014314); { 59 }
b := II(b, c, d, a, TCardinalBuf(Buf)[13], 21, $4E0811A1); { 60 }
a := II(a, b, c, d, TCardinalBuf(Buf)[4], 6, $F7537E82); { 61 }
d := II(d, a, b, c, TCardinalBuf(Buf)[11], 10, $BD3AF235); { 62 }
c := II(c, d, a, b, TCardinalBuf(Buf)[2], 15, $2AD7D2BB); { 63 }
b := II(b, c, d, a, TCardinalBuf(Buf)[9], 21, $EB86D391); { 64 }
inc(TDigestCardinal(Accu)[0], a);
inc(TDigestCardinal(Accu)[1], b);
inc(TDigestCardinal(Accu)[2], c);
inc(TDigestCardinal(Accu)[3], d)
end;
function umlMD5(const buffPtr: PByte; bufSiz: NativeUInt): TMD5;
{$IF Defined(FastMD5) and Defined(Delphi) and (Defined(WIN32) or Defined(WIN64))}
begin
Result := FastMD5(buffPtr, bufSiz);
end;
{$ELSE}
var
Digest: TMD5;
Lo, Hi: Cardinal;
p: PByte;
ChunkIndex: Byte;
ChunkBuff: array [0 .. 63] of Byte;
begin
Lo := 0;
Hi := 0;
PCardinal(@Digest[0])^ := $67452301;
PCardinal(@Digest[4])^ := $EFCDAB89;
PCardinal(@Digest[8])^ := $98BADCFE;
PCardinal(@Digest[12])^ := $10325476;
inc(Lo, bufSiz shl 3);
inc(Hi, bufSiz shr 29);
p := buffPtr;
while bufSiz >= $40 do
begin
umlTransformMD5(Digest, p^);
inc(p, $40);
dec(bufSiz, $40);
end;
if bufSiz > 0 then
CopyPtr(p, @ChunkBuff[0], bufSiz);
Result := PMD5(@Digest[0])^;
ChunkBuff[bufSiz] := $80;
ChunkIndex := bufSiz + 1;
if ChunkIndex > $38 then
begin
if ChunkIndex < $40 then
FillPtrByte(@ChunkBuff[ChunkIndex], $40 - ChunkIndex, 0);
umlTransformMD5(Result, ChunkBuff);
ChunkIndex := 0
end;
FillPtrByte(@ChunkBuff[ChunkIndex], $38 - ChunkIndex, 0);
PCardinal(@ChunkBuff[$38])^ := Lo;
PCardinal(@ChunkBuff[$3C])^ := Hi;
umlTransformMD5(Result, ChunkBuff);
end;
{$IFEND}
function umlMD5Char(const buffPtr: PByte; const BuffSize: NativeUInt): TPascalString;
begin
Result := umlMD5ToStr(umlMD5(buffPtr, BuffSize));
end;
function umlMD5String(const buffPtr: PByte; const BuffSize: NativeUInt): TPascalString;
begin
Result := umlMD5ToStr(umlMD5(buffPtr, BuffSize));
end;
function umlStreamMD5(stream: TCoreClassStream; StartPos, EndPos: Int64): TMD5;
{$IF Defined(FastMD5) and Defined(Delphi) and (Defined(WIN32) or Defined(WIN64))}
begin
Result := FastMD5(stream, StartPos, EndPos);
end;
{$ELSE}
const
deltaSize: Cardinal = $40 * $FFFF;
var
Digest: TMD5;
Lo, Hi: Cardinal;
DeltaBuf: Pointer;
bufSiz: Int64;
Rest: Cardinal;
p: PByte;
ChunkIndex: Byte;
ChunkBuff: array [0 .. 63] of Byte;
begin
if StartPos > EndPos then
Swap(StartPos, EndPos);
StartPos := umlClamp(StartPos, 0, stream.Size);
EndPos := umlClamp(EndPos, 0, stream.Size);
if EndPos - StartPos <= 0 then
begin
Result := umlMD5(nil, 0);
exit;
end;
{$IFDEF OptimizationMemoryStreamMD5}
if stream is TCoreClassMemoryStream then
begin
Result := umlMD5(Pointer(NativeUInt(TCoreClassMemoryStream(stream).Memory) + StartPos), EndPos - StartPos);
exit;
end;
if stream is TMemoryStream64 then
begin
Result := umlMD5(TMemoryStream64(stream).PositionAsPtr(StartPos), EndPos - StartPos);
exit;
end;
{$IFEND}
//
Lo := 0;
Hi := 0;
PCardinal(@Digest[0])^ := $67452301;
PCardinal(@Digest[4])^ := $EFCDAB89;
PCardinal(@Digest[8])^ := $98BADCFE;
PCardinal(@Digest[12])^ := $10325476;
bufSiz := EndPos - StartPos;
Rest := 0;
inc(Lo, bufSiz shl 3);
inc(Hi, bufSiz shr 29);
DeltaBuf := GetMemory(deltaSize);
stream.Position := StartPos;
if bufSiz < $40 then
begin
stream.read(DeltaBuf^, bufSiz);
p := DeltaBuf;
end
else
while bufSiz >= $40 do
begin
if Rest = 0 then
begin
if bufSiz >= deltaSize then
Rest := deltaSize
else
Rest := bufSiz;
stream.ReadBuffer(DeltaBuf^, Rest);
p := DeltaBuf;
end;
umlTransformMD5(Digest, p^);
inc(p, $40);
dec(bufSiz, $40);
dec(Rest, $40);
end;
if bufSiz > 0 then
CopyPtr(p, @ChunkBuff[0], bufSiz);
FreeMemory(DeltaBuf);
Result := PMD5(@Digest[0])^;
ChunkBuff[bufSiz] := $80;
ChunkIndex := bufSiz + 1;
if ChunkIndex > $38 then
begin
if ChunkIndex < $40 then
FillPtrByte(@ChunkBuff[ChunkIndex], $40 - ChunkIndex, 0);
umlTransformMD5(Result, ChunkBuff);
ChunkIndex := 0
end;
FillPtrByte(@ChunkBuff[ChunkIndex], $38 - ChunkIndex, 0);
PCardinal(@ChunkBuff[$38])^ := Lo;
PCardinal(@ChunkBuff[$3C])^ := Hi;
umlTransformMD5(Result, ChunkBuff);
end;
{$IFEND}
function umlStreamMD5(stream: TCoreClassStream): TMD5;
begin
if stream.Size <= 0 then
begin
Result := NullMD5;
exit;
end;
stream.Position := 0;
Result := umlStreamMD5(stream, 0, stream.Size);
stream.Position := 0;
end;
function umlStreamMD5Char(stream: TCoreClassStream): TPascalString;
begin
Result := umlMD5ToStr(umlStreamMD5(stream));
end;
function umlStreamMD5String(stream: TCoreClassStream): TPascalString;
begin
Result := umlMD5ToStr(umlStreamMD5(stream));
end;
function umlStringMD5(const Value: TPascalString): TPascalString;
var
b: TBytes;
begin
b := umlBytesOf(Value);
Result := umlMD5ToStr(umlMD5(@b[0], length(b)));
end;
function umlFileMD5___(FileName: TPascalString): TMD5;
var
fs: TCoreClassFileStream;
begin
try
fs := TCoreClassFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
except
Result := NullMD5;
exit;
end;
try
Result := umlStreamMD5(fs);
finally
DisposeObject(fs);
end;
end;
function umlFileMD5(FileName: TPascalString; StartPos, EndPos: Int64): TMD5;
var
fs: TCoreClassFileStream;
begin
try
fs := TCoreClassFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
except
Result := NullMD5;
exit;
end;
try
Result := umlStreamMD5(fs, StartPos, EndPos);
finally
DisposeObject(fs);
end;
end;
function umlCombineMD5(const m1: TMD5): TMD5;
begin
Result := umlMD5(@m1, SizeOf(TMD5));
end;
function umlCombineMD5(const m1, m2: TMD5): TMD5;
var
buff: array [0 .. 1] of TMD5;
begin
buff[0] := m1;
buff[1] := m2;
Result := umlMD5(@buff[0], SizeOf(TMD5) * 2);
end;
function umlCombineMD5(const m1, m2, m3: TMD5): TMD5;
var
buff: array [0 .. 2] of TMD5;
begin
buff[0] := m1;
buff[1] := m2;
buff[2] := m3;
Result := umlMD5(@buff[0], SizeOf(TMD5) * 3);
end;
function umlCombineMD5(const m1, m2, m3, m4: TMD5): TMD5;
var
buff: array [0 .. 3] of TMD5;
begin
buff[0] := m1;
buff[1] := m2;
buff[2] := m3;
buff[3] := m4;
Result := umlMD5(@buff[0], SizeOf(TMD5) * 4);
end;
function umlCombineMD5(const buff: array of TMD5): TMD5;
begin
Result := umlMD5(@buff[0], length(buff) * SizeOf(TMD5));
end;
function umlMD5ToStr(md5: TMD5): TPascalString;
const
HexArr: array [0 .. 15] of U_Char = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
var
i: Integer;
begin
Result.Len := 32;
for i := 0 to 15 do
begin
Result.buff[i * 2] := HexArr[(md5[i] shr 4) and $0F];
Result.buff[i * 2 + 1] := HexArr[md5[i] and $0F];
end;
end;
function umlMD5ToString(md5: TMD5): TPascalString;
const
HexArr: array [0 .. 15] of U_Char = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
var
i: Integer;
begin
Result.Len := 32;
for i := 0 to 15 do
begin
Result.buff[i * 2] := HexArr[(md5[i] shr 4) and $0F];
Result.buff[i * 2 + 1] := HexArr[md5[i] and $0F];
end;
end;
function umlMD52String(md5: TMD5): TPascalString;
const
HexArr: array [0 .. 15] of U_Char = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
var
i: Integer;
begin
Result.Len := 32;
for i := 0 to 15 do
begin
Result.buff[i * 2] := HexArr[(md5[i] shr 4) and $0F];
Result.buff[i * 2 + 1] := HexArr[md5[i] and $0F];
end;
end;
function umlMD5Compare(const m1, m2: TMD5): Boolean;
begin
Result := (PUInt64(@m1[0])^ = PUInt64(@m2[0])^) and (PUInt64(@m1[8])^ = PUInt64(@m2[8])^);
end;
function umlCompareMD5(const m1, m2: TMD5): Boolean;
begin
Result := (PUInt64(@m1[0])^ = PUInt64(@m2[0])^) and (PUInt64(@m1[8])^ = PUInt64(@m2[8])^);
end;
function umlIsNullMD5(m: TMD5): Boolean;
begin
Result := umlCompareMD5(m, NullMD5);
end;
function umlWasNullMD5(m: TMD5): Boolean;
begin
Result := umlCompareMD5(m, NullMD5);
end;
function umlCRC16(const Value: PByte; const Count: NativeUInt): Word;
var
i: NativeUInt;
p: PByte;
begin
p := Value;
Result := 0;
i := 0;
while i < Count do
begin
Result := (Result shr 8) xor CRC16Table[p^ xor (Result and $00FF)];
inc(i);
inc(p);
end;
end;
function umlStringCRC16(const Value: TPascalString): Word;
var
b: TBytes;
begin
b := umlBytesOf(Value);
Result := umlCRC16(@b[0], length(b));
end;
function umlStreamCRC16(stream: U_Stream; StartPos, EndPos: Int64): Word;
const
ChunkSize = 1024 * 1024;
procedure CRC16BUpdate(var crc: Word; const Buf: Pointer; Len: NativeUInt);
var
p: PByte;
i: Integer;
begin
p := Buf;
i := 0;
while i < Len do
begin
crc := (crc shr 8) xor CRC16Table[p^ xor (crc and $00FF)];
inc(p);
inc(i);
end;
end;
var
j: NativeUInt;
Num: NativeUInt;
Rest: NativeUInt;
Buf: Pointer;
FSize: Int64;
begin
if stream is TCoreClassMemoryStream then
begin
Result := umlCRC16(Pointer(NativeUInt(TCoreClassMemoryStream(stream).Memory) + StartPos), EndPos - StartPos);
exit;
end;
if stream is TMemoryStream64 then
begin
Result := umlCRC16(TMemoryStream64(stream).PositionAsPtr(StartPos), EndPos - StartPos);
exit;
end;
{ Allocate buffer to read file }
Buf := GetMemory(ChunkSize);
{ Initialize CRC }
Result := 0;
{ V1.03 calculate how much of the file we are processing }
FSize := stream.Size;
if (StartPos >= FSize) then
StartPos := 0;
if (EndPos > FSize) or (EndPos = 0) then
EndPos := FSize;
{ Calculate number of full chunks that will fit into the buffer }
Num := EndPos div ChunkSize;
{ Calculate remaining bytes }
Rest := EndPos mod ChunkSize;
{ Set the stream to the beginning of the file }
stream.Position := StartPos;
{ Process full chunks }
for j := 0 to Num - 1 do begin
stream.read(Buf^, ChunkSize);
CRC16BUpdate(Result, Buf, ChunkSize);
end;
{ Process remaining bytes }
if Rest > 0 then begin
stream.read(Buf^, Rest);
CRC16BUpdate(Result, Buf, Rest);
end;
FreeMem(Buf, ChunkSize);
end;
function umlStreamCRC16(stream: U_Stream): Word;
begin
stream.Position := 0;
Result := umlStreamCRC16(stream, 0, stream.Size);
stream.Position := 0;
end;
function umlCRC32(const Value: PByte; const Count: NativeUInt): Cardinal;
var
i: NativeUInt;
p: PByte;
begin
p := Value;
Result := $FFFFFFFF;
i := 0;
while i < Count do
begin
Result := ((Result shr 8) and $00FFFFFF) xor CRC32Table[(Result xor p^) and $000000FF];
inc(i);
inc(p);
end;
Result := Result xor $FFFFFFFF;
end;
function umlString2CRC32(const Value: TPascalString): Cardinal;
var
b: TBytes;
begin
b := umlBytesOf(Value);
Result := umlCRC32(@b[0], length(b));
end;
function umlStreamCRC32(stream: U_Stream; StartPos, EndPos: Int64): Cardinal;
const
ChunkSize = 1024 * 1024;
procedure CRC32BUpdate(var crc: Cardinal; const Buf: Pointer; Len: NativeUInt);
var
p: PByte;
i: Integer;
begin
p := Buf;
i := 0;
while i < Len do
begin
crc := ((crc shr 8) and $00FFFFFF) xor CRC32Table[(crc xor p^) and $000000FF];
inc(p);
inc(i);
end;
end;
var
j: NativeUInt;
Num: NativeUInt;
Rest: NativeUInt;
Buf: Pointer;
FSize: Int64;
begin
if stream is TCoreClassMemoryStream then
begin
Result := umlCRC32(Pointer(NativeUInt(TCoreClassMemoryStream(stream).Memory) + StartPos), EndPos - StartPos);
exit;
end;
if stream is TMemoryStream64 then
begin
Result := umlCRC32(TMemoryStream64(stream).PositionAsPtr(StartPos), EndPos - StartPos);
exit;
end;
{ Allocate buffer to read file }
Buf := GetMemory(ChunkSize);
{ Initialize CRC }
Result := $FFFFFFFF;
{ V1.03 calculate how much of the file we are processing }
FSize := stream.Size;
if (StartPos >= FSize) then
StartPos := 0;
if (EndPos > FSize) or (EndPos = 0) then
EndPos := FSize;
{ Calculate number of full chunks that will fit into the buffer }
Num := EndPos div ChunkSize;
{ Calculate remaining bytes }
Rest := EndPos mod ChunkSize;
{ Set the stream to the beginning of the file }
stream.Position := StartPos;
{ Process full chunks }
for j := 0 to Num - 1 do begin
stream.read(Buf^, ChunkSize);
CRC32BUpdate(Result, Buf, ChunkSize);
end;
{ Process remaining bytes }
if Rest > 0 then begin
stream.read(Buf^, Rest);
CRC32BUpdate(Result, Buf, Rest);
end;
FreeMem(Buf, ChunkSize);
Result := Result xor $FFFFFFFF;
end;
function umlStreamCRC32(stream: U_Stream): Cardinal;
begin
stream.Position := 0;
Result := umlStreamCRC32(stream, 0, stream.Size);
stream.Position := 0;
end;
function umlTrimSpace(const s: TPascalString): TPascalString;
var
L, bp, EP: Integer;
begin
Result := '';
L := s.Len;
if L > 0 then
begin
bp := 1;
while CharIn(s[bp], [#32, #0]) do
begin
inc(bp);
if (bp > L) then
begin
Result := '';
exit;
end;
end;
if bp > L then
Result := ''
else
begin
EP := L;
while CharIn(s[EP], [#32, #0]) do
begin
dec(EP);
if (EP < 1) then
begin
Result := '';
exit;
end;
end;
Result := s.GetString(bp, EP + 1);
end;
end;
end;
function umlSeparatorText(Text_: TPascalString; dest: TCoreClassStrings; SeparatorChar: TPascalString): Integer;
var
NewText_, SeparatorText_: TPascalString;
begin
Result := 0;
if Assigned(dest) then
begin
NewText_ := Text_;
SeparatorText_ := umlGetFirstStr(NewText_, SeparatorChar);
while (SeparatorText_.Len > 0) and (NewText_.Len > 0) do
begin
dest.Add(SeparatorText_.text);
inc(Result);
NewText_ := umlDeleteFirstStr(NewText_, SeparatorChar);
SeparatorText_ := umlGetFirstStr(NewText_, SeparatorChar);
end;
end;
end;
function umlSeparatorText(Text_: TPascalString; dest: THashVariantList; SeparatorChar: TPascalString): Integer;
var
NewText_, SeparatorText_: TPascalString;
begin
Result := 0;
if Assigned(dest) then
begin
NewText_ := Text_;
SeparatorText_ := umlGetFirstStr(NewText_, SeparatorChar);
while (SeparatorText_.Len > 0) and (NewText_.Len > 0) do
begin
dest.IncValue(SeparatorText_.text, 1);
inc(Result);
NewText_ := umlDeleteFirstStr(NewText_, SeparatorChar);
SeparatorText_ := umlGetFirstStr(NewText_, SeparatorChar);
end;
end;
end;
function umlSeparatorText(Text_: TPascalString; dest: TListPascalString; SeparatorChar: TPascalString): Integer;
var
NewText_, SeparatorText_: TPascalString;
begin
Result := 0;
if Assigned(dest) then
begin
NewText_ := Text_;
SeparatorText_ := umlGetFirstStr(NewText_, SeparatorChar);
while (SeparatorText_.Len > 0) and (NewText_.Len > 0) do
begin
dest.Add(SeparatorText_);
inc(Result);
NewText_ := umlDeleteFirstStr(NewText_, SeparatorChar);
SeparatorText_ := umlGetFirstStr(NewText_, SeparatorChar);
end;
end;
end;
function umlStringsMatchText(OriginValue: TCoreClassStrings; DestValue: TPascalString; IgnoreCase: Boolean): Boolean;
var
i: Integer;
begin
Result := False;
if not Assigned(OriginValue) then
exit;
if OriginValue.Count > 0 then
begin
for i := 0 to OriginValue.Count - 1 do
begin
if umlMultipleMatch(IgnoreCase, OriginValue[i], DestValue) then
begin
Result := True;
exit;
end;
end;
end;
end;
function umlStringsInExists(dest: TListPascalString; SText: TPascalString; IgnoreCase: Boolean): Boolean;
var
i: Integer;
ns: TPascalString;
begin
Result := False;
if IgnoreCase then
ns := umlUpperCase(SText)
else
ns := SText;
if Assigned(dest) then
begin
if dest.Count > 0 then
begin
for i := 0 to dest.Count - 1 do
begin
if ((not IgnoreCase) and (SText = dest[i])) or ((IgnoreCase) and (umlSameText(SText, dest[i]))) then
begin
Result := True;
exit;
end;
end;
end;
end;
end;
function umlStringsInExists(dest: TCoreClassStrings; SText: TPascalString; IgnoreCase: Boolean): Boolean;
var
i: Integer;
ns: TPascalString;
begin
Result := False;
if IgnoreCase then
ns := umlUpperCase(SText)
else
ns := SText;
if Assigned(dest) then
begin
if dest.Count > 0 then
begin
for i := 0 to dest.Count - 1 do
begin
if ((not IgnoreCase) and (SText = dest[i])) or ((IgnoreCase) and (umlSameText(SText, dest[i]))) then
begin
Result := True;
exit;
end;
end;
end;
end;
end;
function umlStringsInExists(dest: TCoreClassStrings; SText: TPascalString): Boolean;
begin
Result := umlStringsInExists(dest, SText, True);
end;
function umlTextInStrings(const SText: TPascalString; dest: TListPascalString; IgnoreCase: Boolean): Boolean;
begin
Result := umlStringsInExists(dest, SText, IgnoreCase);
end;
function umlTextInStrings(const SText: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Boolean;
begin
Result := umlStringsInExists(dest, SText, IgnoreCase);
end;
function umlTextInStrings(const SText: TPascalString; dest: TCoreClassStrings): Boolean;
begin
Result := umlStringsInExists(dest, SText);
end;
function umlAddNewStrTo(SourceStr: TPascalString; dest: TListPascalString; IgnoreCase: Boolean): Boolean;
begin
Result := not umlStringsInExists(dest, SourceStr, IgnoreCase);
if Result then
dest.Append(SourceStr.text);
end;
function umlAddNewStrTo(SourceStr: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Boolean;
begin
Result := not umlStringsInExists(dest, SourceStr, IgnoreCase);
if Result then
dest.Append(SourceStr.text);
end;
function umlAddNewStrTo(SourceStr: TPascalString; dest: TCoreClassStrings): Boolean;
begin
Result := not umlStringsInExists(dest, SourceStr, True);
if Result then
dest.Append(SourceStr.text);
end;
function umlAddNewStrTo(SourceStr, dest: TCoreClassStrings): Integer;
var
i: Integer;
begin
Result := 0;
for i := 0 to SourceStr.Count - 1 do
if umlAddNewStrTo(SourceStr[i], dest) then
inc(Result);
end;
function umlDeleteStrings(const SText: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Integer;
var
i: Integer;
begin
Result := 0;
if Assigned(dest) then
begin
if dest.Count > 0 then
begin
i := 0;
while i < dest.Count do
begin
if ((not IgnoreCase) and (SText = dest[i])) or ((IgnoreCase) and (umlMultipleMatch(IgnoreCase, SText, dest[i]))) then
begin
dest.Delete(i);
inc(Result);
end
else
inc(i);
end;
end;
end;
end;
function umlDeleteStringsNot(const SText: TPascalString; dest: TCoreClassStrings; IgnoreCase: Boolean): Integer;
var
i: Integer;
begin
Result := 0;
if Assigned(dest) then
begin
if dest.Count > 0 then
begin
i := 0;
while i < dest.Count do
begin
if ((not IgnoreCase) and (SText <> dest[i])) or ((IgnoreCase) and (not umlMultipleMatch(IgnoreCase, SText, dest[i]))) then
begin
dest.Delete(i);
inc(Result);
end
else
inc(i);
end;
end;
end;
end;
function umlMergeStrings(Source, dest: TCoreClassStrings; IgnoreCase: Boolean): Integer;
var
i: Integer;
begin
Result := 0;
if (Source = nil) or (dest = nil) then
exit;
if Source.Count > 0 then
begin
for i := 0 to Source.Count - 1 do
begin
umlAddNewStrTo(Source[i], dest, IgnoreCase);
inc(Result);
end;
end;
end;
function umlMergeStrings(Source, dest: TListPascalString; IgnoreCase: Boolean): Integer;
var
i: Integer;
begin
Result := 0;
if (Source = nil) or (dest = nil) then
exit;
if Source.Count > 0 then
begin
for i := 0 to Source.Count - 1 do
begin
umlAddNewStrTo(Source[i], dest, IgnoreCase);
inc(Result);
end;
end;
end;
function umlConverStrToFileName(const Value: TPascalString): TPascalString;
var
i: Integer;
begin
Result := Value;
for i := 1 to umlGetLength(Result) do
begin
if CharIn(Result[i], '":;/\|<>?*%') then
Result[i] := ' ';
end;
end;
function umlSplitTextMatch(const SText, Limit, MatchText: TPascalString; IgnoreCase: Boolean): Boolean;
var
n, t: TPascalString;
begin
Result := True;
if MatchText = '' then
exit;
n := SText;
//
if umlExistsChar(n, Limit) then
begin
repeat
t := umlGetFirstStr(n, Limit);
if umlMultipleMatch(IgnoreCase, MatchText, t) then
exit;
n := umlDeleteFirstStr(n, Limit);
until n = '';
end
else
begin
t := n;
if umlMultipleMatch(IgnoreCase, MatchText, t) then
exit;
end;
//
Result := False;
end;
function umlSplitTextTrimSpaceMatch(const SText, Limit, MatchText: TPascalString; IgnoreCase: Boolean): Boolean;
var
n, t: TPascalString;
begin
Result := True;
if MatchText = '' then
exit;
n := SText;
if umlExistsChar(n, Limit) then
begin
repeat
t := umlTrimSpace(umlGetFirstStr(n, Limit));
if umlMultipleMatch(IgnoreCase, MatchText, t) then
exit;
n := umlDeleteFirstStr(n, Limit);
until n = '';
end
else
begin
t := umlTrimSpace(n);
if umlMultipleMatch(IgnoreCase, MatchText, t) then
exit;
end;
Result := False;
end;
function umlSplitDeleteText(const SText, Limit, MatchText: TPascalString; IgnoreCase: Boolean): TPascalString;
var
n, t: TPascalString;
begin
if (MatchText = '') or (Limit = '') then
begin
Result := SText;
exit;
end;
Result := '';
n := SText;
//
if umlExistsChar(n, Limit) then
begin
repeat
t := umlGetFirstStr(n, Limit);
if not umlMultipleMatch(IgnoreCase, MatchText, t) then
begin
if Result <> '' then
Result := Result + Limit[1] + t
else
Result := t;
end;
n := umlDeleteFirstStr(n, Limit);
until n = '';
end
else
begin
t := n;
if not umlMultipleMatch(IgnoreCase, MatchText, t) then
Result := SText;
end;
end;
function umlSplitTextAsList(const SText, Limit: TPascalString; AsLst: TCoreClassStrings): Boolean;
var
n, t: TPascalString;
begin
AsLst.Clear;
n := SText;
//
if umlExistsChar(n, Limit) then
begin
repeat
t := umlGetFirstStr(n, Limit);
AsLst.Append(t.text);
n := umlDeleteFirstStr(n, Limit);
until n = '';
end
else
begin
t := n;
if umlGetLength(t) > 0 then
AsLst.Append(t.text);
end;
//
Result := AsLst.Count > 0;
end;
function umlSplitTextAsListAndTrimSpace(const SText, Limit: TPascalString; AsLst: TCoreClassStrings): Boolean;
var
n, t: TPascalString;
begin
AsLst.Clear;
n := SText;
//
if umlExistsChar(n, Limit) then
begin
repeat
t := umlGetFirstStr(n, Limit);
AsLst.Append(umlTrimSpace(t).text);
n := umlDeleteFirstStr(n, Limit);
until n = '';
end
else
begin
t := n;
if umlGetLength(t) > 0 then
AsLst.Append(umlTrimSpace(t).text);
end;
//
Result := AsLst.Count > 0;
end;
function umlListAsSplitText(const List: TCoreClassStrings; Limit: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
for i := 0 to List.Count - 1 do
if Result = '' then
Result := List[i]
else
Result := Result + Limit + List[i];
end;
function umlListAsSplitText(const List: TListPascalString; Limit: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
for i := 0 to List.Count - 1 do
if Result = '' then
Result := List[i]
else
Result.Append(Limit + List[i]);
end;
function umlDivisionText(const buffer: TPascalString; width: Integer; DivisionAsPascalString: Boolean): TPascalString;
var
i, n: Integer;
begin
Result := '';
n := 0;
for i := 1 to buffer.Len do
begin
if (DivisionAsPascalString) and (n = 0) then
Result.Append(#39);
Result.Append(buffer[i]);
inc(n);
if n = width then
begin
if DivisionAsPascalString then
Result.Append(#39 + '+' + #13#10)
else
Result.Append(#13#10);
n := 0;
end;
end;
if DivisionAsPascalString then
Result.Append(#39);
end;
function umlUpdateComponentName(const Name: TPascalString): TPascalString;
var
i: Integer;
begin
Result := '';
for i := 1 to umlGetLength(name) do
if umlGetLength(Result) > 0 then
begin
if CharIn(name[i], [c0to9, cLoAtoZ, cHiAtoZ], '-') then
Result := Result + name[i];
end
else if CharIn(name[i], [cLoAtoZ, cHiAtoZ]) then
Result := Result + name[i];
end;
function umlMakeComponentName(Owner: TCoreClassComponent; RefrenceName: TPascalString): TPascalString;
var
c: Cardinal;
begin
c := 1;
RefrenceName := umlUpdateComponentName(RefrenceName);
Result := RefrenceName;
while Owner.FindComponent(Result.text) <> nil do
begin
Result := RefrenceName + IntToStr(c);
inc(c);
end;
end;
procedure umlReadComponent(stream: TCoreClassStream; comp: TCoreClassComponent);
var
r: TCoreClassReader;
needClearName: Boolean;
begin
r := TCoreClassReader.Create(stream, 4096);
r.IgnoreChildren := True;
try
needClearName := (comp.Name = '');
r.ReadRootComponent(comp);
if needClearName then
comp.Name := '';
except
end;
DisposeObject(r);
end;
procedure umlWriteComponent(stream: TCoreClassStream; comp: TCoreClassComponent);
var
w: TCoreClassWriter;
begin
w := TCoreClassWriter.Create(stream, 4096);
w.IgnoreChildren := True;
w.WriteDescendent(comp, nil);
DisposeObject(w);
end;
procedure umlCopyComponentDataTo(comp, copyto: TCoreClassComponent);
var
ms: TCoreClassMemoryStream;
begin
if comp.ClassType <> copyto.ClassType then
exit;
ms := TCoreClassMemoryStream.Create;
try
umlWriteComponent(ms, comp);
ms.Position := 0;
umlReadComponent(ms, copyto);
except
end;
DisposeObject(ms);
end;
function umlProcessCycleValue(CurrentVal, DeltaVal, StartVal, OverVal: Single; var EndFlag: Boolean): Single;
function IfOut(Cur, Delta, dest: Single): Boolean;
begin
if Cur > dest then
Result := Cur - Delta < dest
else
Result := Cur + Delta > dest;
end;
function GetOutValue(Cur, Delta, dest: Single): Single;
begin
if IfOut(Cur, Delta, dest) then
begin
if Cur > dest then
Result := dest - (Cur - Delta)
else
Result := Cur + Delta - dest;
end
else
Result := 0;
end;
function GetDeltaValue(Cur, Delta, dest: Single): Single;
begin
if Cur > dest then
Result := Cur - Delta
else
Result := Cur + Delta;
end;
begin
if (DeltaVal > 0) and (StartVal <> OverVal) then
begin
if EndFlag then
begin
if IfOut(CurrentVal, DeltaVal, OverVal) then
begin
EndFlag := False;
Result := umlProcessCycleValue(OverVal, GetOutValue(CurrentVal, DeltaVal, OverVal), StartVal, OverVal, EndFlag);
end
else
Result := GetDeltaValue(CurrentVal, DeltaVal, OverVal);
end
else
begin
if IfOut(CurrentVal, DeltaVal, StartVal) then
begin
EndFlag := True;
Result := umlProcessCycleValue(StartVal, GetOutValue(CurrentVal, DeltaVal, StartVal), StartVal, OverVal, EndFlag);
end
else
Result := GetDeltaValue(CurrentVal, DeltaVal, StartVal);
end
end
else
Result := CurrentVal;
end;
procedure ImportCSV_C(const sour: TArrayPascalString; OnNotify: TCSVSaveCall);
var
i, j, bp, hc: NativeInt;
n: TPascalString;
king, buff: TArrayPascalString;
begin
// csv head
bp := -1;
for i := low(sour) to high(sour) do
begin
n := sour[i];
if n.Len <> 0 then
begin
bp := i + 1;
hc := n.GetCharCount(',') + 1;
SetLength(buff, hc);
SetLength(king, hc);
for j := low(king) to high(king) do
king[j] := '';
j := 0;
while (j < length(king)) and (n.Len > 0) do
begin
king[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
break;
end;
end;
// csv body
if bp > 0 then
for i := bp to high(sour) do
begin
n := sour[i];
if n.Len > 0 then
begin
for j := low(buff) to high(buff) do
buff[j] := '';
j := 0;
while (j < length(buff)) and (n.Len > 0) do
begin
buff[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
OnNotify(sour[i], king, buff);
end;
end;
SetLength(buff, 0);
SetLength(king, 0);
n := '';
end;
procedure CustomImportCSV_C(const OnGetLine: TCSVGetLineCall; OnNotify: TCSVSaveCall);
var
IsEnd: Boolean;
i, j, hc: NativeInt;
n, s: TPascalString;
king, buff: TArrayPascalString;
begin
// csv head
while True do
begin
IsEnd := False;
n := '';
OnGetLine(n, IsEnd);
if IsEnd then
exit;
if n.L <> 0 then
begin
hc := n.GetCharCount(',') + 1;
SetLength(buff, hc);
SetLength(king, hc);
for j := low(king) to high(king) do
king[j] := '';
j := 0;
while (j < length(king)) and (n.Len > 0) do
begin
king[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
break;
end;
end;
// csv body
while True do
begin
IsEnd := False;
n := '';
OnGetLine(n, IsEnd);
if IsEnd then
exit;
if n.Len > 0 then
begin
s := n;
for j := low(buff) to high(buff) do
buff[j] := '';
j := 0;
while (j < length(buff)) and (n.Len > 0) do
begin
buff[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
OnNotify(s, king, buff);
end;
end;
SetLength(buff, 0);
SetLength(king, 0);
n := '';
end;
procedure ImportCSV_M(const sour: TArrayPascalString; OnNotify: TCSVSaveMethod);
var
i, j, bp, hc: NativeInt;
n: TPascalString;
king, buff: TArrayPascalString;
begin
// csv head
bp := -1;
for i := low(sour) to high(sour) do
begin
n := sour[i];
if n.Len <> 0 then
begin
bp := i + 1;
hc := n.GetCharCount(',') + 1;
SetLength(buff, hc);
SetLength(king, hc);
for j := low(king) to high(king) do
king[j] := '';
j := 0;
while (j < length(king)) and (n.Len > 0) do
begin
king[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
break;
end;
end;
// csv body
if bp > 0 then
for i := bp to high(sour) do
begin
n := sour[i];
if n.Len > 0 then
begin
for j := low(buff) to high(buff) do
buff[j] := '';
j := 0;
while (j < length(buff)) and (n.Len > 0) do
begin
buff[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
OnNotify(sour[i], king, buff);
end;
end;
SetLength(buff, 0);
SetLength(king, 0);
n := '';
end;
procedure CustomImportCSV_M(const OnGetLine: TCSVGetLineMethod; OnNotify: TCSVSaveMethod);
var
IsEnd: Boolean;
i, j, hc: NativeInt;
n, s: TPascalString;
king, buff: TArrayPascalString;
begin
// csv head
while True do
begin
IsEnd := False;
n := '';
OnGetLine(n, IsEnd);
if IsEnd then
exit;
if n.L <> 0 then
begin
hc := n.GetCharCount(',') + 1;
SetLength(buff, hc);
SetLength(king, hc);
for j := low(king) to high(king) do
king[j] := '';
j := 0;
while (j < length(king)) and (n.Len > 0) do
begin
king[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
break;
end;
end;
// csv body
while True do
begin
IsEnd := False;
n := '';
OnGetLine(n, IsEnd);
if IsEnd then
exit;
if n.Len > 0 then
begin
s := n;
for j := low(buff) to high(buff) do
buff[j] := '';
j := 0;
while (j < length(buff)) and (n.Len > 0) do
begin
buff[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
OnNotify(s, king, buff);
end;
end;
SetLength(buff, 0);
SetLength(king, 0);
n := '';
end;
procedure ImportCSV_P(const sour: TArrayPascalString; OnNotify: TCSVSaveProc);
var
i, j, bp, hc: NativeInt;
n: TPascalString;
king, buff: TArrayPascalString;
begin
// csv head
bp := -1;
for i := low(sour) to high(sour) do
begin
n := sour[i];
if n.Len <> 0 then
begin
bp := i + 1;
hc := n.GetCharCount(',') + 1;
SetLength(buff, hc);
SetLength(king, hc);
for j := low(king) to high(king) do
king[j] := '';
j := 0;
while (j < length(king)) and (n.Len > 0) do
begin
king[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
break;
end;
end;
// csv body
if bp > 0 then
for i := bp to high(sour) do
begin
n := sour[i];
if n.Len > 0 then
begin
for j := low(buff) to high(buff) do
buff[j] := '';
j := 0;
while (j < length(buff)) and (n.Len > 0) do
begin
buff[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
OnNotify(sour[i], king, buff);
end;
end;
SetLength(buff, 0);
SetLength(king, 0);
n := '';
end;
procedure CustomImportCSV_P(const OnGetLine: TCSVGetLineProc; OnNotify: TCSVSaveProc);
var
IsEnd: Boolean;
i, j, hc: NativeInt;
n, s: TPascalString;
king, buff: TArrayPascalString;
begin
// csv head
while True do
begin
IsEnd := False;
n := '';
OnGetLine(n, IsEnd);
if IsEnd then
exit;
if n.L <> 0 then
begin
hc := n.GetCharCount(',') + 1;
SetLength(buff, hc);
SetLength(king, hc);
for j := low(king) to high(king) do
king[j] := '';
j := 0;
while (j < length(king)) and (n.Len > 0) do
begin
king[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
break;
end;
end;
// csv body
while True do
begin
IsEnd := False;
n := '';
OnGetLine(n, IsEnd);
if IsEnd then
exit;
if n.Len > 0 then
begin
s := n;
for j := low(buff) to high(buff) do
buff[j] := '';
j := 0;
while (j < length(buff)) and (n.Len > 0) do
begin
buff[j] := umlGetFirstStr_Discontinuity(n, ',');
n := umlDeleteFirstStr_Discontinuity(n, ',');
inc(j);
end;
OnNotify(s, king, buff);
end;
end;
SetLength(buff, 0);
SetLength(king, 0);
n := '';
end;
var
ExLibs: THashVariantList = nil;
function GetExtLib(LibName: SystemString): HMODULE;
begin
Result := 0;
{$IF not(Defined(IOS) and Defined(CPUARM))}
if ExLibs = nil then
ExLibs := THashVariantList.Create;
if not ExLibs.Exists(LibName) then
begin
try
{$IFNDEF FPC}
{$IFDEF ANDROID}
Result := LoadLibrary(PChar(umlCombineFileName(System.IOUtils.TPath.GetLibraryPath, LibName).text));
{$ELSE ANDROID}
Result := LoadLibrary(PChar(LibName));
{$ENDIF ANDROID}
{$ELSE FPC}
Result := LoadLibrary(PChar(LibName));
{$ENDIF FPC}
ExLibs.Add(LibName, Result);
except
FreeExtLib(LibName);
Result := 0;
end;
end
else
Result := ExLibs[LibName];
{$IFEND}
end;
function FreeExtLib(LibName: SystemString): Boolean;
begin
Result := False;
{$IF not(Defined(IOS) and Defined(CPUARM))}
if ExLibs = nil then
ExLibs := THashVariantList.Create;
if ExLibs.Exists(LibName) then
begin
try
FreeLibrary(HMODULE(ExLibs[LibName]));
except
end;
ExLibs.Delete(LibName);
Result := True;
end;
{$IFEND}
end;
function GetExtProc(const LibName, ProcName: SystemString): Pointer;
{$IF not(Defined(IOS) and Defined(CPUARM))}
var
h: HMODULE;
{$IFEND}
begin
Result := nil;
{$IF not(Defined(IOS) and Defined(CPUARM))}
h := GetExtLib(LibName);
if h <> 0 then
begin
Result := GetProcAddress(h, PChar(ProcName));
if Result = nil then
DoStatus('error external libray: %s - %s', [LibName, ProcName]);
end;
{$IFEND}
end;
{$IFDEF RangeCheck}{$R-}{$ENDIF}
function umlCompareByteString(const s1: TPascalString; const s2: PArrayRawByte): Boolean;
var
tmp: TBytes;
i: Integer;
begin
SetLength(tmp, s1.L);
for i := 0 to s1.L - 1 do
tmp[i] := Byte(s1.buff[i]);
Result := CompareMemory(@tmp[0], @s2^[0], s1.L);
end;
function umlCompareByteString(const s2: PArrayRawByte; const s1: TPascalString): Boolean;
var
tmp: TBytes;
i: Integer;
begin
SetLength(tmp, s1.L);
for i := 0 to s1.L - 1 do
tmp[i] := Byte(s1.buff[i]);
Result := CompareMemory(@tmp[0], @s2^[0], s1.L);
end;
procedure umlSetByteString(const sour: TPascalString; const dest: PArrayRawByte);
var
i: Integer;
begin
for i := 0 to sour.L - 1 do
dest^[i] := Byte(sour.buff[i]);
end;
procedure umlSetByteString(const dest: PArrayRawByte; const sour: TPascalString);
var
i: Integer;
begin
for i := 0 to sour.L - 1 do
dest^[i] := Byte(sour.buff[i]);
end;
function umlGetByteString(const sour: PArrayRawByte; const L: Integer): TPascalString;
var
i: Integer;
begin
Result.L := L;
for i := 0 to L - 1 do
Result.buff[i] := SystemChar(sour^[i]);
end;
{$IFDEF RangeCheck}{$R+}{$ENDIF}
procedure SaveMemory(p: Pointer; siz: NativeInt; DestFile: TPascalString);
var
m64: TMem64;
begin
m64 := TMem64.Create;
m64.SetPointerWithProtectedMode(p, siz);
m64.SaveToFile(DestFile);
DisposeObject(m64);
end;
type
TFileMD5_CacheData = record
Time_: TDateTime;
Size_: Int64;
md5: TMD5;
end;
PFileMD5_CacheData = ^TFileMD5_CacheData;
TFileMD5Cache = class
private
Critical: TCritical;
FHash: THashList;
procedure DoDataFreeProc(p: Pointer);
function DoGetFileMD5(FileName: U_String): TMD5;
public
constructor Create;
destructor Destroy; override;
procedure Clear;
end;
var
FileMD5Cache: TFileMD5Cache = nil;
procedure TFileMD5Cache.DoDataFreeProc(p: Pointer);
begin
Dispose(PFileMD5_CacheData(p));
end;
function TFileMD5Cache.DoGetFileMD5(FileName: U_String): TMD5;
var
p: PFileMD5_CacheData;
ft: TDateTime;
fs: Int64;
begin
if not umlFileExists(FileName) then
begin
Critical.Lock;
FHash.Delete(FileName);
Critical.UnLock;
Result := NullMD5;
exit;
end;
ft := umlGetFileTime(FileName);
fs := umlGetFileSize(FileName);
Critical.Lock;
p := FHash[FileName];
if p = nil then
begin
new(p);
p^.Time_ := ft;
p^.Size_ := fs;
p^.md5 := umlFileMD5___(FileName);
FHash.Add(FileName, p, False);
Result := p^.md5;
end
else
begin
if (ft <> p^.Time_) or (fs <> p^.Size_) then
begin
p^.Time_ := ft;
p^.Size_ := fs;
p^.md5 := umlFileMD5___(FileName);
end;
Result := p^.md5;
end;
Critical.UnLock;
end;
constructor TFileMD5Cache.Create;
begin
inherited Create;
FHash := THashList.CustomCreate($FFFF);
FHash.OnFreePtr := {$IFDEF FPC}@{$ENDIF FPC}DoDataFreeProc;
FHash.IgnoreCase := True;
FHash.AccessOptimization := True;
Critical := TCritical.Create;
end;
destructor TFileMD5Cache.Destroy;
begin
DisposeObject(Critical);
DisposeObject(FHash);
inherited Destroy;
end;
procedure TFileMD5Cache.Clear;
begin
FHash.Clear;
end;
function umlFileMD5(FileName: TPascalString): TMD5;
begin
Result := FileMD5Cache.DoGetFileMD5(FileName);
end;
procedure umlCacheFileMD5(FileName: U_String);
begin
FileMD5Cache.DoGetFileMD5(FileName);
end;
type
TCacheFileMD5FromDirectoryData_ = record
Directory_, Filter_: U_String;
end;
PCacheFileMD5FromDirectoryData_ = ^TCacheFileMD5FromDirectoryData_;
var
CacheThreadIsAcivted: Boolean = True;
CacheFileMD5FromDirectory_Num: Integer = 0;
procedure DoCacheFileMD5FromDirectory(thSender: TCompute);
var
p: PCacheFileMD5FromDirectoryData_;
arry: U_StringArray;
n: U_SystemString;
begin
p := thSender.UserData;
try
arry := umlGetFileListWithFullPath(p^.Directory_);
for n in arry do
begin
if umlMultipleMatch(p^.Filter_, umlGetFileName(n)) then
if umlFileExists(n) then
umlCacheFileMD5(n);
if not CacheThreadIsAcivted then
break;
end;
SetLength(arry, 0);
except
end;
p^.Directory_ := '';
p^.Filter_ := '';
Dispose(p);
AtomDec(CacheFileMD5FromDirectory_Num);
end;
procedure umlCacheFileMD5FromDirectory(Directory_, Filter_: U_String);
var
p: PCacheFileMD5FromDirectoryData_;
begin
AtomInc(CacheFileMD5FromDirectory_Num);
new(p);
p^.Directory_ := Directory_;
p^.Filter_ := Filter_;
TCompute.RunC(p, nil, {$IFDEF FPC}@{$ENDIF FPC}DoCacheFileMD5FromDirectory);
end;
initialization
FileMD5Cache := TFileMD5Cache.Create;
CacheFileMD5FromDirectory_Num := 0;
CacheThreadIsAcivted := True;
finalization
CacheThreadIsAcivted := False;
while CacheFileMD5FromDirectory_Num > 0 do
TCompute.Sleep(1);
if ExLibs <> nil then
DisposeObject(ExLibs);
DisposeObject(FileMD5Cache);
end.
| 28.021549 | 164 | 0.633463 |
475004c73bf5070d3c3c5536a299dce098bb38d7 | 85,030 | dfm | Pascal | Test/Demo/main.dfm | jonathanneve/copycat | 592f7d689e30d40b3d2c3caa89d418364f4d43ab | [
"MIT"
]
| 5 | 2022-03-20T13:52:39.000Z | 2022-03-31T11:27:46.000Z | Test/Demo/main.dfm | jonathanneve/copycat | 592f7d689e30d40b3d2c3caa89d418364f4d43ab | [
"MIT"
]
| null | null | null | Test/Demo/main.dfm | jonathanneve/copycat | 592f7d689e30d40b3d2c3caa89d418364f4d43ab | [
"MIT"
]
| 3 | 2022-03-20T13:38:49.000Z | 2022-03-24T18:55:15.000Z | object MainForm: TMainForm
Left = 267
Top = 109
Caption = 'Simple CopyCat Demo'
ClientHeight = 577
ClientWidth = 784
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object PageControl: TPageControl
Left = 6
Top = 3
Width = 771
Height = 566
ActivePage = tsIntroduction
TabOrder = 0
object tsIntroduction: TTabSheet
Caption = 'Introduction'
ImageIndex = 2
object Label2: TLabel
Left = 8
Top = 8
Width = 744
Height = 38
Caption =
'Welcome to this demo application, which will show you how to set' +
' up a basic bi-directional replication engine using CopyCat !'
Font.Charset = ANSI_CHARSET
Font.Color = clMaroon
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label4: TLabel
Left = 8
Top = 64
Width = 205
Height = 19
Caption = 'Here'#39's what you need to do :'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Image1: TImage
Left = 24
Top = 96
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label5: TLabel
Left = 56
Top = 96
Width = 363
Height = 19
Caption = 'Drop two connector components on the form'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label6: TLabel
Left = 56
Top = 120
Width = 691
Height = 96
Caption =
'Go to the "CopyCat connectors" tab on your component palette and' +
' select the type of connector you need. '#13#10'If you don'#39't have that' +
' tab, you need to start by installing at least one connector. To' +
' do so, simply open one of the CopyCatXXX_***.dpk package files ' +
'in the Connectors subdirectory of your Copycat install, and comp' +
'ile and install it into the IDE. '#13#10'The connector to choose depen' +
'ds on the 3rd party connectivity libraries you have available to' +
' you. For a full list of supported connectors, check here : http' +
'://copycat.fr/wordpress/supported-connectors/'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Image2: TImage
Left = 24
Top = 240
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label7: TLabel
Left = 56
Top = 240
Width = 442
Height = 19
Caption = 'Configure these connectors to point to your databases'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label8: TLabel
Left = 56
Top = 264
Width = 703
Height = 32
Caption =
'In the object inspector, set the properties of your connector co' +
'mponents to point to two different databases of your choice.'#13#10
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Image3: TImage
Left = 24
Top = 304
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label9: TLabel
Left = 56
Top = 304
Width = 216
Height = 19
Caption = 'Edit the FormCreate event'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label10: TLabel
Left = 56
Top = 328
Width = 601
Height = 48
Caption =
'Go to the FormCreate method implementation in the code for this ' +
'form. '#13#10'Edit the line reading "LocalConnection := XXX" to replac' +
'e "XXX" by the name of your first connector.'#13#10'Edit the line read' +
'ing "RemoteConnection := YYY" to replace "YYY" by the name of yo' +
'ur second connector.'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Image4: TImage
Left = 24
Top = 395
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label11: TLabel
Left = 56
Top = 395
Width = 215
Height = 19
Caption = 'Compile and run the demo'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label12: TLabel
Left = 56
Top = 419
Width = 672
Height = 64
Caption =
'If all goes well, you should be able to compile the demo.'#13#10'If yo' +
'u can'#39't get the demo to compile, or if it fails at runtime, plea' +
'se send it to our support team, and we will help you get it work' +
'ing.'#13#10
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Image5: TImage
Left = 24
Top = 503
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label13: TLabel
Left = 56
Top = 503
Width = 322
Height = 19
Caption = 'Proceed to the Configuration tab above'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label21: TLabel
Left = 56
Top = 473
Width = 553
Height = 16
Caption =
'Click here to access our support forums : http://copycat.fr/word' +
'press/discussions/'
Font.Charset = ANSI_CHARSET
Font.Color = clBlue
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold, fsUnderline]
ParentFont = False
WordWrap = True
OnClick = Label21Click
end
end
object TabSheet1: TTabSheet
Caption = 'Configuration'
object Label1: TLabel
Left = 288
Top = 172
Width = 63
Height = 13
Caption = 'Local tables :'
end
object Label14: TLabel
Left = 8
Top = 8
Width = 722
Height = 38
Caption =
'The configuration step is where you will define which tables to ' +
'replicate, and create the necessary meta-data in your databases ' +
'in order to replicate these tables.'
Font.Charset = ANSI_CHARSET
Font.Color = clMaroon
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label15: TLabel
Left = 48
Top = 64
Width = 309
Height = 19
Caption = 'Start by connecting to your databases'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object btConnect: TSpeedButton
Left = 376
Top = 56
Width = 105
Height = 41
GroupIndex = 1
Caption = 'Connect'
Glyph.Data = {
F6060000424DF606000000000000360000002800000018000000180000000100
180000000000C006000000000000000000000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
898989626262606060848484FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFA4A4A45A5A5A656565646464575757AAAAAAFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAAAA818181D0D0D0D4D4D4B8B8B89797976A6A6AAE
AEAEFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF9E9E9E9B9A99D8D5D4D4D1CFB9B6
B49C9A99747372A5A5A5FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFA29E9D848181
78929D65828D5F7A866378816E6968A7A5A4FF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF6AA3B70087BA0091CA069DCF079CCE008FC7007EB178A0B0FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFACB2B50794C628CBF513B2E81DBDE71CBCE612AFE424C3F00D
81B1AEAEAEFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FF88AEBD0EABDB28CDF717BBEF28CCF628CB
F516B8EC28CAF4038FC1A3B0B5FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF43A5CA20C9F429D3FC
15C1F528D0FB27CFFA15BDF226CCF818B3E15A9DBAFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6EB8D110
B5E52ED9FF2FD9FF1DC5F92FD7FF2BD6FF20C5F742D7FC2DD2FD0A98CB77AABF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF79B8CE0EB2E03ADDFF3CDAFF41DCFF30CBF940DBFF3BDBFF22C8F939D9FF6E
E1FD37D6FD0695C789ADBCFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFAAB4B50DAAD941DFFF46DDFF4EDFFF52E2FF48D8FB50E1FE4BDE
FE3AD4FB36D8FF48DBFF82E6FE29D1FB148AB8AFAFAFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF75B5C926C7F154E3FF55E2FF5CE4FF5FE4FE
5BE0FC5AE0FD54DEFD4BDBFC42D9FD33D9FE78E5FF5DE0FF059FD094ADB9FF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF54B8D652DBFC89ECFF64
E7FF6CE9FF72ECFF73ECFF70EBFF68E9FF5EE4FF52E0FF43DCFF53DDFF83E8FF
0FB3E376A6BAFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF47BA
DD68E3FE96F0FF76EBFF7AEEFF82F0FF82F0FF7FEFFF76ECFF6AE8FF5BE5FF4D
DFFF3DDBFF8EEBFF14BBEA6DA5BCFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FF53BCDB60E1FCA8F3FF8BF0FF87F2FF91F6FF95F7FF8DF3FF81F1
FF73EBFF62E6FF53E1FF3FDCFF7AE8FF12B7E674A8BBFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF77BDCD36D4F7B9F5FF9DF3FF93F5FF9FFAFF
A5FBFF98F8FF88F2FF77EEFF68E7FF56E2FF43DDFF5CE3FF07A6D895AFB9FF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFABB4B412C3F29FF4FFB6
F6FFA3F6FFA1FAFFA7FCFF99F8FF8AF2FF77EEFF68E7FF56E2FF4BE0FF3CDCFF
1995C1AFAFAFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF62C1D637D9FAB9F9FFB7F7FFA6F7FF9BF7FF8EF4FF81F0FF73EBFF63E6FF54
E2FF49E2FF10AADB84B2C2FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFAFAFAF35BBE03DD9FAAEF7FFBDF9FFA8F6FF94F3FF82EE
FF73EBFF60E7FF53E6FF1AB6E461B1CEFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFAFAFAF5CC1D816C6F357DEF8
91F2FF93F4FF88F1FF70EAFF39CCF111A6D476B5CBFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFA5B5B862B5CC34B3D627B2DB27B0D736A7CB66ABBFAAB2B5FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
OnClick = btConnectClick
end
object btDisconnect: TSpeedButton
Left = 483
Top = 56
Width = 105
Height = 41
GroupIndex = 1
Down = True
Caption = 'Disconnect'
Glyph.Data = {
F6060000424DF606000000000000360000002800000018000000180000000100
180000000000C006000000000000000000000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
898989626262606060848484FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFA4A4A45A5A5A656565646464575757AAAAAAFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAAAA818181D0D0D0D4D4D4B8B8B89797976A6A6AAE
AEAEFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF9E9E9E999A9AD4D5D5CFD1D1B4B6
B6999A9A727373A5A5A5FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF9D9E9E818282
9D93938E8383877B7B837A7A686A6AA4A5A5FF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFB8A4A4B97F7FBD7F7FC98A8AC78888BC7E7EB07878B3A2A2FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFB4B1B1C38E8EE5A8A8CF9494D99E9ED89B9BCD8F8FE4A0A0B2
8181AEAEAEFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFBCAFAFD29D9DE6B1B1D59F9FE6B0B0E6AF
AFD39B9BE5AAAABE8686B5B0B0FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFCCA8A8E2B2B2E8BABA
D6A8A8E7B8B8E6B5B5D5A2A2E6B1B1D59E9EBCA0A0FF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFD1B9B9DB
AAAAEAC1C1EBC1C1D8AFAFEBC1C1E9BFBFD9ADADEBBEBEE8B4B4C69090BFABAB
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFCEB9B9D9AAAAEDC6C6EDC6C6EECACADCB7B7EFC9C9EDC7C7D9B1B1ECC4C4EE
CFCFEABABAC48F8FBEAFAFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFB4B2B2D6A6A6EEC9C9EECBCBEED0D0F2D4D4DEC1C1F1D3D3EECE
CEDEBBBBEDC5C5EDC9C9F2D6D6E7B4B4B98B8BAFAFAFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFC9B5B5E5BCBCEFD2D2EFD3D3F3D9D9E3CBCB
D1B9B9DAC0C0D4B8B8D9BBBBD2B0B0ECC3C3F1D6D6EECACACA9292B9AFAFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFD7B9B9EDCECEF6E2E2F2
DBDBF3DEDEDBC8C8DBC9C9E4D2D2DDC6C6E5CBCBDCBEBEE2BFBFEECBCBF3DADA
D5A1A1BBA8A8FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFDDBB
BBF1D7D7F5E7E7F6E3E3F4E4E4D4C6C6E7D8D8E4D6D6E2D0D0E2CDCDD4B9B9E8
C8C8ECC7C7F4DEDED9AAAABDA6A6FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFDCBDBDF0D5D5F8EBEBF7E9E9F9EDEDF8F0F0FBF3F3F0E6E6F6E8
E8E6D2D2F3DADAF1D3D3ECC7C7F3D8D8D7A7A7BDA9A9FF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFCDBDBDF0CCCCF9EFEFF8EDEDF9F1F1FDF9F9
FEFDFDFCF4F4F9ECECF6E5E5F2DCDCEFD2D2EDC9C9F0D1D1D09D9DB9AFAFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFB4B4B4F1C3C3F6E9E9FA
F0F0FAF2F2FDF8F8FDF9F9FAF4F4F9EBEBF5E4E4F2DADAEFD2D2EECBCBEEC7C7
C19595AFAFAFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFD6C3C3F6D2D2F8EFEFFAF2F2FAF2F2FAF2F2F8EEEEF7E7E7F4E0E0F2D8D8EE
D1D1EFCDCDD4A3A3C3B2B2FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFAFAFAFE5C1C1F7D5D5F8EEEEFBF3F3FAEFEFF7EBEBF7E4
E4F4DFDFF1D7D7F0D0D0DBAEAED1B4B4FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFAFAFAFD7C2C2F2C7C7F3D7D7
F6E7E7F6E7E7F6E3E3F3DCDCE7C1C1D3A4A4CCB5B5FF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFB8B6B6CDB5B5D9B4B4DDB4B4DAB0B0CFAAAAC1ACACB4B1B1FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
OnClick = btDisconnectClick
end
object Label16: TLabel
Left = 48
Top = 112
Width = 407
Height = 19
Caption = 'Now check the tables that you want to replicate...'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label17: TLabel
Left = 8
Top = 152
Width = 146
Height = 57
Caption = '... from the local DB to the remote DB :'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold, fsItalic]
ParentFont = False
WordWrap = True
end
object Label18: TLabel
Left = 392
Top = 144
Width = 130
Height = 57
Caption = '... and from the remote DB to the local DB :'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold, fsItalic]
ParentFont = False
WordWrap = True
end
object Label3: TLabel
Left = 56
Top = 400
Width = 409
Height = 19
Caption = 'Now, simply press the Configure databases button'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Image6: TImage
Left = 16
Top = 64
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Image7: TImage
Left = 16
Top = 112
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Image8: TImage
Left = 24
Top = 400
Width = 24
Height = 24
Picture.Data = {
07544269746D6170F6060000424DF60600000000000036000000280000001800
0000180000000100180000000000C00600000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFAAAEAA6BA16B3595351C8D1C1C8D1C3492346A9E6AA9ADA9FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FF8AAC8A1894180FA3171EB62E23BC3621BA3218AF240B9A0F17
8D1788A888FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FF8AAE8A08960827C03B31CA492EC7442CC54129C2
3D25BE3821BC3417AF25088B0888A888FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFA9AEA91796172CC44237D05335CE4F
33CC4D31CA4A2EC7452AC33F26C03922BC3417AF23178D17A9ADA9FF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF6AA56A16AF2140
D95F3CD55A3CD55B3AD35737D05334CD4E30C9492BC44226C03A21BC340B9A10
6A9E6AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF359E3634CD4F43DC6743DC6644DD6442DB613DD65C39D25635CE4F30C9472A
C33F25BE3818B025349234FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FF1A9E2146DF694AE36F4AE36F49E26E47E06A43DC6640D9
5F39D25634CD4F2EC74529C23D21BB311A8C1AFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF1F9F254CE57251EA7951EA7B51EA78
4EE77348E16E43DC663DD65C37D05331CA492AC34123BD361A8E1AFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF3BA54443DC6858
F18358F18456EF8352EB7C4EE77448E16B40D9603BD45833CC4D2DC6441EB62E
349334FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FF6FAB762BC44660F99160F98F5DF68B56EF8151EA7949E26F42DB633BD45934
CD5031CA480FA3176AA16AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFA9AEAA26AB3752EB7E66FF9A5FF88F57F08350E97A49E2
6E44DD643DD65B37D05227BE3B189418A9AEA9FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8EB29320B13952EB7E60F98F
57F08350E97849E26E44DD663FD85E2BC4420897088AAC8AFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF8E
B39426AB3A2BC44643DC684CE57246DF6934CD4F17B0221797178AAE8AFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFAAAFAB70AC773CA6451EA1271D9D2236A0376AA66AA9
AEA9FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label19: TLabel
Left = 56
Top = 435
Width = 642
Height = 32
Caption =
'You should get a message telling you that all went well.'#13#10'If you' +
' get an exception, please contact our support team with a screen' +
'shot and / or a copy of this demo project.'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object Label20: TLabel
Left = 56
Top = 483
Width = 553
Height = 16
Caption =
'Click here to access our support forums : http://copycat.fr/word' +
'press/discussions/'
Font.Charset = ANSI_CHARSET
Font.Color = clBlue
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = [fsBold, fsUnderline]
ParentFont = False
WordWrap = True
OnClick = Label21Click
end
object clbTables: TCheckListBox
Left = 160
Top = 147
Width = 210
Height = 225
IntegralHeight = True
ItemHeight = 13
TabOrder = 0
end
object clbTablesRemote: TCheckListBox
Left = 536
Top = 139
Width = 210
Height = 225
IntegralHeight = True
ItemHeight = 13
TabOrder = 1
end
object btConfigure: TBitBtn
Left = 496
Top = 387
Width = 177
Height = 41
Caption = 'Configure databases'
Glyph.Data = {
F6060000424DF606000000000000360000002800000018000000180000000100
180000000000C006000000000000000000000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFADAEAD6B956B2E7D2B18730D186F0C2D7829689168ACAC
ACFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFB8AFAFBB
A3A3BB9898BC9393B88A8AB88989C3B5AB2F882A048F01049300078E00158600
2C7500286D002777249FA99FFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFBCB4
B4DFB5B5E6B8B8E9BCBCE8B8B8DDABABDDABABE9CDCC379331069F0D009F0635
BE4E18B231009700009700178300366C00277624ABADABFF00FFFF00FFFF00FF
FF00FFBCB2B2E8BCBCFFDEDEF6D0D0EDC1C1E3B2B2D8A5A5E0B6B693B28318A4
2302A51257C46BFFFAFFF8FDFF21B83F0099000099001A8100286D00689068FF
00FFFF00FFFF00FFFF00FFD1AEAEFFE4E4FDDADAF4CCCCEFC6C6EEC7C7ECBEBE
F2D2D2469F4027B83C47B752FDEEFCFFF5FDFFFDFFFAFFFF22B940009900009A
003374002C7A29FF00FFFF00FFFF00FFFF00FFD7B1B1FFE3E3FFEBEBEDD4D4E0
BDBDD4A4A4C59393DDC1C12C9F3125AE33FCE6F9FAEDF958C267A2DBAAFFFFFF
FAFFFF21B83E0099001C840017730BFF00FFFF00FFFF00FFFF00FFDBB3B3FEF6
F6ECC9C9F0C8C8EEC1C1E5B5B5DBA9A9ECD0D032A33546C86645AD4D42B34A15
B93B09B029A4DCABFFFFFFF8FFFE1EB83C0B8B0016740BFF00FFFF00FFFF00FF
FF00FFD6B1B1FFE2E2FEDADAF3CCCCECC0C0E3B1B1D8A5A5E7C6C648A44473DD
9424C5562AC75928C25323BC4808AF29A1D9A9FFFCFFF8FAFE1EA4232C7F2AFF
00FFFF00FFFF00FFFF00FFDFB7B7FFE4E4FDD8D8F4CCCCF2CCCCF3CECEEFC6C6
EFC7C79ABA895AC97459D7842FCB632EC85F29C25221BA4306AC229CD5A3C9E9
D20E97126A966AFF00FFFF00FFFF00FFFF00FFE3B8B8FFE8E8F5E3E3E7CDCDDD
B7B7D19E9EC28E8EC18E8EDABFBE3EA33A79DE9C56D6832ECA6028C35622BB46
1AB43709AB2000A311278727ADAEADFF00FFFF00FFFF00FFFF00FFE1BCBCF9EE
EEF7D1D1F5CCCCEFC1C1E6B5B5DCAAAADCA9A9DCABABD8C9BE41A53D5BCB7673
DF9A4BD07335C3592CBD4816A7262A8C25A1ABA1FF00FFFF00FFFF00FFFF00FF
FF00FFDEB7B7FFE1E1FCD9D9F3CCCCECC0C0E3B3B3D9A6A6D9A6A6D7A4A4D09F
9FDBC0BE8EAF7D44A24032A5372CA1313A9536759665A78D8CFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFE8BDBDFFE2E2FCD8D8F4CCCCEFC2C2E9BFBFE5B9B9
E4B2B2E0ADADD8A5A5CD9A9ACFA5A5D2B1B1D1B5B5C8ACACB494949168686B3C
3CFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFE9BFBFFFEAEAFAE9E9EBD0D0E5
C1C1DBADADCE9B9BC99595C59292BC8989B68383B38080AC7979A673739B6868
9663637F4C4C673737FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFE6C1C1F9E8
E8F3CDCDF5CCCCEEC0C0E4B3B3DAA8A8DBA8A8DAA7A7D09D9DC79494BE8B8BB4
8181AC79799A6767824F4F845151714040FF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFEBC0C0FFE0E0FDDADAF3CCCCECC0C0E3B3B3DAA8A8D9A6A6D8A5A5CE9B
9BC59292BC8989B38080AB78789A67678855557845456A3C3CFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFEEC5C5FFE2E2FBD8D8F3CBCBECBEBEE2B0B0D7A4A4
D8A3A3D7A3A3CC9898C39090BB8787B27F7FAA77779A67678855557845456D40
40FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFF0C4C4FFE0E0FDE1E1F8DEDEF7
DBDBF4D4D4EFCBCBEEC7C7EBC1C1E4B7B7DAACACCE9E9EC29090AF7C7C9D6A6A
8956567441416D3D3DFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFEFC9C9FFFC
FCFCD8D8F8CACAF4C0C0F0BBBBEDB9B9EAB6B6E7B4B4E4B1B1E3B0B0E2AEAEE0
ADADDEABABD7A4A4CC9999A87575754747FF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFC8BCBCF7C6C6F8C4C4F7C3C3F8C4C4F5C2C2F2BFBFF0BDBDEDBABAEAB7
B7E8B5B5E5B3B3E4B1B1E3B0B0DBA7A7CB98989E6E6E9A7F7FFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFB0AFAFC1B1B1CBB3B3D1AFAFD4AFAFD7ABAB
D5A8A8D0A2A2CD9E9EC79A9ABD9292B58B8BA78787A48888A59393ACA8A8FF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
TabOrder = 2
OnClick = btConfigureClick
end
end
object TabSheet2: TTabSheet
Caption = 'Replication'
ImageIndex = 1
object Label22: TLabel
Left = 8
Top = 67
Width = 591
Height = 19
Caption =
'If all went well in the previous steps, you can simply launch re' +
'plication...'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label23: TLabel
Left = 8
Top = 103
Width = 240
Height = 19
Caption = '... and see the results below :'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label24: TLabel
Left = 64
Top = 403
Width = 472
Height = 57
Caption =
'Your changes weren'#39't replicated correctly? Please contact our su' +
'pport team with the contents of this log to describe your proble' +
'm.'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label25: TLabel
Left = 575
Top = 405
Width = 152
Height = 36
Caption = 'Click here to access our support forums'
Font.Charset = ANSI_CHARSET
Font.Color = clBlue
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = [fsBold, fsUnderline]
ParentFont = False
WordWrap = True
OnClick = Label21Click
end
object Label26: TLabel
Left = 64
Top = 475
Width = 472
Height = 38
Caption =
'All went well? Great!'#13#10'Now have a look at the code. You'#39'll see, ' +
'it'#39's pretty simple.'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Image9: TImage
Left = 8
Top = 408
Width = 32
Height = 32
Picture.Data = {
07544269746D6170360C0000424D360C00000000000036000000280000002000
0000200000000100180000000000000C00000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFABABAE4C53B31019B30914B10913AF0913AD0912AB0911AB
0910A9090FA7090EA5090DA4090CA0090BA0090A9D090A9B0909990909990909
9909099909099909099909099909099909099911119A4E4EA1ABABAEFF00FFFF
00FFFF00FFFF00FF4A52B50D22C72C41D40015C70015C50016C30014C30013C0
0012BE0011BC0010B9000EB7000DB5000CB3000BB1000AAF0009AD0008AB0007
A90007A70006A50005A30004A20003A000029F00029D00019C4E4EA1FF00FFFF
00FFFF00FFFF00FF0D1BBD4259E0223DDA001CD5001ED3001CD2001BD1001ACF
031FD2011CCF0018CA0016C90015C50014C30013C10012C00011BC0010BA000B
B50919BE0009B1000BB00009AD0008AC0006A600029F00029E0F0F98FF00FFFF
00FFFF00FFFF00FF0D20BF4A65EE2141E40022E00022DF0022DE0021DD0021DE
2354FF2354FE001DD9001DD5001CD4001CD10019D00018CC0017CA000EC32F57
EF4A7CFF061BC6000EBA000EB7000EB5000CB10005A500029E060699FF00FFFF
00FFFF00FFFF00FF0C1FC44F6BF12344E90023E50025E40024E30024E40F43FF
B2BFE9A9B9EC194CFD001EDA001ED7001DD5001CD2001ACF0011C92953EF95B2
FEE9EDF84677FF0419C5000DB9000EB7000EB50007A90003A0060699FF00FFFF
00FFFF00FFFF00FF0D21C75671F62648ED0026EA0027E90027E9063BFFA4B3E8
EBE8DEF0ECE1A2B3F0194CFD001EDB001FD9001ED60016D1214EF18DAAFEFFFF
F7FFFFF9E1E9FC4575FF0319C5000DB9000EB80008AB0004A2060699FF00FFFF
00FFFF00FFFF00FF0D23C85B78F8284DF20027EF0029EF0032FF9FAFE8EAE7DD
E1E0E0E4E4E3F2EEE5A4B5F2184AFC001FDD001BD81B47F386A4FEFFFFF7FBFB
F9FBFBFBFFFFFDE4ECFF4374FF0318C4000EBA000AAD0005A3060699FF00FFFF
00FFFF00FFFF00FF0E25CA617FFD2B51F60028F40027FF9BABE6E8E5DBE1E0DF
E1E1E1E4E4E4E9E8E7F7F4E9A3B6F41245FB103EF27C9CFEFFFFF6FBFBF9FBFB
FBFDFDFDFEFEFEFFFFFFE4EDFF4272FF0218C40009AF0006A5060699FF00FFFF
00FFFF00FFFF00FF0F26CC6785FF2E55F90025F99BA9E3E9E5D9DFDEDDDFDFDF
E2E2E2E5E5E5E8E8E8EBEAEAFCF8ED9DB1F7698CFCFFFFF5FBFAF8FAFAFAFDFD
FDFEFEFEFFFFFFFFFFFFFFFFFFEAF1FF4778FF0716BA0006A7060699FF00FFFF
00FFFF00FFFF00FF0F28CE6C8CFF3059FE0024F67388E7EEEADADEDEDDE0E0E0
E3E3E3E6E6E6E9E9E9EBEBEBEFEFEEF9F7F1FDFCF4FAF9F7F9F9F9FCFCFCFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFB3C7FF3560F4000CB40007A906069AFF00FFFF
00FFFF00FFFF00FF1029D17293FF3661FF0034FF0021F77488E8F0ECDDE3E3E1
E4E4E4E6E6E6E9E9E9ECECECEFEFEFF2F2F2F5F5F5F8F8F8FAFAFAFDFDFDFEFE
FEFFFFFFFFFFFFFFFFFFAFC5FF2E5CF50010C5000EB70008AB06079CFF00FFFF
00FFFF00FFFF00FF102AD37B9BFF3966FF0039FF033AFF0022F7748AE9F3EFE0
E5E5E4E7E7E7EAEAEAEDEDEDF0F0F0F3F3F3F5F5F5F8F8F8FBFBFBFFFFFFFFFF
FFFFFFFFFFFFFFABC1FF2654F70014CB0017C9000FB90009AD06089FFF00FFFF
00FFFF00FFFF00FF102CD581A2FF3F6CFF043FFF0640FF053EFF0021F5798EEB
F6F2E3E8E8E7EAEAEAEDEDEDF0F0F0F3F3F3F6F6F6F9F9F9FCFCFCFEFEFEFFFF
FFFFFFFFA9BFFF1E4EF70018D2001ACF0018CC0010BC000AAF0609A1FF00FFFF
00FFFF00FFFF00FF112ED789ABFF4272FF0444FF0945FF0945FF0642FF0021F6
798EECF1EFE7EAEAEAEDEDEDF0F0F0F3F3F3F6F6F6F9F9F9FCFCFCFEFEFEFFFF
FFA0B6FF1345F9001BD9001ED6001CD20019D00012BE000BB1060AA3FF00FFFF
00FFFF00FFFF00FF1230D98FB1FF4878FF0849FF0B4BFF0A49FF094AFF002EF7
2649EEF0EFE7EAEAEAEDEDEDF0F0F0F3F3F3F6F6F6F9F9F9FCFCFCFEFEFEFFFF
FF6E8FFF0B39F3001CDA001FD9001DD5001CD10013C0000CB3060BA5FF00FFFF
00FFFF00FFFF00FF1231DF96B7FF4B7FFF094EFF0F50FF0E51FF0030F02D49E4
F4F1E4EAEAE7EAEAEAEDEDEDF0F0F0F3F3F3F6F6F6F8F8F8FBFBFBFFFFFEFFFF
FFFFFFFF7797FF0D3CF4001CDA001ED7001CD50014C3000DB5060CA9FF00FFFF
00FFFF00FFFF00FF1335E09DBDFF4F83FF0D53FF115AFF0031EB2A41DBEFEDE1
E8E7E4E6E6E6E9E9E9ECECECEFEFEFF2F2F2F5F5F5F8F8F8FBFBFBFDFDFDFFFF
FFFFFFFFFFFFFF7494FF0C3BF3001BD7001DD60015C5000EB7060DABFF00FFFF
00FFFF00FFFF00FF1335E2A4C3FF558AFF0F5DFF0033E7293CD1ECE9DDE4E3E0
E3E3E3E6E6E6E9E9E9ECECECEEEEEEF1F1F1F4F4F4F7F7F7FAFAFAFCFCFCFEFE
FEFFFFFFFFFFFFFFFFFF7495FF0D3BF2001BD60016C7000FB9060FADFF00FFFF
00FFFF00FFFF00FF1437E4AACBFF5A93FF0035E22734C6E9E7DBE1E0DDE1E1E0
E2E2E2E5E5E5E8E8E8EBEBEBEEEEEDF9F6F0FCFAF3F8F8F6F8F8F8FBFBFBFDFD
FDFEFEFEFFFFFFFFFFFFFFFFFF7193FF123FF20015C80010BB0610B0FF00FFFF
00FFFF00FFFF00FF1437E6B1D0FF5A8CF90000B5CCCBD5E3E2DADCDCDCDFDFDF
E1E1E1E4E4E4E7E7E7ECECEAFCF9EC8C9EEF8EA0F2FFFFF4F9F9F7F9F9F9FBFB
FBFFFFFFFEFEFEFFFFFFFFFFFFFFFFFF2559FF0724D20011BD0611B2FF00FFFF
00FFFF00FFFF00FF163AE8B8D5FF629DFF0D52F0000EB8D0CFD8E1E1DCDEDEDE
E0E0E0E3E3E3E8E8E6F8F5E995A3E8001AEE001DF299AAF2FFFFF5F8F8F7F9F9
F9FDFDFDFEFEFDFFFFFEFEFEFF2958FF032BE70017CB0013BF0612B4FF00FFFF
00FFFF00FFFF00FF163AEABDDAFF649EFF1A70FF1154EE010FB8D1D0D9E4E3DE
DFDFDFE3E3E2F3F1E598A1E20017E20847FF0641FF001CF199AAF3FFFFF5F8F8
F7F9F9F9FFFFFBFBFCFD2151FF0029EB001FDD001ACE0013C10613B6FF00FFFF
00FFFF00FFFF00FF163CEEC3E0FF68A3FF1A72FF1F77FF1254EE020FB8D2D2DB
E6E5DFF0EFE3939DDC0012D90C4EFF0A4AFF0945FF053DFF001BF0A0AEF2FFFF
F5FFFDF7F6F8F91647FF0029EF0023E30023DF001BD00014C30614B8FF00FFFF
00FFFF00FFFF00FF173EF0C8E3FF6CA8FF1C77FF2276FF1F77FF1153EE030EB8
DFDEDC999ED6000ECE0F55FF0F52FF0B4BFF0945FF0641FF023AFF001BF0A3B0
F2FFFEF51140FE0028F30027E90025E40022E0001BD10015C50616BBFF00FFFF
00FFFF00FFFF00FF1941F2CDE8FF7CB3FF1978FF1F79FF1E75FF1D73FF0D4FED
0611B7000DC4105AFF1056FF0C50FF0B4BFF0746FF0642FF023CFF0034FF0020
EF1139F20027F40029EF0028EA0025E50023E1001BD20015C60617BDFF00FFFF
00FFFF00FFFF00FF0C36F0CEEBFFC2DEFF5DA1FF3E8DFF3D89FF3A84FF3983FF
2C61EC2F70FB2E71FF2B69FF2664FF245EFF1F59FF1D53FF194DFF1649FF1341
FD0F3BF6113BF51039F00F34EC0D32E70C30E2112CD62337CF1021C0FF00FFFF
00FFFF00FFFF00FF4860D94E7BFBCDEBFFCDE7FFCAE4FFC5E1FFC0DBFFBAD6FF
B3D3FFADCCFFA6C5FF9FBFFF98B8FF92B2FF8AABFF83A3FF7D9CFF7494FF6E8C
FF6786FE617FFC5B79F75672F3506BF04B65EB4459DF172CCE4C57BBFF00FFFF
00FFFF00FFFF00FFAAAAB04860D90C37F1143EF3133DF1123BF01239EE1138ED
1137EB1137E81036E81034E51034E30F31E10E2FE10E2FDF0D2DDB0D2CDA0E2A
D70D2AD60C28D40B26D20B26D00A24CF0C23CE0D24C94A56BDABABB0FF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Image10: TImage
Left = 8
Top = 480
Width = 32
Height = 32
Picture.Data = {
07544269746D6170360C0000424D360C00000000000036000000280000002000
0000200000000100180000000000000C00000000000000000000000000000000
0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FF91A5915C8E5C347E341A731A0D6C0D0C6C0C176F172E782E558855889F
88AEAEAEFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF7DA07D
2882280670001376001E7800247800267800287600277300247000196C000968
001D781D6F996FADADADFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFA1ABA1398A39057600
118300128B000F8A000E89001285001981002379002F71003071002F6F002E6E
00266E000C6800277C2796A696FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF91A791157A15028900029B00
009B00009800009900009700009700009400009500009100118500287500376B
00336D00316E00216C000B6B0B7F9D7FFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF93A8930E790E029504029E06029C06
029B05029B04019A010099000098000097000096000095000093000093000B88
00327000376C00336C00286C00056905809E80FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFA4ACA418801805980B05A10C059E0C059E0C
059E0C039C080DAC2311B12D09A5170099000099020098000096000095000092
000092002379003A6900346B00296C000B6B0B96A696FF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF4292420A930F0CA51509A31209A21309A213
08A3131DBF4985DCA4AAE7C15DD98A14B535009901029B050099010097000095
000092000092001E7B003A6A00336C001F6C00277B27ADADADFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FF89A88901830324B0300AA4180CA5190CA5190BA619
12B737C2E5CBFFF6FEFFF8FDFFFDFF68DC9214B535029B03039C07019A030098
00009600009400009300277800376C00326E000A69006E986EFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FF37913720A4291EAE2E0EA71F0FA81F0EA91F0BAF28
BAE0C4FBF2F8F3F2F2F5F5F5FCFAFCFFFFFF67DB9115B637039C07049D09029B
05009901009600009300009200366D00346D00276E001C761CAEAEAEFF00FFFF
00FFFF00FFFF00FF9FAA9F03820343C05315AC2812AB2511AA2501A717B5DBBB
F7EEF5EFEEEEF2F2F2F5F5F5F8F8F8FEFCFDFFFFFF66DA9115B637039C08049D
0A029B05009901009600009500128500386D00317000086B0088A088FF00FFFF
00FFFF00FFFF00FF709E7013981B4EC35F12AD2913AD2A009F06ADD4AFF3EBF2
EBEAEBEEEEEEF1F1F1F4F4F4F7F7F7FAFAFAFFFEFFFFFFFF66DA9116B738049D
09049D0A029B05009901009500009500327000317000196F00538853FF00FFFF
00FFFF00FFFF00FF48924829AB3753C56611AE2B009900A8CFAAEFE7EFE7E6E7
E9E9E9EFEEEFFBF3FAFFF8FFFCF9FCFAFAFAFDFDFDFFFFFFFFFFFF66DA9116B7
38049D08049D09029B040098000096001A81003171002472002D7A2DFF00FFFF
00FFFF00FFFF00FF2F8B2F3BB94E5BC96F04A2156CB669F1E5F1E3E2E3E5E5E5
EBE9EBFBF0F96DC87941BC53C2E5C8FFFBFFFBFAFBFEFEFEFFFFFFFFFFFF66DA
8F15B638039C08039C08019A03009800088E00337100297600147114FF00FFFF
00FFFF00FFFF00FF25892548C25E63CD7910AB2735A132F6E6F6E3E2E3E7E5E7
FAECF943B54A06AB1F14B23106AB21C5E6CAFFFCFFFDFCFDFEFEFEFFFFFFFFFF
FF65D98E15B637029B06039C06009A010098003074002B7700086E08FF00FFFF
00FFFF00FFFF00FF268A264DC46367CF7F2CC04F0092016DB56AF7E8F7F9EAF8
3BAD3D07A91B22BC4520B9401BB53907AB1FC5E6CAFFFCFFFBFAFBFDFCFCFFFE
FFFFFFFF65DA8F14B536019A04019A04009A00277D00297900096E09FF00FFFF
00FFFF00FFFF00FF328F3248C05E6AD28340C56023BF4B019A0F12920E1C9A17
06A71926C04F23BC4921BA441FB8421BB53905AA1EC5E7C9FFFBFFFAF9FAFAFA
FAFEFCFEFFFFFF63D88B13B435009901009C01218200267B00177517FF00FFFF
00FFFF00FFFF00FF4D964D39B64D6BD4875AD07925C14E2CC55826C14F24BE4C
2AC45627C05026BF4D24BD4A22BB4721BA421BB53906A91DC4E6C8FFFAFFF8F7
F8F8F8F8FBF9FAFFFDFF63D78B13B432009A001E85001E7A00328032FF00FFFF
00FFFF00FFFF00FF76A07620A52D6CD88B77D9932BC6582CC5592CC55B2CC55B
2DC65A2AC35629C25327C04F24BD4A22BB451FB8411AB43705A91BC2E5C8FFF8
FFF6F6F6F5F5F5F8F6F8FFF9FF5CD58507A71A1C85001479005A8F5AFF00FFFF
00FFFF00FFFF00FFA5ADA5078D076DD98F76DA9357D17C2CC85E30C96230C960
2FC8602DC65C2BC45829C25327C05024BD4921BA451EB83F19B33604A81BC1E3
C6FDF5FBF4F3F3F3F3F3FCF4FAAAE3BB0DB12A1E870006740090A590FF00FFFF
00FFFF00FFFF00FFFF00FF429A4243BD5976DC987FDF9E36CE6A32CB6532CB66
33CC6530C9622EC75E2BC45828C15225BE4C22BB471FB8421CB53A17B13104A7
19C0E1C3FDF3FBF7F1F6FFF2FF45C86807A3111A8300278527FF00FFFF00FFFF
00FFFF00FFFF00FFFF00FF95AD9507920974E09A7ADE9B72DD972FCB6233CC66
33CD6633CC6631CA622DC65B2AC35527C04F24BD4920B9431DB63C1AB33614AF
2D05A7199CD4A4B3DDBC3DC0590CAC220C9806067A007DA27DFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF53A0532EAF3F7AE1A07DDF9E6AD98E2DCB62
33CC6633CC6731CA642EC75D2BC45728C15124BD4A21BA441EB73E1BB43717B0
3113AD2807A71B07A91C0AA71906A10F0D8906378C37FF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFABAEAB2792274BC26379E09E7EDF9D6EDB91
33CD6631CC6532CC642FC85E2BC45828C15325BE4B21BA451EB73E1BB43818B1
3114AD2B11AA240EA71D0BA617079A0E157E15A1ABA1FF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FF9FAD9F1B8E1B4BC26478E19F79DE9A
7ADD9B4DD27A2ECB622DC85D2BC45828C15125BE4B21BA461EB73E1BB43918B1
3114AD2B11AA240FAA20099D140E800E91A891FF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF9FAD9F27922732B14176E19C
76DE9A79DE9B71DA944DCF7532C75D24C14E21BD471FBA421DB73B18B33616B0
2F15AD2B1BB12E09971218821892AA92FF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFABAEAB53A0530B950D
49C26373DF9B6FDC956ED88F6CD68A60D27F50CB6D43C5603CC2583AC0543BC0
5022A931048805419541A4ADA4FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF95AD95
429D4209920929AB3842BE5A51C86E55CD7452CA6D45C15D32B244199E240387
053796378AAA8AFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFA5ADA577A2774D984D329132268D26258C252F8E2F4894486F9F6F9FAB
9FFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FF}
Transparent = True
end
object Label27: TLabel
Left = 8
Top = 8
Width = 728
Height = 38
Caption =
'Now you can make some changes to your databases (in an external ' +
'tool), and then come back here to replicate them.'
Font.Charset = ANSI_CHARSET
Font.Color = clMaroon
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object btReplicate: TBitBtn
Left = 610
Top = 61
Width = 147
Height = 41
Caption = 'Replicate databases'
Glyph.Data = {
F6060000424DF606000000000000360000002800000018000000180000000100
180000000000C006000000000000000000000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FF7D7D7D5858585757575555555353535252524F4F4F4E4E4E4B4B4B7777
77FF00FFFF00FFFF00FFFF00FFFF00FF80808084838383828282808081808080
7F7F7F7E7E7E7C7CBEBDBD626262F7F7F7FBFBFBFBFBFBE9CCBCF1F1F1FBFBFB
FBFBFBF4F4F44C4C4CB3B3B3FF00FFFF00FFFF00FFFF00FF868484FFE5E5FFE6
E6FFE7E7FFE7E7FFE7E7A99999FFE6E6FFF3F36C6B6BFDFCFCFFFEFEF7E9E3AC
460EC6A495FFFDFDFFFDFDFCFAFA575555B3B3B3FF00FFFF00FFFF00FFFF00FF
878686FFE9E9FFEAEAFFEBEBFFEBEBFFEBEBA99C9CFFEAEAFFF4F4706F6FFFFD
FDFFFDFDC97F54A33D00B05218E1DBD9FFFDFDFCFAFA595757B4B4B4FF00FFFF
00FFFF00FFFF00FF888787FFEDEDFFEEEEFFEFEFFFEFEFFFEFEFA99E9EFFEEEE
FFF6F6717070FDFCFCE9C1AAA84101A53F00AA4200BD7D56F8F5F5FDFAFA5D5A
5AB5B4B4FF00FFFF00FFFF00FFFF00FF898888FFF0F0FFF2F2FFF2F2FFF3F3FF
F3F3A9A1A1FFF2F2FFF8F8747474F9EBE3B15215AA4501D29D7EAF4503B34802
CBAF9FFCF8F85F5D5DB5B5B5FF00FFFF00FFFF00FFFF00FF8A8A8AFFF4F4FFF5
F5FFF6F6FFF7F7FFF7F7A9A4A4FFF6F6FFFAFA777473C1743EAC4600D38E5DF5
F4F4D99B70AF4800BC5B19DBD4D1636161B6B6B6FF00FFFF00FFFF00FFFF00FF
898A8B8797A58898A68899A6899AA6899AA6899AA68899A6C9D1D7975A31AD47
00B86222E9E4E2ECEEF1ECE8E7BC6726B54D00BC7441575758B7B7B7FF00FFFF
00FFFF00FFFF00FF83898D52B8FF55BBFF56BCFF58BEFF58BEFF3A7DA956BCFF
B1DFFFAE5B1FB14E04826D606E73776B6E716C7176806A59B65102BB51008966
4DAFAFB0FF00FFFF00FFFF00FFFF00FF848A8E55BBFF57BDFF59BFFF5BC1FF5B
C1FF3C7FA959BFFF9AD7FFBD8F6CCCBFB6AFDDFFA6D8FF98BAD5A3D5FFABD8FF
C6AA94BA5300C25A069C8271ABABABFF00FFFF00FFFF00FF868B8F57BDFF5AC0
FF5CC2FF5EC4FF5FC5FF3E81A95BC1FF6CC6FFABD0E88ED1FF4FB5FF4BB1FF30
73A945ABFF42A8FFA3D4FFBF8350BE5800C05D0CAF9C8DFF00FFFF00FFFF00FF
878C9058BEFF5BC1FF5EC4FF61C7FF62C8FF4083A95DC3FF5AC0FF6AC4FF53B9
FF4FB5FF4CB2FF3074A945ABFF42A8FF3FA5FFABD7FFC06B20C15B00CF6D18FF
00FFFF00FFFF00FF888D9158BEFF5BC1FF5FC5FF62C8FF63C9FF4084A95DC3FF
5AC0FF56BCFF53B9FF50B6FF4CB2FF3074A946ACFF42A8FF3FA5FF6DB9FFCACF
D5C66108D06808FF00FFFF00FFFF00FF898E9257BDFF5BC1FF5EC4FF60C6FF61
C7FF3F83A95CC2FF59BFFF56BCFF53B9FF4FB5FF4CB2FF3074A945ABFF42A8FF
3FA5FF3BA1FF8BC6FED9B99BCE6A06FF00FFFF00FFFF00FF9293939AA3A99AA3
A99AA4A99AA4A99AA4A99AA4A99AA3A99AA3A99AA3A99AA2A999A2A999A0A898
9EA5989CA39899A098969E98949C969099ADADADC79768FF00FFFF00FFFF00FF
949494FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9A9A9FFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFCFCA9A4A4FFF4F4FFF1F1FFEDEDFFE9E9FDE4E4787878FF00FFFF
00FFFF00FFFF00FF959595FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9A9A9FFFFFF
FFFFFFFFFFFFFFFFFFFFFEFEFFFCFCA9A4A4FFF4F4FFF0F0FFECECFFE8E8FDE3
E3797979FF00FFFF00FFFF00FFFF00FF979797FFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFA9A9A9FFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFFFBFBA9A4A4FFF3F3FFF0F0
FFECECFFE8E8FDE3E37A7979FF00FFFF00FFFF00FFFF00FF989898FFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFA9A9A9FFFFFFFFFFFFFFFFFFFFFEFEFFFDFDFFF9F9A9
A3A3FFF2F2FFEEEEFFEBEBFFE7E7FDE2E27B7B7BFF00FFFF00FFFF00FFFF00FF
999999FDFDFDFDFDFDFDFDFDFDFDFDFDFDFDA8A8A8FDFDFDFDFDFDFDFDFDFDFC
FCFDFAFAFDF6F6A8A1A1FDEFEFFDECECFDE8E8FDE5E5FCE0E07C7C7CFF00FFFF
00FFFF00FFFF00FF9696969595959494949393939090908F8F8F8E8E8E8C8C8C
8B8B8B8A8A8A8989898888888787878585858484848383838181817F7F7F7E7E
7E808080FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF}
TabOrder = 0
OnClick = btReplicateClick
end
object memLog: TMemo
Left = 8
Top = 128
Width = 753
Height = 249
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
end
end
end
object Replicator: TCcReplicator
Version = '3.07.1'
AutoClearMetadata = True
FailIfNoPK = False
TrimCharFields = False
AutoPriority = True
OnReplicationResult = ReplicatorReplicationResult
LogErrors = False
HarmonizeFields = False
KeepConnection = False
AutoReplicate.Frequency = 30
AutoReplicate.Enabled = False
AutoCommit.Frequency = 30
AutoCommit.CommitType = ctNone
CommitOnFinished = ctCommit
AbortOnError = False
OnRowReplicated = ReplicatorRowReplicated
OnConflict = ReplicatorConflict
OnReplicationError = ReplicatorReplicationError
OnException = ReplicatorException
OnProgress = ReplicatorProgress
OnConnectionLost = ReplicatorConnectionLost
OnResolveConflict = ReplicatorResolveConflict
Left = 600
Top = 128
end
object RemoteConfig: TCcConfig
Version = '3.07.1'
FailIfNoPK = False
ConfigName = 'DEMO'
DatabaseNode = dnLocal
Terminator = #167
Tables = <>
Left = 688
Top = 120
end
object LocalConfig: TCcConfig
Version = '3.07.1'
FailIfNoPK = False
ConfigName = 'DEMO'
DatabaseNode = dnLocal
Terminator = #167
Tables = <>
Left = 520
Top = 128
end
object CcConnectionIBDAC1: TCcConnectionIBDAC
UserLogin = 'SYSDBA'
UserPassword = 'masterkey'
SQLDialect = 3
DBType = 'Interbase'
DBVersion = 'FB2.5'
DBName = 'C:\Projects\CopyCat\Test\Demo\FireDAC\DB1.FDB'
TRParams.Strings = (
'write'
'nowait'
'concurrency')
Left = 522
Top = 187
end
object CcConnectionIBDAC2: TCcConnectionIBDAC
UserLogin = 'SYSDBA'
UserPassword = 'masterkey'
SQLDialect = 3
DBType = 'Interbase'
DBVersion = 'FB2.5'
DBName = 'C:\Projects\CopyCat\Test\Demo\FireDAC\DB2.FDB'
TRParams.Strings = (
'write'
'nowait'
'concurrency')
Left = 682
Top = 187
end
end
| 54.71686 | 89 | 0.769517 |
85b92b327644d365ba3cc2b6879e410eb019c41b | 38,575 | pas | Pascal | Projects/CompWizard.pas | istvanszabo890629/issrc | c6823bfff8b16210e29f2976dcf07b8c0284e9fe | [
"FSFAP"
]
| null | null | null | Projects/CompWizard.pas | istvanszabo890629/issrc | c6823bfff8b16210e29f2976dcf07b8c0284e9fe | [
"FSFAP"
]
| null | null | null | Projects/CompWizard.pas | istvanszabo890629/issrc | c6823bfff8b16210e29f2976dcf07b8c0284e9fe | [
"FSFAP"
]
| null | null | null | unit CompWizard;
{
Inno Setup
Copyright (C) 1997-2020 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
Compiler IDE Script Wizard form
}
interface
{$I VERSION.INC}
uses
Windows, Forms, Classes, Graphics, StdCtrls, ExtCtrls, Controls, Dialogs,
UIStateForm, NewStaticText, DropListBox, NewCheckListBox, NewNotebook;
type
TWizardPage = (wpWelcome, wpAppInfo, wpAppDir, wpAppFiles, wpAppIcons,
wpAppDocs, wpPrivilegesRequired, wpLanguages, wpCompiler,
wpISPP, wpFinished);
TWizardFormResult = (wrNone, wrEmpty, wrComplete);
TWizardForm = class(TUIStateForm)
CancelButton: TButton;
NextButton: TButton;
BackButton: TButton;
OuterNotebook: TNewNotebook;
InnerNotebook: TNewNotebook;
WelcomePage: TNewNotebookPage;
MainPage: TNewNotebookPage;
AppInfoPage: TNewNotebookPage;
AppDirPage: TNewNotebookPage;
AppFilesPage: TNewNotebookPage;
AppIconsPage: TNewNotebookPage;
AppDocsPage: TNewNotebookPage;
PrivilegesRequiredPage: TNewNotebookPage;
LanguagesPage: TNewNotebookPage;
CompilerPage: TNewNotebookPage;
ISPPPage: TNewNotebookPage;
FinishedPage: TNewNotebookPage;
Bevel: TBevel;
WelcomeImage: TImage;
WelcomeLabel1: TNewStaticText;
PnlMain: TPanel;
Bevel1: TBevel;
PageNameLabel: TNewStaticText;
PageDescriptionLabel: TNewStaticText;
InnerImage: TImage;
FinishedLabel: TNewStaticText;
FinishedImage: TImage;
WelcomeLabel2: TNewStaticText;
EmptyCheck: TCheckBox;
WelcomeLabel3: TNewStaticText;
AppNameLabel: TNewStaticText;
AppNameEdit: TEdit;
AppVersionLabel: TNewStaticText;
AppVersionEdit: TEdit;
AppDirNameLabel: TNewStaticText;
AppRootDirComboBox: TComboBox;
AppRootDirEdit: TEdit;
AppDirNameEdit: TEdit;
NotDisableDirPageCheck: TCheckBox;
AppRootDirLabel: TNewStaticText;
AppPublisherLabel: TNewStaticText;
AppPublisherEdit: TEdit;
OtherLabel: TNewStaticText;
NotCreateAppDirCheck: TCheckBox;
AppFilesLabel: TNewStaticText;
AppFilesListBox: TDropListBox;
AppFilesAddButton: TButton;
AppFilesEditButton: TButton;
AppFilesRemoveButton: TButton;
AppURLLabel: TNewStaticText;
AppURLEdit: TEdit;
AppExeLabel: TNewStaticText;
AppExeEdit: TEdit;
AppExeRunCheck: TCheckBox;
AppExeButton: TButton;
AppGroupNameLabel: TNewStaticText;
AppGroupNameEdit: TEdit;
NotDisableProgramGroupPageCheck: TCheckBox;
AllowNoIconsCheck: TCheckBox;
AppExeIconsLabel: TNewStaticText;
DesktopIconCheck: TCheckBox;
QuickLaunchIconCheck: TCheckBox;
CreateUninstallIconCheck: TCheckBox;
CreateURLIconCheck: TCheckBox;
AppLicenseFileLabel: TNewStaticText;
AppLicenseFileEdit: TEdit;
AppLicenseFileButton: TButton;
AppInfoBeforeFileLabel: TNewStaticText;
AppInfoBeforeFileEdit: TEdit;
AppInfoBeforeFileButton: TButton;
AppInfoAfterFileLabel: TNewStaticText;
AppInfoAfterFileEdit: TEdit;
AppInfoAfterFileButton: TButton;
RequiredLabel1: TNewStaticText;
RequiredLabel2: TNewStaticText;
AppFilesAddDirButton: TButton;
ISPPCheck: TCheckBox;
ISPPLabel: TLabel;
OutputDirLabel: TNewStaticText;
OutputDirEdit: TEdit;
OutputBaseFileNameLabel: TNewStaticText;
OutputBaseFileNameEdit: TEdit;
SetupIconFileLabel: TNewStaticText;
SetupIconFileEdit: TEdit;
PasswordLabel: TNewStaticText;
PasswordEdit: TEdit;
SetupIconFileButton: TButton;
EncryptionCheck: TCheckBox;
OutputDirButton: TButton;
LanguagesLabel: TNewStaticText;
LanguagesList: TNewCheckListBox;
AllLanguagesButton: TButton;
NoLanguagesButton: TButton;
NoAppExeCheck: TCheckBox;
UseCommonProgramsCheck: TCheckBox;
PrivilegesRequiredLabel: TNewStaticText;
PrivilegesRequiredAdminRadioButton: TRadioButton;
PrivilegesRequiredLowestRadioButton: TRadioButton;
PrivilegesRequiredOverridesAllowedCommandLineCheckbox: TCheckBox;
PrivilegesRequiredOverridesAllowedDialogCheckbox: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormDestroy(Sender: TObject);
procedure NextButtonClick(Sender: TObject);
procedure BackButtonClick(Sender: TObject);
procedure FileButtonClick(Sender: TObject);
procedure AppRootDirComboBoxChange(Sender: TObject);
procedure NotCreateAppDirCheckClick(Sender: TObject);
procedure AppExeButtonClick(Sender: TObject);
procedure AppFilesListBoxClick(Sender: TObject);
procedure AppFilesListBoxDblClick(Sender: TObject);
procedure AppFilesAddButtonClick(Sender: TObject);
procedure NotDisableProgramGroupPageCheckClick(Sender: TObject);
procedure AppFilesEditButtonClick(Sender: TObject);
procedure AppFilesRemoveButtonClick(Sender: TObject);
procedure AppFilesAddDirButtonClick(Sender: TObject);
procedure AppFilesListBoxDropFile(Sender: TDropListBox;
const FileName: String);
procedure PasswordEditChange(Sender: TObject);
procedure OutputDirButtonClick(Sender: TObject);
procedure AllLanguagesButtonClick(Sender: TObject);
procedure NoLanguagesButtonClick(Sender: TObject);
procedure NoAppExeCheckClick(Sender: TObject);
procedure UseCommonProgramsCheckClick(Sender: TObject);
procedure PrivilegesRequiredOverridesAllowedDialogCheckboxClick(Sender: TObject);
private
CurPage: TWizardPage;
FWizardName: String;
FWizardFiles: TList;
FLanguages: TStringList;
FResult: TWizardFormResult;
FResultScript: String;
function FixLabel(const S: String): String;
procedure SetWizardName(const WizardName: String);
procedure CurPageChanged;
function SkipCurPage: Boolean;
procedure AddWizardFile(const Source: String; const RecurseSubDirs, CreateAllSubDirs: Boolean);
procedure UpdateWizardFiles;
procedure UpdateWizardFilesButtons;
procedure UpdateAppExeControls;
procedure UpdateAppIconsControls;
procedure GenerateScript;
public
property WizardName: String write SetWizardName;
property Result: TWizardFormResult read FResult;
property ResultScript: String read FResultScript;
end;
implementation
{$R *.DFM}
uses
SysUtils, ShlObj, ActiveX, UITypes,
PathFunc, CmnFunc, CmnFunc2, CompFunc, VerInfo, BrowseFunc,
CompMsgs, CompWizardFile;
type
TConstant = record
Constant, Description: String;
end;
const
NotebookPages: array[TWizardPage, 0..1] of Integer =
((0, -1), (1, 0), (1, 1), (1, 2),
(1, 3), (1, 4), (1, 5), (1, 6),
(1, 7), (1, 8), (2, -1));
PageCaptions: array[TWizardPage] of String =
(SWizardWelcome, SWizardAppInfo, SWizardAppDir, SWizardAppFiles,
SWizardAppIcons, SWizardAppDocs, SWizardPrivilegesRequired, SWizardLanguages,
SWizardCompiler, SWizardISPP, SWizardFinished);
PageDescriptions: array[TWizardPage] of String =
('', SWizardAppInfo2, SWizardAppDir2, SWizardAppFiles2,
SWizardAppIcons2, SWizardAppDocs2, SWizardPrivilegesRequired2, SWizardLanguages2,
SWizardCompiler2, SWizardISPP2, '');
RequiredLabelVisibles: array[TWizardPage] of Boolean =
(False, True, True, True, True, False, True, True, False, False, False);
AppRootDirs: array[0..0] of TConstant =
(
( Constant: '{autopf}'; Description: 'Program Files folder')
);
LanguagesDefaultIsl = 'Default.isl';
LanguagesDefaultIslDescription = 'English';
EnabledColors: array[Boolean] of TColor = (clBtnFace, clWindow);
function EscapeAmpersands(const S: String): String;
begin
Result := S;
StringChangeEx(Result, '&', '&&', True);
end;
function TWizardForm.FixLabel(const S: String): String;
begin
Result := S;
{don't localize these}
StringChange(Result, '[name]', FWizardName);
end;
procedure TWizardForm.SetWizardName(const WizardName: String);
begin
FWizardName := WizardName;
end;
{ --- }
type
TNotebookAccess = class(TNotebook);
procedure TWizardForm.FormCreate(Sender: TObject);
procedure AddLanguages(const Extension: String);
var
SearchRec: TSearchRec;
begin
if FindFirst(PathExtractPath(NewParamStr(0)) + 'Languages\*.' + Extension, faAnyFile, SearchRec) = 0 then begin
repeat
FLanguages.Add(SearchRec.Name);
until FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
end;
procedure MakeBold(const Ctl: TNewStaticText);
begin
Ctl.Font.Style := [fsBold];
end;
function SpaceLanguageName(const LanguageName: String): String;
var
I: Integer;
begin
Result := '';
for I := 1 to Length(LanguageName) do begin
if (I <> 1) and CharInSet(LanguageName[I], ['A'..'Z']) then
Result := Result + ' ';
Result := Result + LanguageName[I];
end;
end;
var
I: Integer;
begin
FResult := wrNone;
FWizardName := SWizardDefaultName;
FWizardFiles := TList.Create;
FLanguages := TStringList.Create;
FLanguages.Sorted := True;
FLanguages.Duplicates := dupIgnore; { Some systems also return .islu files when searching for *.isl }
AddLanguages('isl');
AddLanguages('islu');
FLanguages.Sorted := False;
FLanguages.Insert(0, LanguagesDefaultIsl);
InitFormFont(Self);
if Font.Name = 'Segoe UI' then begin
{ See Wizard.pas }
for I := 0 to OuterNotebook.PageCount-1 do
OuterNotebook.Pages[I].HandleNeeded;
for I := 0 to InnerNotebook.PageCount-1 do
InnerNotebook.Pages[I].HandleNeeded;
ClientWidth := MulDiv(ClientWidth, 105, 100);
end;
if FontExists('Verdana') then
WelcomeLabel1.Font.Name := 'Verdana';
TNotebookAccess(OuterNotebook).ParentBackground := False;
OuterNotebook.Color := clWindow;
MakeBold(PageNameLabel);
MakeBold(RequiredLabel1);
MakeBold(AppNameLabel);
MakeBold(AppVersionLabel);
MakeBold(AppRootDirLabel);
MakeBold(AppDirNameLabel);
MakeBold(AppExeLabel);
MakeBold(AppGroupNameLabel);
MakeBold(PrivilegesRequiredLabel);
MakeBold(LanguagesLabel);
FinishedImage.Picture := WelcomeImage.Picture;
RequiredLabel2.Left := RequiredLabel1.Left + RequiredLabel1.Width;
{ AppInfo }
AppNameEdit.Text := 'My Program';
AppVersionEdit.Text := '1.5';
AppPublisherEdit.Text := 'My Company, Inc.';
AppURLEdit.Text := 'http://www.example.com/';
{ AppDir }
for I := Low(AppRootDirs) to High(AppRootDirs) do
AppRootDirComboBox.Items.Add(AppRootDirs[I].Description);
AppRootDirComboBox.Items.Add('(Custom)');
AppRootDirComboBox.ItemIndex := 0;
AppRootDirEdit.Enabled := False;
AppRootDirEdit.Color := clBtnFace;
NotDisableDirPageCheck.Checked := True;
{ AppFiles }
AppExeEdit.Text := PathExtractPath(NewParamStr(0)) + 'Examples\MyProg.exe';
AppExeRunCheck.Checked := True;
UpdateWizardFilesButtons;
{ AppIcons }
UseCommonProgramsCheck.Checked := True;
NotDisableProgramGroupPageCheck.Checked := True;
DesktopIconCheck.Checked := True;
{ PrivilegesRequired }
PrivilegesRequiredAdminRadioButton.Checked := True;
{ Languages }
for I := 0 to FLanguages.Count-1 do begin
if FLanguages[I] <> LanguagesDefaultIsl then
LanguagesList.AddCheckBox(SpaceLanguageName(PathChangeExt(FLanguages[I], '')), '', 0, False, True, False, True, TObject(I))
else
LanguagesList.AddCheckBox(LanguagesDefaultIslDescription, '', 0, True, True, False, True, TObject(I));
end;
{ Compiler }
OutputBaseFileNameEdit.Text := 'mysetup';
EncryptionCheck.Visible := ISCryptInstalled;
EncryptionCheck.Checked := True;
EncryptionCheck.Enabled := False;
{ ISPP }
ISPPLabel.Caption := FixLabel(SWizardISPPLabel);
ISPPCheck.Caption := SWizardISPPCheck;
ISPPCheck.Checked := ISPPInstalled;
CurPage := Low(TWizardPage);
CurPageChanged;
end;
procedure TWizardForm.FormShow(Sender: TObject);
begin
Caption := FWizardName;
WelcomeLabel1.Caption := FixLabel(WelcomeLabel1.Caption);
FinishedLabel.Caption := FixLabel(FinishedLabel.Caption);
end;
procedure TWizardForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if ModalResult = mrCancel then
CanClose := MsgBox(FixLabel(SWizardCancelMessage), FWizardName, mbConfirmation, MB_YESNO) = idYes;
end;
procedure TWizardForm.FormDestroy(Sender: TObject);
var
I: Integer;
begin
FLanguages.Free;
for I := 0 to FWizardFiles.Count-1 do
Dispose(FWizardFiles[i]);
FWizardFiles.Free;
end;
{ --- }
procedure TWizardForm.CurPageChanged;
{ Call this whenever the current page is changed }
begin
OuterNotebook.ActivePage := OuterNotebook.Pages[NotebookPages[CurPage, 0]];
if NotebookPages[CurPage, 1] <> -1 then
InnerNotebook.ActivePage := InnerNotebook.Pages[NotebookPages[CurPage, 1]];
{ Set button visibility and captions }
BackButton.Visible := not (CurPage = wpWelcome);
if CurPage = wpFinished then
NextButton.Caption := SWizardFinishButton
else
NextButton.Caption := SWizardNextButton;
RequiredLabel1.Visible := RequiredLabelVisibles[CurPage];
RequiredLabel2.Visible := RequiredLabel1.Visible;
{ Set the Caption to match the current page's title }
PageNameLabel.Caption := PageCaptions[CurPage];
PageDescriptionLabel.Caption := PageDescriptions[CurPage];
{ Adjust focus }
case CurPage of
wpAppInfo: ActiveControl := AppNameEdit;
wpAppDir:
begin
if AppRootDirComboBox.Enabled then
ActiveControl := AppRootDirComboBox
else
ActiveControl := NotCreateAppDirCheck;
end;
wpAppFiles:
begin
if AppExeEdit.Enabled then
ActiveControl := AppExeEdit
else
ActiveControl := AppFilesListBox;
end;
wpAppIcons:
begin
if UseCommonProgramsCheck.Enabled then
ActiveControl := UseCommonProgramsCheck
else
ActiveControl := AppGroupNameEdit;
end;
wpAppDocs: ActiveControl := AppLicenseFileEdit;
wpPrivilegesRequired:
begin
if PrivilegesRequiredAdminRadioButton.Checked then
ActiveControl := PrivilegesRequiredAdminRadioButton
else
ActiveControl := PrivilegesRequiredLowestRadioButton;
end;
wpLanguages: ActiveControl := LanguagesList;
wpCompiler: ActiveControl := OutputDirEdit;
wpISPP: ActiveControl := ISPPCheck;
end;
end;
function TWizardForm.SkipCurPage: Boolean;
begin
if ((CurPage = wpAppIcons) and NotCreateAppDirCheck.Checked) or
((CurPage = wpLanguages) and not (FLanguages.Count > 1)) or
((CurPage = wpISPP) and not ISPPInstalled) or
(not (CurPage in [wpWelcome, wpFinished]) and EmptyCheck.Checked) then
Result := True
else
Result := False;
end;
procedure TWizardForm.NextButtonClick(Sender: TObject);
function CheckAppInfoPage: Boolean;
begin
Result := False;
if AppNameEdit.Text = '' then begin
MsgBox(SWizardAppNameError, '', mbError, MB_OK);
ActiveControl := AppNameEdit;
end else if AppVersionEdit.Text = '' then begin
MsgBox(SWizardAppVersionError, '', mbError, MB_OK);
ActiveControl := AppVersionEdit;
end else
Result := True;
end;
function CheckAppDirPage: Boolean;
begin
Result := False;
if not NotCreateAppDirCheck.Checked and
(AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1) and
(AppRootDirEdit.Text = '') then begin
MsgBox(SWizardAppRootDirError, '', mbError, MB_OK);
ActiveControl := AppRootDirEdit;
end else if not NotCreateAppDirCheck.Checked and (AppDirNameEdit.Text = '') then begin
MsgBox(SWizardAppDirNameError, '', mbError, MB_OK);
ActiveControl := AppDirNameEdit;
end else
Result := True;
end;
function CheckAppFilesPage: Boolean;
begin
Result := False;
if AppExeEdit.Enabled and (AppExeEdit.Text = '') then begin
MsgBox(SWizardAppExeError, '', mbError, MB_OK);
ActiveControl := AppExeEdit;
end else
Result := True;
end;
function CheckAppIconsPage: Boolean;
begin
Result := False;
if AppGroupNameEdit.Text = '' then begin
MsgBox(SWizardAppGroupNameError, '', mbError, MB_OK);
ActiveControl := AppGroupNameEdit;
end else
Result := True;
end;
function CheckLanguagesPage: Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 to LanguagesList.Items.Count-1 do begin
if LanguagesList.Checked[I] then begin
Result := True;
Exit;
end;
end;
MsgBox(SWizardLanguagesSelError, '', mbError, MB_OK);
ActiveControl := LanguagesList;
end;
begin
case CurPage of
wpAppInfo: if not CheckAppInfoPage then Exit;
wpAppDir: if not CheckAppDirPage then Exit;
wpAppFiles: if not CheckAppFilesPage then Exit;
wpAppIcons: if not CheckAppIconsPage then Exit;
wpLanguages: if not CheckLanguagesPage then Exit;
end;
repeat
if CurPage = wpFinished then begin
GenerateScript;
ModalResult := mrOk;
Exit;
end;
Inc(CurPage);
{ Even if we're skipping a page, we should still update it }
case CurPage of
wpAppDir: if AppDirNameEdit.Text = '' then AppDirNameEdit.Text := AppNameEdit.Text;
wpAppIcons: if AppGroupNameEdit.Text = '' then AppGroupNameEdit.Text := AppNameEdit.Text;
end;
until not SkipCurPage;
CurPageChanged;
end;
procedure TWizardForm.BackButtonClick(Sender: TObject);
begin
if CurPage = Low(TWizardPage) then Exit;
{ Go to the previous page }
Dec(CurPage);
while SkipCurPage do
Dec(CurPage);
CurPageChanged;
end;
{---}
procedure TWizardForm.AddWizardFile(const Source: String; const RecurseSubDirs, CreateAllSubDirs: Boolean);
var
WizardFile: PWizardFile;
begin
New(WizardFile);
WizardFile.Source := Source;
WizardFile.RecurseSubDirs := RecurseSubDirs;
WizardFile.CreateAllSubDirs := CreateAllSubDirs;
WizardFile.DestRootDirIsConstant := True;
if not NotCreateAppDirCheck.Checked then
WizardFile.DestRootDir := '{app}'
else
WizardFile.DestRootDir := '{win}';
WizardFile.DestSubDir := '';
FWizardFiles.Add(WizardFile);
end;
procedure TWizardForm.UpdateWizardFiles;
var
WizardFile: PWizardFile;
I: Integer;
begin
AppFilesListBox.Items.BeginUpdate;
AppFilesListBox.Items.Clear;
for I := 0 to FWizardFiles.Count-1 do begin
WizardFile := FWizardFiles[i];
AppFilesListBox.Items.Add(WizardFile.Source);
end;
AppFilesListBox.Items.EndUpdate;
UpdateHorizontalExtent(AppFilesListBox);
end;
procedure TWizardForm.UpdateWizardFilesButtons;
var
Enabled: Boolean;
begin
Enabled := AppFilesListBox.ItemIndex >= 0;
AppFilesEditButton.Enabled := Enabled;
AppFilesRemoveButton.Enabled := Enabled;
end;
procedure TWizardForm.UpdateAppExeControls;
var
Enabled: Boolean;
begin
Enabled := not NotCreateAppDirCheck.Checked;
NoAppExeCheck.Enabled := Enabled;
Enabled := Enabled and not NoAppExeCheck.Checked;
AppExeLabel.Enabled := Enabled;
AppExeEdit.Enabled := Enabled;
AppExeEdit.Color := EnabledColors[Enabled];
AppExeButton.Enabled := Enabled;
AppExeRunCheck.Enabled := Enabled;
AppExeIconsLabel.Enabled := Enabled;
DesktopIconCheck.Enabled := Enabled;
QuickLaunchIconCheck.Enabled := Enabled;
if Enabled then
AppExeLabel.Font.Style := AppExeLabel.Font.Style + [fsBold]
else
AppExeLabel.Font.Style := AppExeLabel.Font.Style - [fsBold];
end;
procedure TWizardForm.UpdateAppIconsControls;
var
Enabled: Boolean;
begin
UseCommonProgramsCheck.Enabled := NoAppExeCheck.Enabled and not NoAppExeCheck.Checked;
Enabled := not (UseCommonProgramsCheck.Enabled and UseCommonProgramsCheck.Checked);
AppGroupNameLabel.Enabled := Enabled;
AppGroupNameEdit.Enabled := Enabled;
AppGroupNameEdit.Color := EnabledColors[Enabled];
NotDisableProgramGroupPageCheck.Enabled := Enabled;
AllowNoIconsCheck.Enabled := Enabled and NotDisableProgramGroupPageCheck.Checked;
CreateURLIconCheck.Enabled := Enabled and (AppURLEdit.Text <> '');
CreateUninstallIconCheck.Enabled := Enabled;
if Enabled then
AppGroupNameLabel.Font.Style := AppGroupNameLabel.Font.Style + [fsBold]
else
AppGroupNameLabel.Font.Style := AppGroupNameLabel.Font.Style - [fsBold];
end;
{---}
procedure TWizardForm.AppRootDirComboBoxChange(Sender: TObject);
begin
if AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1 then begin
AppRootDirEdit.Enabled := True;
AppRootDirEdit.Color := clWindow;
ActiveControl := AppRootDirEdit;
end else begin
AppRootDirEdit.Enabled := False;
AppRootDirEdit.Color := clBtnFace;
end;
end;
procedure TWizardForm.NotCreateAppDirCheckClick(Sender: TObject);
var
Enabled: Boolean;
begin
Enabled := not NotCreateAppDirCheck.Checked;
{ AppDir }
AppRootDirLabel.Enabled := Enabled;
AppRootDirComboBox.Enabled := Enabled;
AppRootDirComboBox.Color := EnabledColors[Enabled];
AppRootDirEdit.Enabled := Enabled and (AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1);
AppRootDirEdit.Color := EnabledColors[AppRootDirEdit.Enabled];
AppDirNameLabel.Enabled := Enabled;
AppDirNameEdit.Enabled := Enabled;
AppDirNameEdit.Color := EnabledColors[Enabled];
NotDisableDirPageCheck.Enabled := Enabled;
if Enabled then begin
AppRootDirLabel.Font.Style := AppRootDirLabel.Font.Style + [fsBold];
AppDirNameLabel.Font.Style := AppRootDirLabel.Font.Style + [fsBold];
end else begin
AppRootDirLabel.Font.Style := AppRootDirLabel.Font.Style - [fsBold];
AppDirNameLabel.Font.Style := AppRootDirLabel.Font.Style - [fsBold];
end;
{ AppFiles }
UpdateAppExeControls;
end;
procedure TWizardForm.AppExeButtonClick(Sender: TObject);
var
FileName: String;
begin
FileName := AppExeEdit.Text;
if NewGetOpenFileName('', FileName, PathExtractPath(FileName), SWizardAppExeFilter, SWizardAppExeDefaultExt, Handle) then
AppExeEdit.Text := FileName;
end;
procedure TWizardForm.NoAppExeCheckClick(Sender: TObject);
begin
UpdateAppExeControls;
UpdateAppIconsControls;
end;
procedure TWizardForm.AppFilesListBoxClick(Sender: TObject);
begin
UpdateWizardFilesButtons;
end;
procedure TWizardForm.AppFilesListBoxDblClick(Sender: TObject);
begin
if AppFilesEditButton.Enabled then
AppFilesEditButton.Click;
end;
procedure TWizardForm.AppFilesAddButtonClick(Sender: TObject);
var
FileList: TStringList;
I: Integer;
begin
FileList := TStringList.Create;
try
if NewGetOpenFileNameMulti('', FileList, '', SWizardAllFilesFilter, '', Handle) then begin
FileList.Sort;
for I := 0 to FileList.Count-1 do
AddWizardFile(FileList[I], False, False);
UpdateWizardFiles;
end;
finally
FileList.Free;
end;
end;
procedure TWizardForm.AppFilesAddDirButtonClick(Sender: TObject);
var
Path: String;
Recurse: Boolean;
begin
Path := '';
if BrowseForFolder(SWizardAppFiles3, Path, Handle, False) then begin
case MsgBox(Format(SWizardAppFilesSubDirsMessage, [Path]), '', mbConfirmation, MB_YESNOCANCEL) of
IDYES: Recurse := True;
IDNO: Recurse := False;
else
Exit;
end;
AddWizardFile(AddBackslash(Path) + '*', Recurse, Recurse);
UpdateWizardFiles;
end;
end;
procedure TWizardForm.AppFilesListBoxDropFile(Sender: TDropListBox;
const FileName: String);
begin
if DirExists(FileName) then
AddWizardFile(AddBackslash(FileName) + '*', True, True)
else
AddWizardFile(FileName, False, False);
UpdateWizardFiles;
UpdateWizardFilesButtons;
end;
procedure TWizardForm.AppFilesEditButtonClick(Sender: TObject);
var
WizardFileForm: TWizardFileForm;
Index: Integer;
begin
WizardFileForm := TWizardFileForm.Create(Application);
try
Index := AppFilesListBox.ItemIndex;
WizardFileForm.AllowAppDestRootDir := not NotCreateAppDirCheck.Checked;
WizardFileForm.WizardFile := FWizardFiles[Index];
if WizardFileForm.ShowModal = mrOK then begin
UpdateWizardFiles;
AppFilesListBox.ItemIndex := Index;
AppFilesListBox.TopIndex := Index;
UpdateWizardFilesButtons;
end;
finally
WizardFileForm.Free;
end;
end;
procedure TWizardForm.AppFilesRemoveButtonClick(Sender: TObject);
var
I: Integer;
begin
I := AppFilesListBox.ItemIndex;
Dispose(FWizardFiles[I]);
FWizardFiles.Delete(I);
UpdateWizardFiles;
UpdateWizardFilesButtons;
end;
procedure TWizardForm.UseCommonProgramsCheckClick(Sender: TObject);
begin
UpdateAppIconsControls;
end;
procedure TWizardForm.NotDisableProgramGroupPageCheckClick(
Sender: TObject);
begin
UpdateAppIconsControls;
end;
procedure TWizardForm.FileButtonClick(Sender: TObject);
var
Edit: TEdit;
Filter, DefaultExt, FileName: String;
begin
if Sender = AppLicenseFileButton then
Edit := AppLicenseFileEdit
else if Sender = AppInfoBeforeFileButton then
Edit := AppInfoBeforeFileEdit
else if Sender = AppInfoAfterFileButton then
Edit := AppInfoAfterFileEdit
else
Edit := SetupIconFileEdit;
if Sender <> SetupIconFileButton then begin
Filter := SWizardAppDocsFilter;
DefaultExt := SWizardAppDocsDefaultExt;
end else begin
Filter := SWizardCompilerSetupIconFileFilter;
DefaultExt := SWizardCompilerSetupIconFileDefaultExt;
end;
FileName := Edit.Text;
if NewGetOpenFileName('', FileName, PathExtractPath(FileName), Filter, DefaultExt, Handle) then
Edit.Text := FileName;
end;
procedure TWizardForm.OutputDirButtonClick(Sender: TObject);
var
Path: String;
begin
Path := OutputDirEdit.Text;
if PathDrivePartLength(Path) = 0 then
Path := ''; { don't pass in a relative path to BrowseForFolder }
if BrowseForFolder(SWizardCompilerOutputDir, Path, Handle, True) then
OutputDirEdit.Text := Path;
end;
procedure TWizardForm.PasswordEditChange(Sender: TObject);
begin
EncryptionCheck.Enabled := PasswordEdit.Text <> '';
end;
procedure TWizardForm.AllLanguagesButtonClick(Sender: TObject);
var
I: Integer;
begin
for I := 0 to LanguagesList.Items.Count-1 do
LanguagesList.Checked[I] := True;
end;
procedure TWizardForm.NoLanguagesButtonClick(Sender: TObject);
var
I: Integer;
begin
for I := 0 to LanguagesList.Items.Count-1 do
LanguagesList.Checked[I] := False;
end;
procedure TWizardForm.PrivilegesRequiredOverridesAllowedDialogCheckboxClick(
Sender: TObject);
begin
PrivilegesRequiredOverridesAllowedCommandLineCheckbox.Enabled := not PrivilegesRequiredOverridesAllowedDialogCheckbox.Checked;
if PrivilegesRequiredOverridesAllowedDialogCheckbox.Checked then
PrivilegesRequiredOverridesAllowedCommandLineCheckbox.Checked := True;
end;
{ --- }
procedure TWizardForm.GenerateScript;
var
Script, ISPP, Setup, Languages, Tasks, Files, INI, Icons, Run, UninstallDelete: String;
WizardFile: PWizardFile;
I: Integer;
AppExeName, AppAmpEscapedName, LanguageName, LanguageMessagesFile: String;
begin
Script := '';
AppExeName := PathExtractName(AppExeEdit.Text);
AppAmpEscapedName := EscapeAmpersands(AppNameEdit.Text);
if ISPPCheck.Checked then begin
{ Setup ISPP usage. Change the edits to reflect ISPP usage. A bit ugly but for now it works. }
ISPP := '#define MyAppName "' + AppNameEdit.Text + '"' + SNewLine +
'#define MyAppVersion "' + AppVersionEdit.Text + '"' + SNewLine;
if AppDirNameEdit.Text = AppNameEdit.Text then
AppDirNameEdit.Text := '{#MyAppName}';
if AppGroupNameEdit.Text = AppNameEdit.Text then
AppGroupNameEdit.Text := '{#MyAppName}';
AppNameEdit.Text := '{#MyAppName}';
AppAmpEscapedName := '{#StringChange(MyAppName, ''&'', ''&&'')}';
AppVersionEdit.Text := '{#MyAppVersion}';
if AppPublisherEdit.Text <> '' then begin
ISPP := ISPP + '#define MyAppPublisher "' + AppPublisherEdit.Text + '"' + SNewLine;
AppPublisherEdit.Text := '{#MyAppPublisher}';
end;
if AppURLEdit.Text <> '' then begin
ISPP := ISPP + '#define MyAppURL "' + AppURLEdit.Text + '"' + SNewLine;
AppURLEdit.Text := '{#MyAppURL}';
end;
{ Special ones }
if not NoAppExeCheck.Checked then begin
ISPP := ISPP + '#define MyAppExeName "' + AppExeName + '"' + SNewLine;
AppExeName := '{#MyAppExeName}';
end;
end else
ISPP := '';
Setup := '[Setup]' + SNewLine;
Languages := '[Languages]' + SNewLine;
Tasks := '[Tasks]' + SNewLine;
Files := '[Files]' + SNewLine;
INI := '[INI]' + SNewLine;
Icons := '[Icons]' + SNewLine;
Run := '[Run]' + SNewLine;
UninstallDelete := '[UninstallDelete]' + SNewLine;
if not EmptyCheck.Checked then begin
Setup := Setup + (
'; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.' + SNewLine +
'; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)' + SNewLine);
Setup := Setup + 'AppId={' + GenerateGuid + SNewLine;
{ AppInfo }
Setup := Setup + 'AppName=' + AppNameEdit.Text + SNewLine;
Setup := Setup + 'AppVersion=' + AppVersionEdit.Text + SNewLine;
Setup := Setup + ';AppVerName=' + AppNameEdit.Text + ' ' + AppVersionEdit.Text + SNewLine;
if AppPublisherEdit.Text <> '' then
Setup := Setup + 'AppPublisher=' + AppPublisherEdit.Text + SNewLine;
if AppURLEdit.Text <> '' then begin
Setup := Setup + 'AppPublisherURL=' + AppURLEdit.Text + SNewLine;
Setup := Setup + 'AppSupportURL=' + AppURLEdit.Text + SNewLine;
Setup := Setup + 'AppUpdatesURL=' + AppURLEdit.Text + SNewLine;
end;
{ AppDir }
if not NotCreateAppDirCheck.Checked then begin
if AppRootDirComboBox.ItemIndex = AppRootDirComboBox.Items.Count-1 then
Setup := Setup + 'DefaultDirName=' + AddBackslash(AppRootDirEdit.Text) + AppDirNameEdit.Text + SNewLine
else
Setup := Setup + 'DefaultDirName=' + AddBackslash(AppRootDirs[AppRootDirComboBox.ItemIndex].Constant) + AppDirNameEdit.Text + SNewLine;
if not NotDisableDirPageCheck.Checked then
Setup := Setup + 'DisableDirPage=yes' + SNewLine;
end else begin
Setup := Setup + 'CreateAppDir=no' + SNewLine;
end;
{ AppFiles }
if not NotCreateAppDirCheck.Checked and not NoAppExeCheck.Checked then begin
Files := Files + 'Source: "' + AppExeEdit.Text + '"; DestDir: "{app}"; Flags: ignoreversion' + SNewLine;
if AppExeRunCheck.Checked then begin
if CompareText(PathExtractExt(AppExeEdit.Text), '.exe') = 0 then
Run := Run + 'Filename: "{app}\' + AppExeName + '"; Description: "{cm:LaunchProgram,' + AppAmpEscapedName + '}"; Flags: nowait postinstall skipifsilent' + SNewLine
else
Run := Run + 'Filename: "{app}\' + AppExeName + '"; Description: "{cm:LaunchProgram,' + AppAmpEscapedName + '}"; Flags: shellexec postinstall skipifsilent' + SNewLine;
end;
end;
for I := 0 to FWizardFiles.Count-1 do begin
WizardFile := FWizardFiles[I];
Files := Files + 'Source: "' + WizardFile.Source + '"; DestDir: "' + RemoveBackslashUnlessRoot(AddBackslash(WizardFile.DestRootDir) + WizardFile.DestSubDir) + '"; Flags: ignoreversion';
if WizardFile.RecurseSubDirs then
Files := Files + ' recursesubdirs';
if WizardFile.CreateAllSubDirs then
Files := Files + ' createallsubdirs';
Files := Files + SNewLine;
end;
{ AppGroup }
if not NotCreateAppDirCheck.Checked then begin
if UseCommonProgramsCheck.Enabled and UseCommonProgramsCheck.Checked then begin
Setup := Setup + 'DisableProgramGroupPage=yes' + SNewLine;
Icons := Icons + 'Name: "{autoprograms}\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"' + SNewLine;
end else begin
Setup := Setup + 'DefaultGroupName=' + AppGroupNameEdit.Text + SNewLine;
if not NoAppExeCheck.Checked then
Icons := Icons + 'Name: "{group}\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"' + SNewLine;
if not NotDisableProgramGroupPageCheck.Checked then
Setup := Setup + 'DisableProgramGroupPage=yes' + SNewLine;
if AllowNoIconsCheck.Checked and NotDisableProgramGroupPageCheck.Checked then
Setup := Setup + 'AllowNoIcons=yes' + SNewLine;
if CreateURLIconCheck.Enabled and CreateURLIconCheck.Checked then
Icons := Icons + 'Name: "{group}\{cm:ProgramOnTheWeb,' + AppNameEdit.Text + '}"; Filename: "' + AppURLEdit.Text + '"' + SNewLine;
if CreateUninstallIconCheck.Checked then
Icons := Icons + 'Name: "{group}\{cm:UninstallProgram,' + AppNameEdit.Text + '}"; Filename: "{uninstallexe}"' + SNewLine;
end;
if DesktopIconCheck.Enabled and DesktopIconCheck.Checked then begin
Tasks := Tasks + 'Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked' + SNewLine;
Icons := Icons + 'Name: "{autodesktop}\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"; Tasks: desktopicon' + SNewLine;
end;
if QuickLaunchIconCheck.Enabled and QuickLaunchIconCheck.Checked then begin
Setup := Setup + '; The [Icons] "quicklaunchicon" entry uses {userappdata} but its [Tasks] entry has a proper IsAdminInstallMode Check.' + SNewLine +
'UsedUserAreasWarning=no' + SNewLine;
Tasks := Tasks + 'Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode' + SNewLine;
Icons := Icons + 'Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\' + AppNameEdit.Text + '"; Filename: "{app}\' + AppExeName + '"; Tasks: quicklaunchicon' + SNewLine;
end;
end;
{ AppDocs }
if AppLicenseFileEdit.Text <> '' then
Setup := Setup + 'LicenseFile=' + AppLicenseFileEdit.Text + SNewLine;
if AppInfoBeforeFileEdit.Text <> '' then
Setup := Setup + 'InfoBeforeFile=' + AppInfoBeforeFileEdit.Text + SNewLine;
if AppInfoAfterFileEdit.Text <> '' then
Setup := Setup + 'InfoAfterFile=' + AppInfoAfterFileEdit.Text + SNewLine;
{ PrivilegesRequired }
if PrivilegesRequiredAdminRadioButton.Checked then
Setup := Setup + '; Uncomment the following line to run in non administrative install mode (install for current user only.)' + SNewLine + ';'
else
Setup := Setup + '; Remove the following line to run in administrative install mode (install for all users.)' + SNewLine;
Setup := Setup + 'PrivilegesRequired=lowest' + SNewLine; { Note how previous made sure this is outputted as comment if needed. }
if PrivilegesRequiredOverridesAllowedDialogCheckbox.Checked then
Setup := Setup + 'PrivilegesRequiredOverridesAllowed=dialog' + SNewLine
else if PrivilegesRequiredOverridesAllowedCommandLineCheckbox.Checked then
Setup := Setup + 'PrivilegesRequiredOverridesAllowed=commandline' + SNewLine;
{ Languages }
if FLanguages.Count > 1 then begin
for I := 0 to LanguagesList.Items.Count-1 do begin
if LanguagesList.Checked[I] then begin
LanguageMessagesFile := FLanguages[Integer(LanguagesList.ItemObject[I])];
if LanguageMessagesFile <> LanguagesDefaultIsl then begin
LanguageName := LanguagesList.Items[I];
LanguageMessagesFile := 'Languages\' + LanguageMessagesFile;
end else
LanguageName := LanguagesDefaultIslDescription;
StringChange(LanguageName, ' ', '');
LanguageName := LowerCase(LanguageName);
Languages := Languages + 'Name: "' + LanguageName + '"; MessagesFile: "compiler:' + LanguageMessagesFile + '"' + SNewLine;
end;
end;
end;
{ Compiler }
if OutputDirEdit.Text <> '' then
Setup := Setup + 'OutputDir=' + OutputDirEdit.Text + SNewLine;
if OutputBaseFileNameEdit.Text <> '' then
Setup := Setup + 'OutputBaseFilename=' + OutputBaseFileNameEdit.Text + SNewLine;
if SetupIconFileEdit.Text <> '' then
Setup := Setup + 'SetupIconFile=' + SetupIconFileEdit.Text + SNewLine;
if PasswordEdit.Text <> '' then begin
Setup := Setup + 'Password=' + PasswordEdit.Text + SNewLine;
if ISCryptInstalled and EncryptionCheck.Checked then
Setup := Setup + 'Encryption=yes' + SNewLine;
end;
{ Other }
Setup := Setup + 'Compression=lzma' + SNewLine;
Setup := Setup + 'SolidCompression=yes' + SNewLine;
Setup := Setup + 'WizardStyle=modern' + SNewLine;
{ Build script }
if ISPP <> '' then
Script := Script + ISPP + SNewLine;
Script := Script + Setup + SNewLine;
if Length(Languages) > Length('[Languages]')+2 then
Script := Script + Languages + SNewLine;
if Length(Tasks) > Length('[Tasks]')+2 then
Script := Script + Tasks + SNewLine;
if Length(Files) > Length('[Files]')+2 then
Script := Script + Files +
'; NOTE: Don''t use "Flags: ignoreversion" on any shared system files' +
SNewLine2;
if Length(INI) > Length('[INI]')+2 then
Script := Script + INI + SNewLine;
if Length(Icons) > Length('[Icons]')+2 then
Script := Script + Icons + SNewLine;
if Length(Run) > Length('[Run]')+2 then
Script := Script + Run + SNewLine;
if Length(UninstallDelete) > Length('[UninstallDelete]')+2 then
Script := Script + UninstallDelete + SNewLine;
FResult := wrComplete;
end else begin
Script := Script + Setup + SNewLine;
FResult := wrEmpty;
end;
FResultScript := FixLabel(SWizardScriptHeader) + SNewLine2 + Script;
end;
{ --- }
end.
| 34.689748 | 220 | 0.694984 |
479ee27ad85a67d3910b28a5bd6430871aac78c8 | 1,390 | pas | Pascal | src/tests/URandomHash.Tests.Delphi.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 384 | 2016-07-16T10:07:28.000Z | 2021-12-29T11:22:56.000Z | src/tests/URandomHash.Tests.Delphi.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 165 | 2016-09-11T11:06:04.000Z | 2021-12-05T23:31:55.000Z | src/tests/URandomHash.Tests.Delphi.pas | rabarbers/PascalCoin | 7a87031bc10a3e1d9461dfed3c61036047ce4fb0 | [
"MIT"
]
| 210 | 2016-08-26T14:49:47.000Z | 2022-02-22T18:06:33.000Z | unit URandomHash.Tests.Delphi;
interface
uses
Classes, SysUtils, {$IFDEF FPC}fpcunit,testregistry {$ELSE}TestFramework {$ENDIF FPC},
UUnitTests, HlpIHash;
type
{ TRandomHashTest }
TRandomHashTest = class(TPascalCoinUnitTest)
published
procedure TestRandomHash_Standard;
end;
implementation
uses variants, UCommon, UMemory, URandomHash, HlpHashFactory, HlpBitConverter, strutils;
const
{ RandomHash Official Values }
DATA_RANDOMHASH_STANDARD_INPUT : array[1..3] of String = (
'0x0',
'The quick brown fox jumps over the lazy dog',
'0x000102030405060708090a0b0c0d0e0f'
);
DATA_RANDOMHASH_STANDARD_EXPECTED : array[1..3] of String = (
'0x675c62c74c313647e95e820bbf540c6d4453482b745e62016404424323b69e09',
'0xaa5b8597f00bdb1c1953e668e6fdd6b5b0df3731b09a7777893d7fc5554b1e3a',
'0xff4f832020dc4eac07868e9f180f256c9b1d5513b35cd24db5af7da6526bb50f'
);
{ TRandomHashTest }
procedure TRandomHashTest.TestRandomHash_Standard;
var
i : integer;
begin
for i := Low(DATA_RANDOMHASH_STANDARD_INPUT) to High(DATA_RANDOMHASH_STANDARD_INPUT) do
AssertEquals(ParseBytes(DATA_RANDOMHASH_STANDARD_EXPECTED[i]), TRandomHash.Compute(ParseBytes(DATA_RANDOMHASH_STANDARD_INPUT[i])));
//WriteLn(Format('%s', [Bytes2Hex(TRandomHash.Compute(ParseBytes(LCase.Input)), True)]));
end;
initialization
RegisterTest(TRandomHashTest.Suite);
end.
| 25.272727 | 135 | 0.784892 |
83a44cc0782a00be20d99c7d123a2e0fd5ab81c3 | 224 | pas | Pascal | Chapter09/Code/RECIPE07/SurveyService/ConstantsU.pas | PacktPublishing/DelphiCookbookThirdEdition | 760fd16277dd21a75320571c664553af33e29950 | [
"MIT"
]
| 51 | 2018-08-03T06:27:36.000Z | 2022-03-16T09:10:10.000Z | Chapter09/Code/RECIPE07/SurveyService/ConstantsU.pas | PacktPublishing/DelphiCookbookThirdEdition | 760fd16277dd21a75320571c664553af33e29950 | [
"MIT"
]
| 1 | 2019-10-28T16:51:11.000Z | 2019-10-28T16:51:11.000Z | Chapter09/Code/RECIPE07/SurveyService/ConstantsU.pas | PacktPublishing/DelphiCookbookThirdEdition | 760fd16277dd21a75320571c664553af33e29950 | [
"MIT"
]
| 28 | 2018-08-03T22:20:00.000Z | 2021-12-02T03:49:03.000Z | unit ConstantsU;
interface
type
TSurveyConstants = class sealed
public
const
SURVEY_RESPONSE = 'SURVEY_RESPONSE';
const
SURVEY_RESPONSE_ERROR = 'SURVEY_RESPONSE_ERROR';
end;
implementation
end.
| 13.176471 | 54 | 0.723214 |
f1c1e52acfedadeb3d266c6036c169d2204c4067 | 406,175 | pas | Pascal | WMPLib_TLB.pas | randydom/commonx | 2315f1acf41167bd77ba4d040b3f5b15a5c5b81a | [
"MIT"
]
| 48 | 2018-11-19T22:13:00.000Z | 2021-11-02T17:25:41.000Z | WMPLib_TLB.pas | randydom/commonx | 2315f1acf41167bd77ba4d040b3f5b15a5c5b81a | [
"MIT"
]
| 6 | 2018-11-24T17:15:29.000Z | 2019-05-15T14:59:56.000Z | WMPLib_TLB.pas | adaloveless/commonx | ed37b239e925119c7ceb3ac7949eefb0259c7f77 | [
"MIT"
]
| 12 | 2018-11-20T15:15:44.000Z | 2021-09-14T10:12:43.000Z | unit WMPLib_TLB;
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// $Rev: 5081 $
// File generated on 11/6/2007 12:38:38 PM from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Windows\system32\wmp.dll (1)
// LIBID: {6BF52A50-394A-11D3-B153-00C04F79FAA6}
// LCID: 0
// Helpfile:
// HelpString: Windows Media Player
// DepndLst:
// (1) v2.0 stdole, (C:\Windows\system32\stdole2.tlb)
// Errors:
// Hint: Member 'label' of 'IWMPCdromBurn' changed to 'label_'
// Hint: Symbol 'type' renamed to 'type_'
// Hint: Symbol 'type' renamed to 'type_'
// Hint: Parameter 'type' of IWMPCDDVDWizardExternal.WriteNamesEx changed to 'type_'
// Hint: Member 'Record' of 'IUPnPService_IWMPUPnPAVTransportDual' changed to 'Record_'
// Hint: Parameter 'Unit' of IUPnPService_IWMPUPnPAVTransportDual.Seek changed to 'Unit_'
// ************************************************************************ //
// *************************************************************************//
// NOTE:
// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties
// which return objects that may need to be explicitly created via a function
// call prior to any access via the property. These items have been disabled
// in order to prevent accidental use from within the object inspector. You
// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively
// removing them from the $IFDEF blocks. However, such items must still be
// programmatically created via a method of the appropriate CoClass before
// they can be used.
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface
uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL, Variants;
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
WMPLibMajorVersion = 1;
WMPLibMinorVersion = 0;
LIBID_WMPLib: TGUID = '{6BF52A50-394A-11D3-B153-00C04F79FAA6}';
IID_IWMPEvents: TGUID = '{19A6627B-DA9E-47C1-BB23-00B5E668236A}';
IID_IWMPEvents2: TGUID = '{1E7601FA-47EA-4107-9EA9-9004ED9684FF}';
IID_IWMPSyncDevice: TGUID = '{82A2986C-0293-4FD0-B279-B21B86C058BE}';
IID_IWMPEvents3: TGUID = '{1F504270-A66B-4223-8E96-26A06C63D69F}';
IID_IWMPCdromRip: TGUID = '{56E2294F-69ED-4629-A869-AEA72C0DCC2C}';
IID_IWMPCdromBurn: TGUID = '{BD94DBEB-417F-4928-AA06-087D56ED9B59}';
IID_IWMPPlaylist: TGUID = '{D5F0F4F1-130C-11D3-B14E-00C04F79FAA6}';
IID_IWMPMedia: TGUID = '{94D55E95-3FAC-11D3-B155-00C04F79FAA6}';
IID_IWMPLibrary: TGUID = '{3DF47861-7DF1-4C1F-A81B-4C26F0F7A7C6}';
IID_IWMPMediaCollection: TGUID = '{8363BC22-B4B4-4B19-989D-1CD765749DD1}';
IID_IWMPStringCollection: TGUID = '{4A976298-8C0D-11D3-B389-00C04F68574B}';
DIID__WMPOCXEvents: TGUID = '{6BF52A51-394A-11D3-B153-00C04F79FAA6}';
IID_IWMPCore: TGUID = '{D84CCA99-CCE2-11D2-9ECC-0000F8085981}';
IID_IWMPCore2: TGUID = '{BC17E5B7-7561-4C18-BB90-17D485775659}';
IID_IWMPCore3: TGUID = '{7587C667-628F-499F-88E7-6A6F4E888464}';
IID_IWMPPlayer4: TGUID = '{6C497D62-8919-413C-82DB-E935FB3EC584}';
IID_IWMPPlayer3: TGUID = '{54062B68-052A-4C25-A39F-8B63346511D4}';
IID_IWMPControls: TGUID = '{74C09E02-F828-11D2-A74B-00A0C905F36E}';
IID_IWMPSettings: TGUID = '{9104D1AB-80C9-4FED-ABF0-2E6417A6DF14}';
IID_IWMPPlaylistCollection: TGUID = '{10A13217-23A7-439B-B1C0-D847C79B7774}';
IID_IWMPPlaylistArray: TGUID = '{679409C0-99F7-11D3-9FB7-00105AA620BB}';
IID_IWMPNetwork: TGUID = '{EC21B779-EDEF-462D-BBA4-AD9DDE2B29A7}';
IID_IWMPCdromCollection: TGUID = '{EE4C8FE2-34B2-11D3-A3BF-006097C9B344}';
IID_IWMPCdrom: TGUID = '{CFAB6E98-8730-11D3-B388-00C04F68574B}';
IID_IWMPClosedCaption: TGUID = '{4F2DF574-C588-11D3-9ED0-00C04FB6E937}';
IID_IWMPError: TGUID = '{A12DCF7D-14AB-4C1B-A8CD-63909F06025B}';
IID_IWMPErrorItem: TGUID = '{3614C646-3B3B-4DE7-A81E-930E3F2127B3}';
IID_IWMPDVD: TGUID = '{8DA61686-4668-4A5C-AE5D-803193293DBE}';
IID_IWMPPlayerApplication: TGUID = '{40897764-CEAB-47BE-AD4A-8E28537F9BBF}';
IID_IWMPPlayer2: TGUID = '{0E6B01D1-D407-4C85-BF5F-1C01F6150280}';
IID_IWMPPlayer: TGUID = '{6BF52A4F-394A-11D3-B153-00C04F79FAA6}';
IID_IWMPErrorItem2: TGUID = '{F75CCEC0-C67C-475C-931E-8719870BEE7D}';
IID_IWMPControls2: TGUID = '{6F030D25-0890-480F-9775-1F7E40AB5B8E}';
IID_IWMPMedia2: TGUID = '{AB7C88BB-143E-4EA4-ACC3-E4350B2106C3}';
IID_IWMPMedia3: TGUID = '{F118EFC7-F03A-4FB4-99C9-1C02A5C1065B}';
IID_IWMPMetadataPicture: TGUID = '{5C29BBE0-F87D-4C45-AA28-A70F0230FFA9}';
IID_IWMPMetadataText: TGUID = '{769A72DB-13D2-45E2-9C48-53CA9D5B7450}';
IID_IWMPSettings2: TGUID = '{FDA937A4-EECE-4DA5-A0B6-39BF89ADE2C2}';
IID_IWMPControls3: TGUID = '{A1D1110E-D545-476A-9A78-AC3E4CB1E6BD}';
IID_IWMPClosedCaption2: TGUID = '{350BA78B-6BC8-4113-A5F5-312056934EB6}';
IID_IWMPMediaCollection2: TGUID = '{8BA957F5-FD8C-4791-B82D-F840401EE474}';
IID_IWMPStringCollection2: TGUID = '{46AD648D-53F1-4A74-92E2-2A1B68D63FD4}';
IID_IWMPQuery: TGUID = '{A00918F3-A6B0-4BFB-9189-FD834C7BC5A5}';
CLASS_WindowsMediaPlayer: TGUID = '{6BF52A52-394A-11D3-B153-00C04F79FAA6}';
IID_IWMPPlayerServices: TGUID = '{1D01FBDB-ADE2-4C8D-9842-C190B95C3306}';
IID_IWMPPlayerServices2: TGUID = '{1BB1592F-F040-418A-9F71-17C7512B4D70}';
IID_IWMPRemoteMediaServices: TGUID = '{CBB92747-741F-44FE-AB5B-F1A48F3B2A59}';
IID_IWMPSyncServices: TGUID = '{8B5050FF-E0A4-4808-B3A8-893A9E1ED894}';
IID_IWMPLibraryServices: TGUID = '{39C2F8D5-1CF2-4D5E-AE09-D73492CF9EAA}';
IID_IWMPLibrarySharingServices: TGUID = '{82CBA86B-9F04-474B-A365-D6DD1466E541}';
IID_IWMPFolderMonitorServices: TGUID = '{788C8743-E57F-439D-A468-5BC77F2E59C6}';
IID_IWMPSyncDevice2: TGUID = '{88AFB4B2-140A-44D2-91E6-4543DA467CD1}';
IID_IWMPPlaylistCtrl: TGUID = '{5F9CFD92-8CAD-11D3-9A7E-00C04F8EFB70}';
IID_IAppDispatch: TGUID = '{E41C88DD-2364-4FF7-A0F5-CA9859AF783F}';
IID_IWMPSafeBrowser: TGUID = '{EF870383-83AB-4EA9-BE48-56FA4251AF10}';
IID_IWMPObjectExtendedProps: TGUID = '{21D077C1-4BAA-11D3-BD45-00C04F6EA5AE}';
IID_IWMPLayoutSubView: TGUID = '{72F486B1-0D43-11D3-BD3F-00C04F6EA5AE}';
IID_IWMPLayoutView: TGUID = '{172E905D-80D9-4C2F-B7CE-2CCB771787A2}';
IID_IWMPEventObject: TGUID = '{5AF0BEC1-46AA-11D3-BD45-00C04F6EA5AE}';
IID_IWMPTheme: TGUID = '{6FCAE13D-E492-4584-9C21-D2C052A2A33A}';
IID_IWMPLayoutSettingsDispatch: TGUID = '{B2C2D18E-97AF-4B6A-A56B-2FFFF470FB81}';
IID_IWMPBrandDispatch: TGUID = '{98BB02D4-ED74-43CC-AD6A-45888F2E0DCC}';
IID_IWMPNowPlayingHelperDispatch: TGUID = '{504F112E-77CC-4E3C-A073-5371B31D9B36}';
IID_IWMPNowDoingDispatch: TGUID = '{2A2E0DA3-19FA-4F82-BE18-CD7D7A3B977F}';
DIID_IWMPButtonCtrlEvents: TGUID = '{BB17FFF7-1692-4555-918A-6AF7BFACEDD2}';
IID_IWMPButtonCtrl: TGUID = '{87291B50-0C8E-11D3-BB2A-00A0C93CA73A}';
CLASS_WMPButtonCtrl: TGUID = '{87291B51-0C8E-11D3-BB2A-00A0C93CA73A}';
IID_IWMPListBoxCtrl: TGUID = '{FC1880CE-83B9-43A7-A066-C44CE8C82583}';
CLASS_WMPListBoxCtrl: TGUID = '{FC1880CF-83B9-43A7-A066-C44CE8C82583}';
IID_IWMPListBoxItem: TGUID = '{D255DFB8-C22A-42CF-B8B7-F15D7BCF65D6}';
IID_IWMPPlaylistCtrlColumn: TGUID = '{63D9D30F-AE4C-4678-8CA8-5720F4FE4419}';
DIID_IWMPSliderCtrlEvents: TGUID = '{CDAC14D2-8BE4-11D3-BB48-00A0C93CA73A}';
IID_IWMPSliderCtrl: TGUID = '{F2BF2C8F-405F-11D3-BB39-00A0C93CA73A}';
CLASS_WMPSliderCtrl: TGUID = '{F2BF2C90-405F-11D3-BB39-00A0C93CA73A}';
DIID_IWMPVideoCtrlEvents: TGUID = '{A85C0477-714C-4A06-B9F6-7C8CA38B45DC}';
IID_IWMPVideoCtrl: TGUID = '{61CECF10-FC3A-11D2-A1CD-005004602752}';
CLASS_WMPVideoCtrl: TGUID = '{61CECF11-FC3A-11D2-A1CD-005004602752}';
IID_IWMPEffectsCtrl: TGUID = '{A9EFAB80-0A60-4C3F-BBD1-4558DD2A9769}';
CLASS_WMPEffects: TGUID = '{47DEA830-D619-4154-B8D8-6B74845D6A2D}';
IID_IWMPEqualizerSettingsCtrl: TGUID = '{2BD3716F-A914-49FB-8655-996D5F495498}';
CLASS_WMPEqualizerSettingsCtrl: TGUID = '{93EB32F5-87B1-45AD-ACC6-0F2483DB83BB}';
IID_IWMPVideoSettingsCtrl: TGUID = '{07EC23DA-EF73-4BDE-A40F-F269E0B7AFD6}';
CLASS_WMPVideoSettingsCtrl: TGUID = '{AE7BFAFE-DCC8-4A73-92C8-CC300CA88859}';
IID_IWMPLibraryTreeCtrl: TGUID = '{B738FCAE-F089-45DF-AED6-034B9E7DB632}';
CLASS_WMPLibraryTreeCtrl: TGUID = '{D9DE732A-AEE9-4503-9D11-5605589977A8}';
IID_IWMPEditCtrl: TGUID = '{70E1217C-C617-4CFD-BD8A-69CA2043E70B}';
CLASS_WMPEditCtrl: TGUID = '{6342FCED-25EA-4033-BDDB-D049A14382D3}';
IID_IWMPPluginUIHost: TGUID = '{5D0AD945-289E-45C5-A9C6-F301F0152108}';
IID_IWMPMenuCtrl: TGUID = '{158A7ADC-33DA-4039-A553-BDDBBE389F5C}';
CLASS_WMPMenuCtrl: TGUID = '{BAB3768B-8883-4AEC-9F9B-E14C947913EF}';
IID_IWMPAutoMenuCtrl: TGUID = '{1AD13E0B-4F3A-41DF-9BE2-F9E6FE0A7875}';
CLASS_WMPAutoMenuCtrl: TGUID = '{6B28F900-8D64-4B80-9963-CC52DDD1FBB4}';
IID_IWMPRegionalButtonCtrl: TGUID = '{58D507B1-2354-11D3-BD41-00C04F6EA5AE}';
CLASS_WMPRegionalButtonCtrl: TGUID = '{AE3B6831-25A9-11D3-BD41-00C04F6EA5AE}';
DIID_IWMPRegionalButtonEvents: TGUID = '{50FC8D31-67AC-11D3-BD4C-00C04F6EA5AE}';
IID_IWMPRegionalButton: TGUID = '{58D507B2-2354-11D3-BD41-00C04F6EA5AE}';
CLASS_WMPRegionalButton: TGUID = '{09AEFF11-69EF-11D3-BD4D-00C04F6EA5AE}';
DIID_IWMPCustomSliderCtrlEvents: TGUID = '{95F45AA4-ED0A-11D2-BA67-0000F80855E6}';
IID_IWMPCustomSlider: TGUID = '{95F45AA2-ED0A-11D2-BA67-0000F80855E6}';
CLASS_WMPCustomSliderCtrl: TGUID = '{95F45AA3-ED0A-11D2-BA67-0000F80855E6}';
IID_IWMPTextCtrl: TGUID = '{237DAC8E-0E32-11D3-A2E2-00C04F79F88E}';
CLASS_WMPTextCtrl: TGUID = '{DDDA102E-0E17-11D3-A2E2-00C04F79F88E}';
CLASS_WMPPlaylistCtrl: TGUID = '{5F9CFD93-8CAD-11D3-9A7E-00C04F8EFB70}';
IID_ITaskCntrCtrl: TGUID = '{891EADB1-1C45-48B0-B704-49A888DA98C4}';
DIID__WMPCoreEvents: TGUID = '{D84CCA96-CCE2-11D2-9ECC-0000F8085981}';
CLASS_WMPCore: TGUID = '{09428D37-E0B9-11D2-B147-00C04F79FAA6}';
IID_IWMPGraphEventHandler: TGUID = '{6B550945-018F-11D3-B14A-00C04F79FAA6}';
IID_IBattery: TGUID = '{F8578BFA-CD8F-4CE1-A684-5B7E85FCA7DC}';
IID_IBatteryPreset: TGUID = '{40C6BDE7-9C90-49D4-AD20-BEF81A6C5F22}';
IID_IBatteryRandomPreset: TGUID = '{F85E2D65-207D-48DB-84B1-915E1735DB17}';
IID_IBatterySavedPreset: TGUID = '{876E7208-0172-4EBB-B08B-2E1D30DFE44C}';
IID_IBarsEffect: TGUID = '{33E9291A-F6A9-11D2-9435-00A0C92A2F2D}';
IID_IWMPExternal: TGUID = '{E2CC638C-FD2C-409B-A1EA-5DDB72DC8E84}';
IID_IWMPExternalColors: TGUID = '{D10CCDFF-472D-498C-B5FE-3630E5405E0A}';
IID_IWMPSubscriptionServiceLimited: TGUID = '{54DF358E-CF38-4010-99F1-F44B0E9000E5}';
IID_IWMPSubscriptionServiceExternal: TGUID = '{2E922378-EE70-4CEB-BBAB-CE7CE4A04816}';
IID_IWMPDownloadManager: TGUID = '{E15E9AD1-8F20-4CC4-9EC7-1A328CA86A0D}';
IID_IWMPDownloadCollection: TGUID = '{0A319C7F-85F9-436C-B88E-82FD88000E1C}';
IID_IWMPDownloadItem: TGUID = '{C9470E8E-3F6B-46A9-A0A9-452815C34297}';
IID_IWMPDownloadItem2: TGUID = '{9FBB3336-6DA3-479D-B8FF-67D46E20A987}';
IID_IWMPSubscriptionServicePlayMedia: TGUID = '{5F0248C1-62B3-42D7-B927-029119E6AD14}';
IID_IWMPDiscoExternal: TGUID = '{A915CEA2-72DF-41E1-A576-EF0BAE5E5169}';
IID_IWMPCDDVDWizardExternal: TGUID = '{2D7EF888-1D3C-484A-A906-9F49D99BB344}';
IID_IWMPBaseExternal: TGUID = '{F81B2A59-02BC-4003-8B2F-C124AF66FC66}';
IID_IWMPOfflineExternal: TGUID = '{3148E685-B243-423D-8341-8480D6EFF674}';
IID_IWMPRemoteUPnPService: TGUID = '{17E5DC63-E296-4EDE-B9CC-CF57D18ED10E}';
IID_IWMPRemoteUPnPDevice: TGUID = '{76F13F00-6E17-4D98-BE2D-D2A84CFF5BFD}';
IID_IWMPRemoteDeviceController: TGUID = '{968F36CA-CB43-4F6A-A03B-66A9C05A93EE}';
IID_IUPnPService_IWMPUPnPAVTransportDual: TGUID = '{0EA1DE14-E288-4958-A23C-942634A27EB5}';
IID_IUPnPService_IWMPUPnPBinaryControlDual: TGUID = '{7CAD1D24-EDED-47FA-A1D8-4628FBE5638C}';
IID_IUPnPService_IWMPUPnPVariableControlDual: TGUID = '{5A09862E-47B1-4D17-94EA-2BDE3014DD42}';
IID_IUPnPService_IWMPUPnPConnectionManagerDual: TGUID = '{1AF41667-542C-42EA-BF53-DC101168C503}';
IID_IUPnPService_IWMPUPnPSkinRetrieverDual: TGUID = '{AC743628-971D-4C1E-B019-50543EFE2BAD}';
// *********************************************************************//
// Declaration of Enumerations defined in Type Library
// *********************************************************************//
// Constants for enum WMPPlaylistChangeEventType
type
WMPPlaylistChangeEventType = TOleEnum;
const
wmplcUnknown = $00000000;
wmplcClear = $00000001;
wmplcInfoChange = $00000002;
wmplcMove = $00000003;
wmplcDelete = $00000004;
wmplcInsert = $00000005;
wmplcAppend = $00000006;
wmplcPrivate = $00000007;
wmplcNameChange = $00000008;
wmplcMorph = $00000009;
wmplcSort = $0000000A;
wmplcLast = $0000000B;
// Constants for enum WMPDeviceStatus
type
WMPDeviceStatus = TOleEnum;
const
wmpdsUnknown = $00000000;
wmpdsPartnershipExists = $00000001;
wmpdsPartnershipDeclined = $00000002;
wmpdsPartnershipAnother = $00000003;
wmpdsManualDevice = $00000004;
wmpdsNewDevice = $00000005;
wmpdsLast = $00000006;
// Constants for enum WMPSyncState
type
WMPSyncState = TOleEnum;
const
wmpssUnknown = $00000000;
wmpssSynchronizing = $00000001;
wmpssStopped = $00000002;
wmpssLast = $00000003;
// Constants for enum WMPRipState
type
WMPRipState = TOleEnum;
const
wmprsUnknown = $00000000;
wmprsRipping = $00000001;
wmprsStopped = $00000002;
// Constants for enum WMPBurnFormat
type
WMPBurnFormat = TOleEnum;
const
wmpbfAudioCD = $00000000;
wmpbfDataCD = $00000001;
// Constants for enum WMPBurnState
type
WMPBurnState = TOleEnum;
const
wmpbsUnknown = $00000000;
wmpbsBusy = $00000001;
wmpbsReady = $00000002;
wmpbsWaitingForDisc = $00000003;
wmpbsRefreshStatusPending = $00000004;
wmpbsPreparingToBurn = $00000005;
wmpbsBurning = $00000006;
wmpbsStopped = $00000007;
wmpbsErasing = $00000008;
wmpbsDownloading = $00000009;
// Constants for enum WMPLibraryType
type
WMPLibraryType = TOleEnum;
const
wmpltUnknown = $00000000;
wmpltAll = $00000001;
wmpltLocal = $00000002;
wmpltRemote = $00000003;
wmpltDisc = $00000004;
wmpltPortableDevice = $00000005;
// Constants for enum WMPFolderScanState
type
WMPFolderScanState = TOleEnum;
const
wmpfssUnknown = $00000000;
wmpfssScanning = $00000001;
wmpfssUpdating = $00000002;
wmpfssStopped = $00000003;
// Constants for enum WMPStringCollectionChangeEventType
type
WMPStringCollectionChangeEventType = TOleEnum;
const
wmpsccetUnknown = $00000000;
wmpsccetInsert = $00000001;
wmpsccetChange = $00000002;
wmpsccetDelete = $00000003;
wmpsccetClear = $00000004;
wmpsccetBeginUpdates = $00000005;
wmpsccetEndUpdates = $00000006;
// Constants for enum WMPOpenState
type
WMPOpenState = TOleEnum;
const
wmposUndefined = $00000000;
wmposPlaylistChanging = $00000001;
wmposPlaylistLocating = $00000002;
wmposPlaylistConnecting = $00000003;
wmposPlaylistLoading = $00000004;
wmposPlaylistOpening = $00000005;
wmposPlaylistOpenNoMedia = $00000006;
wmposPlaylistChanged = $00000007;
wmposMediaChanging = $00000008;
wmposMediaLocating = $00000009;
wmposMediaConnecting = $0000000A;
wmposMediaLoading = $0000000B;
wmposMediaOpening = $0000000C;
wmposMediaOpen = $0000000D;
wmposBeginCodecAcquisition = $0000000E;
wmposEndCodecAcquisition = $0000000F;
wmposBeginLicenseAcquisition = $00000010;
wmposEndLicenseAcquisition = $00000011;
wmposBeginIndividualization = $00000012;
wmposEndIndividualization = $00000013;
wmposMediaWaiting = $00000014;
wmposOpeningUnknownURL = $00000015;
// Constants for enum WMPPlayState
type
WMPPlayState = TOleEnum;
const
wmppsUndefined = $00000000;
wmppsStopped = $00000001;
wmppsPaused = $00000002;
wmppsPlaying = $00000003;
wmppsScanForward = $00000004;
wmppsScanReverse = $00000005;
wmppsBuffering = $00000006;
wmppsWaiting = $00000007;
wmppsMediaEnded = $00000008;
wmppsTransitioning = $00000009;
wmppsReady = $0000000A;
wmppsReconnecting = $0000000B;
wmppsLast = $0000000C;
// Constants for enum WMPSubscriptionDownloadState
type
WMPSubscriptionDownloadState = TOleEnum;
const
wmpsdlsDownloading = $00000000;
wmpsdlsPaused = $00000001;
wmpsdlsProcessing = $00000002;
wmpsdlsCompleted = $00000003;
wmpsdlsCancelled = $00000004;
// Constants for enum WMP_WRITENAMESEX_TYPE
type
WMP_WRITENAMESEX_TYPE = TOleEnum;
const
WMP_WRITENAMES_TYPE_CD_BY_TOC = $00000000;
WMP_WRITENAMES_TYPE_CD_BY_CONTENT_ID = $00000001;
WMP_WRITENAMES_TYPE_CD_BY_MDQCD = $00000002;
WMP_WRITENAMES_TYPE_DVD_BY_DVDID = $00000003;
type
// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IWMPEvents = interface;
IWMPEvents2 = interface;
IWMPSyncDevice = interface;
IWMPEvents3 = interface;
IWMPCdromRip = interface;
IWMPCdromBurn = interface;
IWMPPlaylist = interface;
IWMPPlaylistDisp = dispinterface;
IWMPMedia = interface;
IWMPMediaDisp = dispinterface;
IWMPLibrary = interface;
IWMPMediaCollection = interface;
IWMPMediaCollectionDisp = dispinterface;
IWMPStringCollection = interface;
IWMPStringCollectionDisp = dispinterface;
_WMPOCXEvents = dispinterface;
IWMPCore = interface;
IWMPCoreDisp = dispinterface;
IWMPCore2 = interface;
IWMPCore2Disp = dispinterface;
IWMPCore3 = interface;
IWMPCore3Disp = dispinterface;
IWMPPlayer4 = interface;
IWMPPlayer4Disp = dispinterface;
IWMPPlayer3 = interface;
IWMPPlayer3Disp = dispinterface;
IWMPControls = interface;
IWMPControlsDisp = dispinterface;
IWMPSettings = interface;
IWMPSettingsDisp = dispinterface;
IWMPPlaylistCollection = interface;
IWMPPlaylistCollectionDisp = dispinterface;
IWMPPlaylistArray = interface;
IWMPPlaylistArrayDisp = dispinterface;
IWMPNetwork = interface;
IWMPNetworkDisp = dispinterface;
IWMPCdromCollection = interface;
IWMPCdromCollectionDisp = dispinterface;
IWMPCdrom = interface;
IWMPCdromDisp = dispinterface;
IWMPClosedCaption = interface;
IWMPClosedCaptionDisp = dispinterface;
IWMPError = interface;
IWMPErrorDisp = dispinterface;
IWMPErrorItem = interface;
IWMPErrorItemDisp = dispinterface;
IWMPDVD = interface;
IWMPDVDDisp = dispinterface;
IWMPPlayerApplication = interface;
IWMPPlayerApplicationDisp = dispinterface;
IWMPPlayer2 = interface;
IWMPPlayer2Disp = dispinterface;
IWMPPlayer = interface;
IWMPPlayerDisp = dispinterface;
IWMPErrorItem2 = interface;
IWMPErrorItem2Disp = dispinterface;
IWMPControls2 = interface;
IWMPControls2Disp = dispinterface;
IWMPMedia2 = interface;
IWMPMedia2Disp = dispinterface;
IWMPMedia3 = interface;
IWMPMedia3Disp = dispinterface;
IWMPMetadataPicture = interface;
IWMPMetadataPictureDisp = dispinterface;
IWMPMetadataText = interface;
IWMPMetadataTextDisp = dispinterface;
IWMPSettings2 = interface;
IWMPSettings2Disp = dispinterface;
IWMPControls3 = interface;
IWMPControls3Disp = dispinterface;
IWMPClosedCaption2 = interface;
IWMPClosedCaption2Disp = dispinterface;
IWMPMediaCollection2 = interface;
IWMPMediaCollection2Disp = dispinterface;
IWMPStringCollection2 = interface;
IWMPStringCollection2Disp = dispinterface;
IWMPQuery = interface;
IWMPQueryDisp = dispinterface;
IWMPPlayerServices = interface;
IWMPPlayerServices2 = interface;
IWMPRemoteMediaServices = interface;
IWMPSyncServices = interface;
IWMPLibraryServices = interface;
IWMPLibrarySharingServices = interface;
IWMPFolderMonitorServices = interface;
IWMPSyncDevice2 = interface;
IWMPPlaylistCtrl = interface;
IWMPPlaylistCtrlDisp = dispinterface;
IAppDispatch = interface;
IAppDispatchDisp = dispinterface;
IWMPSafeBrowser = interface;
IWMPSafeBrowserDisp = dispinterface;
IWMPObjectExtendedProps = interface;
IWMPObjectExtendedPropsDisp = dispinterface;
IWMPLayoutSubView = interface;
IWMPLayoutSubViewDisp = dispinterface;
IWMPLayoutView = interface;
IWMPLayoutViewDisp = dispinterface;
IWMPEventObject = interface;
IWMPEventObjectDisp = dispinterface;
IWMPTheme = interface;
IWMPThemeDisp = dispinterface;
IWMPLayoutSettingsDispatch = interface;
IWMPLayoutSettingsDispatchDisp = dispinterface;
IWMPBrandDispatch = interface;
IWMPBrandDispatchDisp = dispinterface;
IWMPNowPlayingHelperDispatch = interface;
IWMPNowPlayingHelperDispatchDisp = dispinterface;
IWMPNowDoingDispatch = interface;
IWMPNowDoingDispatchDisp = dispinterface;
IWMPButtonCtrlEvents = dispinterface;
IWMPButtonCtrl = interface;
IWMPButtonCtrlDisp = dispinterface;
IWMPListBoxCtrl = interface;
IWMPListBoxCtrlDisp = dispinterface;
IWMPListBoxItem = interface;
IWMPListBoxItemDisp = dispinterface;
IWMPPlaylistCtrlColumn = interface;
IWMPPlaylistCtrlColumnDisp = dispinterface;
IWMPSliderCtrlEvents = dispinterface;
IWMPSliderCtrl = interface;
IWMPSliderCtrlDisp = dispinterface;
IWMPVideoCtrlEvents = dispinterface;
IWMPVideoCtrl = interface;
IWMPVideoCtrlDisp = dispinterface;
IWMPEffectsCtrl = interface;
IWMPEffectsCtrlDisp = dispinterface;
IWMPEqualizerSettingsCtrl = interface;
IWMPEqualizerSettingsCtrlDisp = dispinterface;
IWMPVideoSettingsCtrl = interface;
IWMPVideoSettingsCtrlDisp = dispinterface;
IWMPLibraryTreeCtrl = interface;
IWMPLibraryTreeCtrlDisp = dispinterface;
IWMPEditCtrl = interface;
IWMPEditCtrlDisp = dispinterface;
IWMPPluginUIHost = interface;
IWMPPluginUIHostDisp = dispinterface;
IWMPMenuCtrl = interface;
IWMPMenuCtrlDisp = dispinterface;
IWMPAutoMenuCtrl = interface;
IWMPAutoMenuCtrlDisp = dispinterface;
IWMPRegionalButtonCtrl = interface;
IWMPRegionalButtonCtrlDisp = dispinterface;
IWMPRegionalButtonEvents = dispinterface;
IWMPRegionalButton = interface;
IWMPRegionalButtonDisp = dispinterface;
IWMPCustomSliderCtrlEvents = dispinterface;
IWMPCustomSlider = interface;
IWMPCustomSliderDisp = dispinterface;
IWMPTextCtrl = interface;
IWMPTextCtrlDisp = dispinterface;
ITaskCntrCtrl = interface;
ITaskCntrCtrlDisp = dispinterface;
_WMPCoreEvents = dispinterface;
IWMPGraphEventHandler = interface;
IWMPGraphEventHandlerDisp = dispinterface;
IBattery = interface;
IBatteryDisp = dispinterface;
IBatteryPreset = interface;
IBatteryPresetDisp = dispinterface;
IBatteryRandomPreset = interface;
IBatteryRandomPresetDisp = dispinterface;
IBatterySavedPreset = interface;
IBatterySavedPresetDisp = dispinterface;
IBarsEffect = interface;
IBarsEffectDisp = dispinterface;
IWMPExternal = interface;
IWMPExternalDisp = dispinterface;
IWMPExternalColors = interface;
IWMPExternalColorsDisp = dispinterface;
IWMPSubscriptionServiceLimited = interface;
IWMPSubscriptionServiceLimitedDisp = dispinterface;
IWMPSubscriptionServiceExternal = interface;
IWMPSubscriptionServiceExternalDisp = dispinterface;
IWMPDownloadManager = interface;
IWMPDownloadManagerDisp = dispinterface;
IWMPDownloadCollection = interface;
IWMPDownloadCollectionDisp = dispinterface;
IWMPDownloadItem = interface;
IWMPDownloadItemDisp = dispinterface;
IWMPDownloadItem2 = interface;
IWMPDownloadItem2Disp = dispinterface;
IWMPSubscriptionServicePlayMedia = interface;
IWMPSubscriptionServicePlayMediaDisp = dispinterface;
IWMPDiscoExternal = interface;
IWMPDiscoExternalDisp = dispinterface;
IWMPCDDVDWizardExternal = interface;
IWMPCDDVDWizardExternalDisp = dispinterface;
IWMPBaseExternal = interface;
IWMPBaseExternalDisp = dispinterface;
IWMPOfflineExternal = interface;
IWMPOfflineExternalDisp = dispinterface;
IWMPRemoteUPnPService = interface;
IWMPRemoteUPnPServiceDisp = dispinterface;
IWMPRemoteUPnPDevice = interface;
IWMPRemoteUPnPDeviceDisp = dispinterface;
IWMPRemoteDeviceController = interface;
IWMPRemoteDeviceControllerDisp = dispinterface;
IUPnPService_IWMPUPnPAVTransportDual = interface;
IUPnPService_IWMPUPnPAVTransportDualDisp = dispinterface;
IUPnPService_IWMPUPnPBinaryControlDual = interface;
IUPnPService_IWMPUPnPBinaryControlDualDisp = dispinterface;
IUPnPService_IWMPUPnPVariableControlDual = interface;
IUPnPService_IWMPUPnPVariableControlDualDisp = dispinterface;
IUPnPService_IWMPUPnPConnectionManagerDual = interface;
IUPnPService_IWMPUPnPConnectionManagerDualDisp = dispinterface;
IUPnPService_IWMPUPnPSkinRetrieverDual = interface;
IUPnPService_IWMPUPnPSkinRetrieverDualDisp = dispinterface;
// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
WindowsMediaPlayer = IWMPPlayer4;
WMPButtonCtrl = IWMPButtonCtrl;
WMPListBoxCtrl = IWMPListBoxCtrl;
WMPSliderCtrl = IWMPSliderCtrl;
WMPVideoCtrl = IWMPVideoCtrl;
WMPEffects = IWMPEffectsCtrl;
WMPEqualizerSettingsCtrl = IWMPEqualizerSettingsCtrl;
WMPVideoSettingsCtrl = IWMPVideoSettingsCtrl;
WMPLibraryTreeCtrl = IWMPLibraryTreeCtrl;
WMPEditCtrl = IWMPEditCtrl;
WMPMenuCtrl = IWMPMenuCtrl;
WMPAutoMenuCtrl = IWMPAutoMenuCtrl;
WMPRegionalButtonCtrl = IWMPRegionalButtonCtrl;
WMPRegionalButton = IWMPRegionalButton;
WMPCustomSliderCtrl = IWMPCustomSlider;
WMPTextCtrl = IWMPTextCtrl;
WMPPlaylistCtrl = IWMPPlaylistCtrl;
WMPCore = IWMPCore3;
// *********************************************************************//
// Declaration of structures, unions and aliases.
// *********************************************************************//
PByte1 = ^Byte; {*}
PIUnknown1 = ^IUnknown; {*}
ULONG_PTR = LongWord;
// *********************************************************************//
// Interface: IWMPEvents
// Flags: (0)
// GUID: {19A6627B-DA9E-47C1-BB23-00B5E668236A}
// *********************************************************************//
IWMPEvents = interface(IUnknown)
['{19A6627B-DA9E-47C1-BB23-00B5E668236A}']
procedure OpenStateChange(NewState: Integer); stdcall;
procedure PlayStateChange(NewState: Integer); stdcall;
procedure AudioLanguageChange(LangID: Integer); stdcall;
procedure StatusChange; stdcall;
procedure ScriptCommand(const scType: WideString; const Param: WideString); stdcall;
procedure NewStream; stdcall;
procedure Disconnect(Result: Integer); stdcall;
procedure Buffering(Start: WordBool); stdcall;
procedure Error; stdcall;
procedure Warning(WarningType: Integer; Param: Integer; const Description: WideString); stdcall;
procedure EndOfStream(Result: Integer); stdcall;
procedure PositionChange(oldPosition: Double; newPosition: Double); stdcall;
procedure MarkerHit(MarkerNum: Integer); stdcall;
procedure DurationUnitChange(NewDurationUnit: Integer); stdcall;
procedure CdromMediaChange(CdromNum: Integer); stdcall;
procedure PlaylistChange(const Playlist: IDispatch; change: WMPPlaylistChangeEventType); stdcall;
procedure CurrentPlaylistChange(change: WMPPlaylistChangeEventType); stdcall;
procedure CurrentPlaylistItemAvailable(const bstrItemName: WideString); stdcall;
procedure MediaChange(const Item: IDispatch); stdcall;
procedure CurrentMediaItemAvailable(const bstrItemName: WideString); stdcall;
procedure CurrentItemChange(const pdispMedia: IDispatch); stdcall;
procedure MediaCollectionChange; stdcall;
procedure MediaCollectionAttributeStringAdded(const bstrAttribName: WideString;
const bstrAttribVal: WideString); stdcall;
procedure MediaCollectionAttributeStringRemoved(const bstrAttribName: WideString;
const bstrAttribVal: WideString); stdcall;
procedure MediaCollectionAttributeStringChanged(const bstrAttribName: WideString;
const bstrOldAttribVal: WideString;
const bstrNewAttribVal: WideString); stdcall;
procedure PlaylistCollectionChange; stdcall;
procedure PlaylistCollectionPlaylistAdded(const bstrPlaylistName: WideString); stdcall;
procedure PlaylistCollectionPlaylistRemoved(const bstrPlaylistName: WideString); stdcall;
procedure PlaylistCollectionPlaylistSetAsDeleted(const bstrPlaylistName: WideString;
varfIsDeleted: WordBool); stdcall;
procedure ModeChange(const ModeName: WideString; NewValue: WordBool); stdcall;
procedure MediaError(const pMediaObject: IDispatch); stdcall;
procedure OpenPlaylistSwitch(const pItem: IDispatch); stdcall;
procedure DomainChange(const strDomain: WideString); stdcall;
procedure SwitchedToPlayerApplication; stdcall;
procedure SwitchedToControl; stdcall;
procedure PlayerDockedStateChange; stdcall;
procedure PlayerReconnect; stdcall;
procedure Click(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); stdcall;
procedure DoubleClick(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); stdcall;
procedure KeyDown(nKeyCode: Smallint; nShiftState: Smallint); stdcall;
procedure KeyPress(nKeyAscii: Smallint); stdcall;
procedure KeyUp(nKeyCode: Smallint; nShiftState: Smallint); stdcall;
procedure MouseDown(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); stdcall;
procedure MouseMove(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); stdcall;
procedure MouseUp(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); stdcall;
end;
// *********************************************************************//
// Interface: IWMPEvents2
// Flags: (0)
// GUID: {1E7601FA-47EA-4107-9EA9-9004ED9684FF}
// *********************************************************************//
IWMPEvents2 = interface(IWMPEvents)
['{1E7601FA-47EA-4107-9EA9-9004ED9684FF}']
procedure DeviceConnect(const pDevice: IWMPSyncDevice); stdcall;
procedure DeviceDisconnect(const pDevice: IWMPSyncDevice); stdcall;
procedure DeviceStatusChange(const pDevice: IWMPSyncDevice; NewStatus: WMPDeviceStatus); stdcall;
procedure DeviceSyncStateChange(const pDevice: IWMPSyncDevice; NewState: WMPSyncState); stdcall;
procedure DeviceSyncError(const pDevice: IWMPSyncDevice; const pMedia: IDispatch); stdcall;
procedure CreatePartnershipComplete(const pDevice: IWMPSyncDevice; hrResult: HResult); stdcall;
end;
// *********************************************************************//
// Interface: IWMPSyncDevice
// Flags: (256) OleAutomation
// GUID: {82A2986C-0293-4FD0-B279-B21B86C058BE}
// *********************************************************************//
IWMPSyncDevice = interface(IUnknown)
['{82A2986C-0293-4FD0-B279-B21B86C058BE}']
function Get_friendlyName(out pbstrName: WideString): HResult; stdcall;
function Set_friendlyName(const pbstrName: WideString): HResult; stdcall;
function Get_deviceName(out pbstrName: WideString): HResult; stdcall;
function Get_deviceId(out pbstrDeviceId: WideString): HResult; stdcall;
function Get_partnershipIndex(out plIndex: Integer): HResult; stdcall;
function Get_connected(out pvbConnected: WordBool): HResult; stdcall;
function Get_status(out pwmpds: WMPDeviceStatus): HResult; stdcall;
function Get_syncState(out pwmpss: WMPSyncState): HResult; stdcall;
function Get_progress(out plProgress: Integer): HResult; stdcall;
function getItemInfo(const bstrItemName: WideString; out pbstrVal: WideString): HResult; stdcall;
function createPartnership(vbShowUI: WordBool): HResult; stdcall;
function deletePartnership: HResult; stdcall;
function Start: HResult; stdcall;
function stop: HResult; stdcall;
function showSettings: HResult; stdcall;
function isIdentical(const pDevice: IWMPSyncDevice; out pvbool: WordBool): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPEvents3
// Flags: (0)
// GUID: {1F504270-A66B-4223-8E96-26A06C63D69F}
// *********************************************************************//
IWMPEvents3 = interface(IWMPEvents2)
['{1F504270-A66B-4223-8E96-26A06C63D69F}']
procedure CdromRipStateChange(const pCdromRip: IWMPCdromRip; wmprs: WMPRipState); stdcall;
procedure CdromRipMediaError(const pCdromRip: IWMPCdromRip; const pMedia: IDispatch); stdcall;
procedure CdromBurnStateChange(const pCdromBurn: IWMPCdromBurn; wmpbs: WMPBurnState); stdcall;
procedure CdromBurnMediaError(const pCdromBurn: IWMPCdromBurn; const pMedia: IDispatch); stdcall;
procedure CdromBurnError(const pCdromBurn: IWMPCdromBurn; hrError: HResult); stdcall;
procedure LibraryConnect(const pLibrary: IWMPLibrary); stdcall;
procedure LibraryDisconnect(const pLibrary: IWMPLibrary); stdcall;
procedure FolderScanStateChange(wmpfss: WMPFolderScanState); stdcall;
procedure ansistringCollectionChange(const pdispStringCollection: IDispatch;
change: WMPStringCollectionChangeEventType;
lCollectionIndex: Integer); stdcall;
procedure MediaCollectionMediaAdded(const pdispMedia: IDispatch); stdcall;
procedure MediaCollectionMediaRemoved(const pdispMedia: IDispatch); stdcall;
end;
// *********************************************************************//
// Interface: IWMPCdromRip
// Flags: (256) OleAutomation
// GUID: {56E2294F-69ED-4629-A869-AEA72C0DCC2C}
// *********************************************************************//
IWMPCdromRip = interface(IUnknown)
['{56E2294F-69ED-4629-A869-AEA72C0DCC2C}']
function Get_ripState(out pwmprs: WMPRipState): HResult; stdcall;
function Get_ripProgress(out plProgress: Integer): HResult; stdcall;
function startRip: HResult; stdcall;
function stopRip: HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPCdromBurn
// Flags: (256) OleAutomation
// GUID: {BD94DBEB-417F-4928-AA06-087D56ED9B59}
// *********************************************************************//
IWMPCdromBurn = interface(IUnknown)
['{BD94DBEB-417F-4928-AA06-087D56ED9B59}']
function isAvailable(const bstrItem: WideString; out pIsAvailable: WordBool): HResult; stdcall;
function getItemInfo(const bstrItem: WideString; out pbstrVal: WideString): HResult; stdcall;
function Get_label_(out pbstrLabel: WideString): HResult; stdcall;
function Set_label_(const pbstrLabel: WideString): HResult; stdcall;
function Get_burnFormat(out pwmpbf: WMPBurnFormat): HResult; stdcall;
function Set_burnFormat(pwmpbf: WMPBurnFormat): HResult; stdcall;
function Get_burnPlaylist(out ppPlaylist: IWMPPlaylist): HResult; stdcall;
function Set_burnPlaylist(const ppPlaylist: IWMPPlaylist): HResult; stdcall;
function refreshStatus: HResult; stdcall;
function Get_burnState(out pwmpbs: WMPBurnState): HResult; stdcall;
function Get_burnProgress(out plProgress: Integer): HResult; stdcall;
function startBurn: HResult; stdcall;
function stopBurn: HResult; stdcall;
function erase: HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPPlaylist
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D5F0F4F1-130C-11D3-B14E-00C04F79FAA6}
// *********************************************************************//
IWMPPlaylist = interface(IDispatch)
['{D5F0F4F1-130C-11D3-B14E-00C04F79FAA6}']
function Get_count: Integer; safecall;
function Get_name: WideString; safecall;
procedure Set_name(const pbstrName: WideString); safecall;
function Get_attributeCount: Integer; safecall;
function Get_attributeName(lIndex: Integer): WideString; safecall;
function Get_Item(lIndex: Integer): IWMPMedia; safecall;
function getItemInfo(const bstrName: WideString): WideString; safecall;
procedure setItemInfo(const bstrName: WideString; const bstrValue: WideString); safecall;
function Get_isIdentical(const pIWMPPlaylist: IWMPPlaylist): WordBool; safecall;
procedure clear; safecall;
procedure insertItem(lIndex: Integer; const pIWMPMedia: IWMPMedia); safecall;
procedure appendItem(const pIWMPMedia: IWMPMedia); safecall;
procedure removeItem(const pIWMPMedia: IWMPMedia); safecall;
procedure moveItem(lIndexOld: Integer; lIndexNew: Integer); safecall;
property count: Integer read Get_count;
property name: WideString read Get_name write Set_name;
property attributeCount: Integer read Get_attributeCount;
property attributeName[lIndex: Integer]: WideString read Get_attributeName;
property Item[lIndex: Integer]: IWMPMedia read Get_Item;
property isIdentical[const pIWMPPlaylist: IWMPPlaylist]: WordBool read Get_isIdentical;
end;
// *********************************************************************//
// DispIntf: IWMPPlaylistDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D5F0F4F1-130C-11D3-B14E-00C04F79FAA6}
// *********************************************************************//
IWMPPlaylistDisp = dispinterface
['{D5F0F4F1-130C-11D3-B14E-00C04F79FAA6}']
property count: Integer readonly dispid 201;
property name: WideString dispid 202;
property attributeCount: Integer readonly dispid 210;
property attributeName[lIndex: Integer]: WideString readonly dispid 211;
property Item[lIndex: Integer]: IWMPMedia readonly dispid 212;
function getItemInfo(const bstrName: WideString): WideString; dispid 203;
procedure setItemInfo(const bstrName: WideString; const bstrValue: WideString); dispid 204;
property isIdentical[const pIWMPPlaylist: IWMPPlaylist]: WordBool readonly dispid 213;
procedure clear; dispid 205;
procedure insertItem(lIndex: Integer; const pIWMPMedia: IWMPMedia); dispid 206;
procedure appendItem(const pIWMPMedia: IWMPMedia); dispid 207;
procedure removeItem(const pIWMPMedia: IWMPMedia); dispid 208;
procedure moveItem(lIndexOld: Integer; lIndexNew: Integer); dispid 209;
end;
// *********************************************************************//
// Interface: IWMPMedia
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {94D55E95-3FAC-11D3-B155-00C04F79FAA6}
// *********************************************************************//
IWMPMedia = interface(IDispatch)
['{94D55E95-3FAC-11D3-B155-00C04F79FAA6}']
function Get_isIdentical(const pIWMPMedia: IWMPMedia): WordBool; safecall;
function Get_sourceURL: WideString; safecall;
function Get_name: WideString; safecall;
procedure Set_name(const pbstrName: WideString); safecall;
function Get_imageSourceWidth: Integer; safecall;
function Get_imageSourceHeight: Integer; safecall;
function Get_markerCount: Integer; safecall;
function getMarkerTime(MarkerNum: Integer): Double; safecall;
function getMarkerName(MarkerNum: Integer): WideString; safecall;
function Get_duration: Double; safecall;
function Get_durationString: WideString; safecall;
function Get_attributeCount: Integer; safecall;
function getAttributeName(lIndex: Integer): WideString; safecall;
function getItemInfo(const bstrItemName: WideString): WideString; safecall;
procedure setItemInfo(const bstrItemName: WideString; const bstrVal: WideString); safecall;
function getItemInfoByAtom(lAtom: Integer): WideString; safecall;
function isMemberOf(const pPlaylist: IWMPPlaylist): WordBool; safecall;
function isReadOnlyItem(const bstrItemName: WideString): WordBool; safecall;
property isIdentical[const pIWMPMedia: IWMPMedia]: WordBool read Get_isIdentical;
property sourceURL: WideString read Get_sourceURL;
property name: WideString read Get_name write Set_name;
property imageSourceWidth: Integer read Get_imageSourceWidth;
property imageSourceHeight: Integer read Get_imageSourceHeight;
property markerCount: Integer read Get_markerCount;
property duration: Double read Get_duration;
property durationString: WideString read Get_durationString;
property attributeCount: Integer read Get_attributeCount;
end;
// *********************************************************************//
// DispIntf: IWMPMediaDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {94D55E95-3FAC-11D3-B155-00C04F79FAA6}
// *********************************************************************//
IWMPMediaDisp = dispinterface
['{94D55E95-3FAC-11D3-B155-00C04F79FAA6}']
property isIdentical[const pIWMPMedia: IWMPMedia]: WordBool readonly dispid 763;
property sourceURL: WideString readonly dispid 751;
property name: WideString dispid 764;
property imageSourceWidth: Integer readonly dispid 752;
property imageSourceHeight: Integer readonly dispid 753;
property markerCount: Integer readonly dispid 754;
function getMarkerTime(MarkerNum: Integer): Double; dispid 755;
function getMarkerName(MarkerNum: Integer): WideString; dispid 756;
property duration: Double readonly dispid 757;
property durationString: WideString readonly dispid 758;
property attributeCount: Integer readonly dispid 759;
function getAttributeName(lIndex: Integer): WideString; dispid 760;
function getItemInfo(const bstrItemName: WideString): WideString; dispid 761;
procedure setItemInfo(const bstrItemName: WideString; const bstrVal: WideString); dispid 762;
function getItemInfoByAtom(lAtom: Integer): WideString; dispid 765;
function isMemberOf(const pPlaylist: IWMPPlaylist): WordBool; dispid 766;
function isReadOnlyItem(const bstrItemName: WideString): WordBool; dispid 767;
end;
// *********************************************************************//
// Interface: IWMPLibrary
// Flags: (256) OleAutomation
// GUID: {3DF47861-7DF1-4C1F-A81B-4C26F0F7A7C6}
// *********************************************************************//
IWMPLibrary = interface(IUnknown)
['{3DF47861-7DF1-4C1F-A81B-4C26F0F7A7C6}']
function Get_name(out pbstrName: WideString): HResult; stdcall;
function Get_type_(out pwmplt: WMPLibraryType): HResult; stdcall;
function Get_mediaCollection(out ppIWMPMediaCollection: IWMPMediaCollection): HResult; stdcall;
function isIdentical(const pIWMPLibrary: IWMPLibrary; out pvbool: WordBool): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPMediaCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8363BC22-B4B4-4B19-989D-1CD765749DD1}
// *********************************************************************//
IWMPMediaCollection = interface(IDispatch)
['{8363BC22-B4B4-4B19-989D-1CD765749DD1}']
function add(const bstrURL: WideString): IWMPMedia; safecall;
function getAll: IWMPPlaylist; safecall;
function getByName(const bstrName: WideString): IWMPPlaylist; safecall;
function getByGenre(const bstrGenre: WideString): IWMPPlaylist; safecall;
function getByAuthor(const bstrAuthor: WideString): IWMPPlaylist; safecall;
function getByAlbum(const bstrAlbum: WideString): IWMPPlaylist; safecall;
function getByAttribute(const bstrAttribute: WideString; const bstrValue: WideString): IWMPPlaylist; safecall;
procedure remove(const pItem: IWMPMedia; varfDeleteFile: WordBool); safecall;
function getAttributeStringCollection(const bstrAttribute: WideString;
const bstrMediaType: WideString): IWMPStringCollection; safecall;
function getMediaAtom(const bstrItemName: WideString): Integer; safecall;
procedure setDeleted(const pItem: IWMPMedia; varfIsDeleted: WordBool); safecall;
function isDeleted(const pItem: IWMPMedia): WordBool; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPMediaCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8363BC22-B4B4-4B19-989D-1CD765749DD1}
// *********************************************************************//
IWMPMediaCollectionDisp = dispinterface
['{8363BC22-B4B4-4B19-989D-1CD765749DD1}']
function add(const bstrURL: WideString): IWMPMedia; dispid 452;
function getAll: IWMPPlaylist; dispid 453;
function getByName(const bstrName: WideString): IWMPPlaylist; dispid 454;
function getByGenre(const bstrGenre: WideString): IWMPPlaylist; dispid 455;
function getByAuthor(const bstrAuthor: WideString): IWMPPlaylist; dispid 456;
function getByAlbum(const bstrAlbum: WideString): IWMPPlaylist; dispid 457;
function getByAttribute(const bstrAttribute: WideString; const bstrValue: WideString): IWMPPlaylist; dispid 458;
procedure remove(const pItem: IWMPMedia; varfDeleteFile: WordBool); dispid 459;
function getAttributeStringCollection(const bstrAttribute: WideString;
const bstrMediaType: WideString): IWMPStringCollection; dispid 461;
function getMediaAtom(const bstrItemName: WideString): Integer; dispid 470;
procedure setDeleted(const pItem: IWMPMedia; varfIsDeleted: WordBool); dispid 471;
function isDeleted(const pItem: IWMPMedia): WordBool; dispid 472;
end;
// *********************************************************************//
// Interface: IWMPStringCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {4A976298-8C0D-11D3-B389-00C04F68574B}
// *********************************************************************//
IWMPStringCollection = interface(IDispatch)
['{4A976298-8C0D-11D3-B389-00C04F68574B}']
function Get_count: Integer; safecall;
function Item(lIndex: Integer): WideString; safecall;
property count: Integer read Get_count;
end;
// *********************************************************************//
// DispIntf: IWMPStringCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {4A976298-8C0D-11D3-B389-00C04F68574B}
// *********************************************************************//
IWMPStringCollectionDisp = dispinterface
['{4A976298-8C0D-11D3-B389-00C04F68574B}']
property count: Integer readonly dispid 401;
function Item(lIndex: Integer): WideString; dispid 402;
end;
// *********************************************************************//
// DispIntf: _WMPOCXEvents
// Flags: (4112) Hidden Dispatchable
// GUID: {6BF52A51-394A-11D3-B153-00C04F79FAA6}
// *********************************************************************//
_WMPOCXEvents = dispinterface
['{6BF52A51-394A-11D3-B153-00C04F79FAA6}']
procedure OpenStateChange(NewState: Integer); dispid 5001;
procedure PlayStateChange(NewState: Integer); dispid 5101;
procedure AudioLanguageChange(LangID: Integer); dispid 5102;
procedure StatusChange; dispid 5002;
procedure ScriptCommand(const scType: WideString; const Param: WideString); dispid 5301;
procedure NewStream; dispid 5403;
procedure Disconnect(Result: Integer); dispid 5401;
procedure Buffering(Start: WordBool); dispid 5402;
procedure Error; dispid 5501;
procedure Warning(WarningType: Integer; Param: Integer; const Description: WideString); dispid 5601;
procedure EndOfStream(Result: Integer); dispid 5201;
procedure PositionChange(oldPosition: Double; newPosition: Double); dispid 5202;
procedure MarkerHit(MarkerNum: Integer); dispid 5203;
procedure DurationUnitChange(NewDurationUnit: Integer); dispid 5204;
procedure CdromMediaChange(CdromNum: Integer); dispid 5701;
procedure PlaylistChange(const Playlist: IDispatch; change: WMPPlaylistChangeEventType); dispid 5801;
procedure CurrentPlaylistChange(change: WMPPlaylistChangeEventType); dispid 5804;
procedure CurrentPlaylistItemAvailable(const bstrItemName: WideString); dispid 5805;
procedure MediaChange(const Item: IDispatch); dispid 5802;
procedure CurrentMediaItemAvailable(const bstrItemName: WideString); dispid 5803;
procedure CurrentItemChange(const pdispMedia: IDispatch); dispid 5806;
procedure MediaCollectionChange; dispid 5807;
procedure MediaCollectionAttributeStringAdded(const bstrAttribName: WideString;
const bstrAttribVal: WideString); dispid 5808;
procedure MediaCollectionAttributeStringRemoved(const bstrAttribName: WideString;
const bstrAttribVal: WideString); dispid 5809;
procedure MediaCollectionAttributeStringChanged(const bstrAttribName: WideString;
const bstrOldAttribVal: WideString;
const bstrNewAttribVal: WideString); dispid 5820;
procedure PlaylistCollectionChange; dispid 5810;
procedure PlaylistCollectionPlaylistAdded(const bstrPlaylistName: WideString); dispid 5811;
procedure PlaylistCollectionPlaylistRemoved(const bstrPlaylistName: WideString); dispid 5812;
procedure PlaylistCollectionPlaylistSetAsDeleted(const bstrPlaylistName: WideString;
varfIsDeleted: WordBool); dispid 5818;
procedure ModeChange(const ModeName: WideString; NewValue: WordBool); dispid 5819;
procedure MediaError(const pMediaObject: IDispatch); dispid 5821;
procedure OpenPlaylistSwitch(const pItem: IDispatch); dispid 5823;
procedure DomainChange(const strDomain: WideString); dispid 5822;
procedure SwitchedToPlayerApplication; dispid 6501;
procedure SwitchedToControl; dispid 6502;
procedure PlayerDockedStateChange; dispid 6503;
procedure PlayerReconnect; dispid 6504;
procedure Click(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); dispid 6505;
procedure DoubleClick(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); dispid 6506;
procedure KeyDown(nKeyCode: Smallint; nShiftState: Smallint); dispid 6507;
procedure KeyPress(nKeyAscii: Smallint); dispid 6508;
procedure KeyUp(nKeyCode: Smallint; nShiftState: Smallint); dispid 6509;
procedure MouseDown(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); dispid 6510;
procedure MouseMove(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); dispid 6511;
procedure MouseUp(nButton: Smallint; nShiftState: Smallint; fX: Integer; fY: Integer); dispid 6512;
procedure DeviceConnect(const pDevice: IWMPSyncDevice); dispid 6513;
procedure DeviceDisconnect(const pDevice: IWMPSyncDevice); dispid 6514;
procedure DeviceStatusChange(const pDevice: IWMPSyncDevice; NewStatus: WMPDeviceStatus); dispid 6515;
procedure DeviceSyncStateChange(const pDevice: IWMPSyncDevice; NewState: WMPSyncState); dispid 6516;
procedure DeviceSyncError(const pDevice: IWMPSyncDevice; const pMedia: IDispatch); dispid 6517;
procedure CreatePartnershipComplete(const pDevice: IWMPSyncDevice; hrResult: HResult); dispid 6518;
procedure CdromRipStateChange(const pCdromRip: IWMPCdromRip; wmprs: WMPRipState); dispid 6519;
procedure CdromRipMediaError(const pCdromRip: IWMPCdromRip; const pMedia: IDispatch); dispid 6520;
procedure CdromBurnStateChange(const pCdromBurn: IWMPCdromBurn; wmpbs: WMPBurnState); dispid 6521;
procedure CdromBurnMediaError(const pCdromBurn: IWMPCdromBurn; const pMedia: IDispatch); dispid 6522;
procedure CdromBurnError(const pCdromBurn: IWMPCdromBurn; hrError: HResult); dispid 6523;
procedure LibraryConnect(const pLibrary: IWMPLibrary); dispid 6524;
procedure LibraryDisconnect(const pLibrary: IWMPLibrary); dispid 6525;
procedure FolderScanStateChange(wmpfss: WMPFolderScanState); dispid 6526;
procedure ansistringCollectionChange(const pdispStringCollection: IDispatch;
change: WMPStringCollectionChangeEventType;
lCollectionIndex: Integer); dispid 5824;
procedure MediaCollectionMediaAdded(const pdispMedia: IDispatch); dispid 5825;
procedure MediaCollectionMediaRemoved(const pdispMedia: IDispatch); dispid 5826;
end;
// *********************************************************************//
// Interface: IWMPCore
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D84CCA99-CCE2-11D2-9ECC-0000F8085981}
// *********************************************************************//
IWMPCore = interface(IDispatch)
['{D84CCA99-CCE2-11D2-9ECC-0000F8085981}']
procedure close; safecall;
function Get_URL: WideString; safecall;
procedure Set_URL(const pbstrURL: WideString); safecall;
function Get_openState: WMPOpenState; safecall;
function Get_playState: WMPPlayState; safecall;
function Get_controls: IWMPControls; safecall;
function Get_settings: IWMPSettings; safecall;
function Get_currentMedia: IWMPMedia; safecall;
procedure Set_currentMedia(const ppMedia: IWMPMedia); safecall;
function Get_mediaCollection: IWMPMediaCollection; safecall;
function Get_playlistCollection: IWMPPlaylistCollection; safecall;
function Get_versionInfo: WideString; safecall;
procedure launchURL(const bstrURL: WideString); safecall;
function Get_network: IWMPNetwork; safecall;
function Get_currentPlaylist: IWMPPlaylist; safecall;
procedure Set_currentPlaylist(const ppPL: IWMPPlaylist); safecall;
function Get_cdromCollection: IWMPCdromCollection; safecall;
function Get_closedCaption: IWMPClosedCaption; safecall;
function Get_isOnline: WordBool; safecall;
function Get_Error: IWMPError; safecall;
function Get_status: WideString; safecall;
property URL: WideString read Get_URL write Set_URL;
property openState: WMPOpenState read Get_openState;
property playState: WMPPlayState read Get_playState;
property controls: IWMPControls read Get_controls;
property settings: IWMPSettings read Get_settings;
property currentMedia: IWMPMedia read Get_currentMedia write Set_currentMedia;
property mediaCollection: IWMPMediaCollection read Get_mediaCollection;
property playlistCollection: IWMPPlaylistCollection read Get_playlistCollection;
property versionInfo: WideString read Get_versionInfo;
property network: IWMPNetwork read Get_network;
property currentPlaylist: IWMPPlaylist read Get_currentPlaylist write Set_currentPlaylist;
property cdromCollection: IWMPCdromCollection read Get_cdromCollection;
property closedCaption: IWMPClosedCaption read Get_closedCaption;
property isOnline: WordBool read Get_isOnline;
property Error: IWMPError read Get_Error;
property status: WideString read Get_status;
end;
// *********************************************************************//
// DispIntf: IWMPCoreDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D84CCA99-CCE2-11D2-9ECC-0000F8085981}
// *********************************************************************//
IWMPCoreDisp = dispinterface
['{D84CCA99-CCE2-11D2-9ECC-0000F8085981}']
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPCore2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {BC17E5B7-7561-4C18-BB90-17D485775659}
// *********************************************************************//
IWMPCore2 = interface(IWMPCore)
['{BC17E5B7-7561-4C18-BB90-17D485775659}']
function Get_dvd: IWMPDVD; safecall;
property dvd: IWMPDVD read Get_dvd;
end;
// *********************************************************************//
// DispIntf: IWMPCore2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {BC17E5B7-7561-4C18-BB90-17D485775659}
// *********************************************************************//
IWMPCore2Disp = dispinterface
['{BC17E5B7-7561-4C18-BB90-17D485775659}']
property dvd: IWMPDVD readonly dispid 40;
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPCore3
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {7587C667-628F-499F-88E7-6A6F4E888464}
// *********************************************************************//
IWMPCore3 = interface(IWMPCore2)
['{7587C667-628F-499F-88E7-6A6F4E888464}']
function newPlaylist(const bstrName: WideString; const bstrURL: WideString): IWMPPlaylist; safecall;
function newMedia(const bstrURL: WideString): IWMPMedia; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPCore3Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {7587C667-628F-499F-88E7-6A6F4E888464}
// *********************************************************************//
IWMPCore3Disp = dispinterface
['{7587C667-628F-499F-88E7-6A6F4E888464}']
function newPlaylist(const bstrName: WideString; const bstrURL: WideString): IWMPPlaylist; dispid 41;
function newMedia(const bstrURL: WideString): IWMPMedia; dispid 42;
property dvd: IWMPDVD readonly dispid 40;
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPPlayer4
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6C497D62-8919-413C-82DB-E935FB3EC584}
// *********************************************************************//
IWMPPlayer4 = interface(IWMPCore3)
['{6C497D62-8919-413C-82DB-E935FB3EC584}']
function Get_enabled: WordBool; safecall;
procedure Set_enabled(pbEnabled: WordBool); safecall;
function Get_fullScreen: WordBool; safecall;
procedure Set_fullScreen(pbFullScreen: WordBool); safecall;
function Get_enableContextMenu: WordBool; safecall;
procedure Set_enableContextMenu(pbEnableContextMenu: WordBool); safecall;
procedure Set_uiMode(const pbstrMode: WideString); safecall;
function Get_uiMode: WideString; safecall;
function Get_stretchToFit: WordBool; safecall;
procedure Set_stretchToFit(pbEnabled: WordBool); safecall;
function Get_windowlessVideo: WordBool; safecall;
procedure Set_windowlessVideo(pbEnabled: WordBool); safecall;
function Get_isRemote: WordBool; safecall;
function Get_playerApplication: IWMPPlayerApplication; safecall;
procedure openPlayer(const bstrURL: WideString); safecall;
property enabled: WordBool read Get_enabled write Set_enabled;
property fullScreen: WordBool read Get_fullScreen write Set_fullScreen;
property enableContextMenu: WordBool read Get_enableContextMenu write Set_enableContextMenu;
property uiMode: WideString read Get_uiMode write Set_uiMode;
property stretchToFit: WordBool read Get_stretchToFit write Set_stretchToFit;
property windowlessVideo: WordBool read Get_windowlessVideo write Set_windowlessVideo;
property isRemote: WordBool read Get_isRemote;
property playerApplication: IWMPPlayerApplication read Get_playerApplication;
end;
// *********************************************************************//
// DispIntf: IWMPPlayer4Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6C497D62-8919-413C-82DB-E935FB3EC584}
// *********************************************************************//
IWMPPlayer4Disp = dispinterface
['{6C497D62-8919-413C-82DB-E935FB3EC584}']
property enabled: WordBool dispid 19;
property fullScreen: WordBool dispid 21;
property enableContextMenu: WordBool dispid 22;
property uiMode: WideString dispid 23;
property stretchToFit: WordBool dispid 24;
property windowlessVideo: WordBool dispid 25;
property isRemote: WordBool readonly dispid 26;
property playerApplication: IWMPPlayerApplication readonly dispid 27;
procedure openPlayer(const bstrURL: WideString); dispid 28;
function newPlaylist(const bstrName: WideString; const bstrURL: WideString): IWMPPlaylist; dispid 41;
function newMedia(const bstrURL: WideString): IWMPMedia; dispid 42;
property dvd: IWMPDVD readonly dispid 40;
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPPlayer3
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {54062B68-052A-4C25-A39F-8B63346511D4}
// *********************************************************************//
IWMPPlayer3 = interface(IWMPCore2)
['{54062B68-052A-4C25-A39F-8B63346511D4}']
function Get_enabled: WordBool; safecall;
procedure Set_enabled(pbEnabled: WordBool); safecall;
function Get_fullScreen: WordBool; safecall;
procedure Set_fullScreen(pbFullScreen: WordBool); safecall;
function Get_enableContextMenu: WordBool; safecall;
procedure Set_enableContextMenu(pbEnableContextMenu: WordBool); safecall;
procedure Set_uiMode(const pbstrMode: WideString); safecall;
function Get_uiMode: WideString; safecall;
function Get_stretchToFit: WordBool; safecall;
procedure Set_stretchToFit(pbEnabled: WordBool); safecall;
function Get_windowlessVideo: WordBool; safecall;
procedure Set_windowlessVideo(pbEnabled: WordBool); safecall;
property enabled: WordBool read Get_enabled write Set_enabled;
property fullScreen: WordBool read Get_fullScreen write Set_fullScreen;
property enableContextMenu: WordBool read Get_enableContextMenu write Set_enableContextMenu;
property uiMode: WideString read Get_uiMode write Set_uiMode;
property stretchToFit: WordBool read Get_stretchToFit write Set_stretchToFit;
property windowlessVideo: WordBool read Get_windowlessVideo write Set_windowlessVideo;
end;
// *********************************************************************//
// DispIntf: IWMPPlayer3Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {54062B68-052A-4C25-A39F-8B63346511D4}
// *********************************************************************//
IWMPPlayer3Disp = dispinterface
['{54062B68-052A-4C25-A39F-8B63346511D4}']
property enabled: WordBool dispid 19;
property fullScreen: WordBool dispid 21;
property enableContextMenu: WordBool dispid 22;
property uiMode: WideString dispid 23;
property stretchToFit: WordBool dispid 24;
property windowlessVideo: WordBool dispid 25;
property dvd: IWMPDVD readonly dispid 40;
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPControls
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {74C09E02-F828-11D2-A74B-00A0C905F36E}
// *********************************************************************//
IWMPControls = interface(IDispatch)
['{74C09E02-F828-11D2-A74B-00A0C905F36E}']
function Get_isAvailable(const bstrItem: WideString): WordBool; safecall;
procedure play; safecall;
procedure stop; safecall;
procedure pause; safecall;
procedure fastForward; safecall;
procedure fastReverse; safecall;
function Get_currentPosition: Double; safecall;
procedure Set_currentPosition(pdCurrentPosition: Double); safecall;
function Get_currentPositionString: WideString; safecall;
procedure next; safecall;
procedure previous; safecall;
function Get_currentItem: IWMPMedia; safecall;
procedure Set_currentItem(const ppIWMPMedia: IWMPMedia); safecall;
function Get_currentMarker: Integer; safecall;
procedure Set_currentMarker(plMarker: Integer); safecall;
procedure playItem(const pIWMPMedia: IWMPMedia); safecall;
property isAvailable[const bstrItem: WideString]: WordBool read Get_isAvailable;
property currentPosition: Double read Get_currentPosition write Set_currentPosition;
property currentPositionString: WideString read Get_currentPositionString;
property currentItem: IWMPMedia read Get_currentItem write Set_currentItem;
property currentMarker: Integer read Get_currentMarker write Set_currentMarker;
end;
// *********************************************************************//
// DispIntf: IWMPControlsDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {74C09E02-F828-11D2-A74B-00A0C905F36E}
// *********************************************************************//
IWMPControlsDisp = dispinterface
['{74C09E02-F828-11D2-A74B-00A0C905F36E}']
property isAvailable[const bstrItem: WideString]: WordBool readonly dispid 62;
procedure play; dispid 51;
procedure stop; dispid 52;
procedure pause; dispid 53;
procedure fastForward; dispid 54;
procedure fastReverse; dispid 55;
property currentPosition: Double dispid 56;
property currentPositionString: WideString readonly dispid 57;
procedure next; dispid 58;
procedure previous; dispid 59;
property currentItem: IWMPMedia dispid 60;
property currentMarker: Integer dispid 61;
procedure playItem(const pIWMPMedia: IWMPMedia); dispid 63;
end;
// *********************************************************************//
// Interface: IWMPSettings
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {9104D1AB-80C9-4FED-ABF0-2E6417A6DF14}
// *********************************************************************//
IWMPSettings = interface(IDispatch)
['{9104D1AB-80C9-4FED-ABF0-2E6417A6DF14}']
function Get_isAvailable(const bstrItem: WideString): WordBool; safecall;
function Get_autoStart: WordBool; safecall;
procedure Set_autoStart(pfAutoStart: WordBool); safecall;
function Get_baseURL: WideString; safecall;
procedure Set_baseURL(const pbstrBaseURL: WideString); safecall;
function Get_defaultFrame: WideString; safecall;
procedure Set_defaultFrame(const pbstrDefaultFrame: WideString); safecall;
function Get_invokeURLs: WordBool; safecall;
procedure Set_invokeURLs(pfInvokeURLs: WordBool); safecall;
function Get_mute: WordBool; safecall;
procedure Set_mute(pfMute: WordBool); safecall;
function Get_playCount: Integer; safecall;
procedure Set_playCount(plCount: Integer); safecall;
function Get_rate: Double; safecall;
procedure Set_rate(pdRate: Double); safecall;
function Get_balance: Integer; safecall;
procedure Set_balance(plBalance: Integer); safecall;
function Get_volume: Integer; safecall;
procedure Set_volume(plVolume: Integer); safecall;
function getMode(const bstrMode: WideString): WordBool; safecall;
procedure setMode(const bstrMode: WideString; varfMode: WordBool); safecall;
function Get_enableErrorDialogs: WordBool; safecall;
procedure Set_enableErrorDialogs(pfEnableErrorDialogs: WordBool); safecall;
property isAvailable[const bstrItem: WideString]: WordBool read Get_isAvailable;
property autoStart: WordBool read Get_autoStart write Set_autoStart;
property baseURL: WideString read Get_baseURL write Set_baseURL;
property defaultFrame: WideString read Get_defaultFrame write Set_defaultFrame;
property invokeURLs: WordBool read Get_invokeURLs write Set_invokeURLs;
property mute: WordBool read Get_mute write Set_mute;
property playCount: Integer read Get_playCount write Set_playCount;
property rate: Double read Get_rate write Set_rate;
property balance: Integer read Get_balance write Set_balance;
property volume: Integer read Get_volume write Set_volume;
property enableErrorDialogs: WordBool read Get_enableErrorDialogs write Set_enableErrorDialogs;
end;
// *********************************************************************//
// DispIntf: IWMPSettingsDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {9104D1AB-80C9-4FED-ABF0-2E6417A6DF14}
// *********************************************************************//
IWMPSettingsDisp = dispinterface
['{9104D1AB-80C9-4FED-ABF0-2E6417A6DF14}']
property isAvailable[const bstrItem: WideString]: WordBool readonly dispid 113;
property autoStart: WordBool dispid 101;
property baseURL: WideString dispid 108;
property defaultFrame: WideString dispid 109;
property invokeURLs: WordBool dispid 103;
property mute: WordBool dispid 104;
property playCount: Integer dispid 105;
property rate: Double dispid 106;
property balance: Integer dispid 102;
property volume: Integer dispid 107;
function getMode(const bstrMode: WideString): WordBool; dispid 110;
procedure setMode(const bstrMode: WideString; varfMode: WordBool); dispid 111;
property enableErrorDialogs: WordBool dispid 112;
end;
// *********************************************************************//
// Interface: IWMPPlaylistCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {10A13217-23A7-439B-B1C0-D847C79B7774}
// *********************************************************************//
IWMPPlaylistCollection = interface(IDispatch)
['{10A13217-23A7-439B-B1C0-D847C79B7774}']
function newPlaylist(const bstrName: WideString): IWMPPlaylist; safecall;
function getAll: IWMPPlaylistArray; safecall;
function getByName(const bstrName: WideString): IWMPPlaylistArray; safecall;
procedure remove(const pItem: IWMPPlaylist); safecall;
procedure setDeleted(const pItem: IWMPPlaylist; varfIsDeleted: WordBool); safecall;
function isDeleted(const pItem: IWMPPlaylist): WordBool; safecall;
function importPlaylist(const pItem: IWMPPlaylist): IWMPPlaylist; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPPlaylistCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {10A13217-23A7-439B-B1C0-D847C79B7774}
// *********************************************************************//
IWMPPlaylistCollectionDisp = dispinterface
['{10A13217-23A7-439B-B1C0-D847C79B7774}']
function newPlaylist(const bstrName: WideString): IWMPPlaylist; dispid 552;
function getAll: IWMPPlaylistArray; dispid 553;
function getByName(const bstrName: WideString): IWMPPlaylistArray; dispid 554;
procedure remove(const pItem: IWMPPlaylist); dispid 556;
procedure setDeleted(const pItem: IWMPPlaylist; varfIsDeleted: WordBool); dispid 560;
function isDeleted(const pItem: IWMPPlaylist): WordBool; dispid 561;
function importPlaylist(const pItem: IWMPPlaylist): IWMPPlaylist; dispid 562;
end;
// *********************************************************************//
// Interface: IWMPPlaylistArray
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {679409C0-99F7-11D3-9FB7-00105AA620BB}
// *********************************************************************//
IWMPPlaylistArray = interface(IDispatch)
['{679409C0-99F7-11D3-9FB7-00105AA620BB}']
function Get_count: Integer; safecall;
function Item(lIndex: Integer): IWMPPlaylist; safecall;
property count: Integer read Get_count;
end;
// *********************************************************************//
// DispIntf: IWMPPlaylistArrayDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {679409C0-99F7-11D3-9FB7-00105AA620BB}
// *********************************************************************//
IWMPPlaylistArrayDisp = dispinterface
['{679409C0-99F7-11D3-9FB7-00105AA620BB}']
property count: Integer readonly dispid 501;
function Item(lIndex: Integer): IWMPPlaylist; dispid 502;
end;
// *********************************************************************//
// Interface: IWMPNetwork
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {EC21B779-EDEF-462D-BBA4-AD9DDE2B29A7}
// *********************************************************************//
IWMPNetwork = interface(IDispatch)
['{EC21B779-EDEF-462D-BBA4-AD9DDE2B29A7}']
function Get_bandWidth: Integer; safecall;
function Get_recoveredPackets: Integer; safecall;
function Get_sourceProtocol: WideString; safecall;
function Get_receivedPackets: Integer; safecall;
function Get_lostPackets: Integer; safecall;
function Get_receptionQuality: Integer; safecall;
function Get_bufferingCount: Integer; safecall;
function Get_bufferingProgress: Integer; safecall;
function Get_bufferingTime: Integer; safecall;
procedure Set_bufferingTime(plBufferingTime: Integer); safecall;
function Get_frameRate: Integer; safecall;
function Get_maxBitRate: Integer; safecall;
function Get_bitRate: Integer; safecall;
function getProxySettings(const bstrProtocol: WideString): Integer; safecall;
procedure setProxySettings(const bstrProtocol: WideString; lProxySetting: Integer); safecall;
function getProxyName(const bstrProtocol: WideString): WideString; safecall;
procedure setProxyName(const bstrProtocol: WideString; const bstrProxyName: WideString); safecall;
function getProxyPort(const bstrProtocol: WideString): Integer; safecall;
procedure setProxyPort(const bstrProtocol: WideString; lProxyPort: Integer); safecall;
function getProxyExceptionList(const bstrProtocol: WideString): WideString; safecall;
procedure setProxyExceptionList(const bstrProtocol: WideString;
const pbstrExceptionList: WideString); safecall;
function getProxyBypassForLocal(const bstrProtocol: WideString): WordBool; safecall;
procedure setProxyBypassForLocal(const bstrProtocol: WideString; fBypassForLocal: WordBool); safecall;
function Get_maxBandwidth: Integer; safecall;
procedure Set_maxBandwidth(lMaxBandwidth: Integer); safecall;
function Get_downloadProgress: Integer; safecall;
function Get_encodedFrameRate: Integer; safecall;
function Get_framesSkipped: Integer; safecall;
property bandWidth: Integer read Get_bandWidth;
property recoveredPackets: Integer read Get_recoveredPackets;
property sourceProtocol: WideString read Get_sourceProtocol;
property receivedPackets: Integer read Get_receivedPackets;
property lostPackets: Integer read Get_lostPackets;
property receptionQuality: Integer read Get_receptionQuality;
property bufferingCount: Integer read Get_bufferingCount;
property bufferingProgress: Integer read Get_bufferingProgress;
property bufferingTime: Integer read Get_bufferingTime write Set_bufferingTime;
property frameRate: Integer read Get_frameRate;
property maxBitRate: Integer read Get_maxBitRate;
property bitRate: Integer read Get_bitRate;
property maxBandwidth: Integer read Get_maxBandwidth write Set_maxBandwidth;
property downloadProgress: Integer read Get_downloadProgress;
property encodedFrameRate: Integer read Get_encodedFrameRate;
property framesSkipped: Integer read Get_framesSkipped;
end;
// *********************************************************************//
// DispIntf: IWMPNetworkDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {EC21B779-EDEF-462D-BBA4-AD9DDE2B29A7}
// *********************************************************************//
IWMPNetworkDisp = dispinterface
['{EC21B779-EDEF-462D-BBA4-AD9DDE2B29A7}']
property bandWidth: Integer readonly dispid 801;
property recoveredPackets: Integer readonly dispid 802;
property sourceProtocol: WideString readonly dispid 803;
property receivedPackets: Integer readonly dispid 804;
property lostPackets: Integer readonly dispid 805;
property receptionQuality: Integer readonly dispid 806;
property bufferingCount: Integer readonly dispid 807;
property bufferingProgress: Integer readonly dispid 808;
property bufferingTime: Integer dispid 809;
property frameRate: Integer readonly dispid 810;
property maxBitRate: Integer readonly dispid 811;
property bitRate: Integer readonly dispid 812;
function getProxySettings(const bstrProtocol: WideString): Integer; dispid 813;
procedure setProxySettings(const bstrProtocol: WideString; lProxySetting: Integer); dispid 814;
function getProxyName(const bstrProtocol: WideString): WideString; dispid 815;
procedure setProxyName(const bstrProtocol: WideString; const bstrProxyName: WideString); dispid 816;
function getProxyPort(const bstrProtocol: WideString): Integer; dispid 817;
procedure setProxyPort(const bstrProtocol: WideString; lProxyPort: Integer); dispid 818;
function getProxyExceptionList(const bstrProtocol: WideString): WideString; dispid 819;
procedure setProxyExceptionList(const bstrProtocol: WideString;
const pbstrExceptionList: WideString); dispid 820;
function getProxyBypassForLocal(const bstrProtocol: WideString): WordBool; dispid 821;
procedure setProxyBypassForLocal(const bstrProtocol: WideString; fBypassForLocal: WordBool); dispid 822;
property maxBandwidth: Integer dispid 823;
property downloadProgress: Integer readonly dispid 824;
property encodedFrameRate: Integer readonly dispid 825;
property framesSkipped: Integer readonly dispid 826;
end;
// *********************************************************************//
// Interface: IWMPCdromCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {EE4C8FE2-34B2-11D3-A3BF-006097C9B344}
// *********************************************************************//
IWMPCdromCollection = interface(IDispatch)
['{EE4C8FE2-34B2-11D3-A3BF-006097C9B344}']
function Get_count: Integer; safecall;
function Item(lIndex: Integer): IWMPCdrom; safecall;
function getByDriveSpecifier(const bstrDriveSpecifier: WideString): IWMPCdrom; safecall;
property count: Integer read Get_count;
end;
// *********************************************************************//
// DispIntf: IWMPCdromCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {EE4C8FE2-34B2-11D3-A3BF-006097C9B344}
// *********************************************************************//
IWMPCdromCollectionDisp = dispinterface
['{EE4C8FE2-34B2-11D3-A3BF-006097C9B344}']
property count: Integer readonly dispid 301;
function Item(lIndex: Integer): IWMPCdrom; dispid 302;
function getByDriveSpecifier(const bstrDriveSpecifier: WideString): IWMPCdrom; dispid 303;
end;
// *********************************************************************//
// Interface: IWMPCdrom
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {CFAB6E98-8730-11D3-B388-00C04F68574B}
// *********************************************************************//
IWMPCdrom = interface(IDispatch)
['{CFAB6E98-8730-11D3-B388-00C04F68574B}']
function Get_driveSpecifier: WideString; safecall;
function Get_Playlist: IWMPPlaylist; safecall;
procedure eject; safecall;
property driveSpecifier: WideString read Get_driveSpecifier;
property Playlist: IWMPPlaylist read Get_Playlist;
end;
// *********************************************************************//
// DispIntf: IWMPCdromDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {CFAB6E98-8730-11D3-B388-00C04F68574B}
// *********************************************************************//
IWMPCdromDisp = dispinterface
['{CFAB6E98-8730-11D3-B388-00C04F68574B}']
property driveSpecifier: WideString readonly dispid 251;
property Playlist: IWMPPlaylist readonly dispid 252;
procedure eject; dispid 253;
end;
// *********************************************************************//
// Interface: IWMPClosedCaption
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {4F2DF574-C588-11D3-9ED0-00C04FB6E937}
// *********************************************************************//
IWMPClosedCaption = interface(IDispatch)
['{4F2DF574-C588-11D3-9ED0-00C04FB6E937}']
function Get_SAMIStyle: WideString; safecall;
procedure Set_SAMIStyle(const pbstrSAMIStyle: WideString); safecall;
function Get_SAMILang: WideString; safecall;
procedure Set_SAMILang(const pbstrSAMILang: WideString); safecall;
function Get_SAMIFileName: WideString; safecall;
procedure Set_SAMIFileName(const pbstrSAMIFileName: WideString); safecall;
function Get_captioningId: WideString; safecall;
procedure Set_captioningId(const pbstrCaptioningID: WideString); safecall;
property SAMIStyle: WideString read Get_SAMIStyle write Set_SAMIStyle;
property SAMILang: WideString read Get_SAMILang write Set_SAMILang;
property SAMIFileName: WideString read Get_SAMIFileName write Set_SAMIFileName;
property captioningId: WideString read Get_captioningId write Set_captioningId;
end;
// *********************************************************************//
// DispIntf: IWMPClosedCaptionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {4F2DF574-C588-11D3-9ED0-00C04FB6E937}
// *********************************************************************//
IWMPClosedCaptionDisp = dispinterface
['{4F2DF574-C588-11D3-9ED0-00C04FB6E937}']
property SAMIStyle: WideString dispid 951;
property SAMILang: WideString dispid 952;
property SAMIFileName: WideString dispid 953;
property captioningId: WideString dispid 954;
end;
// *********************************************************************//
// Interface: IWMPError
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A12DCF7D-14AB-4C1B-A8CD-63909F06025B}
// *********************************************************************//
IWMPError = interface(IDispatch)
['{A12DCF7D-14AB-4C1B-A8CD-63909F06025B}']
procedure clearErrorQueue; safecall;
function Get_errorCount: Integer; safecall;
function Get_Item(dwIndex: Integer): IWMPErrorItem; safecall;
procedure webHelp; safecall;
property errorCount: Integer read Get_errorCount;
property Item[dwIndex: Integer]: IWMPErrorItem read Get_Item;
end;
// *********************************************************************//
// DispIntf: IWMPErrorDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A12DCF7D-14AB-4C1B-A8CD-63909F06025B}
// *********************************************************************//
IWMPErrorDisp = dispinterface
['{A12DCF7D-14AB-4C1B-A8CD-63909F06025B}']
procedure clearErrorQueue; dispid 851;
property errorCount: Integer readonly dispid 852;
property Item[dwIndex: Integer]: IWMPErrorItem readonly dispid 853;
procedure webHelp; dispid 854;
end;
// *********************************************************************//
// Interface: IWMPErrorItem
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {3614C646-3B3B-4DE7-A81E-930E3F2127B3}
// *********************************************************************//
IWMPErrorItem = interface(IDispatch)
['{3614C646-3B3B-4DE7-A81E-930E3F2127B3}']
function Get_errorCode: Integer; safecall;
function Get_errorDescription: WideString; safecall;
function Get_errorContext: OleVariant; safecall;
function Get_remedy: Integer; safecall;
function Get_customUrl: WideString; safecall;
property errorCode: Integer read Get_errorCode;
property errorDescription: WideString read Get_errorDescription;
property errorContext: OleVariant read Get_errorContext;
property remedy: Integer read Get_remedy;
property customUrl: WideString read Get_customUrl;
end;
// *********************************************************************//
// DispIntf: IWMPErrorItemDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {3614C646-3B3B-4DE7-A81E-930E3F2127B3}
// *********************************************************************//
IWMPErrorItemDisp = dispinterface
['{3614C646-3B3B-4DE7-A81E-930E3F2127B3}']
property errorCode: Integer readonly dispid 901;
property errorDescription: WideString readonly dispid 902;
property errorContext: OleVariant readonly dispid 903;
property remedy: Integer readonly dispid 904;
property customUrl: WideString readonly dispid 905;
end;
// *********************************************************************//
// Interface: IWMPDVD
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8DA61686-4668-4A5C-AE5D-803193293DBE}
// *********************************************************************//
IWMPDVD = interface(IDispatch)
['{8DA61686-4668-4A5C-AE5D-803193293DBE}']
function Get_isAvailable(const bstrItem: WideString): WordBool; safecall;
function Get_domain: WideString; safecall;
procedure topMenu; safecall;
procedure titleMenu; safecall;
procedure back; safecall;
procedure resume; safecall;
property isAvailable[const bstrItem: WideString]: WordBool read Get_isAvailable;
property domain: WideString read Get_domain;
end;
// *********************************************************************//
// DispIntf: IWMPDVDDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8DA61686-4668-4A5C-AE5D-803193293DBE}
// *********************************************************************//
IWMPDVDDisp = dispinterface
['{8DA61686-4668-4A5C-AE5D-803193293DBE}']
property isAvailable[const bstrItem: WideString]: WordBool readonly dispid 1001;
property domain: WideString readonly dispid 1002;
procedure topMenu; dispid 1003;
procedure titleMenu; dispid 1004;
procedure back; dispid 1005;
procedure resume; dispid 1006;
end;
// *********************************************************************//
// Interface: IWMPPlayerApplication
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {40897764-CEAB-47BE-AD4A-8E28537F9BBF}
// *********************************************************************//
IWMPPlayerApplication = interface(IDispatch)
['{40897764-CEAB-47BE-AD4A-8E28537F9BBF}']
procedure switchToPlayerApplication; safecall;
procedure switchToControl; safecall;
function Get_playerDocked: WordBool; safecall;
function Get_hasDisplay: WordBool; safecall;
property playerDocked: WordBool read Get_playerDocked;
property hasDisplay: WordBool read Get_hasDisplay;
end;
// *********************************************************************//
// DispIntf: IWMPPlayerApplicationDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {40897764-CEAB-47BE-AD4A-8E28537F9BBF}
// *********************************************************************//
IWMPPlayerApplicationDisp = dispinterface
['{40897764-CEAB-47BE-AD4A-8E28537F9BBF}']
procedure switchToPlayerApplication; dispid 1101;
procedure switchToControl; dispid 1102;
property playerDocked: WordBool readonly dispid 1103;
property hasDisplay: WordBool readonly dispid 1104;
end;
// *********************************************************************//
// Interface: IWMPPlayer2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0E6B01D1-D407-4C85-BF5F-1C01F6150280}
// *********************************************************************//
IWMPPlayer2 = interface(IWMPCore)
['{0E6B01D1-D407-4C85-BF5F-1C01F6150280}']
function Get_enabled: WordBool; safecall;
procedure Set_enabled(pbEnabled: WordBool); safecall;
function Get_fullScreen: WordBool; safecall;
procedure Set_fullScreen(pbFullScreen: WordBool); safecall;
function Get_enableContextMenu: WordBool; safecall;
procedure Set_enableContextMenu(pbEnableContextMenu: WordBool); safecall;
procedure Set_uiMode(const pbstrMode: WideString); safecall;
function Get_uiMode: WideString; safecall;
function Get_stretchToFit: WordBool; safecall;
procedure Set_stretchToFit(pbEnabled: WordBool); safecall;
function Get_windowlessVideo: WordBool; safecall;
procedure Set_windowlessVideo(pbEnabled: WordBool); safecall;
property enabled: WordBool read Get_enabled write Set_enabled;
property fullScreen: WordBool read Get_fullScreen write Set_fullScreen;
property enableContextMenu: WordBool read Get_enableContextMenu write Set_enableContextMenu;
property uiMode: WideString read Get_uiMode write Set_uiMode;
property stretchToFit: WordBool read Get_stretchToFit write Set_stretchToFit;
property windowlessVideo: WordBool read Get_windowlessVideo write Set_windowlessVideo;
end;
// *********************************************************************//
// DispIntf: IWMPPlayer2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0E6B01D1-D407-4C85-BF5F-1C01F6150280}
// *********************************************************************//
IWMPPlayer2Disp = dispinterface
['{0E6B01D1-D407-4C85-BF5F-1C01F6150280}']
property enabled: WordBool dispid 19;
property fullScreen: WordBool dispid 21;
property enableContextMenu: WordBool dispid 22;
property uiMode: WideString dispid 23;
property stretchToFit: WordBool dispid 24;
property windowlessVideo: WordBool dispid 25;
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPPlayer
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6BF52A4F-394A-11D3-B153-00C04F79FAA6}
// *********************************************************************//
IWMPPlayer = interface(IWMPCore)
['{6BF52A4F-394A-11D3-B153-00C04F79FAA6}']
function Get_enabled: WordBool; safecall;
procedure Set_enabled(pbEnabled: WordBool); safecall;
function Get_fullScreen: WordBool; safecall;
procedure Set_fullScreen(pbFullScreen: WordBool); safecall;
function Get_enableContextMenu: WordBool; safecall;
procedure Set_enableContextMenu(pbEnableContextMenu: WordBool); safecall;
procedure Set_uiMode(const pbstrMode: WideString); safecall;
function Get_uiMode: WideString; safecall;
property enabled: WordBool read Get_enabled write Set_enabled;
property fullScreen: WordBool read Get_fullScreen write Set_fullScreen;
property enableContextMenu: WordBool read Get_enableContextMenu write Set_enableContextMenu;
property uiMode: WideString read Get_uiMode write Set_uiMode;
end;
// *********************************************************************//
// DispIntf: IWMPPlayerDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6BF52A4F-394A-11D3-B153-00C04F79FAA6}
// *********************************************************************//
IWMPPlayerDisp = dispinterface
['{6BF52A4F-394A-11D3-B153-00C04F79FAA6}']
property enabled: WordBool dispid 19;
property fullScreen: WordBool dispid 21;
property enableContextMenu: WordBool dispid 22;
property uiMode: WideString dispid 23;
procedure close; dispid 3;
property URL: WideString dispid 1;
property openState: WMPOpenState readonly dispid 2;
property playState: WMPPlayState readonly dispid 10;
property controls: IWMPControls readonly dispid 4;
property settings: IWMPSettings readonly dispid 5;
property currentMedia: IWMPMedia dispid 6;
property mediaCollection: IWMPMediaCollection readonly dispid 8;
property playlistCollection: IWMPPlaylistCollection readonly dispid 9;
property versionInfo: WideString readonly dispid 11;
procedure launchURL(const bstrURL: WideString); dispid 12;
property network: IWMPNetwork readonly dispid 7;
property currentPlaylist: IWMPPlaylist dispid 13;
property cdromCollection: IWMPCdromCollection readonly dispid 14;
property closedCaption: IWMPClosedCaption readonly dispid 15;
property isOnline: WordBool readonly dispid 16;
property Error: IWMPError readonly dispid 17;
property status: WideString readonly dispid 18;
end;
// *********************************************************************//
// Interface: IWMPErrorItem2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F75CCEC0-C67C-475C-931E-8719870BEE7D}
// *********************************************************************//
IWMPErrorItem2 = interface(IWMPErrorItem)
['{F75CCEC0-C67C-475C-931E-8719870BEE7D}']
function Get_condition: Integer; safecall;
property condition: Integer read Get_condition;
end;
// *********************************************************************//
// DispIntf: IWMPErrorItem2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F75CCEC0-C67C-475C-931E-8719870BEE7D}
// *********************************************************************//
IWMPErrorItem2Disp = dispinterface
['{F75CCEC0-C67C-475C-931E-8719870BEE7D}']
property condition: Integer readonly dispid 906;
property errorCode: Integer readonly dispid 901;
property errorDescription: WideString readonly dispid 902;
property errorContext: OleVariant readonly dispid 903;
property remedy: Integer readonly dispid 904;
property customUrl: WideString readonly dispid 905;
end;
// *********************************************************************//
// Interface: IWMPControls2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6F030D25-0890-480F-9775-1F7E40AB5B8E}
// *********************************************************************//
IWMPControls2 = interface(IWMPControls)
['{6F030D25-0890-480F-9775-1F7E40AB5B8E}']
procedure step(lStep: Integer); safecall;
end;
// *********************************************************************//
// DispIntf: IWMPControls2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6F030D25-0890-480F-9775-1F7E40AB5B8E}
// *********************************************************************//
IWMPControls2Disp = dispinterface
['{6F030D25-0890-480F-9775-1F7E40AB5B8E}']
procedure step(lStep: Integer); dispid 64;
property isAvailable[const bstrItem: WideString]: WordBool readonly dispid 62;
procedure play; dispid 51;
procedure stop; dispid 52;
procedure pause; dispid 53;
procedure fastForward; dispid 54;
procedure fastReverse; dispid 55;
property currentPosition: Double dispid 56;
property currentPositionString: WideString readonly dispid 57;
procedure next; dispid 58;
procedure previous; dispid 59;
property currentItem: IWMPMedia dispid 60;
property currentMarker: Integer dispid 61;
procedure playItem(const pIWMPMedia: IWMPMedia); dispid 63;
end;
// *********************************************************************//
// Interface: IWMPMedia2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {AB7C88BB-143E-4EA4-ACC3-E4350B2106C3}
// *********************************************************************//
IWMPMedia2 = interface(IWMPMedia)
['{AB7C88BB-143E-4EA4-ACC3-E4350B2106C3}']
function Get_Error: IWMPErrorItem; safecall;
property Error: IWMPErrorItem read Get_Error;
end;
// *********************************************************************//
// DispIntf: IWMPMedia2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {AB7C88BB-143E-4EA4-ACC3-E4350B2106C3}
// *********************************************************************//
IWMPMedia2Disp = dispinterface
['{AB7C88BB-143E-4EA4-ACC3-E4350B2106C3}']
property Error: IWMPErrorItem readonly dispid 768;
property isIdentical[const pIWMPMedia: IWMPMedia]: WordBool readonly dispid 763;
property sourceURL: WideString readonly dispid 751;
property name: WideString dispid 764;
property imageSourceWidth: Integer readonly dispid 752;
property imageSourceHeight: Integer readonly dispid 753;
property markerCount: Integer readonly dispid 754;
function getMarkerTime(MarkerNum: Integer): Double; dispid 755;
function getMarkerName(MarkerNum: Integer): WideString; dispid 756;
property duration: Double readonly dispid 757;
property durationString: WideString readonly dispid 758;
property attributeCount: Integer readonly dispid 759;
function getAttributeName(lIndex: Integer): WideString; dispid 760;
function getItemInfo(const bstrItemName: WideString): WideString; dispid 761;
procedure setItemInfo(const bstrItemName: WideString; const bstrVal: WideString); dispid 762;
function getItemInfoByAtom(lAtom: Integer): WideString; dispid 765;
function isMemberOf(const pPlaylist: IWMPPlaylist): WordBool; dispid 766;
function isReadOnlyItem(const bstrItemName: WideString): WordBool; dispid 767;
end;
// *********************************************************************//
// Interface: IWMPMedia3
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F118EFC7-F03A-4FB4-99C9-1C02A5C1065B}
// *********************************************************************//
IWMPMedia3 = interface(IWMPMedia2)
['{F118EFC7-F03A-4FB4-99C9-1C02A5C1065B}']
function getAttributeCountByType(const bstrType: WideString; const bstrLanguage: WideString): Integer; safecall;
function getItemInfoByType(const bstrType: WideString; const bstrLanguage: WideString;
lIndex: Integer): OleVariant; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPMedia3Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F118EFC7-F03A-4FB4-99C9-1C02A5C1065B}
// *********************************************************************//
IWMPMedia3Disp = dispinterface
['{F118EFC7-F03A-4FB4-99C9-1C02A5C1065B}']
function getAttributeCountByType(const bstrType: WideString; const bstrLanguage: WideString): Integer; dispid 769;
function getItemInfoByType(const bstrType: WideString; const bstrLanguage: WideString;
lIndex: Integer): OleVariant; dispid 770;
property Error: IWMPErrorItem readonly dispid 768;
property isIdentical[const pIWMPMedia: IWMPMedia]: WordBool readonly dispid 763;
property sourceURL: WideString readonly dispid 751;
property name: WideString dispid 764;
property imageSourceWidth: Integer readonly dispid 752;
property imageSourceHeight: Integer readonly dispid 753;
property markerCount: Integer readonly dispid 754;
function getMarkerTime(MarkerNum: Integer): Double; dispid 755;
function getMarkerName(MarkerNum: Integer): WideString; dispid 756;
property duration: Double readonly dispid 757;
property durationString: WideString readonly dispid 758;
property attributeCount: Integer readonly dispid 759;
function getAttributeName(lIndex: Integer): WideString; dispid 760;
function getItemInfo(const bstrItemName: WideString): WideString; dispid 761;
procedure setItemInfo(const bstrItemName: WideString; const bstrVal: WideString); dispid 762;
function getItemInfoByAtom(lAtom: Integer): WideString; dispid 765;
function isMemberOf(const pPlaylist: IWMPPlaylist): WordBool; dispid 766;
function isReadOnlyItem(const bstrItemName: WideString): WordBool; dispid 767;
end;
// *********************************************************************//
// Interface: IWMPMetadataPicture
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5C29BBE0-F87D-4C45-AA28-A70F0230FFA9}
// *********************************************************************//
IWMPMetadataPicture = interface(IDispatch)
['{5C29BBE0-F87D-4C45-AA28-A70F0230FFA9}']
function Get_mimeType: WideString; safecall;
function Get_pictureType: WideString; safecall;
function Get_Description: WideString; safecall;
function Get_URL: WideString; safecall;
property mimeType: WideString read Get_mimeType;
property pictureType: WideString read Get_pictureType;
property Description: WideString read Get_Description;
property URL: WideString read Get_URL;
end;
// *********************************************************************//
// DispIntf: IWMPMetadataPictureDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5C29BBE0-F87D-4C45-AA28-A70F0230FFA9}
// *********************************************************************//
IWMPMetadataPictureDisp = dispinterface
['{5C29BBE0-F87D-4C45-AA28-A70F0230FFA9}']
property mimeType: WideString readonly dispid 1051;
property pictureType: WideString readonly dispid 1052;
property Description: WideString readonly dispid 1053;
property URL: WideString readonly dispid 1054;
end;
// *********************************************************************//
// Interface: IWMPMetadataText
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {769A72DB-13D2-45E2-9C48-53CA9D5B7450}
// *********************************************************************//
IWMPMetadataText = interface(IDispatch)
['{769A72DB-13D2-45E2-9C48-53CA9D5B7450}']
function Get_Description: WideString; safecall;
function Get_text: WideString; safecall;
property Description: WideString read Get_Description;
property text: WideString read Get_text;
end;
// *********************************************************************//
// DispIntf: IWMPMetadataTextDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {769A72DB-13D2-45E2-9C48-53CA9D5B7450}
// *********************************************************************//
IWMPMetadataTextDisp = dispinterface
['{769A72DB-13D2-45E2-9C48-53CA9D5B7450}']
property Description: WideString readonly dispid 1056;
property text: WideString readonly dispid 1055;
end;
// *********************************************************************//
// Interface: IWMPSettings2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {FDA937A4-EECE-4DA5-A0B6-39BF89ADE2C2}
// *********************************************************************//
IWMPSettings2 = interface(IWMPSettings)
['{FDA937A4-EECE-4DA5-A0B6-39BF89ADE2C2}']
function Get_defaultAudioLanguage: Integer; safecall;
function Get_mediaAccessRights: WideString; safecall;
function requestMediaAccessRights(const bstrDesiredAccess: WideString): WordBool; safecall;
property defaultAudioLanguage: Integer read Get_defaultAudioLanguage;
property mediaAccessRights: WideString read Get_mediaAccessRights;
end;
// *********************************************************************//
// DispIntf: IWMPSettings2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {FDA937A4-EECE-4DA5-A0B6-39BF89ADE2C2}
// *********************************************************************//
IWMPSettings2Disp = dispinterface
['{FDA937A4-EECE-4DA5-A0B6-39BF89ADE2C2}']
property defaultAudioLanguage: Integer readonly dispid 114;
property mediaAccessRights: WideString readonly dispid 115;
function requestMediaAccessRights(const bstrDesiredAccess: WideString): WordBool; dispid 116;
property isAvailable[const bstrItem: WideString]: WordBool readonly dispid 113;
property autoStart: WordBool dispid 101;
property baseURL: WideString dispid 108;
property defaultFrame: WideString dispid 109;
property invokeURLs: WordBool dispid 103;
property mute: WordBool dispid 104;
property playCount: Integer dispid 105;
property rate: Double dispid 106;
property balance: Integer dispid 102;
property volume: Integer dispid 107;
function getMode(const bstrMode: WideString): WordBool; dispid 110;
procedure setMode(const bstrMode: WideString; varfMode: WordBool); dispid 111;
property enableErrorDialogs: WordBool dispid 112;
end;
// *********************************************************************//
// Interface: IWMPControls3
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A1D1110E-D545-476A-9A78-AC3E4CB1E6BD}
// *********************************************************************//
IWMPControls3 = interface(IWMPControls2)
['{A1D1110E-D545-476A-9A78-AC3E4CB1E6BD}']
function Get_audioLanguageCount: Integer; safecall;
function getAudioLanguageID(lIndex: Integer): Integer; safecall;
function getAudioLanguageDescription(lIndex: Integer): WideString; safecall;
function Get_currentAudioLanguage: Integer; safecall;
procedure Set_currentAudioLanguage(plLangID: Integer); safecall;
function Get_currentAudioLanguageIndex: Integer; safecall;
procedure Set_currentAudioLanguageIndex(plIndex: Integer); safecall;
function getLanguageName(lLangID: Integer): WideString; safecall;
function Get_currentPositionTimecode: WideString; safecall;
procedure Set_currentPositionTimecode(const bstrTimecode: WideString); safecall;
property audioLanguageCount: Integer read Get_audioLanguageCount;
property currentAudioLanguage: Integer read Get_currentAudioLanguage write Set_currentAudioLanguage;
property currentAudioLanguageIndex: Integer read Get_currentAudioLanguageIndex write Set_currentAudioLanguageIndex;
property currentPositionTimecode: WideString read Get_currentPositionTimecode write Set_currentPositionTimecode;
end;
// *********************************************************************//
// DispIntf: IWMPControls3Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A1D1110E-D545-476A-9A78-AC3E4CB1E6BD}
// *********************************************************************//
IWMPControls3Disp = dispinterface
['{A1D1110E-D545-476A-9A78-AC3E4CB1E6BD}']
property audioLanguageCount: Integer readonly dispid 65;
function getAudioLanguageID(lIndex: Integer): Integer; dispid 66;
function getAudioLanguageDescription(lIndex: Integer): WideString; dispid 67;
property currentAudioLanguage: Integer dispid 68;
property currentAudioLanguageIndex: Integer dispid 69;
function getLanguageName(lLangID: Integer): WideString; dispid 70;
property currentPositionTimecode: WideString dispid 71;
procedure step(lStep: Integer); dispid 64;
property isAvailable[const bstrItem: WideString]: WordBool readonly dispid 62;
procedure play; dispid 51;
procedure stop; dispid 52;
procedure pause; dispid 53;
procedure fastForward; dispid 54;
procedure fastReverse; dispid 55;
property currentPosition: Double dispid 56;
property currentPositionString: WideString readonly dispid 57;
procedure next; dispid 58;
procedure previous; dispid 59;
property currentItem: IWMPMedia dispid 60;
property currentMarker: Integer dispid 61;
procedure playItem(const pIWMPMedia: IWMPMedia); dispid 63;
end;
// *********************************************************************//
// Interface: IWMPClosedCaption2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {350BA78B-6BC8-4113-A5F5-312056934EB6}
// *********************************************************************//
IWMPClosedCaption2 = interface(IWMPClosedCaption)
['{350BA78B-6BC8-4113-A5F5-312056934EB6}']
function Get_SAMILangCount: Integer; safecall;
function getSAMILangName(nIndex: Integer): WideString; safecall;
function getSAMILangID(nIndex: Integer): Integer; safecall;
function Get_SAMIStyleCount: Integer; safecall;
function getSAMIStyleName(nIndex: Integer): WideString; safecall;
property SAMILangCount: Integer read Get_SAMILangCount;
property SAMIStyleCount: Integer read Get_SAMIStyleCount;
end;
// *********************************************************************//
// DispIntf: IWMPClosedCaption2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {350BA78B-6BC8-4113-A5F5-312056934EB6}
// *********************************************************************//
IWMPClosedCaption2Disp = dispinterface
['{350BA78B-6BC8-4113-A5F5-312056934EB6}']
property SAMILangCount: Integer readonly dispid 955;
function getSAMILangName(nIndex: Integer): WideString; dispid 956;
function getSAMILangID(nIndex: Integer): Integer; dispid 957;
property SAMIStyleCount: Integer readonly dispid 958;
function getSAMIStyleName(nIndex: Integer): WideString; dispid 959;
property SAMIStyle: WideString dispid 951;
property SAMILang: WideString dispid 952;
property SAMIFileName: WideString dispid 953;
property captioningId: WideString dispid 954;
end;
// *********************************************************************//
// Interface: IWMPMediaCollection2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8BA957F5-FD8C-4791-B82D-F840401EE474}
// *********************************************************************//
IWMPMediaCollection2 = interface(IWMPMediaCollection)
['{8BA957F5-FD8C-4791-B82D-F840401EE474}']
function createQuery: IWMPQuery; safecall;
function getPlaylistByQuery(const pQuery: IWMPQuery; const bstrMediaType: WideString;
const bstrSortAttribute: WideString; fSortAscending: WordBool): IWMPPlaylist; safecall;
function getStringCollectionByQuery(const bstrAttribute: WideString; const pQuery: IWMPQuery;
const bstrMediaType: WideString;
const bstrSortAttribute: WideString;
fSortAscending: WordBool): IWMPStringCollection; safecall;
function getByAttributeAndMediaType(const bstrAttribute: WideString;
const bstrValue: WideString; const bstrMediaType: WideString): IWMPPlaylist; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPMediaCollection2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {8BA957F5-FD8C-4791-B82D-F840401EE474}
// *********************************************************************//
IWMPMediaCollection2Disp = dispinterface
['{8BA957F5-FD8C-4791-B82D-F840401EE474}']
function createQuery: IWMPQuery; dispid 1401;
function getPlaylistByQuery(const pQuery: IWMPQuery; const bstrMediaType: WideString;
const bstrSortAttribute: WideString; fSortAscending: WordBool): IWMPPlaylist; dispid 1402;
function getStringCollectionByQuery(const bstrAttribute: WideString; const pQuery: IWMPQuery;
const bstrMediaType: WideString;
const bstrSortAttribute: WideString;
fSortAscending: WordBool): IWMPStringCollection; dispid 1403;
function getByAttributeAndMediaType(const bstrAttribute: WideString;
const bstrValue: WideString; const bstrMediaType: WideString): IWMPPlaylist; dispid 1404;
function add(const bstrURL: WideString): IWMPMedia; dispid 452;
function getAll: IWMPPlaylist; dispid 453;
function getByName(const bstrName: WideString): IWMPPlaylist; dispid 454;
function getByGenre(const bstrGenre: WideString): IWMPPlaylist; dispid 455;
function getByAuthor(const bstrAuthor: WideString): IWMPPlaylist; dispid 456;
function getByAlbum(const bstrAlbum: WideString): IWMPPlaylist; dispid 457;
function getByAttribute(const bstrAttribute: WideString; const bstrValue: WideString): IWMPPlaylist; dispid 458;
procedure remove(const pItem: IWMPMedia; varfDeleteFile: WordBool); dispid 459;
function getAttributeStringCollection(const bstrAttribute: WideString;
const bstrMediaType: WideString): IWMPStringCollection; dispid 461;
function getMediaAtom(const bstrItemName: WideString): Integer; dispid 470;
procedure setDeleted(const pItem: IWMPMedia; varfIsDeleted: WordBool); dispid 471;
function isDeleted(const pItem: IWMPMedia): WordBool; dispid 472;
end;
// *********************************************************************//
// Interface: IWMPStringCollection2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {46AD648D-53F1-4A74-92E2-2A1B68D63FD4}
// *********************************************************************//
IWMPStringCollection2 = interface(IWMPStringCollection)
['{46AD648D-53F1-4A74-92E2-2A1B68D63FD4}']
function isIdentical(const pIWMPStringCollection2: IWMPStringCollection2): WordBool; safecall;
function getItemInfo(lCollectionIndex: Integer; const bstrItemName: WideString): WideString; safecall;
function getAttributeCountByType(lCollectionIndex: Integer; const bstrType: WideString;
const bstrLanguage: WideString): Integer; safecall;
function getItemInfoByType(lCollectionIndex: Integer; const bstrType: WideString;
const bstrLanguage: WideString; lAttributeIndex: Integer): OleVariant; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPStringCollection2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {46AD648D-53F1-4A74-92E2-2A1B68D63FD4}
// *********************************************************************//
IWMPStringCollection2Disp = dispinterface
['{46AD648D-53F1-4A74-92E2-2A1B68D63FD4}']
function isIdentical(const pIWMPStringCollection2: IWMPStringCollection2): WordBool; dispid 1451;
function getItemInfo(lCollectionIndex: Integer; const bstrItemName: WideString): WideString; dispid 1452;
function getAttributeCountByType(lCollectionIndex: Integer; const bstrType: WideString;
const bstrLanguage: WideString): Integer; dispid 1453;
function getItemInfoByType(lCollectionIndex: Integer; const bstrType: WideString;
const bstrLanguage: WideString; lAttributeIndex: Integer): OleVariant; dispid 1454;
property count: Integer readonly dispid 401;
function Item(lIndex: Integer): WideString; dispid 402;
end;
// *********************************************************************//
// Interface: IWMPQuery
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A00918F3-A6B0-4BFB-9189-FD834C7BC5A5}
// *********************************************************************//
IWMPQuery = interface(IDispatch)
['{A00918F3-A6B0-4BFB-9189-FD834C7BC5A5}']
procedure addCondition(const bstrAttribute: WideString; const bstrOperator: WideString;
const bstrValue: WideString); safecall;
procedure beginNextGroup; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPQueryDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A00918F3-A6B0-4BFB-9189-FD834C7BC5A5}
// *********************************************************************//
IWMPQueryDisp = dispinterface
['{A00918F3-A6B0-4BFB-9189-FD834C7BC5A5}']
procedure addCondition(const bstrAttribute: WideString; const bstrOperator: WideString;
const bstrValue: WideString); dispid 1351;
procedure beginNextGroup; dispid 1352;
end;
// *********************************************************************//
// Interface: IWMPPlayerServices
// Flags: (0)
// GUID: {1D01FBDB-ADE2-4C8D-9842-C190B95C3306}
// *********************************************************************//
IWMPPlayerServices = interface(IUnknown)
['{1D01FBDB-ADE2-4C8D-9842-C190B95C3306}']
function activateUIPlugin(const bstrPlugin: WideString): HResult; stdcall;
function setTaskPane(const bstrTaskPane: WideString): HResult; stdcall;
function setTaskPaneURL(const bstrTaskPane: WideString; const bstrURL: WideString;
const bstrFriendlyName: WideString): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPPlayerServices2
// Flags: (0)
// GUID: {1BB1592F-F040-418A-9F71-17C7512B4D70}
// *********************************************************************//
IWMPPlayerServices2 = interface(IWMPPlayerServices)
['{1BB1592F-F040-418A-9F71-17C7512B4D70}']
function setBackgroundProcessingPriority(const bstrPriority: WideString): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPRemoteMediaServices
// Flags: (0)
// GUID: {CBB92747-741F-44FE-AB5B-F1A48F3B2A59}
// *********************************************************************//
IWMPRemoteMediaServices = interface(IUnknown)
['{CBB92747-741F-44FE-AB5B-F1A48F3B2A59}']
function GetServiceType(out pbstrType: WideString): HResult; stdcall;
function GetApplicationName(out pbstrName: WideString): HResult; stdcall;
function GetScriptableObject(out pbstrName: WideString; out ppDispatch: IDispatch): HResult; stdcall;
function GetCustomUIMode(out pbstrFile: WideString): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPSyncServices
// Flags: (256) OleAutomation
// GUID: {8B5050FF-E0A4-4808-B3A8-893A9E1ED894}
// *********************************************************************//
IWMPSyncServices = interface(IUnknown)
['{8B5050FF-E0A4-4808-B3A8-893A9E1ED894}']
function Get_deviceCount(out plCount: Integer): HResult; stdcall;
function getDevice(lIndex: Integer; out ppDevice: IWMPSyncDevice): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPLibraryServices
// Flags: (256) OleAutomation
// GUID: {39C2F8D5-1CF2-4D5E-AE09-D73492CF9EAA}
// *********************************************************************//
IWMPLibraryServices = interface(IUnknown)
['{39C2F8D5-1CF2-4D5E-AE09-D73492CF9EAA}']
function getCountByType(wmplt: WMPLibraryType; out plCount: Integer): HResult; stdcall;
function getLibraryByType(wmplt: WMPLibraryType; lIndex: Integer; out ppIWMPLibrary: IWMPLibrary): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPLibrarySharingServices
// Flags: (256) OleAutomation
// GUID: {82CBA86B-9F04-474B-A365-D6DD1466E541}
// *********************************************************************//
IWMPLibrarySharingServices = interface(IUnknown)
['{82CBA86B-9F04-474B-A365-D6DD1466E541}']
function isLibraryShared(out pvbShared: WordBool): HResult; stdcall;
function isLibrarySharingEnabled(out pvbEnabled: WordBool): HResult; stdcall;
function showLibrarySharing: HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPFolderMonitorServices
// Flags: (256) OleAutomation
// GUID: {788C8743-E57F-439D-A468-5BC77F2E59C6}
// *********************************************************************//
IWMPFolderMonitorServices = interface(IUnknown)
['{788C8743-E57F-439D-A468-5BC77F2E59C6}']
function Get_count(out plCount: Integer): HResult; stdcall;
function Item(lIndex: Integer; out pbstrFolder: WideString): HResult; stdcall;
function add(const bstrFolder: WideString): HResult; stdcall;
function remove(lIndex: Integer): HResult; stdcall;
function Get_scanState(out pwmpfss: WMPFolderScanState): HResult; stdcall;
function Get_currentFolder(out pbstrFolder: WideString): HResult; stdcall;
function Get_scannedFilesCount(out plCount: Integer): HResult; stdcall;
function Get_addedFilesCount(out plCount: Integer): HResult; stdcall;
function Get_updateProgress(out plProgress: Integer): HResult; stdcall;
function startScan: HResult; stdcall;
function stopScan: HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPSyncDevice2
// Flags: (256) OleAutomation
// GUID: {88AFB4B2-140A-44D2-91E6-4543DA467CD1}
// *********************************************************************//
IWMPSyncDevice2 = interface(IWMPSyncDevice)
['{88AFB4B2-140A-44D2-91E6-4543DA467CD1}']
function setItemInfo(const bstrItemName: WideString; const bstrVal: WideString): HResult; stdcall;
end;
// *********************************************************************//
// Interface: IWMPPlaylistCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5F9CFD92-8CAD-11D3-9A7E-00C04F8EFB70}
// *********************************************************************//
IWMPPlaylistCtrl = interface(IDispatch)
['{5F9CFD92-8CAD-11D3-9A7E-00C04F8EFB70}']
function Get_Playlist: IWMPPlaylist; safecall;
procedure Set_Playlist(const ppdispPlaylist: IWMPPlaylist); safecall;
function Get_columns: WideString; safecall;
procedure Set_columns(const pbstrColumns: WideString); safecall;
function Get_columnCount: Integer; safecall;
function Get_columnOrder: WideString; safecall;
procedure Set_columnOrder(const pbstrColumnOrder: WideString); safecall;
function Get_columnsVisible: WordBool; safecall;
procedure Set_columnsVisible(pVal: WordBool); safecall;
function Get_dropDownVisible: WordBool; safecall;
procedure Set_dropDownVisible(pVal: WordBool); safecall;
function Get_playlistItemsVisible: WordBool; safecall;
procedure Set_playlistItemsVisible(pVal: WordBool); safecall;
function Get_checkboxesVisible: WordBool; safecall;
procedure Set_checkboxesVisible(pVal: WordBool); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pbstrColor: WideString); safecall;
function Get_foregroundColor: WideString; safecall;
procedure Set_foregroundColor(const pbstrColor: WideString); safecall;
function Get_disabledItemColor: WideString; safecall;
procedure Set_disabledItemColor(const pbstrColor: WideString); safecall;
function Get_itemPlayingColor: WideString; safecall;
procedure Set_itemPlayingColor(const pbstrColor: WideString); safecall;
function Get_itemPlayingBackgroundColor: WideString; safecall;
procedure Set_itemPlayingBackgroundColor(const pbstrBackgroundColor: WideString); safecall;
function Get_backgroundImage: WideString; safecall;
procedure Set_backgroundImage(const pbstrImage: WideString); safecall;
function Get_allowItemEditing: WordBool; safecall;
procedure Set_allowItemEditing(pVal: WordBool); safecall;
function Get_allowColumnSorting: WordBool; safecall;
procedure Set_allowColumnSorting(pVal: WordBool); safecall;
function Get_dropDownList: WideString; safecall;
procedure Set_dropDownList(const pbstrList: WideString); safecall;
function Get_dropDownToolTip: WideString; safecall;
procedure Set_dropDownToolTip(const pbstrToolTip: WideString); safecall;
function Get_copying: WordBool; safecall;
procedure Set_copying(pVal: WordBool); safecall;
procedure copy; safecall;
procedure abortCopy; safecall;
procedure deleteSelected; safecall;
procedure deleteSelectedFromLibrary; safecall;
procedure moveSelectedUp; safecall;
procedure moveSelectedDown; safecall;
procedure addSelectedToPlaylist(const pdispPlaylist: IWMPPlaylist); safecall;
function getNextSelectedItem(nStartIndex: Integer): Integer; safecall;
function getNextCheckedItem(nStartIndex: Integer): Integer; safecall;
procedure setSelectedState(nIndex: Integer; vbSelected: WordBool); safecall;
procedure setCheckedState(nIndex: Integer; vbChecked: WordBool); safecall;
procedure sortColumn(nIndex: Integer); safecall;
procedure setColumnResizeMode(nIndex: Integer; const newMode: WideString); safecall;
procedure setColumnWidth(nIndex: Integer; nWidth: Integer); safecall;
function Get_itemErrorColor: WideString; safecall;
procedure Set_itemErrorColor(const pbstrColor: WideString); safecall;
function Get_itemCount: Integer; safecall;
function Get_itemMedia(nIndex: Integer): IWMPMedia; safecall;
function Get_itemPlaylist(nIndex: Integer): IWMPPlaylist; safecall;
function getNextSelectedItem2(nStartIndex: Integer): Integer; safecall;
function getNextCheckedItem2(nStartIndex: Integer): Integer; safecall;
procedure setSelectedState2(nIndex: Integer; vbSelected: WordBool); safecall;
procedure setCheckedState2(nIndex: Integer; vbChecked: WordBool); safecall;
function Get_leftStatus: WideString; safecall;
procedure Set_leftStatus(const pbstrStatus: WideString); safecall;
function Get_rightStatus: WideString; safecall;
procedure Set_rightStatus(const pbstrStatus: WideString); safecall;
function Get_editButtonVisible: WordBool; safecall;
procedure Set_editButtonVisible(pVal: WordBool); safecall;
function Get_dropDownImage: WideString; safecall;
procedure Set_dropDownImage(const pbstrImage: WideString); safecall;
function Get_dropDownBackgroundImage: WideString; safecall;
procedure Set_dropDownBackgroundImage(const pbstrImage: WideString); safecall;
function Get_hueShift: Single; safecall;
procedure Set_hueShift(pVal: Single); safecall;
function Get_saturation: Single; safecall;
procedure Set_saturation(pVal: Single); safecall;
function Get_statusColor: WideString; safecall;
procedure Set_statusColor(const pbstrColor: WideString); safecall;
function Get_toolbarVisible: WordBool; safecall;
procedure Set_toolbarVisible(pVal: WordBool); safecall;
function Get_itemSelectedColor: WideString; safecall;
procedure Set_itemSelectedColor(const pbstrColor: WideString); safecall;
function Get_itemSelectedFocusLostColor: WideString; safecall;
procedure Set_itemSelectedFocusLostColor(const pbstrFocusLostColor: WideString); safecall;
function Get_itemSelectedBackgroundColor: WideString; safecall;
procedure Set_itemSelectedBackgroundColor(const pbstrColor: WideString); safecall;
function Get_itemSelectedBackgroundFocusLostColor: WideString; safecall;
procedure Set_itemSelectedBackgroundFocusLostColor(const pbstrFocusLostColor: WideString); safecall;
function Get_backgroundSplitColor: WideString; safecall;
procedure Set_backgroundSplitColor(const pbstrColor: WideString); safecall;
function Get_statusTextColor: WideString; safecall;
procedure Set_statusTextColor(const pbstrColor: WideString); safecall;
property Playlist: IWMPPlaylist read Get_Playlist write Set_Playlist;
property columns: WideString read Get_columns write Set_columns;
property columnCount: Integer read Get_columnCount;
property columnOrder: WideString read Get_columnOrder write Set_columnOrder;
property columnsVisible: WordBool read Get_columnsVisible write Set_columnsVisible;
property dropDownVisible: WordBool read Get_dropDownVisible write Set_dropDownVisible;
property playlistItemsVisible: WordBool read Get_playlistItemsVisible write Set_playlistItemsVisible;
property checkboxesVisible: WordBool read Get_checkboxesVisible write Set_checkboxesVisible;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property foregroundColor: WideString read Get_foregroundColor write Set_foregroundColor;
property disabledItemColor: WideString read Get_disabledItemColor write Set_disabledItemColor;
property itemPlayingColor: WideString read Get_itemPlayingColor write Set_itemPlayingColor;
property itemPlayingBackgroundColor: WideString read Get_itemPlayingBackgroundColor write Set_itemPlayingBackgroundColor;
property backgroundImage: WideString read Get_backgroundImage write Set_backgroundImage;
property allowItemEditing: WordBool read Get_allowItemEditing write Set_allowItemEditing;
property allowColumnSorting: WordBool read Get_allowColumnSorting write Set_allowColumnSorting;
property dropDownList: WideString read Get_dropDownList write Set_dropDownList;
property dropDownToolTip: WideString read Get_dropDownToolTip write Set_dropDownToolTip;
property copying: WordBool read Get_copying write Set_copying;
property itemErrorColor: WideString read Get_itemErrorColor write Set_itemErrorColor;
property itemCount: Integer read Get_itemCount;
property itemMedia[nIndex: Integer]: IWMPMedia read Get_itemMedia;
property itemPlaylist[nIndex: Integer]: IWMPPlaylist read Get_itemPlaylist;
property leftStatus: WideString read Get_leftStatus write Set_leftStatus;
property rightStatus: WideString read Get_rightStatus write Set_rightStatus;
property editButtonVisible: WordBool read Get_editButtonVisible write Set_editButtonVisible;
property dropDownImage: WideString read Get_dropDownImage write Set_dropDownImage;
property dropDownBackgroundImage: WideString read Get_dropDownBackgroundImage write Set_dropDownBackgroundImage;
property hueShift: Single read Get_hueShift write Set_hueShift;
property saturation: Single read Get_saturation write Set_saturation;
property statusColor: WideString read Get_statusColor write Set_statusColor;
property toolbarVisible: WordBool read Get_toolbarVisible write Set_toolbarVisible;
property itemSelectedColor: WideString read Get_itemSelectedColor write Set_itemSelectedColor;
property itemSelectedFocusLostColor: WideString read Get_itemSelectedFocusLostColor write Set_itemSelectedFocusLostColor;
property itemSelectedBackgroundColor: WideString read Get_itemSelectedBackgroundColor write Set_itemSelectedBackgroundColor;
property itemSelectedBackgroundFocusLostColor: WideString read Get_itemSelectedBackgroundFocusLostColor write Set_itemSelectedBackgroundFocusLostColor;
property backgroundSplitColor: WideString read Get_backgroundSplitColor write Set_backgroundSplitColor;
property statusTextColor: WideString read Get_statusTextColor write Set_statusTextColor;
end;
// *********************************************************************//
// DispIntf: IWMPPlaylistCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5F9CFD92-8CAD-11D3-9A7E-00C04F8EFB70}
// *********************************************************************//
IWMPPlaylistCtrlDisp = dispinterface
['{5F9CFD92-8CAD-11D3-9A7E-00C04F8EFB70}']
property Playlist: IWMPPlaylist dispid 5601;
property columns: WideString dispid 5602;
property columnCount: Integer readonly dispid 5603;
property columnOrder: WideString dispid 5604;
property columnsVisible: WordBool dispid 5605;
property dropDownVisible: WordBool dispid 5607;
property playlistItemsVisible: WordBool dispid 5608;
property checkboxesVisible: WordBool dispid 5609;
property backgroundColor: WideString dispid 5612;
property foregroundColor: WideString dispid 5613;
property disabledItemColor: WideString dispid 5614;
property itemPlayingColor: WideString dispid 5615;
property itemPlayingBackgroundColor: WideString dispid 5616;
property backgroundImage: WideString dispid 5617;
property allowItemEditing: WordBool dispid 5618;
property allowColumnSorting: WordBool dispid 5619;
property dropDownList: WideString dispid 5620;
property dropDownToolTip: WideString dispid 5621;
property copying: WordBool dispid 5622;
procedure copy; dispid 5623;
procedure abortCopy; dispid 5624;
procedure deleteSelected; dispid 5625;
procedure deleteSelectedFromLibrary; dispid 5626;
procedure moveSelectedUp; dispid 5628;
procedure moveSelectedDown; dispid 5629;
procedure addSelectedToPlaylist(const pdispPlaylist: IWMPPlaylist); dispid 5630;
function getNextSelectedItem(nStartIndex: Integer): Integer; dispid 5631;
function getNextCheckedItem(nStartIndex: Integer): Integer; dispid 5632;
procedure setSelectedState(nIndex: Integer; vbSelected: WordBool); dispid 5633;
procedure setCheckedState(nIndex: Integer; vbChecked: WordBool); dispid 5634;
procedure sortColumn(nIndex: Integer); dispid 5635;
procedure setColumnResizeMode(nIndex: Integer; const newMode: WideString); dispid 5636;
procedure setColumnWidth(nIndex: Integer; nWidth: Integer); dispid 5637;
property itemErrorColor: WideString dispid 5642;
property itemCount: Integer readonly dispid 5643;
property itemMedia[nIndex: Integer]: IWMPMedia readonly dispid 5644;
property itemPlaylist[nIndex: Integer]: IWMPPlaylist readonly dispid 5645;
function getNextSelectedItem2(nStartIndex: Integer): Integer; dispid 5646;
function getNextCheckedItem2(nStartIndex: Integer): Integer; dispid 5647;
procedure setSelectedState2(nIndex: Integer; vbSelected: WordBool); dispid 5648;
procedure setCheckedState2(nIndex: Integer; vbChecked: WordBool); dispid 5649;
property leftStatus: WideString dispid 5650;
property rightStatus: WideString dispid 5651;
property editButtonVisible: WordBool dispid 5652;
property dropDownImage: WideString dispid 5653;
property dropDownBackgroundImage: WideString dispid 5654;
property hueShift: Single dispid 5655;
property saturation: Single dispid 5656;
property statusColor: WideString dispid 5658;
property toolbarVisible: WordBool dispid 5660;
property itemSelectedColor: WideString dispid 5662;
property itemSelectedFocusLostColor: WideString dispid 5663;
property itemSelectedBackgroundColor: WideString dispid 5664;
property itemSelectedBackgroundFocusLostColor: WideString dispid 5665;
property backgroundSplitColor: WideString dispid 5666;
property statusTextColor: WideString dispid 5667;
end;
// *********************************************************************//
// Interface: IAppDispatch
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E41C88DD-2364-4FF7-A0F5-CA9859AF783F}
// *********************************************************************//
IAppDispatch = interface(IDispatch)
['{E41C88DD-2364-4FF7-A0F5-CA9859AF783F}']
function Get_titlebarVisible: WordBool; safecall;
procedure Set_titlebarVisible(pVal: WordBool); safecall;
function Get_titlebarAutoHide: WordBool; safecall;
procedure Set_titlebarAutoHide(pVal: WordBool); safecall;
function Get_currentTask: WideString; safecall;
procedure Set_currentTask(const pVal: WideString); safecall;
function Get_settingsVisible: WordBool; safecall;
procedure Set_settingsVisible(pVal: WordBool); safecall;
function Get_playlistVisible: WordBool; safecall;
procedure Set_playlistVisible(pVal: WordBool); safecall;
procedure gotoSkinMode; safecall;
procedure navigatePrevious; safecall;
procedure navigateNext; safecall;
procedure goFullScreen; safecall;
function Get_fullScreenEnabled: WordBool; safecall;
function Get_serviceLoginVisible: WordBool; safecall;
function Get_serviceLoginSignedIn: WordBool; safecall;
procedure serviceLogin; safecall;
procedure serviceLogout; safecall;
function Get_serviceGetInfo(const bstrItem: WideString): OleVariant; safecall;
function Get_navigatePreviousEnabled: WordBool; safecall;
function Get_navigateNextEnabled: WordBool; safecall;
procedure navigateToAddress(const address: WideString); safecall;
function Get_glassEnabled: WordBool; safecall;
function Get_inVistaPlus: WordBool; safecall;
procedure adjustLeft(nDistance: Integer); safecall;
function Get_taskbarVisible: WordBool; safecall;
procedure Set_taskbarVisible(pVal: WordBool); safecall;
function Get_DPI: Integer; safecall;
function Get_previousEnabled: WordBool; safecall;
function Get_playLibraryItemEnabled: WordBool; safecall;
procedure previous; safecall;
function Get_titlebarCurrentlyVisible: WordBool; safecall;
function Get_menubarCurrentlyVisible: WordBool; safecall;
function Get_bgPluginRunning: WordBool; safecall;
procedure configurePlugins(nType: Integer); safecall;
function getTimeString(dTime: Double): WideString; safecall;
function Get_maximized: WordBool; safecall;
function Get_top: Integer; safecall;
procedure Set_top(pVal: Integer); safecall;
function Get_left: Integer; safecall;
procedure Set_left(pVal: Integer); safecall;
function Get_width: Integer; safecall;
procedure Set_width(pVal: Integer); safecall;
function Get_height: Integer; safecall;
procedure Set_height(pVal: Integer); safecall;
procedure setWindowPos(lTop: Integer; lLeft: Integer; lWidth: Integer; lHeight: Integer); safecall;
procedure logData(const ID: WideString; const data: WideString); safecall;
function Get_powerPersonality: WideString; safecall;
procedure navigateNamespace(const address: WideString); safecall;
function Get_exclusiveService: WideString; safecall;
procedure Set_windowText(const Param1: WideString); safecall;
property titlebarVisible: WordBool read Get_titlebarVisible write Set_titlebarVisible;
property titlebarAutoHide: WordBool read Get_titlebarAutoHide write Set_titlebarAutoHide;
property currentTask: WideString read Get_currentTask write Set_currentTask;
property settingsVisible: WordBool read Get_settingsVisible write Set_settingsVisible;
property playlistVisible: WordBool read Get_playlistVisible write Set_playlistVisible;
property fullScreenEnabled: WordBool read Get_fullScreenEnabled;
property serviceLoginVisible: WordBool read Get_serviceLoginVisible;
property serviceLoginSignedIn: WordBool read Get_serviceLoginSignedIn;
property serviceGetInfo[const bstrItem: WideString]: OleVariant read Get_serviceGetInfo;
property navigatePreviousEnabled: WordBool read Get_navigatePreviousEnabled;
property navigateNextEnabled: WordBool read Get_navigateNextEnabled;
property glassEnabled: WordBool read Get_glassEnabled;
property inVistaPlus: WordBool read Get_inVistaPlus;
property taskbarVisible: WordBool read Get_taskbarVisible write Set_taskbarVisible;
property DPI: Integer read Get_DPI;
property previousEnabled: WordBool read Get_previousEnabled;
property playLibraryItemEnabled: WordBool read Get_playLibraryItemEnabled;
property titlebarCurrentlyVisible: WordBool read Get_titlebarCurrentlyVisible;
property menubarCurrentlyVisible: WordBool read Get_menubarCurrentlyVisible;
property bgPluginRunning: WordBool read Get_bgPluginRunning;
property maximized: WordBool read Get_maximized;
property top: Integer read Get_top write Set_top;
property left: Integer read Get_left write Set_left;
property width: Integer read Get_width write Set_width;
property height: Integer read Get_height write Set_height;
property powerPersonality: WideString read Get_powerPersonality;
property exclusiveService: WideString read Get_exclusiveService;
property windowText: WideString write Set_windowText;
end;
// *********************************************************************//
// DispIntf: IAppDispatchDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E41C88DD-2364-4FF7-A0F5-CA9859AF783F}
// *********************************************************************//
IAppDispatchDisp = dispinterface
['{E41C88DD-2364-4FF7-A0F5-CA9859AF783F}']
property titlebarVisible: WordBool dispid 100;
property titlebarAutoHide: WordBool dispid 101;
property currentTask: WideString dispid 102;
property settingsVisible: WordBool dispid 103;
property playlistVisible: WordBool dispid 104;
procedure gotoSkinMode; dispid 105;
procedure navigatePrevious; dispid 125;
procedure navigateNext; dispid 126;
procedure goFullScreen; dispid 142;
property fullScreenEnabled: WordBool readonly dispid 141;
property serviceLoginVisible: WordBool readonly dispid 132;
property serviceLoginSignedIn: WordBool readonly dispid 133;
procedure serviceLogin; dispid 134;
procedure serviceLogout; dispid 135;
property serviceGetInfo[const bstrItem: WideString]: OleVariant readonly dispid 140;
property navigatePreviousEnabled: WordBool readonly dispid 123;
property navigateNextEnabled: WordBool readonly dispid 124;
procedure navigateToAddress(const address: WideString); dispid 130;
property glassEnabled: WordBool readonly dispid 131;
property inVistaPlus: WordBool readonly dispid 136;
procedure adjustLeft(nDistance: Integer); dispid 106;
property taskbarVisible: WordBool dispid 107;
property DPI: Integer readonly dispid 116;
property previousEnabled: WordBool readonly dispid 114;
property playLibraryItemEnabled: WordBool readonly dispid 139;
procedure previous; dispid 115;
property titlebarCurrentlyVisible: WordBool readonly dispid 108;
property menubarCurrentlyVisible: WordBool readonly dispid 137;
property bgPluginRunning: WordBool readonly dispid 109;
procedure configurePlugins(nType: Integer); dispid 110;
function getTimeString(dTime: Double): WideString; dispid 111;
property maximized: WordBool readonly dispid 113;
property top: Integer dispid 117;
property left: Integer dispid 118;
property width: Integer dispid 119;
property height: Integer dispid 120;
procedure setWindowPos(lTop: Integer; lLeft: Integer; lWidth: Integer; lHeight: Integer); dispid 121;
procedure logData(const ID: WideString; const data: WideString); dispid 122;
property powerPersonality: WideString readonly dispid 127;
procedure navigateNamespace(const address: WideString); dispid 128;
property exclusiveService: WideString readonly dispid 129;
property windowText: WideString writeonly dispid 138;
end;
// *********************************************************************//
// Interface: IWMPSafeBrowser
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {EF870383-83AB-4EA9-BE48-56FA4251AF10}
// *********************************************************************//
IWMPSafeBrowser = interface(IDispatch)
['{EF870383-83AB-4EA9-BE48-56FA4251AF10}']
function Get_URL: WideString; safecall;
procedure Set_URL(const pVal: WideString); safecall;
function Get_status: Integer; safecall;
function Get_pendingDownloads: Integer; safecall;
procedure showSAMIText(const samiText: WideString); safecall;
procedure showLyrics(const lyrics: WideString); safecall;
procedure loadSpecialPage(const pageName: WideString); safecall;
procedure goBack; safecall;
procedure goForward; safecall;
procedure stop; safecall;
procedure refresh; safecall;
function Get_baseURL: WideString; safecall;
function Get_fullURL: WideString; safecall;
function Get_secureLock: Integer; safecall;
function Get_busy: WordBool; safecall;
procedure showCert; safecall;
property URL: WideString read Get_URL write Set_URL;
property status: Integer read Get_status;
property pendingDownloads: Integer read Get_pendingDownloads;
property baseURL: WideString read Get_baseURL;
property fullURL: WideString read Get_fullURL;
property secureLock: Integer read Get_secureLock;
property busy: WordBool read Get_busy;
end;
// *********************************************************************//
// DispIntf: IWMPSafeBrowserDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {EF870383-83AB-4EA9-BE48-56FA4251AF10}
// *********************************************************************//
IWMPSafeBrowserDisp = dispinterface
['{EF870383-83AB-4EA9-BE48-56FA4251AF10}']
property URL: WideString dispid 8400;
property status: Integer readonly dispid 8401;
property pendingDownloads: Integer readonly dispid 8402;
procedure showSAMIText(const samiText: WideString); dispid 8403;
procedure showLyrics(const lyrics: WideString); dispid 8404;
procedure loadSpecialPage(const pageName: WideString); dispid 8405;
procedure goBack; dispid 8406;
procedure goForward; dispid 8407;
procedure stop; dispid 8408;
procedure refresh; dispid 8409;
property baseURL: WideString readonly dispid 8410;
property fullURL: WideString readonly dispid 8414;
property secureLock: Integer readonly dispid 8411;
property busy: WordBool readonly dispid 8412;
procedure showCert; dispid 8413;
end;
// *********************************************************************//
// Interface: IWMPObjectExtendedProps
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {21D077C1-4BAA-11D3-BD45-00C04F6EA5AE}
// *********************************************************************//
IWMPObjectExtendedProps = interface(IDispatch)
['{21D077C1-4BAA-11D3-BD45-00C04F6EA5AE}']
function Get_ID: WideString; safecall;
function Get_elementType: WideString; safecall;
function Get_left: Integer; safecall;
procedure Set_left(pVal: Integer); safecall;
function Get_top: Integer; safecall;
procedure Set_top(pVal: Integer); safecall;
function Get_right: Integer; safecall;
procedure Set_right(pVal: Integer); safecall;
function Get_bottom: Integer; safecall;
procedure Set_bottom(pVal: Integer); safecall;
function Get_width: Integer; safecall;
procedure Set_width(pVal: Integer); safecall;
function Get_height: Integer; safecall;
procedure Set_height(pVal: Integer); safecall;
function Get_zIndex: Integer; safecall;
procedure Set_zIndex(pVal: Integer); safecall;
function Get_clippingImage: WideString; safecall;
procedure Set_clippingImage(const pVal: WideString); safecall;
function Get_clippingColor: WideString; safecall;
procedure Set_clippingColor(const pVal: WideString); safecall;
function Get_visible: WordBool; safecall;
procedure Set_visible(pVal: WordBool); safecall;
function Get_enabled: WordBool; safecall;
procedure Set_enabled(pVal: WordBool); safecall;
function Get_tabStop: WordBool; safecall;
procedure Set_tabStop(pVal: WordBool); safecall;
function Get_passThrough: WordBool; safecall;
procedure Set_passThrough(pVal: WordBool); safecall;
function Get_horizontalAlignment: WideString; safecall;
procedure Set_horizontalAlignment(const pVal: WideString); safecall;
function Get_verticalAlignment: WideString; safecall;
procedure Set_verticalAlignment(const pVal: WideString); safecall;
procedure moveTo(newX: Integer; newY: Integer; moveTime: Integer); safecall;
procedure slideTo(newX: Integer; newY: Integer; moveTime: Integer); safecall;
procedure moveSizeTo(newX: Integer; newY: Integer; newWidth: Integer; newHeight: Integer;
moveTime: Integer; fSlide: WordBool); safecall;
function Get_alphaBlend: Integer; safecall;
procedure Set_alphaBlend(pVal: Integer); safecall;
procedure alphaBlendTo(newVal: Integer; alphaTime: Integer); safecall;
function Get_accName: WideString; safecall;
procedure Set_accName(const pszName: WideString); safecall;
function Get_accDescription: WideString; safecall;
procedure Set_accDescription(const pszDesc: WideString); safecall;
function Get_accKeyboardShortcut: WideString; safecall;
procedure Set_accKeyboardShortcut(const pszShortcut: WideString); safecall;
function Get_resizeImages: WordBool; safecall;
procedure Set_resizeImages(pVal: WordBool); safecall;
function Get_nineGridMargins: WideString; safecall;
procedure Set_nineGridMargins(const pszMargins: WideString); safecall;
property ID: WideString read Get_ID;
property elementType: WideString read Get_elementType;
property left: Integer read Get_left write Set_left;
property top: Integer read Get_top write Set_top;
property right: Integer read Get_right write Set_right;
property bottom: Integer read Get_bottom write Set_bottom;
property width: Integer read Get_width write Set_width;
property height: Integer read Get_height write Set_height;
property zIndex: Integer read Get_zIndex write Set_zIndex;
property clippingImage: WideString read Get_clippingImage write Set_clippingImage;
property clippingColor: WideString read Get_clippingColor write Set_clippingColor;
property visible: WordBool read Get_visible write Set_visible;
property enabled: WordBool read Get_enabled write Set_enabled;
property tabStop: WordBool read Get_tabStop write Set_tabStop;
property passThrough: WordBool read Get_passThrough write Set_passThrough;
property horizontalAlignment: WideString read Get_horizontalAlignment write Set_horizontalAlignment;
property verticalAlignment: WideString read Get_verticalAlignment write Set_verticalAlignment;
property alphaBlend: Integer read Get_alphaBlend write Set_alphaBlend;
property accName: WideString read Get_accName write Set_accName;
property accDescription: WideString read Get_accDescription write Set_accDescription;
property accKeyboardShortcut: WideString read Get_accKeyboardShortcut write Set_accKeyboardShortcut;
property resizeImages: WordBool read Get_resizeImages write Set_resizeImages;
property nineGridMargins: WideString read Get_nineGridMargins write Set_nineGridMargins;
end;
// *********************************************************************//
// DispIntf: IWMPObjectExtendedPropsDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {21D077C1-4BAA-11D3-BD45-00C04F6EA5AE}
// *********************************************************************//
IWMPObjectExtendedPropsDisp = dispinterface
['{21D077C1-4BAA-11D3-BD45-00C04F6EA5AE}']
property ID: WideString readonly dispid 2000;
property elementType: WideString readonly dispid 2001;
property left: Integer dispid 2002;
property top: Integer dispid 2003;
property right: Integer dispid 2022;
property bottom: Integer dispid 2023;
property width: Integer dispid 2004;
property height: Integer dispid 2005;
property zIndex: Integer dispid 2006;
property clippingImage: WideString dispid 2007;
property clippingColor: WideString dispid 2008;
property visible: WordBool dispid 2009;
property enabled: WordBool dispid 2010;
property tabStop: WordBool dispid 2011;
property passThrough: WordBool dispid 2012;
property horizontalAlignment: WideString dispid 2013;
property verticalAlignment: WideString dispid 2014;
procedure moveTo(newX: Integer; newY: Integer; moveTime: Integer); dispid 2015;
procedure slideTo(newX: Integer; newY: Integer; moveTime: Integer); dispid 2021;
procedure moveSizeTo(newX: Integer; newY: Integer; newWidth: Integer; newHeight: Integer;
moveTime: Integer; fSlide: WordBool); dispid 2026;
property alphaBlend: Integer dispid 2016;
procedure alphaBlendTo(newVal: Integer; alphaTime: Integer); dispid 2017;
property accName: WideString dispid 2018;
property accDescription: WideString dispid 2019;
property accKeyboardShortcut: WideString dispid 2020;
property resizeImages: WordBool dispid 2024;
property nineGridMargins: WideString dispid 2025;
end;
// *********************************************************************//
// Interface: IWMPLayoutSubView
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {72F486B1-0D43-11D3-BD3F-00C04F6EA5AE}
// *********************************************************************//
IWMPLayoutSubView = interface(IWMPObjectExtendedProps)
['{72F486B1-0D43-11D3-BD3F-00C04F6EA5AE}']
function Get_transparencyColor: WideString; safecall;
procedure Set_transparencyColor(const pVal: WideString); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_backgroundImage: WideString; safecall;
procedure Set_backgroundImage(const pVal: WideString); safecall;
function Get_backgroundTiled: WordBool; safecall;
procedure Set_backgroundTiled(pVal: WordBool); safecall;
function Get_backgroundImageHueShift: Single; safecall;
procedure Set_backgroundImageHueShift(pVal: Single); safecall;
function Get_backgroundImageSaturation: Single; safecall;
procedure Set_backgroundImageSaturation(pVal: Single); safecall;
function Get_resizeBackgroundImage: WordBool; safecall;
procedure Set_resizeBackgroundImage(pVal: WordBool); safecall;
property transparencyColor: WideString read Get_transparencyColor write Set_transparencyColor;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property backgroundImage: WideString read Get_backgroundImage write Set_backgroundImage;
property backgroundTiled: WordBool read Get_backgroundTiled write Set_backgroundTiled;
property backgroundImageHueShift: Single read Get_backgroundImageHueShift write Set_backgroundImageHueShift;
property backgroundImageSaturation: Single read Get_backgroundImageSaturation write Set_backgroundImageSaturation;
property resizeBackgroundImage: WordBool read Get_resizeBackgroundImage write Set_resizeBackgroundImage;
end;
// *********************************************************************//
// DispIntf: IWMPLayoutSubViewDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {72F486B1-0D43-11D3-BD3F-00C04F6EA5AE}
// *********************************************************************//
IWMPLayoutSubViewDisp = dispinterface
['{72F486B1-0D43-11D3-BD3F-00C04F6EA5AE}']
property transparencyColor: WideString dispid 2300;
property backgroundColor: WideString dispid 2301;
property backgroundImage: WideString dispid 2302;
property backgroundTiled: WordBool dispid 2303;
property backgroundImageHueShift: Single dispid 2304;
property backgroundImageSaturation: Single dispid 2305;
property resizeBackgroundImage: WordBool dispid 2306;
property ID: WideString readonly dispid 2000;
property elementType: WideString readonly dispid 2001;
property left: Integer dispid 2002;
property top: Integer dispid 2003;
property right: Integer dispid 2022;
property bottom: Integer dispid 2023;
property width: Integer dispid 2004;
property height: Integer dispid 2005;
property zIndex: Integer dispid 2006;
property clippingImage: WideString dispid 2007;
property clippingColor: WideString dispid 2008;
property visible: WordBool dispid 2009;
property enabled: WordBool dispid 2010;
property tabStop: WordBool dispid 2011;
property passThrough: WordBool dispid 2012;
property horizontalAlignment: WideString dispid 2013;
property verticalAlignment: WideString dispid 2014;
procedure moveTo(newX: Integer; newY: Integer; moveTime: Integer); dispid 2015;
procedure slideTo(newX: Integer; newY: Integer; moveTime: Integer); dispid 2021;
procedure moveSizeTo(newX: Integer; newY: Integer; newWidth: Integer; newHeight: Integer;
moveTime: Integer; fSlide: WordBool); dispid 2026;
property alphaBlend: Integer dispid 2016;
procedure alphaBlendTo(newVal: Integer; alphaTime: Integer); dispid 2017;
property accName: WideString dispid 2018;
property accDescription: WideString dispid 2019;
property accKeyboardShortcut: WideString dispid 2020;
property resizeImages: WordBool dispid 2024;
property nineGridMargins: WideString dispid 2025;
end;
// *********************************************************************//
// Interface: IWMPLayoutView
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {172E905D-80D9-4C2F-B7CE-2CCB771787A2}
// *********************************************************************//
IWMPLayoutView = interface(IWMPLayoutSubView)
['{172E905D-80D9-4C2F-B7CE-2CCB771787A2}']
function Get_title: WideString; safecall;
procedure Set_title(const pVal: WideString); safecall;
function Get_category: WideString; safecall;
procedure Set_category(const pVal: WideString); safecall;
function Get_focusObjectID: WideString; safecall;
procedure Set_focusObjectID(const pVal: WideString); safecall;
function Get_titleBar: WordBool; safecall;
function Get_resizable: WordBool; safecall;
function Get_timerInterval: Integer; safecall;
procedure Set_timerInterval(pVal: Integer); safecall;
function Get_minWidth: Integer; safecall;
procedure Set_minWidth(pVal: Integer); safecall;
function Get_maxWidth: Integer; safecall;
procedure Set_maxWidth(pVal: Integer); safecall;
function Get_minHeight: Integer; safecall;
procedure Set_minHeight(pVal: Integer); safecall;
function Get_maxHeight: Integer; safecall;
procedure Set_maxHeight(pVal: Integer); safecall;
procedure close; safecall;
procedure minimize; safecall;
procedure maximize; safecall;
procedure restore; safecall;
procedure size(const bstrDirection: WideString); safecall;
procedure returnToMediaCenter; safecall;
procedure updateWindow; safecall;
property title: WideString read Get_title write Set_title;
property category: WideString read Get_category write Set_category;
property focusObjectID: WideString read Get_focusObjectID write Set_focusObjectID;
property titleBar: WordBool read Get_titleBar;
property resizable: WordBool read Get_resizable;
property timerInterval: Integer read Get_timerInterval write Set_timerInterval;
property minWidth: Integer read Get_minWidth write Set_minWidth;
property maxWidth: Integer read Get_maxWidth write Set_maxWidth;
property minHeight: Integer read Get_minHeight write Set_minHeight;
property maxHeight: Integer read Get_maxHeight write Set_maxHeight;
end;
// *********************************************************************//
// DispIntf: IWMPLayoutViewDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {172E905D-80D9-4C2F-B7CE-2CCB771787A2}
// *********************************************************************//
IWMPLayoutViewDisp = dispinterface
['{172E905D-80D9-4C2F-B7CE-2CCB771787A2}']
property title: WideString dispid 2307;
property category: WideString dispid 2308;
property focusObjectID: WideString dispid 2309;
property titleBar: WordBool readonly dispid 2311;
property resizable: WordBool readonly dispid 2312;
property timerInterval: Integer dispid 2313;
property minWidth: Integer dispid 2314;
property maxWidth: Integer dispid 2315;
property minHeight: Integer dispid 2316;
property maxHeight: Integer dispid 2317;
procedure close; dispid 2318;
procedure minimize; dispid 2319;
procedure maximize; dispid 2320;
procedure restore; dispid 2321;
procedure size(const bstrDirection: WideString); dispid 2322;
procedure returnToMediaCenter; dispid 2323;
procedure updateWindow; dispid 2324;
property transparencyColor: WideString dispid 2300;
property backgroundColor: WideString dispid 2301;
property backgroundImage: WideString dispid 2302;
property backgroundTiled: WordBool dispid 2303;
property backgroundImageHueShift: Single dispid 2304;
property backgroundImageSaturation: Single dispid 2305;
property resizeBackgroundImage: WordBool dispid 2306;
property ID: WideString readonly dispid 2000;
property elementType: WideString readonly dispid 2001;
property left: Integer dispid 2002;
property top: Integer dispid 2003;
property right: Integer dispid 2022;
property bottom: Integer dispid 2023;
property width: Integer dispid 2004;
property height: Integer dispid 2005;
property zIndex: Integer dispid 2006;
property clippingImage: WideString dispid 2007;
property clippingColor: WideString dispid 2008;
property visible: WordBool dispid 2009;
property enabled: WordBool dispid 2010;
property tabStop: WordBool dispid 2011;
property passThrough: WordBool dispid 2012;
property horizontalAlignment: WideString dispid 2013;
property verticalAlignment: WideString dispid 2014;
procedure moveTo(newX: Integer; newY: Integer; moveTime: Integer); dispid 2015;
procedure slideTo(newX: Integer; newY: Integer; moveTime: Integer); dispid 2021;
procedure moveSizeTo(newX: Integer; newY: Integer; newWidth: Integer; newHeight: Integer;
moveTime: Integer; fSlide: WordBool); dispid 2026;
property alphaBlend: Integer dispid 2016;
procedure alphaBlendTo(newVal: Integer; alphaTime: Integer); dispid 2017;
property accName: WideString dispid 2018;
property accDescription: WideString dispid 2019;
property accKeyboardShortcut: WideString dispid 2020;
property resizeImages: WordBool dispid 2024;
property nineGridMargins: WideString dispid 2025;
end;
// *********************************************************************//
// Interface: IWMPEventObject
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5AF0BEC1-46AA-11D3-BD45-00C04F6EA5AE}
// *********************************************************************//
IWMPEventObject = interface(IDispatch)
['{5AF0BEC1-46AA-11D3-BD45-00C04F6EA5AE}']
function Get_srcElement: IDispatch; safecall;
function Get_altKey: WordBool; safecall;
function Get_ctrlKey: WordBool; safecall;
function Get_shiftKey: WordBool; safecall;
function Get_fromElement: IDispatch; safecall;
function Get_toElement: IDispatch; safecall;
procedure Set_keyCode(p: Integer); safecall;
function Get_keyCode: Integer; safecall;
function Get_button: Integer; safecall;
function Get_x: Integer; safecall;
function Get_y: Integer; safecall;
function Get_clientX: Integer; safecall;
function Get_clientY: Integer; safecall;
function Get_offsetX: Integer; safecall;
function Get_offsetY: Integer; safecall;
function Get_screenX: Integer; safecall;
function Get_screenY: Integer; safecall;
function Get_screenWidth: Integer; safecall;
function Get_screenHeight: Integer; safecall;
property srcElement: IDispatch read Get_srcElement;
property altKey: WordBool read Get_altKey;
property ctrlKey: WordBool read Get_ctrlKey;
property shiftKey: WordBool read Get_shiftKey;
property fromElement: IDispatch read Get_fromElement;
property toElement: IDispatch read Get_toElement;
property keyCode: Integer read Get_keyCode write Set_keyCode;
property button: Integer read Get_button;
property x: Integer read Get_x;
property y: Integer read Get_y;
property clientX: Integer read Get_clientX;
property clientY: Integer read Get_clientY;
property offsetX: Integer read Get_offsetX;
property offsetY: Integer read Get_offsetY;
property screenX: Integer read Get_screenX;
property screenY: Integer read Get_screenY;
property screenWidth: Integer read Get_screenWidth;
property screenHeight: Integer read Get_screenHeight;
end;
// *********************************************************************//
// DispIntf: IWMPEventObjectDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5AF0BEC1-46AA-11D3-BD45-00C04F6EA5AE}
// *********************************************************************//
IWMPEventObjectDisp = dispinterface
['{5AF0BEC1-46AA-11D3-BD45-00C04F6EA5AE}']
property srcElement: IDispatch readonly dispid 2200;
property altKey: WordBool readonly dispid 2201;
property ctrlKey: WordBool readonly dispid 2202;
property shiftKey: WordBool readonly dispid 2203;
property fromElement: IDispatch readonly dispid 2204;
property toElement: IDispatch readonly dispid 2205;
property keyCode: Integer dispid 2206;
property button: Integer readonly dispid 2207;
property x: Integer readonly dispid 2208;
property y: Integer readonly dispid 2209;
property clientX: Integer readonly dispid 2210;
property clientY: Integer readonly dispid 2211;
property offsetX: Integer readonly dispid 2212;
property offsetY: Integer readonly dispid 2213;
property screenX: Integer readonly dispid 2214;
property screenY: Integer readonly dispid 2215;
property screenWidth: Integer readonly dispid 2216;
property screenHeight: Integer readonly dispid 2217;
end;
// *********************************************************************//
// Interface: IWMPTheme
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6FCAE13D-E492-4584-9C21-D2C052A2A33A}
// *********************************************************************//
IWMPTheme = interface(IDispatch)
['{6FCAE13D-E492-4584-9C21-D2C052A2A33A}']
function Get_title: WideString; safecall;
function Get_version: Single; safecall;
function Get_authorVersion: WideString; safecall;
function Get_author: WideString; safecall;
function Get_copyright: WideString; safecall;
function Get_currentViewID: WideString; safecall;
procedure Set_currentViewID(const pVal: WideString); safecall;
procedure showErrorDialog; safecall;
procedure logString(const ansistringVal: WideString); safecall;
procedure openView(const viewID: WideString); safecall;
procedure openViewRelative(const viewID: WideString; x: Integer; y: Integer); safecall;
procedure closeView(const viewID: WideString); safecall;
function openDialog(const dialogType: WideString; const parameters: WideString): WideString; safecall;
function loadString(const bstrString: WideString): WideString; safecall;
function loadPreference(const bstrName: WideString): WideString; safecall;
procedure savePreference(const bstrName: WideString; const bstrValue: WideString); safecall;
procedure playSound(const bstrFilename: WideString); safecall;
property title: WideString read Get_title;
property version: Single read Get_version;
property authorVersion: WideString read Get_authorVersion;
property author: WideString read Get_author;
property copyright: WideString read Get_copyright;
property currentViewID: WideString read Get_currentViewID write Set_currentViewID;
end;
// *********************************************************************//
// DispIntf: IWMPThemeDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6FCAE13D-E492-4584-9C21-D2C052A2A33A}
// *********************************************************************//
IWMPThemeDisp = dispinterface
['{6FCAE13D-E492-4584-9C21-D2C052A2A33A}']
property title: WideString readonly dispid 2500;
property version: Single readonly dispid 2501;
property authorVersion: WideString readonly dispid 2502;
property author: WideString readonly dispid 2503;
property copyright: WideString readonly dispid 2504;
property currentViewID: WideString dispid 2505;
procedure showErrorDialog; dispid 2506;
procedure logString(const ansistringVal: WideString); dispid 2507;
procedure openView(const viewID: WideString); dispid 2508;
procedure openViewRelative(const viewID: WideString; x: Integer; y: Integer); dispid 2515;
procedure closeView(const viewID: WideString); dispid 2509;
function openDialog(const dialogType: WideString; const parameters: WideString): WideString; dispid 2510;
function loadString(const bstrString: WideString): WideString; dispid 2511;
function loadPreference(const bstrName: WideString): WideString; dispid 2512;
procedure savePreference(const bstrName: WideString; const bstrValue: WideString); dispid 2513;
procedure playSound(const bstrFilename: WideString); dispid 2514;
end;
// *********************************************************************//
// Interface: IWMPLayoutSettingsDispatch
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {B2C2D18E-97AF-4B6A-A56B-2FFFF470FB81}
// *********************************************************************//
IWMPLayoutSettingsDispatch = interface(IDispatch)
['{B2C2D18E-97AF-4B6A-A56B-2FFFF470FB81}']
function Get_effectType: WideString; safecall;
procedure Set_effectType(const pVal: WideString); safecall;
function Get_effectPreset: Integer; safecall;
procedure Set_effectPreset(pVal: Integer); safecall;
function Get_settingsView: WideString; safecall;
procedure Set_settingsView(const pVal: WideString); safecall;
function Get_videoZoom: Integer; safecall;
procedure Set_videoZoom(pVal: Integer); safecall;
function Get_videoShrinkToFit: WordBool; safecall;
procedure Set_videoShrinkToFit(pVal: WordBool); safecall;
function Get_videoStretchToFit: WordBool; safecall;
procedure Set_videoStretchToFit(pVal: WordBool); safecall;
function Get_userVideoStretchToFit: WordBool; safecall;
procedure Set_userVideoStretchToFit(pVal: WordBool); safecall;
function Get_showCaptions: WordBool; safecall;
procedure Set_showCaptions(pVal: WordBool); safecall;
function Get_showTitles: WordBool; safecall;
procedure Set_showTitles(pVal: WordBool); safecall;
function Get_showEffects: WordBool; safecall;
procedure Set_showEffects(pVal: WordBool); safecall;
function Get_showFullScreenPlaylist: WordBool; safecall;
procedure Set_showFullScreenPlaylist(pVal: WordBool); safecall;
function Get_contrastMode: WideString; safecall;
function getNamedString(const bstrName: WideString): WideString; safecall;
function getDurationStringFromSeconds(lDurationVal: Integer): WideString; safecall;
function Get_displayView: WideString; safecall;
procedure Set_displayView(const pVal: WideString); safecall;
function Get_metadataView: WideString; safecall;
procedure Set_metadataView(const pVal: WideString); safecall;
function Get_showSettings: WordBool; safecall;
procedure Set_showSettings(pVal: WordBool); safecall;
function Get_showResizeBars: WordBool; safecall;
procedure Set_showResizeBars(pVal: WordBool); safecall;
function Get_showPlaylist: WordBool; safecall;
procedure Set_showPlaylist(pVal: WordBool); safecall;
function Get_showMetadata: WordBool; safecall;
procedure Set_showMetadata(pVal: WordBool); safecall;
function Get_settingsWidth: Integer; safecall;
procedure Set_settingsWidth(pVal: Integer); safecall;
function Get_settingsHeight: Integer; safecall;
procedure Set_settingsHeight(pVal: Integer); safecall;
function Get_playlistWidth: Integer; safecall;
procedure Set_playlistWidth(pVal: Integer); safecall;
function Get_playlistHeight: Integer; safecall;
procedure Set_playlistHeight(pVal: Integer); safecall;
function Get_metadataWidth: Integer; safecall;
procedure Set_metadataWidth(pVal: Integer); safecall;
function Get_metadataHeight: Integer; safecall;
procedure Set_metadataHeight(pVal: Integer); safecall;
function Get_fullScreenAvailable: WordBool; safecall;
procedure Set_fullScreenAvailable(pVal: WordBool); safecall;
function Get_fullScreenRequest: WordBool; safecall;
procedure Set_fullScreenRequest(pVal: WordBool); safecall;
function Get_quickHide: WordBool; safecall;
procedure Set_quickHide(pVal: WordBool); safecall;
function Get_displayPreset: Integer; safecall;
procedure Set_displayPreset(pVal: Integer); safecall;
function Get_settingsPreset: Integer; safecall;
procedure Set_settingsPreset(pVal: Integer); safecall;
function Get_metadataPreset: Integer; safecall;
procedure Set_metadataPreset(pVal: Integer); safecall;
function Get_userDisplayView: WideString; safecall;
function Get_userWMPDisplayView: WideString; safecall;
function Get_userDisplayPreset: Integer; safecall;
function Get_userWMPDisplayPreset: Integer; safecall;
function Get_dynamicRangeControl: Integer; safecall;
procedure Set_dynamicRangeControl(pVal: Integer); safecall;
function Get_slowRate: Single; safecall;
procedure Set_slowRate(pVal: Single); safecall;
function Get_fastRate: Single; safecall;
procedure Set_fastRate(pVal: Single); safecall;
function Get_buttonHueShift: Single; safecall;
procedure Set_buttonHueShift(pVal: Single); safecall;
function Get_buttonSaturation: Single; safecall;
procedure Set_buttonSaturation(pVal: Single); safecall;
function Get_backHueShift: Single; safecall;
procedure Set_backHueShift(pVal: Single); safecall;
function Get_backSaturation: Single; safecall;
procedure Set_backSaturation(pVal: Single); safecall;
function Get_vizRequest: Integer; safecall;
procedure Set_vizRequest(pVal: Integer); safecall;
function Get_appColorLight: WideString; safecall;
function Get_appColorMedium: WideString; safecall;
function Get_appColorDark: WideString; safecall;
function Get_toolbarButtonHighlight: WideString; safecall;
function Get_toolbarButtonShadow: WideString; safecall;
function Get_toolbarButtonFace: WideString; safecall;
function Get_itemPlayingColor: WideString; safecall;
function Get_itemPlayingBackgroundColor: WideString; safecall;
function Get_itemErrorColor: WideString; safecall;
function Get_appColorLimited: WordBool; safecall;
function Get_appColorBlackBackground: WordBool; safecall;
procedure Set_appColorBlackBackground(pVal: WordBool); safecall;
function Get_appColorVideoBorder: WideString; safecall;
procedure Set_appColorVideoBorder(const pVal: WideString); safecall;
function Get_appColorAux1: WideString; safecall;
function Get_appColorAux2: WideString; safecall;
function Get_appColorAux3: WideString; safecall;
function Get_appColorAux4: WideString; safecall;
function Get_appColorAux5: WideString; safecall;
function Get_appColorAux6: WideString; safecall;
function Get_appColorAux7: WideString; safecall;
function Get_appColorAux8: WideString; safecall;
function Get_appColorAux9: WideString; safecall;
function Get_appColorAux10: WideString; safecall;
function Get_appColorAux11: WideString; safecall;
function Get_appColorAux12: WideString; safecall;
function Get_appColorAux13: WideString; safecall;
function Get_appColorAux14: WideString; safecall;
function Get_appColorAux15: WideString; safecall;
function Get_status: WideString; safecall;
procedure Set_status(const pVal: WideString); safecall;
function Get_userWMPSettingsView: WideString; safecall;
function Get_userWMPSettingsPreset: Integer; safecall;
function Get_userWMPShowSettings: WordBool; safecall;
function Get_userWMPMetadataView: WideString; safecall;
function Get_userWMPMetadataPreset: Integer; safecall;
function Get_userWMPShowMetadata: WordBool; safecall;
function Get_captionsHeight: Integer; safecall;
procedure Set_captionsHeight(pVal: Integer); safecall;
function Get_snapToVideo: WordBool; safecall;
procedure Set_snapToVideo(pVal: WordBool); safecall;
function Get_pinFullScreenControls: WordBool; safecall;
procedure Set_pinFullScreenControls(pVal: WordBool); safecall;
procedure SetLockFullScreen(locked: WordBool; const Val: WideString); safecall;
function Get_fullScreenLocked: WordBool; safecall;
function Get_isMultiMon: WordBool; safecall;
function Get_exclusiveHueShift: Single; safecall;
procedure Set_exclusiveHueShift(pVal: Single); safecall;
function Get_exclusiveSaturation: Single; safecall;
procedure Set_exclusiveSaturation(pVal: Single); safecall;
function Get_themeBkgColorIsActive: WordBool; safecall;
procedure Set_themeBkgColorIsActive(pVal: WordBool); safecall;
function Get_themeBkgColorActive: WideString; safecall;
function Get_themeBkgColorInactive: WideString; safecall;
property effectType: WideString read Get_effectType write Set_effectType;
property effectPreset: Integer read Get_effectPreset write Set_effectPreset;
property settingsView: WideString read Get_settingsView write Set_settingsView;
property videoZoom: Integer read Get_videoZoom write Set_videoZoom;
property videoShrinkToFit: WordBool read Get_videoShrinkToFit write Set_videoShrinkToFit;
property videoStretchToFit: WordBool read Get_videoStretchToFit write Set_videoStretchToFit;
property userVideoStretchToFit: WordBool read Get_userVideoStretchToFit write Set_userVideoStretchToFit;
property showCaptions: WordBool read Get_showCaptions write Set_showCaptions;
property showTitles: WordBool read Get_showTitles write Set_showTitles;
property showEffects: WordBool read Get_showEffects write Set_showEffects;
property showFullScreenPlaylist: WordBool read Get_showFullScreenPlaylist write Set_showFullScreenPlaylist;
property contrastMode: WideString read Get_contrastMode;
property displayView: WideString read Get_displayView write Set_displayView;
property metadataView: WideString read Get_metadataView write Set_metadataView;
property showSettings: WordBool read Get_showSettings write Set_showSettings;
property showResizeBars: WordBool read Get_showResizeBars write Set_showResizeBars;
property showPlaylist: WordBool read Get_showPlaylist write Set_showPlaylist;
property showMetadata: WordBool read Get_showMetadata write Set_showMetadata;
property settingsWidth: Integer read Get_settingsWidth write Set_settingsWidth;
property settingsHeight: Integer read Get_settingsHeight write Set_settingsHeight;
property playlistWidth: Integer read Get_playlistWidth write Set_playlistWidth;
property playlistHeight: Integer read Get_playlistHeight write Set_playlistHeight;
property metadataWidth: Integer read Get_metadataWidth write Set_metadataWidth;
property metadataHeight: Integer read Get_metadataHeight write Set_metadataHeight;
property fullScreenAvailable: WordBool read Get_fullScreenAvailable write Set_fullScreenAvailable;
property fullScreenRequest: WordBool read Get_fullScreenRequest write Set_fullScreenRequest;
property quickHide: WordBool read Get_quickHide write Set_quickHide;
property displayPreset: Integer read Get_displayPreset write Set_displayPreset;
property settingsPreset: Integer read Get_settingsPreset write Set_settingsPreset;
property metadataPreset: Integer read Get_metadataPreset write Set_metadataPreset;
property userDisplayView: WideString read Get_userDisplayView;
property userWMPDisplayView: WideString read Get_userWMPDisplayView;
property userDisplayPreset: Integer read Get_userDisplayPreset;
property userWMPDisplayPreset: Integer read Get_userWMPDisplayPreset;
property dynamicRangeControl: Integer read Get_dynamicRangeControl write Set_dynamicRangeControl;
property slowRate: Single read Get_slowRate write Set_slowRate;
property fastRate: Single read Get_fastRate write Set_fastRate;
property buttonHueShift: Single read Get_buttonHueShift write Set_buttonHueShift;
property buttonSaturation: Single read Get_buttonSaturation write Set_buttonSaturation;
property backHueShift: Single read Get_backHueShift write Set_backHueShift;
property backSaturation: Single read Get_backSaturation write Set_backSaturation;
property vizRequest: Integer read Get_vizRequest write Set_vizRequest;
property appColorLight: WideString read Get_appColorLight;
property appColorMedium: WideString read Get_appColorMedium;
property appColorDark: WideString read Get_appColorDark;
property toolbarButtonHighlight: WideString read Get_toolbarButtonHighlight;
property toolbarButtonShadow: WideString read Get_toolbarButtonShadow;
property toolbarButtonFace: WideString read Get_toolbarButtonFace;
property itemPlayingColor: WideString read Get_itemPlayingColor;
property itemPlayingBackgroundColor: WideString read Get_itemPlayingBackgroundColor;
property itemErrorColor: WideString read Get_itemErrorColor;
property appColorLimited: WordBool read Get_appColorLimited;
property appColorBlackBackground: WordBool read Get_appColorBlackBackground write Set_appColorBlackBackground;
property appColorVideoBorder: WideString read Get_appColorVideoBorder write Set_appColorVideoBorder;
property appColorAux1: WideString read Get_appColorAux1;
property appColorAux2: WideString read Get_appColorAux2;
property appColorAux3: WideString read Get_appColorAux3;
property appColorAux4: WideString read Get_appColorAux4;
property appColorAux5: WideString read Get_appColorAux5;
property appColorAux6: WideString read Get_appColorAux6;
property appColorAux7: WideString read Get_appColorAux7;
property appColorAux8: WideString read Get_appColorAux8;
property appColorAux9: WideString read Get_appColorAux9;
property appColorAux10: WideString read Get_appColorAux10;
property appColorAux11: WideString read Get_appColorAux11;
property appColorAux12: WideString read Get_appColorAux12;
property appColorAux13: WideString read Get_appColorAux13;
property appColorAux14: WideString read Get_appColorAux14;
property appColorAux15: WideString read Get_appColorAux15;
property status: WideString read Get_status write Set_status;
property userWMPSettingsView: WideString read Get_userWMPSettingsView;
property userWMPSettingsPreset: Integer read Get_userWMPSettingsPreset;
property userWMPShowSettings: WordBool read Get_userWMPShowSettings;
property userWMPMetadataView: WideString read Get_userWMPMetadataView;
property userWMPMetadataPreset: Integer read Get_userWMPMetadataPreset;
property userWMPShowMetadata: WordBool read Get_userWMPShowMetadata;
property captionsHeight: Integer read Get_captionsHeight write Set_captionsHeight;
property snapToVideo: WordBool read Get_snapToVideo write Set_snapToVideo;
property pinFullScreenControls: WordBool read Get_pinFullScreenControls write Set_pinFullScreenControls;
property fullScreenLocked: WordBool read Get_fullScreenLocked;
property isMultiMon: WordBool read Get_isMultiMon;
property exclusiveHueShift: Single read Get_exclusiveHueShift write Set_exclusiveHueShift;
property exclusiveSaturation: Single read Get_exclusiveSaturation write Set_exclusiveSaturation;
property themeBkgColorIsActive: WordBool read Get_themeBkgColorIsActive write Set_themeBkgColorIsActive;
property themeBkgColorActive: WideString read Get_themeBkgColorActive;
property themeBkgColorInactive: WideString read Get_themeBkgColorInactive;
end;
// *********************************************************************//
// DispIntf: IWMPLayoutSettingsDispatchDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {B2C2D18E-97AF-4B6A-A56B-2FFFF470FB81}
// *********************************************************************//
IWMPLayoutSettingsDispatchDisp = dispinterface
['{B2C2D18E-97AF-4B6A-A56B-2FFFF470FB81}']
property effectType: WideString dispid 2800;
property effectPreset: Integer dispid 2801;
property settingsView: WideString dispid 2802;
property videoZoom: Integer dispid 2803;
property videoShrinkToFit: WordBool dispid 2804;
property videoStretchToFit: WordBool dispid 2805;
property userVideoStretchToFit: WordBool dispid 2868;
property showCaptions: WordBool dispid 2807;
property showTitles: WordBool dispid 2808;
property showEffects: WordBool dispid 2809;
property showFullScreenPlaylist: WordBool dispid 2811;
property contrastMode: WideString readonly dispid 2813;
function getNamedString(const bstrName: WideString): WideString; dispid 2810;
function getDurationStringFromSeconds(lDurationVal: Integer): WideString; dispid 2815;
property displayView: WideString dispid 2816;
property metadataView: WideString dispid 2817;
property showSettings: WordBool dispid 2818;
property showResizeBars: WordBool dispid 2819;
property showPlaylist: WordBool dispid 2820;
property showMetadata: WordBool dispid 2821;
property settingsWidth: Integer dispid 2822;
property settingsHeight: Integer dispid 2823;
property playlistWidth: Integer dispid 2824;
property playlistHeight: Integer dispid 2825;
property metadataWidth: Integer dispid 2826;
property metadataHeight: Integer dispid 2827;
property fullScreenAvailable: WordBool dispid 2828;
property fullScreenRequest: WordBool dispid 2829;
property quickHide: WordBool dispid 2830;
property displayPreset: Integer dispid 2831;
property settingsPreset: Integer dispid 2832;
property metadataPreset: Integer dispid 2833;
property userDisplayView: WideString readonly dispid 2834;
property userWMPDisplayView: WideString readonly dispid 2835;
property userDisplayPreset: Integer readonly dispid 2836;
property userWMPDisplayPreset: Integer readonly dispid 2837;
property dynamicRangeControl: Integer dispid 2838;
property slowRate: Single dispid 2839;
property fastRate: Single dispid 2840;
property buttonHueShift: Single dispid 2841;
property buttonSaturation: Single dispid 2842;
property backHueShift: Single dispid 2843;
property backSaturation: Single dispid 2844;
property vizRequest: Integer dispid 2845;
property appColorLight: WideString readonly dispid 2847;
property appColorMedium: WideString readonly dispid 2848;
property appColorDark: WideString readonly dispid 2849;
property toolbarButtonHighlight: WideString readonly dispid 2856;
property toolbarButtonShadow: WideString readonly dispid 2857;
property toolbarButtonFace: WideString readonly dispid 2858;
property itemPlayingColor: WideString readonly dispid 2850;
property itemPlayingBackgroundColor: WideString readonly dispid 2851;
property itemErrorColor: WideString readonly dispid 2852;
property appColorLimited: WordBool readonly dispid 2853;
property appColorBlackBackground: WordBool dispid 2854;
property appColorVideoBorder: WideString dispid 2855;
property appColorAux1: WideString readonly dispid 2869;
property appColorAux2: WideString readonly dispid 2870;
property appColorAux3: WideString readonly dispid 2871;
property appColorAux4: WideString readonly dispid 2872;
property appColorAux5: WideString readonly dispid 2873;
property appColorAux6: WideString readonly dispid 2874;
property appColorAux7: WideString readonly dispid 2875;
property appColorAux8: WideString readonly dispid 2876;
property appColorAux9: WideString readonly dispid 2877;
property appColorAux10: WideString readonly dispid 2878;
property appColorAux11: WideString readonly dispid 2879;
property appColorAux12: WideString readonly dispid 2880;
property appColorAux13: WideString readonly dispid 2881;
property appColorAux14: WideString readonly dispid 2882;
property appColorAux15: WideString readonly dispid 2883;
property status: WideString dispid 2884;
property userWMPSettingsView: WideString readonly dispid 2859;
property userWMPSettingsPreset: Integer readonly dispid 2860;
property userWMPShowSettings: WordBool readonly dispid 2861;
property userWMPMetadataView: WideString readonly dispid 2862;
property userWMPMetadataPreset: Integer readonly dispid 2863;
property userWMPShowMetadata: WordBool readonly dispid 2864;
property captionsHeight: Integer dispid 2865;
property snapToVideo: WordBool dispid 2866;
property pinFullScreenControls: WordBool dispid 2867;
procedure SetLockFullScreen(locked: WordBool; const Val: WideString); dispid 2885;
property fullScreenLocked: WordBool readonly dispid 2886;
property isMultiMon: WordBool readonly dispid 2887;
property exclusiveHueShift: Single dispid 2888;
property exclusiveSaturation: Single dispid 2889;
property themeBkgColorIsActive: WordBool dispid 2892;
property themeBkgColorActive: WideString readonly dispid 2890;
property themeBkgColorInactive: WideString readonly dispid 2891;
end;
// *********************************************************************//
// Interface: IWMPBrandDispatch
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {98BB02D4-ED74-43CC-AD6A-45888F2E0DCC}
// *********************************************************************//
IWMPBrandDispatch = interface(IDispatch)
['{98BB02D4-ED74-43CC-AD6A-45888F2E0DCC}']
function Get_fullServiceName: WideString; safecall;
function Get_friendlyName: WideString; safecall;
function Get_guideButtonText: WideString; safecall;
function Get_guideButtonTip: WideString; safecall;
function Get_guideMenuText: WideString; safecall;
function Get_guideAccText: WideString; safecall;
function Get_task1ButtonText: WideString; safecall;
function Get_task1ButtonTip: WideString; safecall;
function Get_task1MenuText: WideString; safecall;
function Get_task1AccText: WideString; safecall;
function Get_guideUrl: WideString; safecall;
function Get_task1Url: WideString; safecall;
function Get_imageLargeUrl: WideString; safecall;
function Get_imageSmallUrl: WideString; safecall;
function Get_imageMenuUrl: WideString; safecall;
function Get_infoCenterUrl: WideString; safecall;
function Get_albumInfoUrl: WideString; safecall;
function Get_buyCDUrl: WideString; safecall;
function Get_htmlViewUrl: WideString; safecall;
function Get_navigateUrl: WideString; safecall;
function Get_cookieUrl: WideString; safecall;
function Get_downloadStatusUrl: WideString; safecall;
function Get_colorPlayer: WideString; safecall;
function Get_colorPlayerText: WideString; safecall;
function Get_navigateDispid: Integer; safecall;
function Get_navigateParams: WideString; safecall;
function Get_navigatePane: WideString; safecall;
function Get_selectedPane: WideString; safecall;
procedure Set_selectedPane(const pVal: WideString); safecall;
procedure setNavigateProps(const bstrPane: WideString; lDispid: Integer;
const bstrParams: WideString); safecall;
function getMediaParams(const pObject: IUnknown; const bstrURL: WideString): WideString; safecall;
procedure Set_selectedTask(Param1: Integer); safecall;
function Get_contentPartnerSelected: WordBool; safecall;
property fullServiceName: WideString read Get_fullServiceName;
property friendlyName: WideString read Get_friendlyName;
property guideButtonText: WideString read Get_guideButtonText;
property guideButtonTip: WideString read Get_guideButtonTip;
property guideMenuText: WideString read Get_guideMenuText;
property guideAccText: WideString read Get_guideAccText;
property task1ButtonText: WideString read Get_task1ButtonText;
property task1ButtonTip: WideString read Get_task1ButtonTip;
property task1MenuText: WideString read Get_task1MenuText;
property task1AccText: WideString read Get_task1AccText;
property guideUrl: WideString read Get_guideUrl;
property task1Url: WideString read Get_task1Url;
property imageLargeUrl: WideString read Get_imageLargeUrl;
property imageSmallUrl: WideString read Get_imageSmallUrl;
property imageMenuUrl: WideString read Get_imageMenuUrl;
property infoCenterUrl: WideString read Get_infoCenterUrl;
property albumInfoUrl: WideString read Get_albumInfoUrl;
property buyCDUrl: WideString read Get_buyCDUrl;
property htmlViewUrl: WideString read Get_htmlViewUrl;
property navigateUrl: WideString read Get_navigateUrl;
property cookieUrl: WideString read Get_cookieUrl;
property downloadStatusUrl: WideString read Get_downloadStatusUrl;
property colorPlayer: WideString read Get_colorPlayer;
property colorPlayerText: WideString read Get_colorPlayerText;
property navigateDispid: Integer read Get_navigateDispid;
property navigateParams: WideString read Get_navigateParams;
property navigatePane: WideString read Get_navigatePane;
property selectedPane: WideString read Get_selectedPane write Set_selectedPane;
property selectedTask: Integer write Set_selectedTask;
property contentPartnerSelected: WordBool read Get_contentPartnerSelected;
end;
// *********************************************************************//
// DispIntf: IWMPBrandDispatchDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {98BB02D4-ED74-43CC-AD6A-45888F2E0DCC}
// *********************************************************************//
IWMPBrandDispatchDisp = dispinterface
['{98BB02D4-ED74-43CC-AD6A-45888F2E0DCC}']
property fullServiceName: WideString readonly dispid 3040;
property friendlyName: WideString readonly dispid 3000;
property guideButtonText: WideString readonly dispid 3001;
property guideButtonTip: WideString readonly dispid 3002;
property guideMenuText: WideString readonly dispid 3003;
property guideAccText: WideString readonly dispid 3004;
property task1ButtonText: WideString readonly dispid 3005;
property task1ButtonTip: WideString readonly dispid 3006;
property task1MenuText: WideString readonly dispid 3007;
property task1AccText: WideString readonly dispid 3008;
property guideUrl: WideString readonly dispid 3017;
property task1Url: WideString readonly dispid 3018;
property imageLargeUrl: WideString readonly dispid 3021;
property imageSmallUrl: WideString readonly dispid 3022;
property imageMenuUrl: WideString readonly dispid 3023;
property infoCenterUrl: WideString readonly dispid 3024;
property albumInfoUrl: WideString readonly dispid 3025;
property buyCDUrl: WideString readonly dispid 3026;
property htmlViewUrl: WideString readonly dispid 3027;
property navigateUrl: WideString readonly dispid 3028;
property cookieUrl: WideString readonly dispid 3029;
property downloadStatusUrl: WideString readonly dispid 3030;
property colorPlayer: WideString readonly dispid 3031;
property colorPlayerText: WideString readonly dispid 3032;
property navigateDispid: Integer readonly dispid 3035;
property navigateParams: WideString readonly dispid 3036;
property navigatePane: WideString readonly dispid 3037;
property selectedPane: WideString dispid 3038;
procedure setNavigateProps(const bstrPane: WideString; lDispid: Integer;
const bstrParams: WideString); dispid 3041;
function getMediaParams(const pObject: IUnknown; const bstrURL: WideString): WideString; dispid 3042;
property selectedTask: Integer writeonly dispid 3039;
property contentPartnerSelected: WordBool readonly dispid 3043;
end;
// *********************************************************************//
// Interface: IWMPNowPlayingHelperDispatch
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {504F112E-77CC-4E3C-A073-5371B31D9B36}
// *********************************************************************//
IWMPNowPlayingHelperDispatch = interface(IDispatch)
['{504F112E-77CC-4E3C-A073-5371B31D9B36}']
function Get_viewFriendlyName(const bstrView: WideString): WideString; safecall;
function Get_viewPresetCount(const bstrView: WideString): Integer; safecall;
function Get_viewPresetName(const bstrView: WideString; nPresetIndex: Integer): WideString; safecall;
function Get_effectFriendlyName(const bstrEffect: WideString): WideString; safecall;
function Get_effectPresetName(const bstrEffect: WideString; nPresetIndex: Integer): WideString; safecall;
function resolveDisplayView(fSafe: WordBool): WideString; safecall;
function isValidDisplayView(const bstrView: WideString): WordBool; safecall;
function getSkinFile: WideString; safecall;
function Get_captionsAvailable: WordBool; safecall;
function Get_linkAvailable: Integer; safecall;
function Get_linkRequest: Integer; safecall;
procedure Set_linkRequest(pVal: Integer); safecall;
function Get_linkRequestParams: WideString; safecall;
procedure Set_linkRequestParams(const pVal: WideString); safecall;
function getCurrentArtID(fLargeArt: WordBool): Integer; safecall;
function getTimeString(dTime: Double): WideString; safecall;
function getCurrentScriptCommand(const bstrType: WideString): WideString; safecall;
procedure calcLayout(lWidth: Integer; lHeight: Integer; vbCaptions: WordBool; vbBanner: WordBool); safecall;
function getLayoutSize(nProp: Integer): Integer; safecall;
function getRootPlaylist(const pPlaylist: IDispatch): IDispatch; safecall;
function getHTMLViewURL: WideString; safecall;
function Get_canSendLink: WordBool; safecall;
procedure sendLink(dblStartTime: Double; dblEndTime: Double); safecall;
function Get_editObj: IUnknown; safecall;
procedure Set_editObj(const ppVal: IUnknown); safecall;
function getStatusString(const bstrStatusId: WideString): WideString; safecall;
function getStatusPct(const bstrStatusId: WideString): Integer; safecall;
function getStatusResult(const bstrStatusId: WideString): Integer; safecall;
function getStatusIcon(const bstrStatusId: WideString): Integer; safecall;
function getStatusIdList: WideString; safecall;
function Get_notificationString: WideString; safecall;
function Get_htmlViewBaseURL: WideString; safecall;
procedure Set_htmlViewBaseURL(const pVal: WideString); safecall;
function Get_htmlViewFullURL: WideString; safecall;
procedure Set_htmlViewFullURL(const pVal: WideString); safecall;
function Get_htmlViewSecureLock: Integer; safecall;
procedure Set_htmlViewSecureLock(pVal: Integer); safecall;
function Get_htmlViewBusy: WordBool; safecall;
procedure Set_htmlViewBusy(pVal: WordBool); safecall;
function Get_htmlViewShowCert: WordBool; safecall;
procedure Set_htmlViewShowCert(pVal: WordBool); safecall;
function Get_previousEnabled: WordBool; safecall;
procedure Set_previousEnabled(pVal: WordBool); safecall;
function Get_doPreviousNow: WordBool; safecall;
procedure Set_doPreviousNow(pVal: WordBool); safecall;
function Get_DPI: Integer; safecall;
procedure clearColors; safecall;
function Get_lastMessage: WideString; safecall;
procedure Set_lastMessage(const pVal: WideString); safecall;
function Get_inVistaPlus: WordBool; safecall;
function Get_isBidi: WordBool; safecall;
property viewFriendlyName[const bstrView: WideString]: WideString read Get_viewFriendlyName;
property viewPresetCount[const bstrView: WideString]: Integer read Get_viewPresetCount;
property viewPresetName[const bstrView: WideString; nPresetIndex: Integer]: WideString read Get_viewPresetName;
property effectFriendlyName[const bstrEffect: WideString]: WideString read Get_effectFriendlyName;
property effectPresetName[const bstrEffect: WideString; nPresetIndex: Integer]: WideString read Get_effectPresetName;
property captionsAvailable: WordBool read Get_captionsAvailable;
property linkAvailable: Integer read Get_linkAvailable;
property linkRequest: Integer read Get_linkRequest write Set_linkRequest;
property linkRequestParams: WideString read Get_linkRequestParams write Set_linkRequestParams;
property canSendLink: WordBool read Get_canSendLink;
property editObj: IUnknown read Get_editObj write Set_editObj;
property notificationString: WideString read Get_notificationString;
property htmlViewBaseURL: WideString read Get_htmlViewBaseURL write Set_htmlViewBaseURL;
property htmlViewFullURL: WideString read Get_htmlViewFullURL write Set_htmlViewFullURL;
property htmlViewSecureLock: Integer read Get_htmlViewSecureLock write Set_htmlViewSecureLock;
property htmlViewBusy: WordBool read Get_htmlViewBusy write Set_htmlViewBusy;
property htmlViewShowCert: WordBool read Get_htmlViewShowCert write Set_htmlViewShowCert;
property previousEnabled: WordBool read Get_previousEnabled write Set_previousEnabled;
property doPreviousNow: WordBool read Get_doPreviousNow write Set_doPreviousNow;
property DPI: Integer read Get_DPI;
property lastMessage: WideString read Get_lastMessage write Set_lastMessage;
property inVistaPlus: WordBool read Get_inVistaPlus;
property isBidi: WordBool read Get_isBidi;
end;
// *********************************************************************//
// DispIntf: IWMPNowPlayingHelperDispatchDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {504F112E-77CC-4E3C-A073-5371B31D9B36}
// *********************************************************************//
IWMPNowPlayingHelperDispatchDisp = dispinterface
['{504F112E-77CC-4E3C-A073-5371B31D9B36}']
property viewFriendlyName[const bstrView: WideString]: WideString readonly dispid 2901;
property viewPresetCount[const bstrView: WideString]: Integer readonly dispid 2902;
property viewPresetName[const bstrView: WideString; nPresetIndex: Integer]: WideString readonly dispid 2903;
property effectFriendlyName[const bstrEffect: WideString]: WideString readonly dispid 2904;
property effectPresetName[const bstrEffect: WideString; nPresetIndex: Integer]: WideString readonly dispid 2905;
function resolveDisplayView(fSafe: WordBool): WideString; dispid 2909;
function isValidDisplayView(const bstrView: WideString): WordBool; dispid 2910;
function getSkinFile: WideString; dispid 2911;
property captionsAvailable: WordBool readonly dispid 2912;
property linkAvailable: Integer readonly dispid 2913;
property linkRequest: Integer dispid 2914;
property linkRequestParams: WideString dispid 2915;
function getCurrentArtID(fLargeArt: WordBool): Integer; dispid 2917;
function getTimeString(dTime: Double): WideString; dispid 2918;
function getCurrentScriptCommand(const bstrType: WideString): WideString; dispid 2919;
procedure calcLayout(lWidth: Integer; lHeight: Integer; vbCaptions: WordBool; vbBanner: WordBool); dispid 2920;
function getLayoutSize(nProp: Integer): Integer; dispid 2921;
function getRootPlaylist(const pPlaylist: IDispatch): IDispatch; dispid 2922;
function getHTMLViewURL: WideString; dispid 2923;
property canSendLink: WordBool readonly dispid 2924;
procedure sendLink(dblStartTime: Double; dblEndTime: Double); dispid 2925;
property editObj: IUnknown dispid 2926;
function getStatusString(const bstrStatusId: WideString): WideString; dispid 2927;
function getStatusPct(const bstrStatusId: WideString): Integer; dispid 2939;
function getStatusResult(const bstrStatusId: WideString): Integer; dispid 2940;
function getStatusIcon(const bstrStatusId: WideString): Integer; dispid 2941;
function getStatusIdList: WideString; dispid 2942;
property notificationString: WideString readonly dispid 2928;
property htmlViewBaseURL: WideString dispid 2930;
property htmlViewFullURL: WideString dispid 2933;
property htmlViewSecureLock: Integer dispid 2929;
property htmlViewBusy: WordBool dispid 2931;
property htmlViewShowCert: WordBool dispid 2932;
property previousEnabled: WordBool dispid 2934;
property doPreviousNow: WordBool dispid 2935;
property DPI: Integer readonly dispid 2936;
procedure clearColors; dispid 2937;
property lastMessage: WideString dispid 2938;
property inVistaPlus: WordBool readonly dispid 2943;
property isBidi: WordBool readonly dispid 2944;
end;
// *********************************************************************//
// Interface: IWMPNowDoingDispatch
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2A2E0DA3-19FA-4F82-BE18-CD7D7A3B977F}
// *********************************************************************//
IWMPNowDoingDispatch = interface(IDispatch)
['{2A2E0DA3-19FA-4F82-BE18-CD7D7A3B977F}']
procedure buyContent; safecall;
procedure hideBasket; safecall;
function Get_DPI: Integer; safecall;
function Get_mode: WideString; safecall;
procedure Set_burn_selectedDrive(pVal: Integer); safecall;
function Get_burn_selectedDrive: Integer; safecall;
function Get_sync_selectedDevice: Integer; safecall;
procedure Set_sync_selectedDevice(pVal: Integer); safecall;
function Get_burn_numDiscsSpanned: Integer; safecall;
function Get_editPlaylist: IDispatch; safecall;
function Get_burn_mediaType: WideString; safecall;
function Get_burn_contentType: WideString; safecall;
function Get_burn_freeSpace: Integer; safecall;
function Get_burn_totalSpace: Integer; safecall;
function Get_burn_driveName: WideString; safecall;
function Get_burn_numDevices: Integer; safecall;
function Get_burn_spaceToUse: Integer; safecall;
function Get_sync_spaceToUse: Integer; safecall;
function Get_sync_spaceUsed: Integer; safecall;
function Get_sync_totalSpace: Integer; safecall;
function Get_sync_deviceName: WideString; safecall;
function Get_sync_numDevices: Integer; safecall;
function Get_sync_oemName: WideString; safecall;
procedure logData(const ID: WideString; const data: WideString); safecall;
function formatTime(value: Integer): WideString; safecall;
property DPI: Integer read Get_DPI;
property mode: WideString read Get_mode;
property burn_selectedDrive: Integer read Get_burn_selectedDrive write Set_burn_selectedDrive;
property sync_selectedDevice: Integer read Get_sync_selectedDevice write Set_sync_selectedDevice;
property burn_numDiscsSpanned: Integer read Get_burn_numDiscsSpanned;
property editPlaylist: IDispatch read Get_editPlaylist;
property burn_mediaType: WideString read Get_burn_mediaType;
property burn_contentType: WideString read Get_burn_contentType;
property burn_freeSpace: Integer read Get_burn_freeSpace;
property burn_totalSpace: Integer read Get_burn_totalSpace;
property burn_driveName: WideString read Get_burn_driveName;
property burn_numDevices: Integer read Get_burn_numDevices;
property burn_spaceToUse: Integer read Get_burn_spaceToUse;
property sync_spaceToUse: Integer read Get_sync_spaceToUse;
property sync_spaceUsed: Integer read Get_sync_spaceUsed;
property sync_totalSpace: Integer read Get_sync_totalSpace;
property sync_deviceName: WideString read Get_sync_deviceName;
property sync_numDevices: Integer read Get_sync_numDevices;
property sync_oemName: WideString read Get_sync_oemName;
end;
// *********************************************************************//
// DispIntf: IWMPNowDoingDispatchDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2A2E0DA3-19FA-4F82-BE18-CD7D7A3B977F}
// *********************************************************************//
IWMPNowDoingDispatchDisp = dispinterface
['{2A2E0DA3-19FA-4F82-BE18-CD7D7A3B977F}']
procedure buyContent; dispid 3217;
procedure hideBasket; dispid 3218;
property DPI: Integer readonly dispid 3219;
property mode: WideString readonly dispid 3200;
property burn_selectedDrive: Integer dispid 3206;
property sync_selectedDevice: Integer dispid 3214;
property burn_numDiscsSpanned: Integer readonly dispid 3208;
property editPlaylist: IDispatch readonly dispid 3221;
property burn_mediaType: WideString readonly dispid 3201;
property burn_contentType: WideString readonly dispid 3202;
property burn_freeSpace: Integer readonly dispid 3203;
property burn_totalSpace: Integer readonly dispid 3204;
property burn_driveName: WideString readonly dispid 3205;
property burn_numDevices: Integer readonly dispid 3207;
property burn_spaceToUse: Integer readonly dispid 3209;
property sync_spaceToUse: Integer readonly dispid 3210;
property sync_spaceUsed: Integer readonly dispid 3211;
property sync_totalSpace: Integer readonly dispid 3212;
property sync_deviceName: WideString readonly dispid 3213;
property sync_numDevices: Integer readonly dispid 3215;
property sync_oemName: WideString readonly dispid 3216;
procedure logData(const ID: WideString; const data: WideString); dispid 3220;
function formatTime(value: Integer): WideString; dispid 3222;
end;
// *********************************************************************//
// DispIntf: IWMPButtonCtrlEvents
// Flags: (4096) Dispatchable
// GUID: {BB17FFF7-1692-4555-918A-6AF7BFACEDD2}
// *********************************************************************//
IWMPButtonCtrlEvents = dispinterface
['{BB17FFF7-1692-4555-918A-6AF7BFACEDD2}']
procedure onclick; dispid 5120;
end;
// *********************************************************************//
// Interface: IWMPButtonCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {87291B50-0C8E-11D3-BB2A-00A0C93CA73A}
// *********************************************************************//
IWMPButtonCtrl = interface(IDispatch)
['{87291B50-0C8E-11D3-BB2A-00A0C93CA73A}']
function Get_image: WideString; safecall;
procedure Set_image(const pVal: WideString); safecall;
function Get_hoverImage: WideString; safecall;
procedure Set_hoverImage(const pVal: WideString); safecall;
function Get_downImage: WideString; safecall;
procedure Set_downImage(const pVal: WideString); safecall;
function Get_disabledImage: WideString; safecall;
procedure Set_disabledImage(const pVal: WideString); safecall;
function Get_hoverDownImage: WideString; safecall;
procedure Set_hoverDownImage(const pVal: WideString); safecall;
function Get_tiled: WordBool; safecall;
procedure Set_tiled(pVal: WordBool); safecall;
function Get_transparencyColor: WideString; safecall;
procedure Set_transparencyColor(const pVal: WideString); safecall;
function Get_down: WordBool; safecall;
procedure Set_down(pVal: WordBool); safecall;
function Get_sticky: WordBool; safecall;
procedure Set_sticky(pVal: WordBool); safecall;
function Get_upToolTip: WideString; safecall;
procedure Set_upToolTip(const pVal: WideString); safecall;
function Get_downToolTip: WideString; safecall;
procedure Set_downToolTip(const pVal: WideString); safecall;
function Get_cursor: WideString; safecall;
procedure Set_cursor(const pVal: WideString); safecall;
property image: WideString read Get_image write Set_image;
property hoverImage: WideString read Get_hoverImage write Set_hoverImage;
property downImage: WideString read Get_downImage write Set_downImage;
property disabledImage: WideString read Get_disabledImage write Set_disabledImage;
property hoverDownImage: WideString read Get_hoverDownImage write Set_hoverDownImage;
property tiled: WordBool read Get_tiled write Set_tiled;
property transparencyColor: WideString read Get_transparencyColor write Set_transparencyColor;
property down: WordBool read Get_down write Set_down;
property sticky: WordBool read Get_sticky write Set_sticky;
property upToolTip: WideString read Get_upToolTip write Set_upToolTip;
property downToolTip: WideString read Get_downToolTip write Set_downToolTip;
property cursor: WideString read Get_cursor write Set_cursor;
end;
// *********************************************************************//
// DispIntf: IWMPButtonCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {87291B50-0C8E-11D3-BB2A-00A0C93CA73A}
// *********************************************************************//
IWMPButtonCtrlDisp = dispinterface
['{87291B50-0C8E-11D3-BB2A-00A0C93CA73A}']
property image: WideString dispid 5102;
property hoverImage: WideString dispid 5103;
property downImage: WideString dispid 5104;
property disabledImage: WideString dispid 5105;
property hoverDownImage: WideString dispid 5106;
property tiled: WordBool dispid 5107;
property transparencyColor: WideString dispid 5108;
property down: WordBool dispid 5109;
property sticky: WordBool dispid 5110;
property upToolTip: WideString dispid 5112;
property downToolTip: WideString dispid 5113;
property cursor: WideString dispid 5114;
end;
// *********************************************************************//
// Interface: IWMPListBoxCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {FC1880CE-83B9-43A7-A066-C44CE8C82583}
// *********************************************************************//
IWMPListBoxCtrl = interface(IDispatch)
['{FC1880CE-83B9-43A7-A066-C44CE8C82583}']
function Get_selectedItem: Integer; safecall;
procedure Set_selectedItem(pnPos: Integer); safecall;
function Get_sorted: WordBool; safecall;
procedure Set_sorted(pVal: WordBool); safecall;
function Get_multiselect: WordBool; safecall;
procedure Set_multiselect(pVal: WordBool); safecall;
function Get_readOnly: WordBool; safecall;
procedure Set_readOnly(pVal: WordBool); safecall;
function Get_foregroundColor: WideString; safecall;
procedure Set_foregroundColor(const pVal: WideString); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_fontSize: Integer; safecall;
procedure Set_fontSize(pVal: Integer); safecall;
function Get_fontStyle: WideString; safecall;
procedure Set_fontStyle(const pVal: WideString); safecall;
function Get_fontFace: WideString; safecall;
procedure Set_fontFace(const pVal: WideString); safecall;
function Get_itemCount: Integer; safecall;
function Get_firstVisibleItem: Integer; safecall;
procedure Set_firstVisibleItem(pVal: Integer); safecall;
procedure Set_popUp(Param1: WordBool); safecall;
function Get_focusItem: Integer; safecall;
procedure Set_focusItem(pVal: Integer); safecall;
function Get_border: WordBool; safecall;
procedure Set_border(pVal: WordBool); safecall;
function getItem(nPos: Integer): WideString; safecall;
procedure insertItem(nPos: Integer; const newVal: WideString); safecall;
procedure appendItem(const newVal: WideString); safecall;
procedure replaceItem(nPos: Integer; const newVal: WideString); safecall;
procedure deleteItem(nPos: Integer); safecall;
procedure deleteAll; safecall;
function findItem(nStartIndex: Integer; const newVal: WideString): Integer; safecall;
function getNextSelectedItem(nStartIndex: Integer): Integer; safecall;
procedure setSelectedState(nPos: Integer; vbSelected: WordBool); safecall;
procedure show; safecall;
procedure dismiss; safecall;
property selectedItem: Integer read Get_selectedItem write Set_selectedItem;
property sorted: WordBool read Get_sorted write Set_sorted;
property multiselect: WordBool read Get_multiselect write Set_multiselect;
property readOnly: WordBool read Get_readOnly write Set_readOnly;
property foregroundColor: WideString read Get_foregroundColor write Set_foregroundColor;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property fontSize: Integer read Get_fontSize write Set_fontSize;
property fontStyle: WideString read Get_fontStyle write Set_fontStyle;
property fontFace: WideString read Get_fontFace write Set_fontFace;
property itemCount: Integer read Get_itemCount;
property firstVisibleItem: Integer read Get_firstVisibleItem write Set_firstVisibleItem;
property popUp: WordBool write Set_popUp;
property focusItem: Integer read Get_focusItem write Set_focusItem;
property border: WordBool read Get_border write Set_border;
end;
// *********************************************************************//
// DispIntf: IWMPListBoxCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {FC1880CE-83B9-43A7-A066-C44CE8C82583}
// *********************************************************************//
IWMPListBoxCtrlDisp = dispinterface
['{FC1880CE-83B9-43A7-A066-C44CE8C82583}']
property selectedItem: Integer dispid 6108;
property sorted: WordBool dispid 6100;
property multiselect: WordBool dispid 6101;
property readOnly: WordBool dispid 6102;
property foregroundColor: WideString dispid 6103;
property backgroundColor: WideString dispid 6104;
property fontSize: Integer dispid 6105;
property fontStyle: WideString dispid 6106;
property fontFace: WideString dispid 6107;
property itemCount: Integer readonly dispid 6109;
property firstVisibleItem: Integer dispid 6110;
property popUp: WordBool writeonly dispid 6120;
property focusItem: Integer dispid 6121;
property border: WordBool dispid 6125;
function getItem(nPos: Integer): WideString; dispid 6111;
procedure insertItem(nPos: Integer; const newVal: WideString); dispid 6112;
procedure appendItem(const newVal: WideString); dispid 6113;
procedure replaceItem(nPos: Integer; const newVal: WideString); dispid 6114;
procedure deleteItem(nPos: Integer); dispid 6115;
procedure deleteAll; dispid 6116;
function findItem(nStartIndex: Integer; const newVal: WideString): Integer; dispid 6117;
function getNextSelectedItem(nStartIndex: Integer): Integer; dispid 6118;
procedure setSelectedState(nPos: Integer; vbSelected: WordBool); dispid 6122;
procedure show; dispid 6123;
procedure dismiss; dispid 6124;
end;
// *********************************************************************//
// Interface: IWMPListBoxItem
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D255DFB8-C22A-42CF-B8B7-F15D7BCF65D6}
// *********************************************************************//
IWMPListBoxItem = interface(IDispatch)
['{D255DFB8-C22A-42CF-B8B7-F15D7BCF65D6}']
procedure Set_value(const Param1: WideString); safecall;
property value: WideString write Set_value;
end;
// *********************************************************************//
// DispIntf: IWMPListBoxItemDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D255DFB8-C22A-42CF-B8B7-F15D7BCF65D6}
// *********************************************************************//
IWMPListBoxItemDisp = dispinterface
['{D255DFB8-C22A-42CF-B8B7-F15D7BCF65D6}']
property value: WideString writeonly dispid 6119;
end;
// *********************************************************************//
// Interface: IWMPPlaylistCtrlColumn
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {63D9D30F-AE4C-4678-8CA8-5720F4FE4419}
// *********************************************************************//
IWMPPlaylistCtrlColumn = interface(IDispatch)
['{63D9D30F-AE4C-4678-8CA8-5720F4FE4419}']
function Get_columnName: WideString; safecall;
procedure Set_columnName(const pVal: WideString); safecall;
function Get_columnID: WideString; safecall;
procedure Set_columnID(const pVal: WideString); safecall;
function Get_columnResizeMode: WideString; safecall;
procedure Set_columnResizeMode(const pVal: WideString); safecall;
function Get_columnWidth: Integer; safecall;
procedure Set_columnWidth(pVal: Integer); safecall;
property columnName: WideString read Get_columnName write Set_columnName;
property columnID: WideString read Get_columnID write Set_columnID;
property columnResizeMode: WideString read Get_columnResizeMode write Set_columnResizeMode;
property columnWidth: Integer read Get_columnWidth write Set_columnWidth;
end;
// *********************************************************************//
// DispIntf: IWMPPlaylistCtrlColumnDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {63D9D30F-AE4C-4678-8CA8-5720F4FE4419}
// *********************************************************************//
IWMPPlaylistCtrlColumnDisp = dispinterface
['{63D9D30F-AE4C-4678-8CA8-5720F4FE4419}']
property columnName: WideString dispid 5670;
property columnID: WideString dispid 5671;
property columnResizeMode: WideString dispid 5672;
property columnWidth: Integer dispid 5673;
end;
// *********************************************************************//
// DispIntf: IWMPSliderCtrlEvents
// Flags: (4096) Dispatchable
// GUID: {CDAC14D2-8BE4-11D3-BB48-00A0C93CA73A}
// *********************************************************************//
IWMPSliderCtrlEvents = dispinterface
['{CDAC14D2-8BE4-11D3-BB48-00A0C93CA73A}']
procedure ondragbegin; dispid 5430;
procedure ondragend; dispid 5431;
procedure onpositionchange; dispid 5432;
end;
// *********************************************************************//
// Interface: IWMPSliderCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F2BF2C8F-405F-11D3-BB39-00A0C93CA73A}
// *********************************************************************//
IWMPSliderCtrl = interface(IDispatch)
['{F2BF2C8F-405F-11D3-BB39-00A0C93CA73A}']
function Get_direction: WideString; safecall;
procedure Set_direction(const pVal: WideString); safecall;
function Get_slide: WordBool; safecall;
procedure Set_slide(pVal: WordBool); safecall;
function Get_tiled: WordBool; safecall;
procedure Set_tiled(pVal: WordBool); safecall;
function Get_foregroundColor: WideString; safecall;
procedure Set_foregroundColor(const pVal: WideString); safecall;
function Get_foregroundEndColor: WideString; safecall;
procedure Set_foregroundEndColor(const pVal: WideString); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_backgroundEndColor: WideString; safecall;
procedure Set_backgroundEndColor(const pVal: WideString); safecall;
function Get_disabledColor: WideString; safecall;
procedure Set_disabledColor(const pVal: WideString); safecall;
function Get_transparencyColor: WideString; safecall;
procedure Set_transparencyColor(const pVal: WideString); safecall;
function Get_foregroundImage: WideString; safecall;
procedure Set_foregroundImage(const pVal: WideString); safecall;
function Get_backgroundImage: WideString; safecall;
procedure Set_backgroundImage(const pVal: WideString); safecall;
function Get_backgroundHoverImage: WideString; safecall;
procedure Set_backgroundHoverImage(const pVal: WideString); safecall;
function Get_disabledImage: WideString; safecall;
procedure Set_disabledImage(const pVal: WideString); safecall;
function Get_thumbImage: WideString; safecall;
procedure Set_thumbImage(const pVal: WideString); safecall;
function Get_thumbHoverImage: WideString; safecall;
procedure Set_thumbHoverImage(const pVal: WideString); safecall;
function Get_thumbDownImage: WideString; safecall;
procedure Set_thumbDownImage(const pVal: WideString); safecall;
function Get_thumbDisabledImage: WideString; safecall;
procedure Set_thumbDisabledImage(const pVal: WideString); safecall;
function Get_min: Single; safecall;
procedure Set_min(pVal: Single); safecall;
function Get_max: Single; safecall;
procedure Set_max(pVal: Single); safecall;
function Get_value: Single; safecall;
procedure Set_value(pVal: Single); safecall;
function Get_toolTip: WideString; safecall;
procedure Set_toolTip(const pVal: WideString); safecall;
function Get_cursor: WideString; safecall;
procedure Set_cursor(const pVal: WideString); safecall;
function Get_borderSize: SYSINT; safecall;
procedure Set_borderSize(pVal: SYSINT); safecall;
function Get_foregroundHoverImage: WideString; safecall;
procedure Set_foregroundHoverImage(const pVal: WideString); safecall;
function Get_foregroundProgress: Single; safecall;
procedure Set_foregroundProgress(pVal: Single); safecall;
function Get_useForegroundProgress: WordBool; safecall;
procedure Set_useForegroundProgress(pVal: WordBool); safecall;
property direction: WideString read Get_direction write Set_direction;
property slide: WordBool read Get_slide write Set_slide;
property tiled: WordBool read Get_tiled write Set_tiled;
property foregroundColor: WideString read Get_foregroundColor write Set_foregroundColor;
property foregroundEndColor: WideString read Get_foregroundEndColor write Set_foregroundEndColor;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property backgroundEndColor: WideString read Get_backgroundEndColor write Set_backgroundEndColor;
property disabledColor: WideString read Get_disabledColor write Set_disabledColor;
property transparencyColor: WideString read Get_transparencyColor write Set_transparencyColor;
property foregroundImage: WideString read Get_foregroundImage write Set_foregroundImage;
property backgroundImage: WideString read Get_backgroundImage write Set_backgroundImage;
property backgroundHoverImage: WideString read Get_backgroundHoverImage write Set_backgroundHoverImage;
property disabledImage: WideString read Get_disabledImage write Set_disabledImage;
property thumbImage: WideString read Get_thumbImage write Set_thumbImage;
property thumbHoverImage: WideString read Get_thumbHoverImage write Set_thumbHoverImage;
property thumbDownImage: WideString read Get_thumbDownImage write Set_thumbDownImage;
property thumbDisabledImage: WideString read Get_thumbDisabledImage write Set_thumbDisabledImage;
property min: Single read Get_min write Set_min;
property max: Single read Get_max write Set_max;
property value: Single read Get_value write Set_value;
property toolTip: WideString read Get_toolTip write Set_toolTip;
property cursor: WideString read Get_cursor write Set_cursor;
property borderSize: SYSINT read Get_borderSize write Set_borderSize;
property foregroundHoverImage: WideString read Get_foregroundHoverImage write Set_foregroundHoverImage;
property foregroundProgress: Single read Get_foregroundProgress write Set_foregroundProgress;
property useForegroundProgress: WordBool read Get_useForegroundProgress write Set_useForegroundProgress;
end;
// *********************************************************************//
// DispIntf: IWMPSliderCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F2BF2C8F-405F-11D3-BB39-00A0C93CA73A}
// *********************************************************************//
IWMPSliderCtrlDisp = dispinterface
['{F2BF2C8F-405F-11D3-BB39-00A0C93CA73A}']
property direction: WideString dispid 5400;
property slide: WordBool dispid 5402;
property tiled: WordBool dispid 5403;
property foregroundColor: WideString dispid 5404;
property foregroundEndColor: WideString dispid 5405;
property backgroundColor: WideString dispid 5406;
property backgroundEndColor: WideString dispid 5407;
property disabledColor: WideString dispid 5408;
property transparencyColor: WideString dispid 5409;
property foregroundImage: WideString dispid 5410;
property backgroundImage: WideString dispid 5411;
property backgroundHoverImage: WideString dispid 5412;
property disabledImage: WideString dispid 5413;
property thumbImage: WideString dispid 5414;
property thumbHoverImage: WideString dispid 5415;
property thumbDownImage: WideString dispid 5416;
property thumbDisabledImage: WideString dispid 5417;
property min: Single dispid 5418;
property max: Single dispid 5419;
property value: Single dispid 5420;
property toolTip: WideString dispid 5421;
property cursor: WideString dispid 5422;
property borderSize: SYSINT dispid 5423;
property foregroundHoverImage: WideString dispid 5424;
property foregroundProgress: Single dispid 5425;
property useForegroundProgress: WordBool dispid 5426;
end;
// *********************************************************************//
// DispIntf: IWMPVideoCtrlEvents
// Flags: (4096) Dispatchable
// GUID: {A85C0477-714C-4A06-B9F6-7C8CA38B45DC}
// *********************************************************************//
IWMPVideoCtrlEvents = dispinterface
['{A85C0477-714C-4A06-B9F6-7C8CA38B45DC}']
procedure onvideostart; dispid 5720;
procedure onvideoend; dispid 5721;
end;
// *********************************************************************//
// Interface: IWMPVideoCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {61CECF10-FC3A-11D2-A1CD-005004602752}
// *********************************************************************//
IWMPVideoCtrl = interface(IDispatch)
['{61CECF10-FC3A-11D2-A1CD-005004602752}']
procedure Set_windowless(pbClipped: WordBool); safecall;
function Get_windowless: WordBool; safecall;
procedure Set_cursor(const pbstrCursor: WideString); safecall;
function Get_cursor: WideString; safecall;
procedure Set_backgroundColor(const pbstrColor: WideString); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_maintainAspectRatio(pbMaintainAspectRatio: WordBool); safecall;
function Get_maintainAspectRatio: WordBool; safecall;
procedure Set_toolTip(const bstrToolTip: WideString); safecall;
function Get_toolTip: WideString; safecall;
function Get_fullScreen: WordBool; safecall;
procedure Set_fullScreen(pbFullScreen: WordBool); safecall;
procedure Set_shrinkToFit(pbShrinkToFit: WordBool); safecall;
function Get_shrinkToFit: WordBool; safecall;
procedure Set_stretchToFit(pbStretchToFit: WordBool); safecall;
function Get_stretchToFit: WordBool; safecall;
procedure Set_zoom(pzoom: Integer); safecall;
function Get_zoom: Integer; safecall;
property windowless: WordBool read Get_windowless write Set_windowless;
property cursor: WideString read Get_cursor write Set_cursor;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property maintainAspectRatio: WordBool read Get_maintainAspectRatio write Set_maintainAspectRatio;
property toolTip: WideString read Get_toolTip write Set_toolTip;
property fullScreen: WordBool read Get_fullScreen write Set_fullScreen;
property shrinkToFit: WordBool read Get_shrinkToFit write Set_shrinkToFit;
property stretchToFit: WordBool read Get_stretchToFit write Set_stretchToFit;
property zoom: Integer read Get_zoom write Set_zoom;
end;
// *********************************************************************//
// DispIntf: IWMPVideoCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {61CECF10-FC3A-11D2-A1CD-005004602752}
// *********************************************************************//
IWMPVideoCtrlDisp = dispinterface
['{61CECF10-FC3A-11D2-A1CD-005004602752}']
property windowless: WordBool dispid 5700;
property cursor: WideString dispid 5701;
property backgroundColor: WideString dispid 5702;
property maintainAspectRatio: WordBool dispid 5704;
property toolTip: WideString dispid 5706;
property fullScreen: WordBool dispid 5707;
property shrinkToFit: WordBool dispid 5703;
property stretchToFit: WordBool dispid 5708;
property zoom: Integer dispid 5709;
end;
// *********************************************************************//
// Interface: IWMPEffectsCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A9EFAB80-0A60-4C3F-BBD1-4558DD2A9769}
// *********************************************************************//
IWMPEffectsCtrl = interface(IDispatch)
['{A9EFAB80-0A60-4C3F-BBD1-4558DD2A9769}']
function Get_windowed: WordBool; safecall;
procedure Set_windowed(pVal: WordBool); safecall;
function Get_allowAll: WordBool; safecall;
procedure Set_allowAll(pVal: WordBool); safecall;
procedure Set_currentEffectType(const pVal: WideString); safecall;
function Get_currentEffectType: WideString; safecall;
function Get_currentEffectTitle: WideString; safecall;
procedure next; safecall;
procedure previous; safecall;
procedure settings; safecall;
function Get_currentEffect: IDispatch; safecall;
procedure Set_currentEffect(const p: IDispatch); safecall;
procedure nextEffect; safecall;
procedure previousEffect; safecall;
procedure nextPreset; safecall;
procedure previousPreset; safecall;
function Get_currentPreset: Integer; safecall;
procedure Set_currentPreset(pVal: Integer); safecall;
function Get_currentPresetTitle: WideString; safecall;
function Get_currentEffectPresetCount: Integer; safecall;
function Get_fullScreen: WordBool; safecall;
procedure Set_fullScreen(pbFullScreen: WordBool); safecall;
function Get_effectCanGoFullScreen: WordBool; safecall;
function Get_effectHasPropertyPage: WordBool; safecall;
function Get_effectCount: Integer; safecall;
function Get_effectTitle(index: Integer): WideString; safecall;
function Get_effectType(index: Integer): WideString; safecall;
property windowed: WordBool read Get_windowed write Set_windowed;
property allowAll: WordBool read Get_allowAll write Set_allowAll;
property currentEffectType: WideString read Get_currentEffectType write Set_currentEffectType;
property currentEffectTitle: WideString read Get_currentEffectTitle;
property currentEffect: IDispatch read Get_currentEffect write Set_currentEffect;
property currentPreset: Integer read Get_currentPreset write Set_currentPreset;
property currentPresetTitle: WideString read Get_currentPresetTitle;
property currentEffectPresetCount: Integer read Get_currentEffectPresetCount;
property fullScreen: WordBool read Get_fullScreen write Set_fullScreen;
property effectCanGoFullScreen: WordBool read Get_effectCanGoFullScreen;
property effectHasPropertyPage: WordBool read Get_effectHasPropertyPage;
property effectCount: Integer read Get_effectCount;
property effectTitle[index: Integer]: WideString read Get_effectTitle;
property effectType[index: Integer]: WideString read Get_effectType;
end;
// *********************************************************************//
// DispIntf: IWMPEffectsCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A9EFAB80-0A60-4C3F-BBD1-4558DD2A9769}
// *********************************************************************//
IWMPEffectsCtrlDisp = dispinterface
['{A9EFAB80-0A60-4C3F-BBD1-4558DD2A9769}']
property windowed: WordBool dispid 5500;
property allowAll: WordBool dispid 5501;
property currentEffectType: WideString dispid 5507;
property currentEffectTitle: WideString readonly dispid 5506;
procedure next; dispid 5502;
procedure previous; dispid 5503;
procedure settings; dispid 5504;
property currentEffect: IDispatch dispid 5505;
procedure nextEffect; dispid 5509;
procedure previousEffect; dispid 5510;
procedure nextPreset; dispid 5511;
procedure previousPreset; dispid 5512;
property currentPreset: Integer dispid 5513;
property currentPresetTitle: WideString readonly dispid 5514;
property currentEffectPresetCount: Integer readonly dispid 5515;
property fullScreen: WordBool dispid 5516;
property effectCanGoFullScreen: WordBool readonly dispid 5517;
property effectHasPropertyPage: WordBool readonly dispid 5518;
property effectCount: Integer readonly dispid 5520;
property effectTitle[index: Integer]: WideString readonly dispid 5521;
property effectType[index: Integer]: WideString readonly dispid 5522;
end;
// *********************************************************************//
// Interface: IWMPEqualizerSettingsCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2BD3716F-A914-49FB-8655-996D5F495498}
// *********************************************************************//
IWMPEqualizerSettingsCtrl = interface(IDispatch)
['{2BD3716F-A914-49FB-8655-996D5F495498}']
function Get_bypass: WordBool; safecall;
procedure Set_bypass(pVal: WordBool); safecall;
function Get_gainLevel1: Single; safecall;
procedure Set_gainLevel1(pflLevel: Single); safecall;
function Get_gainLevel2: Single; safecall;
procedure Set_gainLevel2(pflLevel: Single); safecall;
function Get_gainLevel3: Single; safecall;
procedure Set_gainLevel3(pflLevel: Single); safecall;
function Get_gainLevel4: Single; safecall;
procedure Set_gainLevel4(pflLevel: Single); safecall;
function Get_gainLevel5: Single; safecall;
procedure Set_gainLevel5(pflLevel: Single); safecall;
function Get_gainLevel6: Single; safecall;
procedure Set_gainLevel6(pflLevel: Single); safecall;
function Get_gainLevel7: Single; safecall;
procedure Set_gainLevel7(pflLevel: Single); safecall;
function Get_gainLevel8: Single; safecall;
procedure Set_gainLevel8(pflLevel: Single); safecall;
function Get_gainLevel9: Single; safecall;
procedure Set_gainLevel9(pflLevel: Single); safecall;
function Get_gainLevel10: Single; safecall;
procedure Set_gainLevel10(pflLevel: Single); safecall;
function Get_gainLevels(iIndex: Integer): Single; safecall;
procedure Set_gainLevels(iIndex: Integer; pflLevel: Single); safecall;
procedure reset; safecall;
function Get_bands: Integer; safecall;
procedure nextPreset; safecall;
procedure previousPreset; safecall;
function Get_currentPreset: Integer; safecall;
procedure Set_currentPreset(pVal: Integer); safecall;
function Get_currentPresetTitle: WideString; safecall;
function Get_presetCount: Integer; safecall;
function Get_enhancedAudio: WordBool; safecall;
procedure Set_enhancedAudio(pfVal: WordBool); safecall;
function Get_speakerSize: Integer; safecall;
procedure Set_speakerSize(plVal: Integer); safecall;
function Get_currentSpeakerName: WideString; safecall;
function Get_truBassLevel: Integer; safecall;
procedure Set_truBassLevel(plTruBassLevel: Integer); safecall;
function Get_wowLevel: Integer; safecall;
procedure Set_wowLevel(plWowLevel: Integer); safecall;
function Get_splineTension: Single; safecall;
procedure Set_splineTension(pflSplineTension: Single); safecall;
function Get_enableSplineTension: WordBool; safecall;
procedure Set_enableSplineTension(pfEnableSplineTension: WordBool); safecall;
function Get_presetTitle(iIndex: Integer): WideString; safecall;
function Get_normalization: WordBool; safecall;
procedure Set_normalization(pfVal: WordBool); safecall;
function Get_normalizationAverage: Single; safecall;
function Get_normalizationPeak: Single; safecall;
function Get_crossFade: WordBool; safecall;
procedure Set_crossFade(pfVal: WordBool); safecall;
function Get_crossFadeWindow: Integer; safecall;
procedure Set_crossFadeWindow(plWindow: Integer); safecall;
property bypass: WordBool read Get_bypass write Set_bypass;
property gainLevel1: Single read Get_gainLevel1 write Set_gainLevel1;
property gainLevel2: Single read Get_gainLevel2 write Set_gainLevel2;
property gainLevel3: Single read Get_gainLevel3 write Set_gainLevel3;
property gainLevel4: Single read Get_gainLevel4 write Set_gainLevel4;
property gainLevel5: Single read Get_gainLevel5 write Set_gainLevel5;
property gainLevel6: Single read Get_gainLevel6 write Set_gainLevel6;
property gainLevel7: Single read Get_gainLevel7 write Set_gainLevel7;
property gainLevel8: Single read Get_gainLevel8 write Set_gainLevel8;
property gainLevel9: Single read Get_gainLevel9 write Set_gainLevel9;
property gainLevel10: Single read Get_gainLevel10 write Set_gainLevel10;
property gainLevels[iIndex: Integer]: Single read Get_gainLevels write Set_gainLevels;
property bands: Integer read Get_bands;
property currentPreset: Integer read Get_currentPreset write Set_currentPreset;
property currentPresetTitle: WideString read Get_currentPresetTitle;
property presetCount: Integer read Get_presetCount;
property enhancedAudio: WordBool read Get_enhancedAudio write Set_enhancedAudio;
property speakerSize: Integer read Get_speakerSize write Set_speakerSize;
property currentSpeakerName: WideString read Get_currentSpeakerName;
property truBassLevel: Integer read Get_truBassLevel write Set_truBassLevel;
property wowLevel: Integer read Get_wowLevel write Set_wowLevel;
property splineTension: Single read Get_splineTension write Set_splineTension;
property enableSplineTension: WordBool read Get_enableSplineTension write Set_enableSplineTension;
property presetTitle[iIndex: Integer]: WideString read Get_presetTitle;
property normalization: WordBool read Get_normalization write Set_normalization;
property normalizationAverage: Single read Get_normalizationAverage;
property normalizationPeak: Single read Get_normalizationPeak;
property crossFade: WordBool read Get_crossFade write Set_crossFade;
property crossFadeWindow: Integer read Get_crossFadeWindow write Set_crossFadeWindow;
end;
// *********************************************************************//
// DispIntf: IWMPEqualizerSettingsCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2BD3716F-A914-49FB-8655-996D5F495498}
// *********************************************************************//
IWMPEqualizerSettingsCtrlDisp = dispinterface
['{2BD3716F-A914-49FB-8655-996D5F495498}']
property bypass: WordBool dispid 5800;
property gainLevel1: Single dispid 5804;
property gainLevel2: Single dispid 5805;
property gainLevel3: Single dispid 5806;
property gainLevel4: Single dispid 5807;
property gainLevel5: Single dispid 5808;
property gainLevel6: Single dispid 5809;
property gainLevel7: Single dispid 5810;
property gainLevel8: Single dispid 5811;
property gainLevel9: Single dispid 5812;
property gainLevel10: Single dispid 5813;
property gainLevels[iIndex: Integer]: Single dispid 5815;
procedure reset; dispid 5814;
property bands: Integer readonly dispid 5801;
procedure nextPreset; dispid 5816;
procedure previousPreset; dispid 5817;
property currentPreset: Integer dispid 5818;
property currentPresetTitle: WideString readonly dispid 5819;
property presetCount: Integer readonly dispid 5820;
property enhancedAudio: WordBool dispid 5821;
property speakerSize: Integer dispid 5822;
property currentSpeakerName: WideString readonly dispid 5823;
property truBassLevel: Integer dispid 5824;
property wowLevel: Integer dispid 5825;
property splineTension: Single dispid 5827;
property enableSplineTension: WordBool dispid 5826;
property presetTitle[iIndex: Integer]: WideString readonly dispid 5828;
property normalization: WordBool dispid 5829;
property normalizationAverage: Single readonly dispid 5830;
property normalizationPeak: Single readonly dispid 5831;
property crossFade: WordBool dispid 5832;
property crossFadeWindow: Integer dispid 5833;
end;
// *********************************************************************//
// Interface: IWMPVideoSettingsCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {07EC23DA-EF73-4BDE-A40F-F269E0B7AFD6}
// *********************************************************************//
IWMPVideoSettingsCtrl = interface(IDispatch)
['{07EC23DA-EF73-4BDE-A40F-F269E0B7AFD6}']
function Get_brightness: Integer; safecall;
procedure Set_brightness(pVal: Integer); safecall;
function Get_contrast: Integer; safecall;
procedure Set_contrast(pVal: Integer); safecall;
function Get_hue: Integer; safecall;
procedure Set_hue(pVal: Integer); safecall;
function Get_saturation: Integer; safecall;
procedure Set_saturation(pVal: Integer); safecall;
procedure reset; safecall;
property brightness: Integer read Get_brightness write Set_brightness;
property contrast: Integer read Get_contrast write Set_contrast;
property hue: Integer read Get_hue write Set_hue;
property saturation: Integer read Get_saturation write Set_saturation;
end;
// *********************************************************************//
// DispIntf: IWMPVideoSettingsCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {07EC23DA-EF73-4BDE-A40F-F269E0B7AFD6}
// *********************************************************************//
IWMPVideoSettingsCtrlDisp = dispinterface
['{07EC23DA-EF73-4BDE-A40F-F269E0B7AFD6}']
property brightness: Integer dispid 5900;
property contrast: Integer dispid 5901;
property hue: Integer dispid 5902;
property saturation: Integer dispid 5903;
procedure reset; dispid 5904;
end;
// *********************************************************************//
// Interface: IWMPLibraryTreeCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {B738FCAE-F089-45DF-AED6-034B9E7DB632}
// *********************************************************************//
IWMPLibraryTreeCtrl = interface(IDispatch)
['{B738FCAE-F089-45DF-AED6-034B9E7DB632}']
function Get_dropDownVisible: WordBool; safecall;
procedure Set_dropDownVisible(pVal: WordBool); safecall;
function Get_foregroundColor: WideString; safecall;
procedure Set_foregroundColor(const pVal: WideString); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_fontSize: Integer; safecall;
procedure Set_fontSize(pVal: Integer); safecall;
function Get_fontStyle: WideString; safecall;
procedure Set_fontStyle(const pVal: WideString); safecall;
function Get_fontFace: WideString; safecall;
procedure Set_fontFace(const pVal: WideString); safecall;
function Get_filter: WideString; safecall;
procedure Set_filter(const pVal: WideString); safecall;
function Get_expandState: WideString; safecall;
procedure Set_expandState(const pVal: WideString); safecall;
function Get_Playlist: IWMPPlaylist; safecall;
procedure Set_Playlist(const ppPlaylist: IWMPPlaylist); safecall;
function Get_selectedPlaylist: IWMPPlaylist; safecall;
function Get_selectedMedia: IWMPMedia; safecall;
property dropDownVisible: WordBool read Get_dropDownVisible write Set_dropDownVisible;
property foregroundColor: WideString read Get_foregroundColor write Set_foregroundColor;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property fontSize: Integer read Get_fontSize write Set_fontSize;
property fontStyle: WideString read Get_fontStyle write Set_fontStyle;
property fontFace: WideString read Get_fontFace write Set_fontFace;
property filter: WideString read Get_filter write Set_filter;
property expandState: WideString read Get_expandState write Set_expandState;
property Playlist: IWMPPlaylist read Get_Playlist write Set_Playlist;
property selectedPlaylist: IWMPPlaylist read Get_selectedPlaylist;
property selectedMedia: IWMPMedia read Get_selectedMedia;
end;
// *********************************************************************//
// DispIntf: IWMPLibraryTreeCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {B738FCAE-F089-45DF-AED6-034B9E7DB632}
// *********************************************************************//
IWMPLibraryTreeCtrlDisp = dispinterface
['{B738FCAE-F089-45DF-AED6-034B9E7DB632}']
property dropDownVisible: WordBool dispid 6401;
property foregroundColor: WideString dispid 6402;
property backgroundColor: WideString dispid 6403;
property fontSize: Integer dispid 6404;
property fontStyle: WideString dispid 6405;
property fontFace: WideString dispid 6406;
property filter: WideString dispid 6407;
property expandState: WideString dispid 6408;
property Playlist: IWMPPlaylist dispid 6409;
property selectedPlaylist: IWMPPlaylist readonly dispid 6410;
property selectedMedia: IWMPMedia readonly dispid 6411;
end;
// *********************************************************************//
// Interface: IWMPEditCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {70E1217C-C617-4CFD-BD8A-69CA2043E70B}
// *********************************************************************//
IWMPEditCtrl = interface(IDispatch)
['{70E1217C-C617-4CFD-BD8A-69CA2043E70B}']
function Get_value: WideString; safecall;
procedure Set_value(const pVal: WideString); safecall;
function Get_border: WordBool; safecall;
procedure Set_border(pVal: WordBool); safecall;
function Get_justification: WideString; safecall;
procedure Set_justification(const pVal: WideString); safecall;
function Get_editStyle: WideString; safecall;
procedure Set_editStyle(const pVal: WideString); safecall;
function Get_wordWrap: WordBool; safecall;
procedure Set_wordWrap(pVal: WordBool); safecall;
function Get_readOnly: WordBool; safecall;
procedure Set_readOnly(pVal: WordBool); safecall;
function Get_foregroundColor: WideString; safecall;
procedure Set_foregroundColor(const pVal: WideString); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_fontSize: Integer; safecall;
procedure Set_fontSize(pVal: Integer); safecall;
function Get_fontStyle: WideString; safecall;
procedure Set_fontStyle(const pVal: WideString); safecall;
function Get_fontFace: WideString; safecall;
procedure Set_fontFace(const pVal: WideString); safecall;
function Get_textLimit: Integer; safecall;
procedure Set_textLimit(pVal: Integer); safecall;
function Get_lineCount: Integer; safecall;
function getLine(nIndex: Integer): WideString; safecall;
function getSelectionStart: Integer; safecall;
function getSelectionEnd: Integer; safecall;
procedure setSelection(nStart: Integer; nEnd: Integer); safecall;
procedure replaceSelection(const newVal: WideString); safecall;
function getLineIndex(nIndex: Integer): Integer; safecall;
function getLineFromChar(nPosition: Integer): Integer; safecall;
property value: WideString read Get_value write Set_value;
property border: WordBool read Get_border write Set_border;
property justification: WideString read Get_justification write Set_justification;
property editStyle: WideString read Get_editStyle write Set_editStyle;
property wordWrap: WordBool read Get_wordWrap write Set_wordWrap;
property readOnly: WordBool read Get_readOnly write Set_readOnly;
property foregroundColor: WideString read Get_foregroundColor write Set_foregroundColor;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property fontSize: Integer read Get_fontSize write Set_fontSize;
property fontStyle: WideString read Get_fontStyle write Set_fontStyle;
property fontFace: WideString read Get_fontFace write Set_fontFace;
property textLimit: Integer read Get_textLimit write Set_textLimit;
property lineCount: Integer read Get_lineCount;
end;
// *********************************************************************//
// DispIntf: IWMPEditCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {70E1217C-C617-4CFD-BD8A-69CA2043E70B}
// *********************************************************************//
IWMPEditCtrlDisp = dispinterface
['{70E1217C-C617-4CFD-BD8A-69CA2043E70B}']
property value: WideString dispid 0;
property border: WordBool dispid 6000;
property justification: WideString dispid 6001;
property editStyle: WideString dispid 6002;
property wordWrap: WordBool dispid 6003;
property readOnly: WordBool dispid 6004;
property foregroundColor: WideString dispid 6005;
property backgroundColor: WideString dispid 6006;
property fontSize: Integer dispid 6007;
property fontStyle: WideString dispid 6008;
property fontFace: WideString dispid 6009;
property textLimit: Integer dispid 6010;
property lineCount: Integer readonly dispid 6011;
function getLine(nIndex: Integer): WideString; dispid 6012;
function getSelectionStart: Integer; dispid 6013;
function getSelectionEnd: Integer; dispid 6014;
procedure setSelection(nStart: Integer; nEnd: Integer); dispid 6015;
procedure replaceSelection(const newVal: WideString); dispid 6016;
function getLineIndex(nIndex: Integer): Integer; dispid 6017;
function getLineFromChar(nPosition: Integer): Integer; dispid 6018;
end;
// *********************************************************************//
// Interface: IWMPPluginUIHost
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5D0AD945-289E-45C5-A9C6-F301F0152108}
// *********************************************************************//
IWMPPluginUIHost = interface(IDispatch)
['{5D0AD945-289E-45C5-A9C6-F301F0152108}']
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_objectID: WideString; safecall;
procedure Set_objectID(const pVal: WideString); safecall;
function getProperty(const bstrName: WideString): OleVariant; safecall;
procedure setProperty(const bstrName: WideString; newVal: OleVariant); safecall;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property objectID: WideString read Get_objectID write Set_objectID;
end;
// *********************************************************************//
// DispIntf: IWMPPluginUIHostDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5D0AD945-289E-45C5-A9C6-F301F0152108}
// *********************************************************************//
IWMPPluginUIHostDisp = dispinterface
['{5D0AD945-289E-45C5-A9C6-F301F0152108}']
property backgroundColor: WideString dispid 6201;
property objectID: WideString dispid 6202;
function getProperty(const bstrName: WideString): OleVariant; dispid 6203;
procedure setProperty(const bstrName: WideString; newVal: OleVariant); dispid 6204;
end;
// *********************************************************************//
// Interface: IWMPMenuCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {158A7ADC-33DA-4039-A553-BDDBBE389F5C}
// *********************************************************************//
IWMPMenuCtrl = interface(IDispatch)
['{158A7ADC-33DA-4039-A553-BDDBBE389F5C}']
procedure deleteAllItems; safecall;
procedure appendItem(nID: Integer; const bstrItem: WideString); safecall;
procedure appendSeparator; safecall;
procedure enableItem(nID: Integer; newVal: WordBool); safecall;
procedure checkItem(nID: Integer; newVal: WordBool); safecall;
procedure checkRadioItem(nID: Integer; newVal: WordBool); safecall;
function Get_showFlags: Integer; safecall;
procedure Set_showFlags(pVal: Integer); safecall;
function show: Integer; safecall;
procedure showEx(nID: Integer); safecall;
property showFlags: Integer read Get_showFlags write Set_showFlags;
end;
// *********************************************************************//
// DispIntf: IWMPMenuCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {158A7ADC-33DA-4039-A553-BDDBBE389F5C}
// *********************************************************************//
IWMPMenuCtrlDisp = dispinterface
['{158A7ADC-33DA-4039-A553-BDDBBE389F5C}']
procedure deleteAllItems; dispid 6301;
procedure appendItem(nID: Integer; const bstrItem: WideString); dispid 6302;
procedure appendSeparator; dispid 6303;
procedure enableItem(nID: Integer; newVal: WordBool); dispid 6304;
procedure checkItem(nID: Integer; newVal: WordBool); dispid 6305;
procedure checkRadioItem(nID: Integer; newVal: WordBool); dispid 6306;
property showFlags: Integer dispid 6307;
function show: Integer; dispid 6308;
procedure showEx(nID: Integer); dispid 6309;
end;
// *********************************************************************//
// Interface: IWMPAutoMenuCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {1AD13E0B-4F3A-41DF-9BE2-F9E6FE0A7875}
// *********************************************************************//
IWMPAutoMenuCtrl = interface(IDispatch)
['{1AD13E0B-4F3A-41DF-9BE2-F9E6FE0A7875}']
procedure show(const newVal: WideString); safecall;
end;
// *********************************************************************//
// DispIntf: IWMPAutoMenuCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {1AD13E0B-4F3A-41DF-9BE2-F9E6FE0A7875}
// *********************************************************************//
IWMPAutoMenuCtrlDisp = dispinterface
['{1AD13E0B-4F3A-41DF-9BE2-F9E6FE0A7875}']
procedure show(const newVal: WideString); dispid 6501;
end;
// *********************************************************************//
// Interface: IWMPRegionalButtonCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {58D507B1-2354-11D3-BD41-00C04F6EA5AE}
// *********************************************************************//
IWMPRegionalButtonCtrl = interface(IDispatch)
['{58D507B1-2354-11D3-BD41-00C04F6EA5AE}']
function Get_image: WideString; safecall;
procedure Set_image(const pVal: WideString); safecall;
function Get_hoverImage: WideString; safecall;
procedure Set_hoverImage(const pVal: WideString); safecall;
function Get_downImage: WideString; safecall;
procedure Set_downImage(const pVal: WideString); safecall;
function Get_hoverDownImage: WideString; safecall;
procedure Set_hoverDownImage(const pVal: WideString); safecall;
function Get_hoverHoverImage: WideString; safecall;
procedure Set_hoverHoverImage(const pVal: WideString); safecall;
function Get_disabledImage: WideString; safecall;
procedure Set_disabledImage(const pVal: WideString); safecall;
function Get_mappingImage: WideString; safecall;
procedure Set_mappingImage(const pVal: WideString); safecall;
function Get_transparencyColor: WideString; safecall;
procedure Set_transparencyColor(const pVal: WideString); safecall;
function Get_cursor: WideString; safecall;
procedure Set_cursor(const pVal: WideString); safecall;
function Get_showBackground: WordBool; safecall;
procedure Set_showBackground(pVal: WordBool); safecall;
function Get_radio: WordBool; safecall;
procedure Set_radio(pVal: WordBool); safecall;
function Get_buttonCount: Integer; safecall;
function createButton: IDispatch; safecall;
function getButton(nButton: Integer): IDispatch; safecall;
procedure Click(nButton: Integer); safecall;
function Get_hueShift: Single; safecall;
procedure Set_hueShift(pVal: Single); safecall;
function Get_saturation: Single; safecall;
procedure Set_saturation(pVal: Single); safecall;
property image: WideString read Get_image write Set_image;
property hoverImage: WideString read Get_hoverImage write Set_hoverImage;
property downImage: WideString read Get_downImage write Set_downImage;
property hoverDownImage: WideString read Get_hoverDownImage write Set_hoverDownImage;
property hoverHoverImage: WideString read Get_hoverHoverImage write Set_hoverHoverImage;
property disabledImage: WideString read Get_disabledImage write Set_disabledImage;
property mappingImage: WideString read Get_mappingImage write Set_mappingImage;
property transparencyColor: WideString read Get_transparencyColor write Set_transparencyColor;
property cursor: WideString read Get_cursor write Set_cursor;
property showBackground: WordBool read Get_showBackground write Set_showBackground;
property radio: WordBool read Get_radio write Set_radio;
property buttonCount: Integer read Get_buttonCount;
property hueShift: Single read Get_hueShift write Set_hueShift;
property saturation: Single read Get_saturation write Set_saturation;
end;
// *********************************************************************//
// DispIntf: IWMPRegionalButtonCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {58D507B1-2354-11D3-BD41-00C04F6EA5AE}
// *********************************************************************//
IWMPRegionalButtonCtrlDisp = dispinterface
['{58D507B1-2354-11D3-BD41-00C04F6EA5AE}']
property image: WideString dispid 5300;
property hoverImage: WideString dispid 5301;
property downImage: WideString dispid 5302;
property hoverDownImage: WideString dispid 5303;
property hoverHoverImage: WideString dispid 5317;
property disabledImage: WideString dispid 5304;
property mappingImage: WideString dispid 5305;
property transparencyColor: WideString dispid 5306;
property cursor: WideString dispid 5308;
property showBackground: WordBool dispid 5309;
property radio: WordBool dispid 5310;
property buttonCount: Integer readonly dispid 5311;
function createButton: IDispatch; dispid 5312;
function getButton(nButton: Integer): IDispatch; dispid 5313;
procedure Click(nButton: Integer); dispid 5314;
property hueShift: Single dispid 5315;
property saturation: Single dispid 5316;
end;
// *********************************************************************//
// DispIntf: IWMPRegionalButtonEvents
// Flags: (4096) Dispatchable
// GUID: {50FC8D31-67AC-11D3-BD4C-00C04F6EA5AE}
// *********************************************************************//
IWMPRegionalButtonEvents = dispinterface
['{50FC8D31-67AC-11D3-BD4C-00C04F6EA5AE}']
procedure onblur; dispid 5360;
procedure onfocus; dispid 5361;
procedure onclick; dispid 5362;
procedure ondblclick; dispid 5363;
procedure onmousedown; dispid 5364;
procedure onmouseup; dispid 5365;
procedure onmousemove; dispid 5366;
procedure onmouseover; dispid 5367;
procedure onmouseout; dispid 5368;
procedure onkeypress; dispid 5369;
procedure onkeydown; dispid 5370;
procedure onkeyup; dispid 5371;
end;
// *********************************************************************//
// Interface: IWMPRegionalButton
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {58D507B2-2354-11D3-BD41-00C04F6EA5AE}
// *********************************************************************//
IWMPRegionalButton = interface(IDispatch)
['{58D507B2-2354-11D3-BD41-00C04F6EA5AE}']
function Get_upToolTip: WideString; safecall;
procedure Set_upToolTip(const pVal: WideString); safecall;
function Get_downToolTip: WideString; safecall;
procedure Set_downToolTip(const pVal: WideString); safecall;
function Get_mappingColor: WideString; safecall;
procedure Set_mappingColor(const pVal: WideString); safecall;
function Get_enabled: WordBool; safecall;
procedure Set_enabled(pVal: WordBool); safecall;
function Get_sticky: WordBool; safecall;
procedure Set_sticky(pVal: WordBool); safecall;
function Get_down: WordBool; safecall;
procedure Set_down(pVal: WordBool); safecall;
function Get_index: Integer; safecall;
function Get_tabStop: WordBool; safecall;
procedure Set_tabStop(pVal: WordBool); safecall;
function Get_cursor: WideString; safecall;
procedure Set_cursor(const pVal: WideString); safecall;
procedure Click; safecall;
function Get_accName: WideString; safecall;
procedure Set_accName(const pszName: WideString); safecall;
function Get_accDescription: WideString; safecall;
procedure Set_accDescription(const pszDescription: WideString); safecall;
function Get_accKeyboardShortcut: WideString; safecall;
procedure Set_accKeyboardShortcut(const pszShortcut: WideString); safecall;
property upToolTip: WideString read Get_upToolTip write Set_upToolTip;
property downToolTip: WideString read Get_downToolTip write Set_downToolTip;
property mappingColor: WideString read Get_mappingColor write Set_mappingColor;
property enabled: WordBool read Get_enabled write Set_enabled;
property sticky: WordBool read Get_sticky write Set_sticky;
property down: WordBool read Get_down write Set_down;
property index: Integer read Get_index;
property tabStop: WordBool read Get_tabStop write Set_tabStop;
property cursor: WideString read Get_cursor write Set_cursor;
property accName: WideString read Get_accName write Set_accName;
property accDescription: WideString read Get_accDescription write Set_accDescription;
property accKeyboardShortcut: WideString read Get_accKeyboardShortcut write Set_accKeyboardShortcut;
end;
// *********************************************************************//
// DispIntf: IWMPRegionalButtonDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {58D507B2-2354-11D3-BD41-00C04F6EA5AE}
// *********************************************************************//
IWMPRegionalButtonDisp = dispinterface
['{58D507B2-2354-11D3-BD41-00C04F6EA5AE}']
property upToolTip: WideString dispid 5330;
property downToolTip: WideString dispid 5331;
property mappingColor: WideString dispid 5332;
property enabled: WordBool dispid 5333;
property sticky: WordBool dispid 5339;
property down: WordBool dispid 5340;
property index: Integer readonly dispid 5341;
property tabStop: WordBool dispid 5342;
property cursor: WideString dispid 5343;
procedure Click; dispid 5344;
property accName: WideString dispid 5345;
property accDescription: WideString dispid 5346;
property accKeyboardShortcut: WideString dispid 5347;
end;
// *********************************************************************//
// DispIntf: IWMPCustomSliderCtrlEvents
// Flags: (4096) Dispatchable
// GUID: {95F45AA4-ED0A-11D2-BA67-0000F80855E6}
// *********************************************************************//
IWMPCustomSliderCtrlEvents = dispinterface
['{95F45AA4-ED0A-11D2-BA67-0000F80855E6}']
procedure ondragbegin; dispid 5020;
procedure ondragend; dispid 5021;
procedure onpositionchange; dispid 5022;
end;
// *********************************************************************//
// Interface: IWMPCustomSlider
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {95F45AA2-ED0A-11D2-BA67-0000F80855E6}
// *********************************************************************//
IWMPCustomSlider = interface(IDispatch)
['{95F45AA2-ED0A-11D2-BA67-0000F80855E6}']
function Get_cursor: WideString; safecall;
procedure Set_cursor(const pVal: WideString); safecall;
function Get_min: Single; safecall;
procedure Set_min(pVal: Single); safecall;
function Get_max: Single; safecall;
procedure Set_max(pVal: Single); safecall;
function Get_value: Single; safecall;
procedure Set_value(pVal: Single); safecall;
function Get_toolTip: WideString; safecall;
procedure Set_toolTip(const pVal: WideString); safecall;
function Get_positionImage: WideString; safecall;
procedure Set_positionImage(const pVal: WideString); safecall;
function Get_image: WideString; safecall;
procedure Set_image(const pVal: WideString); safecall;
function Get_hoverImage: WideString; safecall;
procedure Set_hoverImage(const pVal: WideString); safecall;
function Get_disabledImage: WideString; safecall;
procedure Set_disabledImage(const pVal: WideString); safecall;
function Get_downImage: WideString; safecall;
procedure Set_downImage(const pVal: WideString); safecall;
function Get_transparencyColor: WideString; safecall;
procedure Set_transparencyColor(const pVal: WideString); safecall;
property cursor: WideString read Get_cursor write Set_cursor;
property min: Single read Get_min write Set_min;
property max: Single read Get_max write Set_max;
property value: Single read Get_value write Set_value;
property toolTip: WideString read Get_toolTip write Set_toolTip;
property positionImage: WideString read Get_positionImage write Set_positionImage;
property image: WideString read Get_image write Set_image;
property hoverImage: WideString read Get_hoverImage write Set_hoverImage;
property disabledImage: WideString read Get_disabledImage write Set_disabledImage;
property downImage: WideString read Get_downImage write Set_downImage;
property transparencyColor: WideString read Get_transparencyColor write Set_transparencyColor;
end;
// *********************************************************************//
// DispIntf: IWMPCustomSliderDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {95F45AA2-ED0A-11D2-BA67-0000F80855E6}
// *********************************************************************//
IWMPCustomSliderDisp = dispinterface
['{95F45AA2-ED0A-11D2-BA67-0000F80855E6}']
property cursor: WideString dispid 5009;
property min: Single dispid 5005;
property max: Single dispid 5006;
property value: Single dispid 5010;
property toolTip: WideString dispid 5011;
property positionImage: WideString dispid 5002;
property image: WideString dispid 5001;
property hoverImage: WideString dispid 5003;
property disabledImage: WideString dispid 5004;
property downImage: WideString dispid 5012;
property transparencyColor: WideString dispid 5008;
end;
// *********************************************************************//
// Interface: IWMPTextCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {237DAC8E-0E32-11D3-A2E2-00C04F79F88E}
// *********************************************************************//
IWMPTextCtrl = interface(IDispatch)
['{237DAC8E-0E32-11D3-A2E2-00C04F79F88E}']
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_fontFace: WideString; safecall;
procedure Set_fontFace(const pVal: WideString); safecall;
function Get_fontStyle: WideString; safecall;
procedure Set_fontStyle(const pVal: WideString); safecall;
function Get_fontSize: Integer; safecall;
procedure Set_fontSize(pVal: Integer); safecall;
function Get_foregroundColor: WideString; safecall;
procedure Set_foregroundColor(const pVal: WideString); safecall;
function Get_hoverBackgroundColor: WideString; safecall;
procedure Set_hoverBackgroundColor(const pVal: WideString); safecall;
function Get_hoverForegroundColor: WideString; safecall;
procedure Set_hoverForegroundColor(const pVal: WideString); safecall;
function Get_hoverFontStyle: WideString; safecall;
procedure Set_hoverFontStyle(const pVal: WideString); safecall;
function Get_value: WideString; safecall;
procedure Set_value(const pVal: WideString); safecall;
function Get_toolTip: WideString; safecall;
procedure Set_toolTip(const pVal: WideString); safecall;
function Get_disabledFontStyle: WideString; safecall;
procedure Set_disabledFontStyle(const pVal: WideString); safecall;
function Get_disabledForegroundColor: WideString; safecall;
procedure Set_disabledForegroundColor(const pVal: WideString); safecall;
function Get_disabledBackgroundColor: WideString; safecall;
procedure Set_disabledBackgroundColor(const pVal: WideString); safecall;
function Get_fontSmoothing: WordBool; safecall;
procedure Set_fontSmoothing(pVal: WordBool); safecall;
function Get_justification: WideString; safecall;
procedure Set_justification(const pVal: WideString); safecall;
function Get_wordWrap: WordBool; safecall;
procedure Set_wordWrap(pVal: WordBool); safecall;
function Get_cursor: WideString; safecall;
procedure Set_cursor(const pVal: WideString); safecall;
function Get_scrolling: WordBool; safecall;
procedure Set_scrolling(pVal: WordBool); safecall;
function Get_scrollingDirection: WideString; safecall;
procedure Set_scrollingDirection(const pVal: WideString); safecall;
function Get_scrollingDelay: SYSINT; safecall;
procedure Set_scrollingDelay(pVal: SYSINT); safecall;
function Get_scrollingAmount: SYSINT; safecall;
procedure Set_scrollingAmount(pVal: SYSINT); safecall;
function Get_textWidth: SYSINT; safecall;
function Get_onGlass: WordBool; safecall;
procedure Set_onGlass(pVal: WordBool); safecall;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property fontFace: WideString read Get_fontFace write Set_fontFace;
property fontStyle: WideString read Get_fontStyle write Set_fontStyle;
property fontSize: Integer read Get_fontSize write Set_fontSize;
property foregroundColor: WideString read Get_foregroundColor write Set_foregroundColor;
property hoverBackgroundColor: WideString read Get_hoverBackgroundColor write Set_hoverBackgroundColor;
property hoverForegroundColor: WideString read Get_hoverForegroundColor write Set_hoverForegroundColor;
property hoverFontStyle: WideString read Get_hoverFontStyle write Set_hoverFontStyle;
property value: WideString read Get_value write Set_value;
property toolTip: WideString read Get_toolTip write Set_toolTip;
property disabledFontStyle: WideString read Get_disabledFontStyle write Set_disabledFontStyle;
property disabledForegroundColor: WideString read Get_disabledForegroundColor write Set_disabledForegroundColor;
property disabledBackgroundColor: WideString read Get_disabledBackgroundColor write Set_disabledBackgroundColor;
property fontSmoothing: WordBool read Get_fontSmoothing write Set_fontSmoothing;
property justification: WideString read Get_justification write Set_justification;
property wordWrap: WordBool read Get_wordWrap write Set_wordWrap;
property cursor: WideString read Get_cursor write Set_cursor;
property scrolling: WordBool read Get_scrolling write Set_scrolling;
property scrollingDirection: WideString read Get_scrollingDirection write Set_scrollingDirection;
property scrollingDelay: SYSINT read Get_scrollingDelay write Set_scrollingDelay;
property scrollingAmount: SYSINT read Get_scrollingAmount write Set_scrollingAmount;
property textWidth: SYSINT read Get_textWidth;
property onGlass: WordBool read Get_onGlass write Set_onGlass;
end;
// *********************************************************************//
// DispIntf: IWMPTextCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {237DAC8E-0E32-11D3-A2E2-00C04F79F88E}
// *********************************************************************//
IWMPTextCtrlDisp = dispinterface
['{237DAC8E-0E32-11D3-A2E2-00C04F79F88E}']
property backgroundColor: WideString dispid 5201;
property fontFace: WideString dispid 5206;
property fontStyle: WideString dispid 5207;
property fontSize: Integer dispid 5208;
property foregroundColor: WideString dispid 5209;
property hoverBackgroundColor: WideString dispid 5210;
property hoverForegroundColor: WideString dispid 5211;
property hoverFontStyle: WideString dispid 5212;
property value: WideString dispid 5213;
property toolTip: WideString dispid 5214;
property disabledFontStyle: WideString dispid 5215;
property disabledForegroundColor: WideString dispid 5216;
property disabledBackgroundColor: WideString dispid 5217;
property fontSmoothing: WordBool dispid 5221;
property justification: WideString dispid 5222;
property wordWrap: WordBool dispid 5223;
property cursor: WideString dispid 5224;
property scrolling: WordBool dispid 5225;
property scrollingDirection: WideString dispid 5226;
property scrollingDelay: SYSINT dispid 5227;
property scrollingAmount: SYSINT dispid 5228;
property textWidth: SYSINT readonly dispid 5229;
property onGlass: WordBool dispid 5230;
end;
// *********************************************************************//
// Interface: ITaskCntrCtrl
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {891EADB1-1C45-48B0-B704-49A888DA98C4}
// *********************************************************************//
ITaskCntrCtrl = interface(IDispatch)
['{891EADB1-1C45-48B0-B704-49A888DA98C4}']
function Get_CurrentContainer: IUnknown; safecall;
procedure Set_CurrentContainer(const ppUnk: IUnknown); safecall;
procedure Activate; safecall;
property CurrentContainer: IUnknown read Get_CurrentContainer write Set_CurrentContainer;
end;
// *********************************************************************//
// DispIntf: ITaskCntrCtrlDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {891EADB1-1C45-48B0-B704-49A888DA98C4}
// *********************************************************************//
ITaskCntrCtrlDisp = dispinterface
['{891EADB1-1C45-48B0-B704-49A888DA98C4}']
property CurrentContainer: IUnknown dispid 1610743808;
procedure Activate; dispid 1610743810;
end;
// *********************************************************************//
// DispIntf: _WMPCoreEvents
// Flags: (4112) Hidden Dispatchable
// GUID: {D84CCA96-CCE2-11D2-9ECC-0000F8085981}
// *********************************************************************//
_WMPCoreEvents = dispinterface
['{D84CCA96-CCE2-11D2-9ECC-0000F8085981}']
procedure OpenStateChange(NewState: Integer); dispid 5001;
procedure PlayStateChange(NewState: Integer); dispid 5101;
procedure AudioLanguageChange(LangID: Integer); dispid 5102;
procedure StatusChange; dispid 5002;
procedure ScriptCommand(const scType: WideString; const Param: WideString); dispid 5301;
procedure NewStream; dispid 5403;
procedure Disconnect(Result: Integer); dispid 5401;
procedure Buffering(Start: WordBool); dispid 5402;
procedure Error; dispid 5501;
procedure Warning(WarningType: Integer; Param: Integer; const Description: WideString); dispid 5601;
procedure EndOfStream(Result: Integer); dispid 5201;
procedure PositionChange(oldPosition: Double; newPosition: Double); dispid 5202;
procedure MarkerHit(MarkerNum: Integer); dispid 5203;
procedure DurationUnitChange(NewDurationUnit: Integer); dispid 5204;
procedure CdromMediaChange(CdromNum: Integer); dispid 5701;
procedure PlaylistChange(const Playlist: IDispatch; change: WMPPlaylistChangeEventType); dispid 5801;
procedure CurrentPlaylistChange(change: WMPPlaylistChangeEventType); dispid 5804;
procedure CurrentPlaylistItemAvailable(const bstrItemName: WideString); dispid 5805;
procedure MediaChange(const Item: IDispatch); dispid 5802;
procedure CurrentMediaItemAvailable(const bstrItemName: WideString); dispid 5803;
procedure CurrentItemChange(const pdispMedia: IDispatch); dispid 5806;
procedure MediaCollectionChange; dispid 5807;
procedure MediaCollectionAttributeStringAdded(const bstrAttribName: WideString;
const bstrAttribVal: WideString); dispid 5808;
procedure MediaCollectionAttributeStringRemoved(const bstrAttribName: WideString;
const bstrAttribVal: WideString); dispid 5809;
procedure MediaCollectionAttributeStringChanged(const bstrAttribName: WideString;
const bstrOldAttribVal: WideString;
const bstrNewAttribVal: WideString); dispid 5820;
procedure PlaylistCollectionChange; dispid 5810;
procedure PlaylistCollectionPlaylistAdded(const bstrPlaylistName: WideString); dispid 5811;
procedure PlaylistCollectionPlaylistRemoved(const bstrPlaylistName: WideString); dispid 5812;
procedure PlaylistCollectionPlaylistSetAsDeleted(const bstrPlaylistName: WideString;
varfIsDeleted: WordBool); dispid 5818;
procedure ModeChange(const ModeName: WideString; NewValue: WordBool); dispid 5819;
procedure MediaError(const pMediaObject: IDispatch); dispid 5821;
procedure OpenPlaylistSwitch(const pItem: IDispatch); dispid 5823;
procedure DomainChange(const strDomain: WideString); dispid 5822;
procedure ansistringCollectionChange(const pdispStringCollection: IDispatch;
change: WMPStringCollectionChangeEventType;
lCollectionIndex: Integer); dispid 5824;
procedure MediaCollectionMediaAdded(const pdispMedia: IDispatch); dispid 5825;
procedure MediaCollectionMediaRemoved(const pdispMedia: IDispatch); dispid 5826;
end;
// *********************************************************************//
// Interface: IWMPGraphEventHandler
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6B550945-018F-11D3-B14A-00C04F79FAA6}
// *********************************************************************//
IWMPGraphEventHandler = interface(IDispatch)
['{6B550945-018F-11D3-B14A-00C04F79FAA6}']
procedure NotifyGraphStateChange(punkGraph: ULONG_PTR; lGraphState: Integer); safecall;
procedure AsyncNotifyGraphStateChange(punkGraph: ULONG_PTR; lGraphState: Integer); safecall;
procedure NotifyRateChange(punkGraph: ULONG_PTR; dRate: Double); safecall;
procedure NotifyPlaybackEnd(punkGraph: ULONG_PTR; const bstrQueuedUrl: WideString;
dwCurrentContext: ULONG_PTR); safecall;
procedure NotifyStreamEnd(punkGraph: ULONG_PTR); safecall;
procedure NotifyScriptCommand(punkGraph: ULONG_PTR; const bstrCommand: WideString;
const bstrParam: WideString); safecall;
procedure NotifyEarlyScriptCommand(punkGraph: ULONG_PTR; const bstrCommand: WideString;
const bstrParam: WideString; dTime: Double); safecall;
procedure NotifyMarkerHit(punkGraph: ULONG_PTR; lMarker: Integer); safecall;
procedure NotifyGraphError(punkGraph: ULONG_PTR; lErrMajor: Integer; lErrMinor: Integer;
lCondition: Integer; const bstrInfo: WideString;
const punkGraphData: IUnknown); safecall;
procedure NotifyAcquireCredentials(punkGraph: ULONG_PTR; const bstrRealm: WideString;
const bstrSite: WideString; const bstrUser: WideString;
const bstrPassword: WideString; var pdwFlags: LongWord;
out pfCancel: WordBool); safecall;
procedure NotifyUntrustedLicense(punkGraph: ULONG_PTR; const bstrURL: WideString;
out pfCancel: WordBool); safecall;
procedure NotifyLicenseDialog(punkGraph: ULONG_PTR; const bstrURL: WideString;
const bstrContent: WideString; var pPostData: Byte;
dwPostDataSize: LongWord; lResult: Integer); safecall;
procedure NotifyNeedsIndividualization(punkGraph: ULONG_PTR; out pfResult: WordBool); safecall;
procedure NotifyNewMetadata(punkGraph: ULONG_PTR); safecall;
procedure NotifyNewMediaCaps(punkGraph: ULONG_PTR); safecall;
procedure NotifyDisconnect(punkGraph: ULONG_PTR; lResult: Integer); safecall;
procedure NotifySave(punkGraph: ULONG_PTR; fStarted: Integer; lResult: Integer); safecall;
procedure NotifyDelayClose(punkGraph: ULONG_PTR; fDelay: WordBool); safecall;
procedure NotifyDVD(punkGraph: ULONG_PTR; lEventCode: Integer; lParam1: Integer;
lParam2: Integer); safecall;
procedure NotifyRequestAppThreadAction(punkGraph: ULONG_PTR; dwAction: LongWord); safecall;
procedure NotifyPrerollReady(punkGraph: ULONG_PTR); safecall;
procedure NotifyNewIcons(punkGraph: ULONG_PTR); safecall;
procedure NotifyStepComplete(punkGraph: ULONG_PTR); safecall;
procedure NotifyNewBitrate(punkGraph: ULONG_PTR; dwBitrate: LongWord); safecall;
procedure NotifyGraphCreationPreRender(punkGraph: ULONG_PTR; punkFilterGraph: ULONG_PTR;
punkCardeaEncConfig: ULONG_PTR; phrContinue: ULONG_PTR;
hEventToSet: ULONG_PTR); safecall;
procedure NotifyGraphCreationPostRender(punkGraph: ULONG_PTR; punkFilterGraph: ULONG_PTR;
phrContinue: ULONG_PTR; hEventToSet: ULONG_PTR); safecall;
procedure NotifyGraphUserEvent(punkGraph: ULONG_PTR; EventCode: Integer); safecall;
procedure NotifyRevocation(punkGraph: ULONG_PTR; out pfResult: WordBool); safecall;
procedure NotifyNeedsWMGraphIndividualization(punkGraph: ULONG_PTR; phWnd: ULONG_PTR;
hIndivEvent: ULONG_PTR; out pfCancel: WordBool;
out pfResult: WordBool); safecall;
procedure NotifyNeedsFullscreen(punkGraph: ULONG_PTR); safecall;
end;
// *********************************************************************//
// DispIntf: IWMPGraphEventHandlerDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {6B550945-018F-11D3-B14A-00C04F79FAA6}
// *********************************************************************//
IWMPGraphEventHandlerDisp = dispinterface
['{6B550945-018F-11D3-B14A-00C04F79FAA6}']
procedure NotifyGraphStateChange(punkGraph: ULONG_PTR; lGraphState: Integer); dispid 8151;
procedure AsyncNotifyGraphStateChange(punkGraph: ULONG_PTR; lGraphState: Integer); dispid 8173;
procedure NotifyRateChange(punkGraph: ULONG_PTR; dRate: Double); dispid 8153;
procedure NotifyPlaybackEnd(punkGraph: ULONG_PTR; const bstrQueuedUrl: WideString;
dwCurrentContext: ULONG_PTR); dispid 8157;
procedure NotifyStreamEnd(punkGraph: ULONG_PTR); dispid 8156;
procedure NotifyScriptCommand(punkGraph: ULONG_PTR; const bstrCommand: WideString;
const bstrParam: WideString); dispid 8158;
procedure NotifyEarlyScriptCommand(punkGraph: ULONG_PTR; const bstrCommand: WideString;
const bstrParam: WideString; dTime: Double); dispid 8172;
procedure NotifyMarkerHit(punkGraph: ULONG_PTR; lMarker: Integer); dispid 8159;
procedure NotifyGraphError(punkGraph: ULONG_PTR; lErrMajor: Integer; lErrMinor: Integer;
lCondition: Integer; const bstrInfo: WideString;
const punkGraphData: IUnknown); dispid 8160;
procedure NotifyAcquireCredentials(punkGraph: ULONG_PTR; const bstrRealm: WideString;
const bstrSite: WideString; const bstrUser: WideString;
const bstrPassword: WideString; var pdwFlags: LongWord;
out pfCancel: WordBool); dispid 8161;
procedure NotifyUntrustedLicense(punkGraph: ULONG_PTR; const bstrURL: WideString;
out pfCancel: WordBool); dispid 8178;
procedure NotifyLicenseDialog(punkGraph: ULONG_PTR; const bstrURL: WideString;
const bstrContent: WideString; var pPostData: Byte;
dwPostDataSize: LongWord; lResult: Integer); dispid 8162;
procedure NotifyNeedsIndividualization(punkGraph: ULONG_PTR; out pfResult: WordBool); dispid 8163;
procedure NotifyNewMetadata(punkGraph: ULONG_PTR); dispid 8165;
procedure NotifyNewMediaCaps(punkGraph: ULONG_PTR); dispid 8166;
procedure NotifyDisconnect(punkGraph: ULONG_PTR; lResult: Integer); dispid 8167;
procedure NotifySave(punkGraph: ULONG_PTR; fStarted: Integer; lResult: Integer); dispid 8168;
procedure NotifyDelayClose(punkGraph: ULONG_PTR; fDelay: WordBool); dispid 8169;
procedure NotifyDVD(punkGraph: ULONG_PTR; lEventCode: Integer; lParam1: Integer;
lParam2: Integer); dispid 8170;
procedure NotifyRequestAppThreadAction(punkGraph: ULONG_PTR; dwAction: LongWord); dispid 8171;
procedure NotifyPrerollReady(punkGraph: ULONG_PTR); dispid 8174;
procedure NotifyNewIcons(punkGraph: ULONG_PTR); dispid 8177;
procedure NotifyStepComplete(punkGraph: ULONG_PTR); dispid 8179;
procedure NotifyNewBitrate(punkGraph: ULONG_PTR; dwBitrate: LongWord); dispid 8180;
procedure NotifyGraphCreationPreRender(punkGraph: ULONG_PTR; punkFilterGraph: ULONG_PTR;
punkCardeaEncConfig: ULONG_PTR; phrContinue: ULONG_PTR;
hEventToSet: ULONG_PTR); dispid 8181;
procedure NotifyGraphCreationPostRender(punkGraph: ULONG_PTR; punkFilterGraph: ULONG_PTR;
phrContinue: ULONG_PTR; hEventToSet: ULONG_PTR); dispid 8182;
procedure NotifyGraphUserEvent(punkGraph: ULONG_PTR; EventCode: Integer); dispid 8186;
procedure NotifyRevocation(punkGraph: ULONG_PTR; out pfResult: WordBool); dispid 8183;
procedure NotifyNeedsWMGraphIndividualization(punkGraph: ULONG_PTR; phWnd: ULONG_PTR;
hIndivEvent: ULONG_PTR; out pfCancel: WordBool;
out pfResult: WordBool); dispid 8184;
procedure NotifyNeedsFullscreen(punkGraph: ULONG_PTR); dispid 8185;
end;
// *********************************************************************//
// Interface: IBattery
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F8578BFA-CD8F-4CE1-A684-5B7E85FCA7DC}
// *********************************************************************//
IBattery = interface(IDispatch)
['{F8578BFA-CD8F-4CE1-A684-5B7E85FCA7DC}']
function Get_presetCount: Integer; safecall;
function Get_preset(nIndex: Integer): IDispatch; safecall;
property presetCount: Integer read Get_presetCount;
property preset[nIndex: Integer]: IDispatch read Get_preset;
end;
// *********************************************************************//
// DispIntf: IBatteryDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F8578BFA-CD8F-4CE1-A684-5B7E85FCA7DC}
// *********************************************************************//
IBatteryDisp = dispinterface
['{F8578BFA-CD8F-4CE1-A684-5B7E85FCA7DC}']
property presetCount: Integer readonly dispid 1;
property preset[nIndex: Integer]: IDispatch readonly dispid 2;
end;
// *********************************************************************//
// Interface: IBatteryPreset
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {40C6BDE7-9C90-49D4-AD20-BEF81A6C5F22}
// *********************************************************************//
IBatteryPreset = interface(IDispatch)
['{40C6BDE7-9C90-49D4-AD20-BEF81A6C5F22}']
function Get_title: WideString; safecall;
procedure Set_title(const pVal: WideString); safecall;
property title: WideString read Get_title write Set_title;
end;
// *********************************************************************//
// DispIntf: IBatteryPresetDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {40C6BDE7-9C90-49D4-AD20-BEF81A6C5F22}
// *********************************************************************//
IBatteryPresetDisp = dispinterface
['{40C6BDE7-9C90-49D4-AD20-BEF81A6C5F22}']
property title: WideString dispid 1;
end;
// *********************************************************************//
// Interface: IBatteryRandomPreset
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F85E2D65-207D-48DB-84B1-915E1735DB17}
// *********************************************************************//
IBatteryRandomPreset = interface(IBatteryPreset)
['{F85E2D65-207D-48DB-84B1-915E1735DB17}']
end;
// *********************************************************************//
// DispIntf: IBatteryRandomPresetDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F85E2D65-207D-48DB-84B1-915E1735DB17}
// *********************************************************************//
IBatteryRandomPresetDisp = dispinterface
['{F85E2D65-207D-48DB-84B1-915E1735DB17}']
property title: WideString dispid 1;
end;
// *********************************************************************//
// Interface: IBatterySavedPreset
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {876E7208-0172-4EBB-B08B-2E1D30DFE44C}
// *********************************************************************//
IBatterySavedPreset = interface(IBatteryPreset)
['{876E7208-0172-4EBB-B08B-2E1D30DFE44C}']
end;
// *********************************************************************//
// DispIntf: IBatterySavedPresetDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {876E7208-0172-4EBB-B08B-2E1D30DFE44C}
// *********************************************************************//
IBatterySavedPresetDisp = dispinterface
['{876E7208-0172-4EBB-B08B-2E1D30DFE44C}']
property title: WideString dispid 1;
end;
// *********************************************************************//
// Interface: IBarsEffect
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {33E9291A-F6A9-11D2-9435-00A0C92A2F2D}
// *********************************************************************//
IBarsEffect = interface(IDispatch)
['{33E9291A-F6A9-11D2-9435-00A0C92A2F2D}']
function Get_displayMode: Integer; safecall;
procedure Set_displayMode(pVal: Integer); safecall;
function Get_showPeaks: WordBool; safecall;
procedure Set_showPeaks(pVal: WordBool); safecall;
function Get_peakHangTime: Integer; safecall;
procedure Set_peakHangTime(pVal: Integer); safecall;
function Get_peakFallbackAcceleration: Single; safecall;
procedure Set_peakFallbackAcceleration(pVal: Single); safecall;
function Get_peakFallbackSpeed: Single; safecall;
procedure Set_peakFallbackSpeed(pVal: Single); safecall;
function Get_levelFallbackAcceleration: Single; safecall;
procedure Set_levelFallbackAcceleration(pVal: Single); safecall;
function Get_levelFallbackSpeed: Single; safecall;
procedure Set_levelFallbackSpeed(pVal: Single); safecall;
function Get_backgroundColor: WideString; safecall;
procedure Set_backgroundColor(const pVal: WideString); safecall;
function Get_levelColor: WideString; safecall;
procedure Set_levelColor(const pVal: WideString); safecall;
function Get_peakColor: WideString; safecall;
procedure Set_peakColor(const pVal: WideString); safecall;
function Get_horizontalSpacing: Integer; safecall;
procedure Set_horizontalSpacing(pVal: Integer); safecall;
function Get_levelWidth: Integer; safecall;
procedure Set_levelWidth(pVal: Integer); safecall;
function Get_levelScale: Single; safecall;
procedure Set_levelScale(pVal: Single); safecall;
function Get_fadeRate: Integer; safecall;
procedure Set_fadeRate(pVal: Integer); safecall;
function Get_fadeMode: Integer; safecall;
procedure Set_fadeMode(pVal: Integer); safecall;
function Get_transparent: WordBool; safecall;
procedure Set_transparent(pVal: WordBool); safecall;
property displayMode: Integer read Get_displayMode write Set_displayMode;
property showPeaks: WordBool read Get_showPeaks write Set_showPeaks;
property peakHangTime: Integer read Get_peakHangTime write Set_peakHangTime;
property peakFallbackAcceleration: Single read Get_peakFallbackAcceleration write Set_peakFallbackAcceleration;
property peakFallbackSpeed: Single read Get_peakFallbackSpeed write Set_peakFallbackSpeed;
property levelFallbackAcceleration: Single read Get_levelFallbackAcceleration write Set_levelFallbackAcceleration;
property levelFallbackSpeed: Single read Get_levelFallbackSpeed write Set_levelFallbackSpeed;
property backgroundColor: WideString read Get_backgroundColor write Set_backgroundColor;
property levelColor: WideString read Get_levelColor write Set_levelColor;
property peakColor: WideString read Get_peakColor write Set_peakColor;
property horizontalSpacing: Integer read Get_horizontalSpacing write Set_horizontalSpacing;
property levelWidth: Integer read Get_levelWidth write Set_levelWidth;
property levelScale: Single read Get_levelScale write Set_levelScale;
property fadeRate: Integer read Get_fadeRate write Set_fadeRate;
property fadeMode: Integer read Get_fadeMode write Set_fadeMode;
property transparent: WordBool read Get_transparent write Set_transparent;
end;
// *********************************************************************//
// DispIntf: IBarsEffectDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {33E9291A-F6A9-11D2-9435-00A0C92A2F2D}
// *********************************************************************//
IBarsEffectDisp = dispinterface
['{33E9291A-F6A9-11D2-9435-00A0C92A2F2D}']
property displayMode: Integer dispid 8000;
property showPeaks: WordBool dispid 8001;
property peakHangTime: Integer dispid 8002;
property peakFallbackAcceleration: Single dispid 8003;
property peakFallbackSpeed: Single dispid 8004;
property levelFallbackAcceleration: Single dispid 8005;
property levelFallbackSpeed: Single dispid 8006;
property backgroundColor: WideString dispid 8007;
property levelColor: WideString dispid 8008;
property peakColor: WideString dispid 8009;
property horizontalSpacing: Integer dispid 8010;
property levelWidth: Integer dispid 8012;
property levelScale: Single dispid 8013;
property fadeRate: Integer dispid 8014;
property fadeMode: Integer dispid 8015;
property transparent: WordBool dispid 8016;
end;
// *********************************************************************//
// Interface: IWMPExternal
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E2CC638C-FD2C-409B-A1EA-5DDB72DC8E84}
// *********************************************************************//
IWMPExternal = interface(IDispatch)
['{E2CC638C-FD2C-409B-A1EA-5DDB72DC8E84}']
function Get_version: WideString; safecall;
function Get_appColorLight: WideString; safecall;
procedure Set_OnColorChange(const Param1: IDispatch); safecall;
property version: WideString read Get_version;
property appColorLight: WideString read Get_appColorLight;
property OnColorChange: IDispatch write Set_OnColorChange;
end;
// *********************************************************************//
// DispIntf: IWMPExternalDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E2CC638C-FD2C-409B-A1EA-5DDB72DC8E84}
// *********************************************************************//
IWMPExternalDisp = dispinterface
['{E2CC638C-FD2C-409B-A1EA-5DDB72DC8E84}']
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPExternalColors
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D10CCDFF-472D-498C-B5FE-3630E5405E0A}
// *********************************************************************//
IWMPExternalColors = interface(IWMPExternal)
['{D10CCDFF-472D-498C-B5FE-3630E5405E0A}']
function Get_appColorMedium: WideString; safecall;
function Get_appColorDark: WideString; safecall;
function Get_appColorButtonHighlight: WideString; safecall;
function Get_appColorButtonShadow: WideString; safecall;
function Get_appColorButtonHoverFace: WideString; safecall;
property appColorMedium: WideString read Get_appColorMedium;
property appColorDark: WideString read Get_appColorDark;
property appColorButtonHighlight: WideString read Get_appColorButtonHighlight;
property appColorButtonShadow: WideString read Get_appColorButtonShadow;
property appColorButtonHoverFace: WideString read Get_appColorButtonHoverFace;
end;
// *********************************************************************//
// DispIntf: IWMPExternalColorsDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {D10CCDFF-472D-498C-B5FE-3630E5405E0A}
// *********************************************************************//
IWMPExternalColorsDisp = dispinterface
['{D10CCDFF-472D-498C-B5FE-3630E5405E0A}']
property appColorMedium: WideString readonly dispid 10013;
property appColorDark: WideString readonly dispid 10014;
property appColorButtonHighlight: WideString readonly dispid 10015;
property appColorButtonShadow: WideString readonly dispid 10016;
property appColorButtonHoverFace: WideString readonly dispid 10017;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPSubscriptionServiceLimited
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {54DF358E-CF38-4010-99F1-F44B0E9000E5}
// *********************************************************************//
IWMPSubscriptionServiceLimited = interface(IWMPExternalColors)
['{54DF358E-CF38-4010-99F1-F44B0E9000E5}']
procedure NavigateTaskPaneURL(const bstrKeyName: WideString; const bstrTaskPane: WideString;
const bstrParams: WideString); safecall;
procedure Set_SelectedTaskPane(const bstrTaskPane: WideString); safecall;
function Get_SelectedTaskPane: WideString; safecall;
property SelectedTaskPane: WideString read Get_SelectedTaskPane write Set_SelectedTaskPane;
end;
// *********************************************************************//
// DispIntf: IWMPSubscriptionServiceLimitedDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {54DF358E-CF38-4010-99F1-F44B0E9000E5}
// *********************************************************************//
IWMPSubscriptionServiceLimitedDisp = dispinterface
['{54DF358E-CF38-4010-99F1-F44B0E9000E5}']
procedure NavigateTaskPaneURL(const bstrKeyName: WideString; const bstrTaskPane: WideString;
const bstrParams: WideString); dispid 10026;
property SelectedTaskPane: WideString dispid 10027;
property appColorMedium: WideString readonly dispid 10013;
property appColorDark: WideString readonly dispid 10014;
property appColorButtonHighlight: WideString readonly dispid 10015;
property appColorButtonShadow: WideString readonly dispid 10016;
property appColorButtonHoverFace: WideString readonly dispid 10017;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPSubscriptionServiceExternal
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2E922378-EE70-4CEB-BBAB-CE7CE4A04816}
// *********************************************************************//
IWMPSubscriptionServiceExternal = interface(IWMPSubscriptionServiceLimited)
['{2E922378-EE70-4CEB-BBAB-CE7CE4A04816}']
function Get_DownloadManager: IWMPDownloadManager; safecall;
property DownloadManager: IWMPDownloadManager read Get_DownloadManager;
end;
// *********************************************************************//
// DispIntf: IWMPSubscriptionServiceExternalDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2E922378-EE70-4CEB-BBAB-CE7CE4A04816}
// *********************************************************************//
IWMPSubscriptionServiceExternalDisp = dispinterface
['{2E922378-EE70-4CEB-BBAB-CE7CE4A04816}']
property DownloadManager: IWMPDownloadManager readonly dispid 10009;
procedure NavigateTaskPaneURL(const bstrKeyName: WideString; const bstrTaskPane: WideString;
const bstrParams: WideString); dispid 10026;
property SelectedTaskPane: WideString dispid 10027;
property appColorMedium: WideString readonly dispid 10013;
property appColorDark: WideString readonly dispid 10014;
property appColorButtonHighlight: WideString readonly dispid 10015;
property appColorButtonShadow: WideString readonly dispid 10016;
property appColorButtonHoverFace: WideString readonly dispid 10017;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPDownloadManager
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E15E9AD1-8F20-4CC4-9EC7-1A328CA86A0D}
// *********************************************************************//
IWMPDownloadManager = interface(IDispatch)
['{E15E9AD1-8F20-4CC4-9EC7-1A328CA86A0D}']
function getDownloadCollection(lCollectionId: Integer): IWMPDownloadCollection; safecall;
function createDownloadCollection: IWMPDownloadCollection; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPDownloadManagerDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E15E9AD1-8F20-4CC4-9EC7-1A328CA86A0D}
// *********************************************************************//
IWMPDownloadManagerDisp = dispinterface
['{E15E9AD1-8F20-4CC4-9EC7-1A328CA86A0D}']
function getDownloadCollection(lCollectionId: Integer): IWMPDownloadCollection; dispid 1151;
function createDownloadCollection: IWMPDownloadCollection; dispid 1152;
end;
// *********************************************************************//
// Interface: IWMPDownloadCollection
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0A319C7F-85F9-436C-B88E-82FD88000E1C}
// *********************************************************************//
IWMPDownloadCollection = interface(IDispatch)
['{0A319C7F-85F9-436C-B88E-82FD88000E1C}']
function Get_ID: Integer; safecall;
function Get_count: Integer; safecall;
function Item(lItem: Integer): IWMPDownloadItem2; safecall;
function startDownload(const bstrSourceURL: WideString; const bstrType: WideString): IWMPDownloadItem2; safecall;
procedure removeItem(lItem: Integer); safecall;
procedure clear; safecall;
property ID: Integer read Get_ID;
property count: Integer read Get_count;
end;
// *********************************************************************//
// DispIntf: IWMPDownloadCollectionDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0A319C7F-85F9-436C-B88E-82FD88000E1C}
// *********************************************************************//
IWMPDownloadCollectionDisp = dispinterface
['{0A319C7F-85F9-436C-B88E-82FD88000E1C}']
property ID: Integer readonly dispid 1201;
property count: Integer readonly dispid 1202;
function Item(lItem: Integer): IWMPDownloadItem2; dispid 1203;
function startDownload(const bstrSourceURL: WideString; const bstrType: WideString): IWMPDownloadItem2; dispid 1204;
procedure removeItem(lItem: Integer); dispid 1205;
procedure clear; dispid 1206;
end;
// *********************************************************************//
// Interface: IWMPDownloadItem
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {C9470E8E-3F6B-46A9-A0A9-452815C34297}
// *********************************************************************//
IWMPDownloadItem = interface(IDispatch)
['{C9470E8E-3F6B-46A9-A0A9-452815C34297}']
function Get_sourceURL: WideString; safecall;
function Get_size: Integer; safecall;
function Get_type_: WideString; safecall;
function Get_progress: Integer; safecall;
function Get_downloadState: WMPSubscriptionDownloadState; safecall;
procedure pause; safecall;
procedure resume; safecall;
procedure cancel; safecall;
property sourceURL: WideString read Get_sourceURL;
property size: Integer read Get_size;
property type_: WideString read Get_type_;
property progress: Integer read Get_progress;
property downloadState: WMPSubscriptionDownloadState read Get_downloadState;
end;
// *********************************************************************//
// DispIntf: IWMPDownloadItemDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {C9470E8E-3F6B-46A9-A0A9-452815C34297}
// *********************************************************************//
IWMPDownloadItemDisp = dispinterface
['{C9470E8E-3F6B-46A9-A0A9-452815C34297}']
property sourceURL: WideString readonly dispid 1251;
property size: Integer readonly dispid 1252;
property type_: WideString readonly dispid 1253;
property progress: Integer readonly dispid 1254;
property downloadState: WMPSubscriptionDownloadState readonly dispid 1255;
procedure pause; dispid 1256;
procedure resume; dispid 1257;
procedure cancel; dispid 1258;
end;
// *********************************************************************//
// Interface: IWMPDownloadItem2
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {9FBB3336-6DA3-479D-B8FF-67D46E20A987}
// *********************************************************************//
IWMPDownloadItem2 = interface(IWMPDownloadItem)
['{9FBB3336-6DA3-479D-B8FF-67D46E20A987}']
function getItemInfo(const bstrItemName: WideString): WideString; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPDownloadItem2Disp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {9FBB3336-6DA3-479D-B8FF-67D46E20A987}
// *********************************************************************//
IWMPDownloadItem2Disp = dispinterface
['{9FBB3336-6DA3-479D-B8FF-67D46E20A987}']
function getItemInfo(const bstrItemName: WideString): WideString; dispid 1301;
property sourceURL: WideString readonly dispid 1251;
property size: Integer readonly dispid 1252;
property type_: WideString readonly dispid 1253;
property progress: Integer readonly dispid 1254;
property downloadState: WMPSubscriptionDownloadState readonly dispid 1255;
procedure pause; dispid 1256;
procedure resume; dispid 1257;
procedure cancel; dispid 1258;
end;
// *********************************************************************//
// Interface: IWMPSubscriptionServicePlayMedia
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5F0248C1-62B3-42D7-B927-029119E6AD14}
// *********************************************************************//
IWMPSubscriptionServicePlayMedia = interface(IWMPSubscriptionServiceLimited)
['{5F0248C1-62B3-42D7-B927-029119E6AD14}']
procedure playMedia(const bstrURL: WideString); safecall;
end;
// *********************************************************************//
// DispIntf: IWMPSubscriptionServicePlayMediaDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5F0248C1-62B3-42D7-B927-029119E6AD14}
// *********************************************************************//
IWMPSubscriptionServicePlayMediaDisp = dispinterface
['{5F0248C1-62B3-42D7-B927-029119E6AD14}']
procedure playMedia(const bstrURL: WideString); dispid 10004;
procedure NavigateTaskPaneURL(const bstrKeyName: WideString; const bstrTaskPane: WideString;
const bstrParams: WideString); dispid 10026;
property SelectedTaskPane: WideString dispid 10027;
property appColorMedium: WideString readonly dispid 10013;
property appColorDark: WideString readonly dispid 10014;
property appColorButtonHighlight: WideString readonly dispid 10015;
property appColorButtonShadow: WideString readonly dispid 10016;
property appColorButtonHoverFace: WideString readonly dispid 10017;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPDiscoExternal
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A915CEA2-72DF-41E1-A576-EF0BAE5E5169}
// *********************************************************************//
IWMPDiscoExternal = interface(IWMPSubscriptionServiceExternal)
['{A915CEA2-72DF-41E1-A576-EF0BAE5E5169}']
procedure Set_OnLoginChange(const Param1: IDispatch); safecall;
function Get_userLoggedIn: WordBool; safecall;
procedure attemptLogin; safecall;
function Get_accountType: WideString; safecall;
procedure Set_OnViewChange(const Param1: IDispatch); safecall;
procedure changeView(const bstrLibraryLocationType: WideString;
const bstrLibraryLocationID: WideString; const bstrFilter: WideString;
const bstrViewParams: WideString); safecall;
procedure changeViewOnlineList(const bstrLibraryLocationType: WideString;
const bstrLibraryLocationID: WideString;
const bstrParams: WideString;
const bstrFriendlyName: WideString;
const bstrListType: WideString; const bstrViewMode: WideString); safecall;
function Get_libraryLocationType: WideString; safecall;
function Get_libraryLocationID: WideString; safecall;
function Get_selectedItemType: WideString; safecall;
function Get_selectedItemID: WideString; safecall;
function Get_filter: WideString; safecall;
function Get_task: WideString; safecall;
function Get_viewParameters: WideString; safecall;
procedure cancelNavigate; safecall;
procedure showPopup(lPopupIndex: Integer; const bstrParameters: WideString); safecall;
procedure addToBasket(const bstrViewType: WideString; const bstrViewIDs: WideString); safecall;
function Get_basketTitle: WideString; safecall;
procedure play(const bstrLibraryLocationType: WideString;
const bstrLibraryLocationIDs: WideString); safecall;
procedure download(const bstrViewType: WideString; const bstrViewIDs: WideString); safecall;
procedure buy(const bstrViewType: WideString; const bstrViewIDs: WideString); safecall;
procedure saveCurrentViewToLibrary(const bstrFriendlyListType: WideString; fDynamic: WordBool); safecall;
procedure authenticate(lAuthenticationIndex: Integer); safecall;
procedure sendMessage(const bstrMsg: WideString; const bstrParam: WideString); safecall;
procedure Set_OnSendMessageComplete(const Param1: IDispatch); safecall;
procedure Set_ignoreIEHistory(Param1: WordBool); safecall;
function Get_pluginRunning: WordBool; safecall;
function Get_templateBeingDisplayedInLocalLibrary: WordBool; safecall;
procedure Set_OnChangeViewError(const Param1: IDispatch); safecall;
procedure Set_OnChangeViewOnlineListError(const Param1: IDispatch); safecall;
property OnLoginChange: IDispatch write Set_OnLoginChange;
property userLoggedIn: WordBool read Get_userLoggedIn;
property accountType: WideString read Get_accountType;
property OnViewChange: IDispatch write Set_OnViewChange;
property libraryLocationType: WideString read Get_libraryLocationType;
property libraryLocationID: WideString read Get_libraryLocationID;
property selectedItemType: WideString read Get_selectedItemType;
property selectedItemID: WideString read Get_selectedItemID;
property filter: WideString read Get_filter;
property task: WideString read Get_task;
property viewParameters: WideString read Get_viewParameters;
property basketTitle: WideString read Get_basketTitle;
property OnSendMessageComplete: IDispatch write Set_OnSendMessageComplete;
property ignoreIEHistory: WordBool write Set_ignoreIEHistory;
property pluginRunning: WordBool read Get_pluginRunning;
property templateBeingDisplayedInLocalLibrary: WordBool read Get_templateBeingDisplayedInLocalLibrary;
property OnChangeViewError: IDispatch write Set_OnChangeViewError;
property OnChangeViewOnlineListError: IDispatch write Set_OnChangeViewOnlineListError;
end;
// *********************************************************************//
// DispIntf: IWMPDiscoExternalDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A915CEA2-72DF-41E1-A576-EF0BAE5E5169}
// *********************************************************************//
IWMPDiscoExternalDisp = dispinterface
['{A915CEA2-72DF-41E1-A576-EF0BAE5E5169}']
property OnLoginChange: IDispatch writeonly dispid 10028;
property userLoggedIn: WordBool readonly dispid 10029;
procedure attemptLogin; dispid 10030;
property accountType: WideString readonly dispid 10031;
property OnViewChange: IDispatch writeonly dispid 10032;
procedure changeView(const bstrLibraryLocationType: WideString;
const bstrLibraryLocationID: WideString; const bstrFilter: WideString;
const bstrViewParams: WideString); dispid 10033;
procedure changeViewOnlineList(const bstrLibraryLocationType: WideString;
const bstrLibraryLocationID: WideString;
const bstrParams: WideString;
const bstrFriendlyName: WideString;
const bstrListType: WideString; const bstrViewMode: WideString); dispid 10034;
property libraryLocationType: WideString readonly dispid 10035;
property libraryLocationID: WideString readonly dispid 10036;
property selectedItemType: WideString readonly dispid 10037;
property selectedItemID: WideString readonly dispid 10038;
property filter: WideString readonly dispid 10039;
property task: WideString readonly dispid 10040;
property viewParameters: WideString readonly dispid 10041;
procedure cancelNavigate; dispid 10042;
procedure showPopup(lPopupIndex: Integer; const bstrParameters: WideString); dispid 10043;
procedure addToBasket(const bstrViewType: WideString; const bstrViewIDs: WideString); dispid 10044;
property basketTitle: WideString readonly dispid 10045;
procedure play(const bstrLibraryLocationType: WideString;
const bstrLibraryLocationIDs: WideString); dispid 10046;
procedure download(const bstrViewType: WideString; const bstrViewIDs: WideString); dispid 10047;
procedure buy(const bstrViewType: WideString; const bstrViewIDs: WideString); dispid 10048;
procedure saveCurrentViewToLibrary(const bstrFriendlyListType: WideString; fDynamic: WordBool); dispid 10049;
procedure authenticate(lAuthenticationIndex: Integer); dispid 10050;
procedure sendMessage(const bstrMsg: WideString; const bstrParam: WideString); dispid 10051;
property OnSendMessageComplete: IDispatch writeonly dispid 10052;
property ignoreIEHistory: WordBool writeonly dispid 10053;
property pluginRunning: WordBool readonly dispid 10054;
property templateBeingDisplayedInLocalLibrary: WordBool readonly dispid 10055;
property OnChangeViewError: IDispatch writeonly dispid 10056;
property OnChangeViewOnlineListError: IDispatch writeonly dispid 10057;
property DownloadManager: IWMPDownloadManager readonly dispid 10009;
procedure NavigateTaskPaneURL(const bstrKeyName: WideString; const bstrTaskPane: WideString;
const bstrParams: WideString); dispid 10026;
property SelectedTaskPane: WideString dispid 10027;
property appColorMedium: WideString readonly dispid 10013;
property appColorDark: WideString readonly dispid 10014;
property appColorButtonHighlight: WideString readonly dispid 10015;
property appColorButtonShadow: WideString readonly dispid 10016;
property appColorButtonHoverFace: WideString readonly dispid 10017;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPCDDVDWizardExternal
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2D7EF888-1D3C-484A-A906-9F49D99BB344}
// *********************************************************************//
IWMPCDDVDWizardExternal = interface(IWMPExternalColors)
['{2D7EF888-1D3C-484A-A906-9F49D99BB344}']
procedure WriteNames(const bstrTOC: WideString; const bstrMetadata: WideString); safecall;
procedure ReturnToMainTask; safecall;
procedure WriteNamesEx(type_: WMP_WRITENAMESEX_TYPE; const bstrTypeId: WideString;
const bstrMetadata: WideString; fRenameRegroupFiles: WordBool); safecall;
function GetMDQByRequestID(const bstrRequestID: WideString): WideString; safecall;
procedure EditMetadata; safecall;
function IsMetadataAvailableForEdit: WordBool; safecall;
procedure BuyCD(const bstrTitle: WideString; const bstrArtist: WideString;
const bstrAlbum: WideString; const bstrUFID: WideString;
const bstrWMID: WideString); safecall;
end;
// *********************************************************************//
// DispIntf: IWMPCDDVDWizardExternalDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {2D7EF888-1D3C-484A-A906-9F49D99BB344}
// *********************************************************************//
IWMPCDDVDWizardExternalDisp = dispinterface
['{2D7EF888-1D3C-484A-A906-9F49D99BB344}']
procedure WriteNames(const bstrTOC: WideString; const bstrMetadata: WideString); dispid 10001;
procedure ReturnToMainTask; dispid 10002;
procedure WriteNamesEx(type_: WMP_WRITENAMESEX_TYPE; const bstrTypeId: WideString;
const bstrMetadata: WideString; fRenameRegroupFiles: WordBool); dispid 10007;
function GetMDQByRequestID(const bstrRequestID: WideString): WideString; dispid 10008;
procedure EditMetadata; dispid 10011;
function IsMetadataAvailableForEdit: WordBool; dispid 10010;
procedure BuyCD(const bstrTitle: WideString; const bstrArtist: WideString;
const bstrAlbum: WideString; const bstrUFID: WideString;
const bstrWMID: WideString); dispid 10023;
property appColorMedium: WideString readonly dispid 10013;
property appColorDark: WideString readonly dispid 10014;
property appColorButtonHighlight: WideString readonly dispid 10015;
property appColorButtonShadow: WideString readonly dispid 10016;
property appColorButtonHoverFace: WideString readonly dispid 10017;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPBaseExternal
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F81B2A59-02BC-4003-8B2F-C124AF66FC66}
// *********************************************************************//
IWMPBaseExternal = interface(IWMPExternal)
['{F81B2A59-02BC-4003-8B2F-C124AF66FC66}']
end;
// *********************************************************************//
// DispIntf: IWMPBaseExternalDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {F81B2A59-02BC-4003-8B2F-C124AF66FC66}
// *********************************************************************//
IWMPBaseExternalDisp = dispinterface
['{F81B2A59-02BC-4003-8B2F-C124AF66FC66}']
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPOfflineExternal
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {3148E685-B243-423D-8341-8480D6EFF674}
// *********************************************************************//
IWMPOfflineExternal = interface(IWMPExternal)
['{3148E685-B243-423D-8341-8480D6EFF674}']
procedure forceOnline; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPOfflineExternalDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {3148E685-B243-423D-8341-8480D6EFF674}
// *********************************************************************//
IWMPOfflineExternalDisp = dispinterface
['{3148E685-B243-423D-8341-8480D6EFF674}']
procedure forceOnline; dispid 10025;
property version: WideString readonly dispid 10005;
property appColorLight: WideString readonly dispid 10012;
property OnColorChange: IDispatch writeonly dispid 10018;
end;
// *********************************************************************//
// Interface: IWMPRemoteUPnPService
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {17E5DC63-E296-4EDE-B9CC-CF57D18ED10E}
// *********************************************************************//
IWMPRemoteUPnPService = interface(IDispatch)
['{17E5DC63-E296-4EDE-B9CC-CF57D18ED10E}']
procedure RegisterEvent(const bstrVariableName: WideString; const pdispJScriptCode: IDispatch); safecall;
procedure UnregisterEvent(const bstrVariableName: WideString); safecall;
function ID: WideString; safecall;
procedure InvokeAction(const bstrActionName: WideString; const pdispInArgs: IDispatch;
const pdispOutArgs: IDispatch; const pdispRetVals: IDispatch); safecall;
function LastTransportStatus: Integer; safecall;
function QueryStateVariable(const bstrVariableName: WideString): OleVariant; safecall;
function ServiceTypeIdentifier: WideString; safecall;
end;
// *********************************************************************//
// DispIntf: IWMPRemoteUPnPServiceDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {17E5DC63-E296-4EDE-B9CC-CF57D18ED10E}
// *********************************************************************//
IWMPRemoteUPnPServiceDisp = dispinterface
['{17E5DC63-E296-4EDE-B9CC-CF57D18ED10E}']
procedure RegisterEvent(const bstrVariableName: WideString; const pdispJScriptCode: IDispatch); dispid 10121;
procedure UnregisterEvent(const bstrVariableName: WideString); dispid 10122;
function ID: WideString; dispid 10123;
procedure InvokeAction(const bstrActionName: WideString; const pdispInArgs: IDispatch;
const pdispOutArgs: IDispatch; const pdispRetVals: IDispatch); dispid 10124;
function LastTransportStatus: Integer; dispid 10125;
function QueryStateVariable(const bstrVariableName: WideString): OleVariant; dispid 10126;
function ServiceTypeIdentifier: WideString; dispid 10127;
end;
// *********************************************************************//
// Interface: IWMPRemoteUPnPDevice
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {76F13F00-6E17-4D98-BE2D-D2A84CFF5BFD}
// *********************************************************************//
IWMPRemoteUPnPDevice = interface(IDispatch)
['{76F13F00-6E17-4D98-BE2D-D2A84CFF5BFD}']
function friendlyName: WideString; safecall;
function FindService(const bstrService: WideString): IDispatch; safecall;
procedure getDevice(var ppDevice: IUnknown); safecall;
end;
// *********************************************************************//
// DispIntf: IWMPRemoteUPnPDeviceDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {76F13F00-6E17-4D98-BE2D-D2A84CFF5BFD}
// *********************************************************************//
IWMPRemoteUPnPDeviceDisp = dispinterface
['{76F13F00-6E17-4D98-BE2D-D2A84CFF5BFD}']
function friendlyName: WideString; dispid 10131;
function FindService(const bstrService: WideString): IDispatch; dispid 10132;
procedure getDevice(var ppDevice: IUnknown); dispid 10133;
end;
// *********************************************************************//
// Interface: IWMPRemoteDeviceController
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {968F36CA-CB43-4F6A-A03B-66A9C05A93EE}
// *********************************************************************//
IWMPRemoteDeviceController = interface(IDispatch)
['{968F36CA-CB43-4F6A-A03B-66A9C05A93EE}']
procedure RegisterDeviceSwitch(const pdispJScriptFunction: IDispatch); safecall;
procedure SyncDeviceList; safecall;
function Get_numberDevices: Integer; safecall;
function getDevice(lIndex: Integer): IDispatch; safecall;
procedure SwitchUIToMatchDevice(const pdispDevice: IDispatch); safecall;
property numberDevices: Integer read Get_numberDevices;
end;
// *********************************************************************//
// DispIntf: IWMPRemoteDeviceControllerDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {968F36CA-CB43-4F6A-A03B-66A9C05A93EE}
// *********************************************************************//
IWMPRemoteDeviceControllerDisp = dispinterface
['{968F36CA-CB43-4F6A-A03B-66A9C05A93EE}']
procedure RegisterDeviceSwitch(const pdispJScriptFunction: IDispatch); dispid 10101;
procedure SyncDeviceList; dispid 10102;
property numberDevices: Integer readonly dispid 10103;
function getDevice(lIndex: Integer): IDispatch; dispid 10104;
procedure SwitchUIToMatchDevice(const pdispDevice: IDispatch); dispid 10106;
end;
// *********************************************************************//
// Interface: IUPnPService_IWMPUPnPAVTransportDual
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0EA1DE14-E288-4958-A23C-942634A27EB5}
// *********************************************************************//
IUPnPService_IWMPUPnPAVTransportDual = interface(IDispatch)
['{0EA1DE14-E288-4958-A23C-942634A27EB5}']
function Get_TransportState: WideString; safecall;
function Get_TransportStatus: WideString; safecall;
function Get_PlaybackStorageMedium: WideString; safecall;
function Get_RecordStorageMedium: WideString; safecall;
function Get_PossiblePlaybackStorageMedia: WideString; safecall;
function Get_PossibleRecordStorageMedia: WideString; safecall;
function Get_CurrentPlayMode: WideString; safecall;
function Get_TransportPlaySpeed: WideString; safecall;
function Get_RecordMediumWriteStatus: WideString; safecall;
function Get_CurrentRecordQualityMode: WideString; safecall;
function Get_PossibleRecordQualityModes: WideString; safecall;
function Get_NumberOfTracks: LongWord; safecall;
function Get_CurrentTrack: LongWord; safecall;
function Get_CurrentTrackDuration: WideString; safecall;
function Get_CurrentMediaDuration: WideString; safecall;
function Get_CurrentTrackMetaData: WideString; safecall;
function Get_CurrentTrackURI: WideString; safecall;
function Get_AVTransportURI: WideString; safecall;
function Get_AVTransportURIMetaData: WideString; safecall;
function Get_NextAVTransportURI: WideString; safecall;
function Get_NextAVTransportURIMetaData: WideString; safecall;
function Get_RelativeTimePosition: WideString; safecall;
function Get_AbsoluteTimePosition: WideString; safecall;
function Get_RelativeCounterPosition: Integer; safecall;
function Get_AbsoluteCounterPosition: Integer; safecall;
function Get_CurrentTransportActions: WideString; safecall;
function Get_LastChange: WideString; safecall;
function Get_A_ARG_TYPE_SeekMode: WideString; safecall;
function Get_A_ARG_TYPE_SeekTarget: WideString; safecall;
function Get_A_ARG_TYPE_InstanceID: LongWord; safecall;
procedure SetAVTransportURI(InstanceID: LongWord; const CurrentURI: WideString;
const CurrentURIMetaData: WideString); safecall;
procedure SetNextAVTransportURI(InstanceID: LongWord; const NextURI: WideString;
const NextURIMetaData: WideString); safecall;
procedure GetMediaInfo(InstanceID: LongWord; var pNrTracks: LongWord;
var pMediaDuration: WideString; var pCurrentURI: WideString;
var pCurrentURIMetaData: WideString; var pNextURI: WideString;
var pNextURIMetaData: WideString; var pPlayMedium: WideString;
var pRecordMedium: WideString; var pWriteStatus: WideString); safecall;
procedure GetTransportInfo(InstanceID: LongWord; var pCurrentTransportState: WideString;
var pCurrentTransportStatus: WideString;
var pCurrentSpeed: WideString); safecall;
procedure GetPositionInfo(InstanceID: LongWord; var pTrack: LongWord;
var pTrackDuration: WideString; var pTrackMetaData: WideString;
var pTrackURI: WideString; var pRelTime: WideString;
var pAbsTime: WideString; var pRelCount: Integer;
var pAbsCount: Integer); safecall;
procedure GetDeviceCapabilities(InstanceID: LongWord; var pPlayMedia: WideString;
var pRecMedia: WideString; var pRecQualityModes: WideString); safecall;
procedure GetTransportSettings(InstanceID: LongWord; var pPlayMode: WideString;
var pRecQualityMode: WideString); safecall;
procedure stop(InstanceID: LongWord); safecall;
procedure play(InstanceID: LongWord; const Speed: WideString); safecall;
procedure pause(InstanceID: LongWord); safecall;
procedure Record_(InstanceID: LongWord); safecall;
procedure Seek(InstanceID: LongWord; const Unit_: WideString; const Target: WideString); safecall;
procedure next(InstanceID: LongWord); safecall;
procedure previous(InstanceID: LongWord); safecall;
procedure SetPlayMode(InstanceID: LongWord; const NewPlayMode: WideString); safecall;
procedure SetRecordQualityMode(InstanceID: LongWord; const NewRecordQualityMode: WideString); safecall;
procedure GetCurrentTransportActions(InstanceID: LongWord; var pActions: WideString); safecall;
property TransportState: WideString read Get_TransportState;
property TransportStatus: WideString read Get_TransportStatus;
property PlaybackStorageMedium: WideString read Get_PlaybackStorageMedium;
property RecordStorageMedium: WideString read Get_RecordStorageMedium;
property PossiblePlaybackStorageMedia: WideString read Get_PossiblePlaybackStorageMedia;
property PossibleRecordStorageMedia: WideString read Get_PossibleRecordStorageMedia;
property CurrentPlayMode: WideString read Get_CurrentPlayMode;
property TransportPlaySpeed: WideString read Get_TransportPlaySpeed;
property RecordMediumWriteStatus: WideString read Get_RecordMediumWriteStatus;
property CurrentRecordQualityMode: WideString read Get_CurrentRecordQualityMode;
property PossibleRecordQualityModes: WideString read Get_PossibleRecordQualityModes;
property NumberOfTracks: LongWord read Get_NumberOfTracks;
property CurrentTrack: LongWord read Get_CurrentTrack;
property CurrentTrackDuration: WideString read Get_CurrentTrackDuration;
property CurrentMediaDuration: WideString read Get_CurrentMediaDuration;
property CurrentTrackMetaData: WideString read Get_CurrentTrackMetaData;
property CurrentTrackURI: WideString read Get_CurrentTrackURI;
property AVTransportURI: WideString read Get_AVTransportURI;
property AVTransportURIMetaData: WideString read Get_AVTransportURIMetaData;
property NextAVTransportURI: WideString read Get_NextAVTransportURI;
property NextAVTransportURIMetaData: WideString read Get_NextAVTransportURIMetaData;
property RelativeTimePosition: WideString read Get_RelativeTimePosition;
property AbsoluteTimePosition: WideString read Get_AbsoluteTimePosition;
property RelativeCounterPosition: Integer read Get_RelativeCounterPosition;
property AbsoluteCounterPosition: Integer read Get_AbsoluteCounterPosition;
property CurrentTransportActions: WideString read Get_CurrentTransportActions;
property LastChange: WideString read Get_LastChange;
property A_ARG_TYPE_SeekMode: WideString read Get_A_ARG_TYPE_SeekMode;
property A_ARG_TYPE_SeekTarget: WideString read Get_A_ARG_TYPE_SeekTarget;
property A_ARG_TYPE_InstanceID: LongWord read Get_A_ARG_TYPE_InstanceID;
end;
// *********************************************************************//
// DispIntf: IUPnPService_IWMPUPnPAVTransportDualDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {0EA1DE14-E288-4958-A23C-942634A27EB5}
// *********************************************************************//
IUPnPService_IWMPUPnPAVTransportDualDisp = dispinterface
['{0EA1DE14-E288-4958-A23C-942634A27EB5}']
property TransportState: WideString readonly dispid 1;
property TransportStatus: WideString readonly dispid 2;
property PlaybackStorageMedium: WideString readonly dispid 3;
property RecordStorageMedium: WideString readonly dispid 4;
property PossiblePlaybackStorageMedia: WideString readonly dispid 5;
property PossibleRecordStorageMedia: WideString readonly dispid 6;
property CurrentPlayMode: WideString readonly dispid 7;
property TransportPlaySpeed: WideString readonly dispid 8;
property RecordMediumWriteStatus: WideString readonly dispid 9;
property CurrentRecordQualityMode: WideString readonly dispid 10;
property PossibleRecordQualityModes: WideString readonly dispid 11;
property NumberOfTracks: LongWord readonly dispid 12;
property CurrentTrack: LongWord readonly dispid 13;
property CurrentTrackDuration: WideString readonly dispid 14;
property CurrentMediaDuration: WideString readonly dispid 15;
property CurrentTrackMetaData: WideString readonly dispid 16;
property CurrentTrackURI: WideString readonly dispid 17;
property AVTransportURI: WideString readonly dispid 18;
property AVTransportURIMetaData: WideString readonly dispid 19;
property NextAVTransportURI: WideString readonly dispid 20;
property NextAVTransportURIMetaData: WideString readonly dispid 21;
property RelativeTimePosition: WideString readonly dispid 22;
property AbsoluteTimePosition: WideString readonly dispid 23;
property RelativeCounterPosition: Integer readonly dispid 24;
property AbsoluteCounterPosition: Integer readonly dispid 25;
property CurrentTransportActions: WideString readonly dispid 26;
property LastChange: WideString readonly dispid 27;
property A_ARG_TYPE_SeekMode: WideString readonly dispid 28;
property A_ARG_TYPE_SeekTarget: WideString readonly dispid 29;
property A_ARG_TYPE_InstanceID: LongWord readonly dispid 30;
procedure SetAVTransportURI(InstanceID: LongWord; const CurrentURI: WideString;
const CurrentURIMetaData: WideString); dispid 31;
procedure SetNextAVTransportURI(InstanceID: LongWord; const NextURI: WideString;
const NextURIMetaData: WideString); dispid 32;
procedure GetMediaInfo(InstanceID: LongWord; var pNrTracks: LongWord;
var pMediaDuration: WideString; var pCurrentURI: WideString;
var pCurrentURIMetaData: WideString; var pNextURI: WideString;
var pNextURIMetaData: WideString; var pPlayMedium: WideString;
var pRecordMedium: WideString; var pWriteStatus: WideString); dispid 33;
procedure GetTransportInfo(InstanceID: LongWord; var pCurrentTransportState: WideString;
var pCurrentTransportStatus: WideString;
var pCurrentSpeed: WideString); dispid 34;
procedure GetPositionInfo(InstanceID: LongWord; var pTrack: LongWord;
var pTrackDuration: WideString; var pTrackMetaData: WideString;
var pTrackURI: WideString; var pRelTime: WideString;
var pAbsTime: WideString; var pRelCount: Integer;
var pAbsCount: Integer); dispid 35;
procedure GetDeviceCapabilities(InstanceID: LongWord; var pPlayMedia: WideString;
var pRecMedia: WideString; var pRecQualityModes: WideString); dispid 36;
procedure GetTransportSettings(InstanceID: LongWord; var pPlayMode: WideString;
var pRecQualityMode: WideString); dispid 37;
procedure stop(InstanceID: LongWord); dispid 38;
procedure play(InstanceID: LongWord; const Speed: WideString); dispid 39;
procedure pause(InstanceID: LongWord); dispid 40;
procedure Record_(InstanceID: LongWord); dispid 41;
procedure Seek(InstanceID: LongWord; const Unit_: WideString; const Target: WideString); dispid 42;
procedure next(InstanceID: LongWord); dispid 43;
procedure previous(InstanceID: LongWord); dispid 44;
procedure SetPlayMode(InstanceID: LongWord; const NewPlayMode: WideString); dispid 45;
procedure SetRecordQualityMode(InstanceID: LongWord; const NewRecordQualityMode: WideString); dispid 46;
procedure GetCurrentTransportActions(InstanceID: LongWord; var pActions: WideString); dispid 47;
end;
// *********************************************************************//
// Interface: IUPnPService_IWMPUPnPBinaryControlDual
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {7CAD1D24-EDED-47FA-A1D8-4628FBE5638C}
// *********************************************************************//
IUPnPService_IWMPUPnPBinaryControlDual = interface(IDispatch)
['{7CAD1D24-EDED-47FA-A1D8-4628FBE5638C}']
function Get_CurrentState: WideString; safecall;
function GetCurrentState: WideString; safecall;
procedure SetCurrentState(const NewState: WideString); safecall;
procedure SetOn; safecall;
procedure SetOff; safecall;
property CurrentState: WideString read Get_CurrentState;
end;
// *********************************************************************//
// DispIntf: IUPnPService_IWMPUPnPBinaryControlDualDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {7CAD1D24-EDED-47FA-A1D8-4628FBE5638C}
// *********************************************************************//
IUPnPService_IWMPUPnPBinaryControlDualDisp = dispinterface
['{7CAD1D24-EDED-47FA-A1D8-4628FBE5638C}']
property CurrentState: WideString readonly dispid 1;
function GetCurrentState: WideString; dispid 2;
procedure SetCurrentState(const NewState: WideString); dispid 3;
procedure SetOn; dispid 4;
procedure SetOff; dispid 5;
end;
// *********************************************************************//
// Interface: IUPnPService_IWMPUPnPVariableControlDual
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5A09862E-47B1-4D17-94EA-2BDE3014DD42}
// *********************************************************************//
IUPnPService_IWMPUPnPVariableControlDual = interface(IDispatch)
['{5A09862E-47B1-4D17-94EA-2BDE3014DD42}']
function Get_CurrentPercent: Single; safecall;
function Get_CurrentValue: Single; safecall;
function Get_UnitOfMeasure: WideString; safecall;
function Get_MinValue: Single; safecall;
function Get_MaxValue: Single; safecall;
function Get_NumberOfSteps: LongWord; safecall;
procedure GetCurrentPercent(var pcurPercent: Single); safecall;
procedure GetCurrentValue(var pcurValue: Single); safecall;
procedure GetUnitOfMeasure(var pUnitOfMeasure: WideString); safecall;
procedure GetMinValue(var pMinValue: Single); safecall;
procedure GetMaxValue(var pMaxValue: Single); safecall;
procedure GetNumberOfSteps(var pNumberOfSteps: LongWord); safecall;
procedure SetCurrentPercent(newCurrentPercent: Single); safecall;
procedure SetCurrentValue(newCurrentValue: Single); safecall;
property CurrentPercent: Single read Get_CurrentPercent;
property CurrentValue: Single read Get_CurrentValue;
property UnitOfMeasure: WideString read Get_UnitOfMeasure;
property MinValue: Single read Get_MinValue;
property MaxValue: Single read Get_MaxValue;
property NumberOfSteps: LongWord read Get_NumberOfSteps;
end;
// *********************************************************************//
// DispIntf: IUPnPService_IWMPUPnPVariableControlDualDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {5A09862E-47B1-4D17-94EA-2BDE3014DD42}
// *********************************************************************//
IUPnPService_IWMPUPnPVariableControlDualDisp = dispinterface
['{5A09862E-47B1-4D17-94EA-2BDE3014DD42}']
property CurrentPercent: Single readonly dispid 1;
property CurrentValue: Single readonly dispid 2;
property UnitOfMeasure: WideString readonly dispid 3;
property MinValue: Single readonly dispid 4;
property MaxValue: Single readonly dispid 5;
property NumberOfSteps: LongWord readonly dispid 6;
procedure GetCurrentPercent(var pcurPercent: Single); dispid 7;
procedure GetCurrentValue(var pcurValue: Single); dispid 8;
procedure GetUnitOfMeasure(var pUnitOfMeasure: WideString); dispid 9;
procedure GetMinValue(var pMinValue: Single); dispid 10;
procedure GetMaxValue(var pMaxValue: Single); dispid 11;
procedure GetNumberOfSteps(var pNumberOfSteps: LongWord); dispid 12;
procedure SetCurrentPercent(newCurrentPercent: Single); dispid 13;
procedure SetCurrentValue(newCurrentValue: Single); dispid 14;
end;
// *********************************************************************//
// Interface: IUPnPService_IWMPUPnPConnectionManagerDual
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {1AF41667-542C-42EA-BF53-DC101168C503}
// *********************************************************************//
IUPnPService_IWMPUPnPConnectionManagerDual = interface(IDispatch)
['{1AF41667-542C-42EA-BF53-DC101168C503}']
function Get_SourceProtocolInfo: WideString; safecall;
function Get_SinkProtocolInfo: WideString; safecall;
function Get_CurrentConnectionIDs: WideString; safecall;
function Get_A_ARG_TYPE_ConnectionStatus: WideString; safecall;
function Get_A_ARG_TYPE_ConnectionManager: WideString; safecall;
function Get_A_ARG_TYPE_Direction: WideString; safecall;
function Get_A_ARG_TYPE_ProtocolInfo: WideString; safecall;
function Get_A_ARG_TYPE_ConnectionID: Integer; safecall;
function Get_A_ARG_TYPE_AVTransportID: Integer; safecall;
function Get_A_ARG_TYPE_RcsID: Integer; safecall;
procedure GetProtocolInfo(var pSourceProtocol: WideString; var pSinkProtocol: WideString); safecall;
procedure PrepareForConnection(const remoteProtocolInfo: WideString;
const peerConnectionManager: WideString;
peerConnectionID: Integer; const direction: WideString;
var pConnectionID: Integer; var pAVTransportID: Integer;
var pResID: Integer); safecall;
procedure ConnectionComplete(connectionID: Integer); safecall;
procedure GetCurrentConnectionIDs(var pCurrentConnectionIDs: WideString); safecall;
procedure GetCurrentConnectionInfo(connectionID: Integer; var pResID: Integer;
var pAVTransportID: Integer; var pProtocolInfo: WideString;
var pPeerConnectionManager: WideString;
var pPeerConnectionID: Integer; var pDirection: WideString;
var pStatus: WideString); safecall;
property SourceProtocolInfo: WideString read Get_SourceProtocolInfo;
property SinkProtocolInfo: WideString read Get_SinkProtocolInfo;
property CurrentConnectionIDs: WideString read Get_CurrentConnectionIDs;
property A_ARG_TYPE_ConnectionStatus: WideString read Get_A_ARG_TYPE_ConnectionStatus;
property A_ARG_TYPE_ConnectionManager: WideString read Get_A_ARG_TYPE_ConnectionManager;
property A_ARG_TYPE_Direction: WideString read Get_A_ARG_TYPE_Direction;
property A_ARG_TYPE_ProtocolInfo: WideString read Get_A_ARG_TYPE_ProtocolInfo;
property A_ARG_TYPE_ConnectionID: Integer read Get_A_ARG_TYPE_ConnectionID;
property A_ARG_TYPE_AVTransportID: Integer read Get_A_ARG_TYPE_AVTransportID;
property A_ARG_TYPE_RcsID: Integer read Get_A_ARG_TYPE_RcsID;
end;
// *********************************************************************//
// DispIntf: IUPnPService_IWMPUPnPConnectionManagerDualDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {1AF41667-542C-42EA-BF53-DC101168C503}
// *********************************************************************//
IUPnPService_IWMPUPnPConnectionManagerDualDisp = dispinterface
['{1AF41667-542C-42EA-BF53-DC101168C503}']
property SourceProtocolInfo: WideString readonly dispid 1;
property SinkProtocolInfo: WideString readonly dispid 2;
property CurrentConnectionIDs: WideString readonly dispid 3;
property A_ARG_TYPE_ConnectionStatus: WideString readonly dispid 4;
property A_ARG_TYPE_ConnectionManager: WideString readonly dispid 5;
property A_ARG_TYPE_Direction: WideString readonly dispid 6;
property A_ARG_TYPE_ProtocolInfo: WideString readonly dispid 7;
property A_ARG_TYPE_ConnectionID: Integer readonly dispid 8;
property A_ARG_TYPE_AVTransportID: Integer readonly dispid 9;
property A_ARG_TYPE_RcsID: Integer readonly dispid 10;
procedure GetProtocolInfo(var pSourceProtocol: WideString; var pSinkProtocol: WideString); dispid 11;
procedure PrepareForConnection(const remoteProtocolInfo: WideString;
const peerConnectionManager: WideString;
peerConnectionID: Integer; const direction: WideString;
var pConnectionID: Integer; var pAVTransportID: Integer;
var pResID: Integer); dispid 12;
procedure ConnectionComplete(connectionID: Integer); dispid 13;
procedure GetCurrentConnectionIDs(var pCurrentConnectionIDs: WideString); dispid 14;
procedure GetCurrentConnectionInfo(connectionID: Integer; var pResID: Integer;
var pAVTransportID: Integer; var pProtocolInfo: WideString;
var pPeerConnectionManager: WideString;
var pPeerConnectionID: Integer; var pDirection: WideString;
var pStatus: WideString); dispid 15;
end;
// *********************************************************************//
// Interface: IUPnPService_IWMPUPnPSkinRetrieverDual
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {AC743628-971D-4C1E-B019-50543EFE2BAD}
// *********************************************************************//
IUPnPService_IWMPUPnPSkinRetrieverDual = interface(IDispatch)
['{AC743628-971D-4C1E-B019-50543EFE2BAD}']
function Get_SkinURL: WideString; safecall;
procedure GetSkinURL(var ppbstrSkinURL: WideString); safecall;
property SkinURL: WideString read Get_SkinURL;
end;
// *********************************************************************//
// DispIntf: IUPnPService_IWMPUPnPSkinRetrieverDualDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {AC743628-971D-4C1E-B019-50543EFE2BAD}
// *********************************************************************//
IUPnPService_IWMPUPnPSkinRetrieverDualDisp = dispinterface
['{AC743628-971D-4C1E-B019-50543EFE2BAD}']
property SkinURL: WideString readonly dispid 1;
procedure GetSkinURL(var ppbstrSkinURL: WideString); dispid 2;
end;
// *********************************************************************//
// OLE Control Proxy class declaration
// Control Name : TWindowsMediaPlayer
// Help ansistring : Windows Media Player ActiveX Control
// Default Interface: IWMPPlayer4
// Def. Intf. DISP? : No
// Event Interface: _WMPOCXEvents
// TypeFlags : (2) CanCreate
// *********************************************************************//
TWindowsMediaPlayerOpenStateChange = procedure(ASender: TObject; NewState: Integer) of object;
TWindowsMediaPlayerPlayStateChange = procedure(ASender: TObject; NewState: Integer) of object;
TWindowsMediaPlayerAudioLanguageChange = procedure(ASender: TObject; LangID: Integer) of object;
TWindowsMediaPlayerScriptCommand = procedure(ASender: TObject; const scType: WideString;
const Param: WideString) of object;
TWindowsMediaPlayerDisconnect = procedure(ASender: TObject; Result: Integer) of object;
TWindowsMediaPlayerBuffering = procedure(ASender: TObject; Start: WordBool) of object;
TWindowsMediaPlayerWarning = procedure(ASender: TObject; WarningType: Integer; Param: Integer;
const Description: WideString) of object;
TWindowsMediaPlayerEndOfStream = procedure(ASender: TObject; Result: Integer) of object;
TWindowsMediaPlayerPositionChange = procedure(ASender: TObject; oldPosition: Double;
newPosition: Double) of object;
TWindowsMediaPlayerMarkerHit = procedure(ASender: TObject; MarkerNum: Integer) of object;
TWindowsMediaPlayerDurationUnitChange = procedure(ASender: TObject; NewDurationUnit: Integer) of object;
TWindowsMediaPlayerCdromMediaChange = procedure(ASender: TObject; CdromNum: Integer) of object;
TWindowsMediaPlayerPlaylistChange = procedure(ASender: TObject; const Playlist: IDispatch;
change: WMPPlaylistChangeEventType) of object;
TWindowsMediaPlayerCurrentPlaylistChange = procedure(ASender: TObject; change: WMPPlaylistChangeEventType) of object;
TWindowsMediaPlayerCurrentPlaylistItemAvailable = procedure(ASender: TObject; const bstrItemName: WideString) of object;
TWindowsMediaPlayerMediaChange = procedure(ASender: TObject; const Item: IDispatch) of object;
TWindowsMediaPlayerCurrentMediaItemAvailable = procedure(ASender: TObject; const bstrItemName: WideString) of object;
TWindowsMediaPlayerCurrentItemChange = procedure(ASender: TObject; const pdispMedia: IDispatch) of object;
TWindowsMediaPlayerMediaCollectionAttributeStringAdded = procedure(ASender: TObject; const bstrAttribName: WideString;
const bstrAttribVal: WideString) of object;
TWindowsMediaPlayerMediaCollectionAttributeStringRemoved = procedure(ASender: TObject; const bstrAttribName: WideString;
const bstrAttribVal: WideString) of object;
TWindowsMediaPlayerMediaCollectionAttributeStringChanged = procedure(ASender: TObject; const bstrAttribName: WideString;
const bstrOldAttribVal: WideString;
const bstrNewAttribVal: WideString) of object;
TWindowsMediaPlayerPlaylistCollectionPlaylistAdded = procedure(ASender: TObject; const bstrPlaylistName: WideString) of object;
TWindowsMediaPlayerPlaylistCollectionPlaylistRemoved = procedure(ASender: TObject; const bstrPlaylistName: WideString) of object;
TWindowsMediaPlayerPlaylistCollectionPlaylistSetAsDeleted = procedure(ASender: TObject; const bstrPlaylistName: WideString;
varfIsDeleted: WordBool) of object;
TWindowsMediaPlayerModeChange = procedure(ASender: TObject; const ModeName: WideString;
NewValue: WordBool) of object;
TWindowsMediaPlayerMediaError = procedure(ASender: TObject; const pMediaObject: IDispatch) of object;
TWindowsMediaPlayerOpenPlaylistSwitch = procedure(ASender: TObject; const pItem: IDispatch) of object;
TWindowsMediaPlayerDomainChange = procedure(ASender: TObject; const strDomain: WideString) of object;
TWindowsMediaPlayerClick = procedure(ASender: TObject; nButton: Smallint; nShiftState: Smallint;
fX: Integer; fY: Integer) of object;
TWindowsMediaPlayerDoubleClick = procedure(ASender: TObject; nButton: Smallint;
nShiftState: Smallint; fX: Integer;
fY: Integer) of object;
TWindowsMediaPlayerKeyDown = procedure(ASender: TObject; nKeyCode: Smallint; nShiftState: Smallint) of object;
TWindowsMediaPlayerKeyPress = procedure(ASender: TObject; nKeyAscii: Smallint) of object;
TWindowsMediaPlayerKeyUp = procedure(ASender: TObject; nKeyCode: Smallint; nShiftState: Smallint) of object;
TWindowsMediaPlayerMouseDown = procedure(ASender: TObject; nButton: Smallint;
nShiftState: Smallint; fX: Integer;
fY: Integer) of object;
TWindowsMediaPlayerMouseMove = procedure(ASender: TObject; nButton: Smallint;
nShiftState: Smallint; fX: Integer;
fY: Integer) of object;
TWindowsMediaPlayerMouseUp = procedure(ASender: TObject; nButton: Smallint;
nShiftState: Smallint; fX: Integer;
fY: Integer) of object;
TWindowsMediaPlayerDeviceConnect = procedure(ASender: TObject; const pDevice: IWMPSyncDevice) of object;
TWindowsMediaPlayerDeviceDisconnect = procedure(ASender: TObject; const pDevice: IWMPSyncDevice) of object;
TWindowsMediaPlayerDeviceStatusChange = procedure(ASender: TObject; const pDevice: IWMPSyncDevice;
NewStatus: WMPDeviceStatus) of object;
TWindowsMediaPlayerDeviceSyncStateChange = procedure(ASender: TObject; const pDevice: IWMPSyncDevice;
NewState: WMPSyncState) of object;
TWindowsMediaPlayerDeviceSyncError = procedure(ASender: TObject; const pDevice: IWMPSyncDevice;
const pMedia: IDispatch) of object;
TWindowsMediaPlayerCreatePartnershipComplete = procedure(ASender: TObject; const pDevice: IWMPSyncDevice;
hrResult: HResult) of object;
TWindowsMediaPlayerCdromRipStateChange = procedure(ASender: TObject; const pCdromRip: IWMPCdromRip;
wmprs: WMPRipState) of object;
TWindowsMediaPlayerCdromRipMediaError = procedure(ASender: TObject; const pCdromRip: IWMPCdromRip;
const pMedia: IDispatch) of object;
TWindowsMediaPlayerCdromBurnStateChange = procedure(ASender: TObject; const pCdromBurn: IWMPCdromBurn;
wmpbs: WMPBurnState) of object;
TWindowsMediaPlayerCdromBurnMediaError = procedure(ASender: TObject; const pCdromBurn: IWMPCdromBurn;
const pMedia: IDispatch) of object;
TWindowsMediaPlayerCdromBurnError = procedure(ASender: TObject; const pCdromBurn: IWMPCdromBurn;
hrError: HResult) of object;
TWindowsMediaPlayerLibraryConnect = procedure(ASender: TObject; const pLibrary: IWMPLibrary) of object;
TWindowsMediaPlayerLibraryDisconnect = procedure(ASender: TObject; const pLibrary: IWMPLibrary) of object;
TWindowsMediaPlayerFolderScanStateChange = procedure(ASender: TObject; wmpfss: WMPFolderScanState) of object;
TWindowsMediaPlayerStringCollectionChange = procedure(ASender: TObject; const pdispStringCollection: IDispatch;
change: WMPStringCollectionChangeEventType;
lCollectionIndex: Integer) of object;
TWindowsMediaPlayerMediaCollectionMediaAdded = procedure(ASender: TObject; const pdispMedia: IDispatch) of object;
TWindowsMediaPlayerMediaCollectionMediaRemoved = procedure(ASender: TObject; const pdispMedia: IDispatch) of object;
TWindowsMediaPlayer = class(TOleControl)
private
FOnOpenStateChange: TWindowsMediaPlayerOpenStateChange;
FOnPlayStateChange: TWindowsMediaPlayerPlayStateChange;
FOnAudioLanguageChange: TWindowsMediaPlayerAudioLanguageChange;
FOnStatusChange: TNotifyEvent;
FOnScriptCommand: TWindowsMediaPlayerScriptCommand;
FOnNewStream: TNotifyEvent;
FOnDisconnect: TWindowsMediaPlayerDisconnect;
FOnBuffering: TWindowsMediaPlayerBuffering;
FOnError: TNotifyEvent;
FOnWarning: TWindowsMediaPlayerWarning;
FOnEndOfStream: TWindowsMediaPlayerEndOfStream;
FOnPositionChange: TWindowsMediaPlayerPositionChange;
FOnMarkerHit: TWindowsMediaPlayerMarkerHit;
FOnDurationUnitChange: TWindowsMediaPlayerDurationUnitChange;
FOnCdromMediaChange: TWindowsMediaPlayerCdromMediaChange;
FOnPlaylistChange: TWindowsMediaPlayerPlaylistChange;
FOnCurrentPlaylistChange: TWindowsMediaPlayerCurrentPlaylistChange;
FOnCurrentPlaylistItemAvailable: TWindowsMediaPlayerCurrentPlaylistItemAvailable;
FOnMediaChange: TWindowsMediaPlayerMediaChange;
FOnCurrentMediaItemAvailable: TWindowsMediaPlayerCurrentMediaItemAvailable;
FOnCurrentItemChange: TWindowsMediaPlayerCurrentItemChange;
FOnMediaCollectionChange: TNotifyEvent;
FOnMediaCollectionAttributeStringAdded: TWindowsMediaPlayerMediaCollectionAttributeStringAdded;
FOnMediaCollectionAttributeStringRemoved: TWindowsMediaPlayerMediaCollectionAttributeStringRemoved;
FOnMediaCollectionAttributeStringChanged: TWindowsMediaPlayerMediaCollectionAttributeStringChanged;
FOnPlaylistCollectionChange: TNotifyEvent;
FOnPlaylistCollectionPlaylistAdded: TWindowsMediaPlayerPlaylistCollectionPlaylistAdded;
FOnPlaylistCollectionPlaylistRemoved: TWindowsMediaPlayerPlaylistCollectionPlaylistRemoved;
FOnPlaylistCollectionPlaylistSetAsDeleted: TWindowsMediaPlayerPlaylistCollectionPlaylistSetAsDeleted;
FOnModeChange: TWindowsMediaPlayerModeChange;
FOnMediaError: TWindowsMediaPlayerMediaError;
FOnOpenPlaylistSwitch: TWindowsMediaPlayerOpenPlaylistSwitch;
FOnDomainChange: TWindowsMediaPlayerDomainChange;
FOnSwitchedToPlayerApplication: TNotifyEvent;
FOnSwitchedToControl: TNotifyEvent;
FOnPlayerDockedStateChange: TNotifyEvent;
FOnPlayerReconnect: TNotifyEvent;
FOnClick: TWindowsMediaPlayerClick;
FOnDoubleClick: TWindowsMediaPlayerDoubleClick;
FOnKeyDown: TWindowsMediaPlayerKeyDown;
FOnKeyPress: TWindowsMediaPlayerKeyPress;
FOnKeyUp: TWindowsMediaPlayerKeyUp;
FOnMouseDown: TWindowsMediaPlayerMouseDown;
FOnMouseMove: TWindowsMediaPlayerMouseMove;
FOnMouseUp: TWindowsMediaPlayerMouseUp;
FOnDeviceConnect: TWindowsMediaPlayerDeviceConnect;
FOnDeviceDisconnect: TWindowsMediaPlayerDeviceDisconnect;
FOnDeviceStatusChange: TWindowsMediaPlayerDeviceStatusChange;
FOnDeviceSyncStateChange: TWindowsMediaPlayerDeviceSyncStateChange;
FOnDeviceSyncError: TWindowsMediaPlayerDeviceSyncError;
FOnCreatePartnershipComplete: TWindowsMediaPlayerCreatePartnershipComplete;
FOnCdromRipStateChange: TWindowsMediaPlayerCdromRipStateChange;
FOnCdromRipMediaError: TWindowsMediaPlayerCdromRipMediaError;
FOnCdromBurnStateChange: TWindowsMediaPlayerCdromBurnStateChange;
FOnCdromBurnMediaError: TWindowsMediaPlayerCdromBurnMediaError;
FOnCdromBurnError: TWindowsMediaPlayerCdromBurnError;
FOnLibraryConnect: TWindowsMediaPlayerLibraryConnect;
FOnLibraryDisconnect: TWindowsMediaPlayerLibraryDisconnect;
FOnFolderScanStateChange: TWindowsMediaPlayerFolderScanStateChange;
FOnStringCollectionChange: TWindowsMediaPlayerStringCollectionChange;
FOnMediaCollectionMediaAdded: TWindowsMediaPlayerMediaCollectionMediaAdded;
FOnMediaCollectionMediaRemoved: TWindowsMediaPlayerMediaCollectionMediaRemoved;
FIntf: IWMPPlayer4;
function GetControlInterface: IWMPPlayer4;
protected
procedure CreateControl;
procedure InitControlData; override;
function Get_controls: IWMPControls;
function Get_settings: IWMPSettings;
function Get_currentMedia: IWMPMedia;
procedure Set_currentMedia(const ppMedia: IWMPMedia);
function Get_mediaCollection: IWMPMediaCollection;
function Get_playlistCollection: IWMPPlaylistCollection;
function Get_network: IWMPNetwork;
function Get_currentPlaylist: IWMPPlaylist;
procedure Set_currentPlaylist(const ppPL: IWMPPlaylist);
function Get_cdromCollection: IWMPCdromCollection;
function Get_closedCaption: IWMPClosedCaption;
function Get_Error: IWMPError;
function Get_dvd: IWMPDVD;
function Get_playerApplication: IWMPPlayerApplication;
public
procedure close;
procedure launchURL(const bstrURL: WideString);
function newPlaylist(const bstrName: WideString; const bstrURL: WideString): IWMPPlaylist;
function newMedia(const bstrURL: WideString): IWMPMedia;
procedure openPlayer(const bstrURL: WideString);
property ControlInterface: IWMPPlayer4 read GetControlInterface;
property DefaultInterface: IWMPPlayer4 read GetControlInterface;
property openState: TOleEnum index 2 read GetTOleEnumProp;
property playState: TOleEnum index 10 read GetTOleEnumProp;
property controls: IWMPControls read Get_controls;
property settings: IWMPSettings read Get_settings;
property mediaCollection: IWMPMediaCollection read Get_mediaCollection;
property playlistCollection: IWMPPlaylistCollection read Get_playlistCollection;
property versionInfo: WideString index 11 read GetWideStringProp;
property network: IWMPNetwork read Get_network;
property cdromCollection: IWMPCdromCollection read Get_cdromCollection;
property closedCaption: IWMPClosedCaption read Get_closedCaption;
property isOnline: WordBool index 16 read GetWordBoolProp;
property Error: IWMPError read Get_Error;
property status: WideString index 18 read GetWideStringProp;
property dvd: IWMPDVD read Get_dvd;
property isRemote: WordBool index 26 read GetWordBoolProp;
property playerApplication: IWMPPlayerApplication read Get_playerApplication;
published
property Anchors;
property TabStop;
property Align;
property DragCursor;
property DragMode;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDrag;
property URL: WideString index 1 read GetWideStringProp write SetWideStringProp stored False;
property currentMedia: IWMPMedia read Get_currentMedia write Set_currentMedia stored False;
property currentPlaylist: IWMPPlaylist read Get_currentPlaylist write Set_currentPlaylist stored False;
property enabled: WordBool index 19 read GetWordBoolProp write SetWordBoolProp stored False;
property fullScreen: WordBool index 21 read GetWordBoolProp write SetWordBoolProp stored False;
property enableContextMenu: WordBool index 22 read GetWordBoolProp write SetWordBoolProp stored False;
property uiMode: WideString index 23 read GetWideStringProp write SetWideStringProp stored False;
property stretchToFit: WordBool index 24 read GetWordBoolProp write SetWordBoolProp stored False;
property windowlessVideo: WordBool index 25 read GetWordBoolProp write SetWordBoolProp stored False;
property OnOpenStateChange: TWindowsMediaPlayerOpenStateChange read FOnOpenStateChange write FOnOpenStateChange;
property OnPlayStateChange: TWindowsMediaPlayerPlayStateChange read FOnPlayStateChange write FOnPlayStateChange;
property OnAudioLanguageChange: TWindowsMediaPlayerAudioLanguageChange read FOnAudioLanguageChange write FOnAudioLanguageChange;
property OnStatusChange: TNotifyEvent read FOnStatusChange write FOnStatusChange;
property OnScriptCommand: TWindowsMediaPlayerScriptCommand read FOnScriptCommand write FOnScriptCommand;
property OnNewStream: TNotifyEvent read FOnNewStream write FOnNewStream;
property OnDisconnect: TWindowsMediaPlayerDisconnect read FOnDisconnect write FOnDisconnect;
property OnBuffering: TWindowsMediaPlayerBuffering read FOnBuffering write FOnBuffering;
property OnError: TNotifyEvent read FOnError write FOnError;
property OnWarning: TWindowsMediaPlayerWarning read FOnWarning write FOnWarning;
property OnEndOfStream: TWindowsMediaPlayerEndOfStream read FOnEndOfStream write FOnEndOfStream;
property OnPositionChange: TWindowsMediaPlayerPositionChange read FOnPositionChange write FOnPositionChange;
property OnMarkerHit: TWindowsMediaPlayerMarkerHit read FOnMarkerHit write FOnMarkerHit;
property OnDurationUnitChange: TWindowsMediaPlayerDurationUnitChange read FOnDurationUnitChange write FOnDurationUnitChange;
property OnCdromMediaChange: TWindowsMediaPlayerCdromMediaChange read FOnCdromMediaChange write FOnCdromMediaChange;
property OnPlaylistChange: TWindowsMediaPlayerPlaylistChange read FOnPlaylistChange write FOnPlaylistChange;
property OnCurrentPlaylistChange: TWindowsMediaPlayerCurrentPlaylistChange read FOnCurrentPlaylistChange write FOnCurrentPlaylistChange;
property OnCurrentPlaylistItemAvailable: TWindowsMediaPlayerCurrentPlaylistItemAvailable read FOnCurrentPlaylistItemAvailable write FOnCurrentPlaylistItemAvailable;
property OnMediaChange: TWindowsMediaPlayerMediaChange read FOnMediaChange write FOnMediaChange;
property OnCurrentMediaItemAvailable: TWindowsMediaPlayerCurrentMediaItemAvailable read FOnCurrentMediaItemAvailable write FOnCurrentMediaItemAvailable;
property OnCurrentItemChange: TWindowsMediaPlayerCurrentItemChange read FOnCurrentItemChange write FOnCurrentItemChange;
property OnMediaCollectionChange: TNotifyEvent read FOnMediaCollectionChange write FOnMediaCollectionChange;
property OnMediaCollectionAttributeStringAdded: TWindowsMediaPlayerMediaCollectionAttributeStringAdded read FOnMediaCollectionAttributeStringAdded write FOnMediaCollectionAttributeStringAdded;
property OnMediaCollectionAttributeStringRemoved: TWindowsMediaPlayerMediaCollectionAttributeStringRemoved read FOnMediaCollectionAttributeStringRemoved write FOnMediaCollectionAttributeStringRemoved;
property OnMediaCollectionAttributeStringChanged: TWindowsMediaPlayerMediaCollectionAttributeStringChanged read FOnMediaCollectionAttributeStringChanged write FOnMediaCollectionAttributeStringChanged;
property OnPlaylistCollectionChange: TNotifyEvent read FOnPlaylistCollectionChange write FOnPlaylistCollectionChange;
property OnPlaylistCollectionPlaylistAdded: TWindowsMediaPlayerPlaylistCollectionPlaylistAdded read FOnPlaylistCollectionPlaylistAdded write FOnPlaylistCollectionPlaylistAdded;
property OnPlaylistCollectionPlaylistRemoved: TWindowsMediaPlayerPlaylistCollectionPlaylistRemoved read FOnPlaylistCollectionPlaylistRemoved write FOnPlaylistCollectionPlaylistRemoved;
property OnPlaylistCollectionPlaylistSetAsDeleted: TWindowsMediaPlayerPlaylistCollectionPlaylistSetAsDeleted read FOnPlaylistCollectionPlaylistSetAsDeleted write FOnPlaylistCollectionPlaylistSetAsDeleted;
property OnModeChange: TWindowsMediaPlayerModeChange read FOnModeChange write FOnModeChange;
property OnMediaError: TWindowsMediaPlayerMediaError read FOnMediaError write FOnMediaError;
property OnOpenPlaylistSwitch: TWindowsMediaPlayerOpenPlaylistSwitch read FOnOpenPlaylistSwitch write FOnOpenPlaylistSwitch;
property OnDomainChange: TWindowsMediaPlayerDomainChange read FOnDomainChange write FOnDomainChange;
property OnSwitchedToPlayerApplication: TNotifyEvent read FOnSwitchedToPlayerApplication write FOnSwitchedToPlayerApplication;
property OnSwitchedToControl: TNotifyEvent read FOnSwitchedToControl write FOnSwitchedToControl;
property OnPlayerDockedStateChange: TNotifyEvent read FOnPlayerDockedStateChange write FOnPlayerDockedStateChange;
property OnPlayerReconnect: TNotifyEvent read FOnPlayerReconnect write FOnPlayerReconnect;
property OnClick: TWindowsMediaPlayerClick read FOnClick write FOnClick;
property OnDoubleClick: TWindowsMediaPlayerDoubleClick read FOnDoubleClick write FOnDoubleClick;
property OnKeyDown: TWindowsMediaPlayerKeyDown read FOnKeyDown write FOnKeyDown;
property OnKeyPress: TWindowsMediaPlayerKeyPress read FOnKeyPress write FOnKeyPress;
property OnKeyUp: TWindowsMediaPlayerKeyUp read FOnKeyUp write FOnKeyUp;
property OnMouseDown: TWindowsMediaPlayerMouseDown read FOnMouseDown write FOnMouseDown;
property OnMouseMove: TWindowsMediaPlayerMouseMove read FOnMouseMove write FOnMouseMove;
property OnMouseUp: TWindowsMediaPlayerMouseUp read FOnMouseUp write FOnMouseUp;
property OnDeviceConnect: TWindowsMediaPlayerDeviceConnect read FOnDeviceConnect write FOnDeviceConnect;
property OnDeviceDisconnect: TWindowsMediaPlayerDeviceDisconnect read FOnDeviceDisconnect write FOnDeviceDisconnect;
property OnDeviceStatusChange: TWindowsMediaPlayerDeviceStatusChange read FOnDeviceStatusChange write FOnDeviceStatusChange;
property OnDeviceSyncStateChange: TWindowsMediaPlayerDeviceSyncStateChange read FOnDeviceSyncStateChange write FOnDeviceSyncStateChange;
property OnDeviceSyncError: TWindowsMediaPlayerDeviceSyncError read FOnDeviceSyncError write FOnDeviceSyncError;
property OnCreatePartnershipComplete: TWindowsMediaPlayerCreatePartnershipComplete read FOnCreatePartnershipComplete write FOnCreatePartnershipComplete;
property OnCdromRipStateChange: TWindowsMediaPlayerCdromRipStateChange read FOnCdromRipStateChange write FOnCdromRipStateChange;
property OnCdromRipMediaError: TWindowsMediaPlayerCdromRipMediaError read FOnCdromRipMediaError write FOnCdromRipMediaError;
property OnCdromBurnStateChange: TWindowsMediaPlayerCdromBurnStateChange read FOnCdromBurnStateChange write FOnCdromBurnStateChange;
property OnCdromBurnMediaError: TWindowsMediaPlayerCdromBurnMediaError read FOnCdromBurnMediaError write FOnCdromBurnMediaError;
property OnCdromBurnError: TWindowsMediaPlayerCdromBurnError read FOnCdromBurnError write FOnCdromBurnError;
property OnLibraryConnect: TWindowsMediaPlayerLibraryConnect read FOnLibraryConnect write FOnLibraryConnect;
property OnLibraryDisconnect: TWindowsMediaPlayerLibraryDisconnect read FOnLibraryDisconnect write FOnLibraryDisconnect;
property OnFolderScanStateChange: TWindowsMediaPlayerFolderScanStateChange read FOnFolderScanStateChange write FOnFolderScanStateChange;
property OnStringCollectionChange: TWindowsMediaPlayerStringCollectionChange read FOnStringCollectionChange write FOnStringCollectionChange;
property OnMediaCollectionMediaAdded: TWindowsMediaPlayerMediaCollectionMediaAdded read FOnMediaCollectionMediaAdded write FOnMediaCollectionMediaAdded;
property OnMediaCollectionMediaRemoved: TWindowsMediaPlayerMediaCollectionMediaRemoved read FOnMediaCollectionMediaRemoved write FOnMediaCollectionMediaRemoved;
end;
// *********************************************************************//
// The Class CoWMPButtonCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPButtonCtrl exposed by
// the CoClass WMPButtonCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPButtonCtrl = class
class function Create: IWMPButtonCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPButtonCtrl;
end;
// *********************************************************************//
// The Class CoWMPListBoxCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPListBoxCtrl exposed by
// the CoClass WMPListBoxCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPListBoxCtrl = class
class function Create: IWMPListBoxCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPListBoxCtrl;
end;
// *********************************************************************//
// The Class CoWMPSliderCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPSliderCtrl exposed by
// the CoClass WMPSliderCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPSliderCtrl = class
class function Create: IWMPSliderCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPSliderCtrl;
end;
// *********************************************************************//
// The Class CoWMPVideoCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPVideoCtrl exposed by
// the CoClass WMPVideoCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPVideoCtrl = class
class function Create: IWMPVideoCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPVideoCtrl;
end;
// *********************************************************************//
// The Class CoWMPEffects provides a Create and CreateRemote method to
// create instances of the default interface IWMPEffectsCtrl exposed by
// the CoClass WMPEffects. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPEffects = class
class function Create: IWMPEffectsCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPEffectsCtrl;
end;
// *********************************************************************//
// The Class CoWMPEqualizerSettingsCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPEqualizerSettingsCtrl exposed by
// the CoClass WMPEqualizerSettingsCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPEqualizerSettingsCtrl = class
class function Create: IWMPEqualizerSettingsCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPEqualizerSettingsCtrl;
end;
// *********************************************************************//
// The Class CoWMPVideoSettingsCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPVideoSettingsCtrl exposed by
// the CoClass WMPVideoSettingsCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPVideoSettingsCtrl = class
class function Create: IWMPVideoSettingsCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPVideoSettingsCtrl;
end;
// *********************************************************************//
// The Class CoWMPLibraryTreeCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPLibraryTreeCtrl exposed by
// the CoClass WMPLibraryTreeCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPLibraryTreeCtrl = class
class function Create: IWMPLibraryTreeCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPLibraryTreeCtrl;
end;
// *********************************************************************//
// The Class CoWMPEditCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPEditCtrl exposed by
// the CoClass WMPEditCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPEditCtrl = class
class function Create: IWMPEditCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPEditCtrl;
end;
// *********************************************************************//
// The Class CoWMPMenuCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPMenuCtrl exposed by
// the CoClass WMPMenuCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPMenuCtrl = class
class function Create: IWMPMenuCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPMenuCtrl;
end;
// *********************************************************************//
// The Class CoWMPAutoMenuCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPAutoMenuCtrl exposed by
// the CoClass WMPAutoMenuCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPAutoMenuCtrl = class
class function Create: IWMPAutoMenuCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPAutoMenuCtrl;
end;
// *********************************************************************//
// The Class CoWMPRegionalButtonCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPRegionalButtonCtrl exposed by
// the CoClass WMPRegionalButtonCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPRegionalButtonCtrl = class
class function Create: IWMPRegionalButtonCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPRegionalButtonCtrl;
end;
// *********************************************************************//
// The Class CoWMPRegionalButton provides a Create and CreateRemote method to
// create instances of the default interface IWMPRegionalButton exposed by
// the CoClass WMPRegionalButton. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPRegionalButton = class
class function Create: IWMPRegionalButton;
class function CreateRemote(const MachineName: ansistring): IWMPRegionalButton;
end;
// *********************************************************************//
// The Class CoWMPCustomSliderCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPCustomSlider exposed by
// the CoClass WMPCustomSliderCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPCustomSliderCtrl = class
class function Create: IWMPCustomSlider;
class function CreateRemote(const MachineName: ansistring): IWMPCustomSlider;
end;
// *********************************************************************//
// The Class CoWMPTextCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPTextCtrl exposed by
// the CoClass WMPTextCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPTextCtrl = class
class function Create: IWMPTextCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPTextCtrl;
end;
// *********************************************************************//
// The Class CoWMPPlaylistCtrl provides a Create and CreateRemote method to
// create instances of the default interface IWMPPlaylistCtrl exposed by
// the CoClass WMPPlaylistCtrl. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPPlaylistCtrl = class
class function Create: IWMPPlaylistCtrl;
class function CreateRemote(const MachineName: ansistring): IWMPPlaylistCtrl;
end;
// *********************************************************************//
// The Class CoWMPCore provides a Create and CreateRemote method to
// create instances of the default interface IWMPCore3 exposed by
// the CoClass WMPCore. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoWMPCore = class
class function Create: IWMPCore3;
class function CreateRemote(const MachineName: ansistring): IWMPCore3;
end;
procedure Register;
resourcestring
dtlServerPage = 'ActiveX';
dtlOcxPage = 'ActiveX';
implementation
uses ComObj;
procedure TWindowsMediaPlayer.InitControlData;
const
CEventDispIDs: array [0..61] of DWORD = (
$00001389, $000013ED, $000013EE, $0000138A, $000014B5, $0000151B,
$00001519, $0000151A, $0000157D, $000015E1, $00001451, $00001452,
$00001453, $00001454, $00001645, $000016A9, $000016AC, $000016AD,
$000016AA, $000016AB, $000016AE, $000016AF, $000016B0, $000016B1,
$000016BC, $000016B2, $000016B3, $000016B4, $000016BA, $000016BB,
$000016BD, $000016BF, $000016BE, $00001965, $00001966, $00001967,
$00001968, $00001969, $0000196A, $0000196B, $0000196C, $0000196D,
$0000196E, $0000196F, $00001970, $00001971, $00001972, $00001973,
$00001974, $00001975, $00001976, $00001977, $00001978, $00001979,
$0000197A, $0000197B, $0000197C, $0000197D, $0000197E, $000016C0,
$000016C1, $000016C2);
CControlData: TControlData2 = (
ClassID: '{6BF52A52-394A-11D3-B153-00C04F79FAA6}';
EventIID: '{6BF52A51-394A-11D3-B153-00C04F79FAA6}';
EventCount: 62;
EventDispIDs: @CEventDispIDs;
LicenseKey: nil (*HR:$80004002*);
Flags: $00000000;
Version: 401);
begin
ControlData := @CControlData;
TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnOpenStateChange) - Cardinal(Self);
end;
procedure TWindowsMediaPlayer.CreateControl;
procedure DoCreate;
begin
FIntf := IUnknown(OleObject) as IWMPPlayer4;
end;
begin
if FIntf = nil then DoCreate;
end;
function TWindowsMediaPlayer.GetControlInterface: IWMPPlayer4;
begin
CreateControl;
Result := FIntf;
end;
function TWindowsMediaPlayer.Get_controls: IWMPControls;
begin
Result := DefaultInterface.controls;
end;
function TWindowsMediaPlayer.Get_settings: IWMPSettings;
begin
Result := DefaultInterface.settings;
end;
function TWindowsMediaPlayer.Get_currentMedia: IWMPMedia;
begin
Result := DefaultInterface.currentMedia;
end;
procedure TWindowsMediaPlayer.Set_currentMedia(const ppMedia: IWMPMedia);
begin
DefaultInterface.Set_currentMedia(ppMedia);
end;
function TWindowsMediaPlayer.Get_mediaCollection: IWMPMediaCollection;
begin
Result := DefaultInterface.mediaCollection;
end;
function TWindowsMediaPlayer.Get_playlistCollection: IWMPPlaylistCollection;
begin
Result := DefaultInterface.playlistCollection;
end;
function TWindowsMediaPlayer.Get_network: IWMPNetwork;
begin
Result := DefaultInterface.network;
end;
function TWindowsMediaPlayer.Get_currentPlaylist: IWMPPlaylist;
begin
Result := DefaultInterface.currentPlaylist;
end;
procedure TWindowsMediaPlayer.Set_currentPlaylist(const ppPL: IWMPPlaylist);
begin
DefaultInterface.Set_currentPlaylist(ppPL);
end;
function TWindowsMediaPlayer.Get_cdromCollection: IWMPCdromCollection;
begin
Result := DefaultInterface.cdromCollection;
end;
function TWindowsMediaPlayer.Get_closedCaption: IWMPClosedCaption;
begin
Result := DefaultInterface.closedCaption;
end;
function TWindowsMediaPlayer.Get_Error: IWMPError;
begin
Result := DefaultInterface.Error;
end;
function TWindowsMediaPlayer.Get_dvd: IWMPDVD;
begin
Result := DefaultInterface.dvd;
end;
function TWindowsMediaPlayer.Get_playerApplication: IWMPPlayerApplication;
begin
Result := DefaultInterface.playerApplication;
end;
procedure TWindowsMediaPlayer.close;
begin
DefaultInterface.close;
end;
procedure TWindowsMediaPlayer.launchURL(const bstrURL: WideString);
begin
DefaultInterface.launchURL(bstrURL);
end;
function TWindowsMediaPlayer.newPlaylist(const bstrName: WideString; const bstrURL: WideString): IWMPPlaylist;
begin
Result := DefaultInterface.newPlaylist(bstrName, bstrURL);
end;
function TWindowsMediaPlayer.newMedia(const bstrURL: WideString): IWMPMedia;
begin
Result := DefaultInterface.newMedia(bstrURL);
end;
procedure TWindowsMediaPlayer.openPlayer(const bstrURL: WideString);
begin
DefaultInterface.openPlayer(bstrURL);
end;
class function CoWMPButtonCtrl.Create: IWMPButtonCtrl;
begin
Result := CreateComObject(CLASS_WMPButtonCtrl) as IWMPButtonCtrl;
end;
class function CoWMPButtonCtrl.CreateRemote(const MachineName: ansistring): IWMPButtonCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPButtonCtrl) as IWMPButtonCtrl;
end;
class function CoWMPListBoxCtrl.Create: IWMPListBoxCtrl;
begin
Result := CreateComObject(CLASS_WMPListBoxCtrl) as IWMPListBoxCtrl;
end;
class function CoWMPListBoxCtrl.CreateRemote(const MachineName: ansistring): IWMPListBoxCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPListBoxCtrl) as IWMPListBoxCtrl;
end;
class function CoWMPSliderCtrl.Create: IWMPSliderCtrl;
begin
Result := CreateComObject(CLASS_WMPSliderCtrl) as IWMPSliderCtrl;
end;
class function CoWMPSliderCtrl.CreateRemote(const MachineName: ansistring): IWMPSliderCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPSliderCtrl) as IWMPSliderCtrl;
end;
class function CoWMPVideoCtrl.Create: IWMPVideoCtrl;
begin
Result := CreateComObject(CLASS_WMPVideoCtrl) as IWMPVideoCtrl;
end;
class function CoWMPVideoCtrl.CreateRemote(const MachineName: ansistring): IWMPVideoCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPVideoCtrl) as IWMPVideoCtrl;
end;
class function CoWMPEffects.Create: IWMPEffectsCtrl;
begin
Result := CreateComObject(CLASS_WMPEffects) as IWMPEffectsCtrl;
end;
class function CoWMPEffects.CreateRemote(const MachineName: ansistring): IWMPEffectsCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPEffects) as IWMPEffectsCtrl;
end;
class function CoWMPEqualizerSettingsCtrl.Create: IWMPEqualizerSettingsCtrl;
begin
Result := CreateComObject(CLASS_WMPEqualizerSettingsCtrl) as IWMPEqualizerSettingsCtrl;
end;
class function CoWMPEqualizerSettingsCtrl.CreateRemote(const MachineName: ansistring): IWMPEqualizerSettingsCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPEqualizerSettingsCtrl) as IWMPEqualizerSettingsCtrl;
end;
class function CoWMPVideoSettingsCtrl.Create: IWMPVideoSettingsCtrl;
begin
Result := CreateComObject(CLASS_WMPVideoSettingsCtrl) as IWMPVideoSettingsCtrl;
end;
class function CoWMPVideoSettingsCtrl.CreateRemote(const MachineName: ansistring): IWMPVideoSettingsCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPVideoSettingsCtrl) as IWMPVideoSettingsCtrl;
end;
class function CoWMPLibraryTreeCtrl.Create: IWMPLibraryTreeCtrl;
begin
Result := CreateComObject(CLASS_WMPLibraryTreeCtrl) as IWMPLibraryTreeCtrl;
end;
class function CoWMPLibraryTreeCtrl.CreateRemote(const MachineName: ansistring): IWMPLibraryTreeCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPLibraryTreeCtrl) as IWMPLibraryTreeCtrl;
end;
class function CoWMPEditCtrl.Create: IWMPEditCtrl;
begin
Result := CreateComObject(CLASS_WMPEditCtrl) as IWMPEditCtrl;
end;
class function CoWMPEditCtrl.CreateRemote(const MachineName: ansistring): IWMPEditCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPEditCtrl) as IWMPEditCtrl;
end;
class function CoWMPMenuCtrl.Create: IWMPMenuCtrl;
begin
Result := CreateComObject(CLASS_WMPMenuCtrl) as IWMPMenuCtrl;
end;
class function CoWMPMenuCtrl.CreateRemote(const MachineName: ansistring): IWMPMenuCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPMenuCtrl) as IWMPMenuCtrl;
end;
class function CoWMPAutoMenuCtrl.Create: IWMPAutoMenuCtrl;
begin
Result := CreateComObject(CLASS_WMPAutoMenuCtrl) as IWMPAutoMenuCtrl;
end;
class function CoWMPAutoMenuCtrl.CreateRemote(const MachineName: ansistring): IWMPAutoMenuCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPAutoMenuCtrl) as IWMPAutoMenuCtrl;
end;
class function CoWMPRegionalButtonCtrl.Create: IWMPRegionalButtonCtrl;
begin
Result := CreateComObject(CLASS_WMPRegionalButtonCtrl) as IWMPRegionalButtonCtrl;
end;
class function CoWMPRegionalButtonCtrl.CreateRemote(const MachineName: ansistring): IWMPRegionalButtonCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPRegionalButtonCtrl) as IWMPRegionalButtonCtrl;
end;
class function CoWMPRegionalButton.Create: IWMPRegionalButton;
begin
Result := CreateComObject(CLASS_WMPRegionalButton) as IWMPRegionalButton;
end;
class function CoWMPRegionalButton.CreateRemote(const MachineName: ansistring): IWMPRegionalButton;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPRegionalButton) as IWMPRegionalButton;
end;
class function CoWMPCustomSliderCtrl.Create: IWMPCustomSlider;
begin
Result := CreateComObject(CLASS_WMPCustomSliderCtrl) as IWMPCustomSlider;
end;
class function CoWMPCustomSliderCtrl.CreateRemote(const MachineName: ansistring): IWMPCustomSlider;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPCustomSliderCtrl) as IWMPCustomSlider;
end;
class function CoWMPTextCtrl.Create: IWMPTextCtrl;
begin
Result := CreateComObject(CLASS_WMPTextCtrl) as IWMPTextCtrl;
end;
class function CoWMPTextCtrl.CreateRemote(const MachineName: ansistring): IWMPTextCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPTextCtrl) as IWMPTextCtrl;
end;
class function CoWMPPlaylistCtrl.Create: IWMPPlaylistCtrl;
begin
Result := CreateComObject(CLASS_WMPPlaylistCtrl) as IWMPPlaylistCtrl;
end;
class function CoWMPPlaylistCtrl.CreateRemote(const MachineName: ansistring): IWMPPlaylistCtrl;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPPlaylistCtrl) as IWMPPlaylistCtrl;
end;
class function CoWMPCore.Create: IWMPCore3;
begin
Result := CreateComObject(CLASS_WMPCore) as IWMPCore3;
end;
class function CoWMPCore.CreateRemote(const MachineName: ansistring): IWMPCore3;
begin
Result := CreateRemoteComObject(MachineName, CLASS_WMPCore) as IWMPCore3;
end;
procedure Register;
begin
RegisterComponents(dtlOcxPage, [TWindowsMediaPlayer]);
end;
end.
| 55.846968 | 208 | 0.703766 |
47d8c62dae3c11b9e4b08f1d1357a045c92e5899 | 46 | pas | Pascal | Test/FailureScripts/not_untyped.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| 1 | 2022-02-18T22:14:44.000Z | 2022-02-18T22:14:44.000Z | Test/FailureScripts/not_untyped.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | Test/FailureScripts/not_untyped.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | procedure Test;
begin
end;
var a := not Test; | 9.2 | 18 | 0.695652 |
8503ba7bc3372fc4a5fc37432d1711d12885ba97 | 149 | dfm | Pascal | Demos/Beacons/Service/BD.ServiceModule.dfm | atkins126/Playground | 6e90050a3247a28da1024ec4359785c1b261f342 | [
"MIT"
]
| 14 | 2021-12-30T08:03:49.000Z | 2022-03-17T19:33:24.000Z | Demos/Beacons/Service/BD.ServiceModule.dfm | atkins126/Playground | 6e90050a3247a28da1024ec4359785c1b261f342 | [
"MIT"
]
| 6 | 2022-01-01T21:56:18.000Z | 2022-03-01T22:23:56.000Z | Demos/Beacons/Service/BD.ServiceModule.dfm | atkins126/Playground | 6e90050a3247a28da1024ec4359785c1b261f342 | [
"MIT"
]
| 4 | 2022-01-04T13:25:08.000Z | 2022-01-13T09:58:32.000Z | object ServiceModule: TServiceModule
OnHandleIntent = AndroidIntentServiceHandleIntent
Height = 238
Width = 324
PixelsPerInch = 96
end
| 21.285714 | 52 | 0.765101 |
f17d1dab93ec81dc604a5d06a942bfd77ea9ceea | 945 | pas | Pascal | src/ColorPicker/RGBCMYKUtils.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | src/ColorPicker/RGBCMYKUtils.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | src/ColorPicker/RGBCMYKUtils.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | unit RGBCMYKUtils;
interface
uses
Windows, Graphics, Math;
procedure ColorToCMYK(clr: TColor; var C, M, Y, K: integer);
function GetCValue(c: TColor): integer;
function GetMValue(c: TColor): integer;
function GetYValue(c: TColor): integer;
function GetKValue(c: TColor): integer;
implementation
procedure ColorToCMYK(clr: TColor; var C, M, Y, K: integer);
begin
C := 255 - GetRValue(clr);
M := 255 - GetGValue(clr);
Y := 255 - GetBValue(clr);
K := MinIntValue([C, M, Y]);
C := C - K;
M := M - K;
Y := Y - K;
end;
function GetCValue(c: TColor): integer;
var
d: integer;
begin
ColorToCMYK(c, Result, d, d, d);
end;
function GetMValue(c: TColor): integer;
var
d: integer;
begin
ColorToCMYK(c, d, Result, d, d);
end;
function GetYValue(c: TColor): integer;
var
d: integer;
begin
ColorToCMYK(c, d, d, Result, d);
end;
function GetKValue(c: TColor): integer;
var
d: integer;
begin
ColorToCMYK(c, d, d, d, Result);
end;
end.
| 16.578947 | 60 | 0.67619 |
aa95b360506c91b78d92cd51b4540df18a4a35b7 | 45,103 | pas | Pascal | source/HtmlSymb.pas | PopRe/HtmlViewer | e7e96247fb1b63f59ddfcd2888793b354275b319 | [
"MIT"
]
| 320 | 2015-01-12T08:42:13.000Z | 2022-03-26T14:49:32.000Z | source/HtmlSymb.pas | PopRe/HtmlViewer | e7e96247fb1b63f59ddfcd2888793b354275b319 | [
"MIT"
]
| 217 | 2015-01-05T10:40:53.000Z | 2022-03-17T13:49:52.000Z | source/HtmlSymb.pas | PopRe/HtmlViewer | e7e96247fb1b63f59ddfcd2888793b354275b319 | [
"MIT"
]
| 133 | 2015-02-10T12:51:08.000Z | 2022-03-17T13:51:32.000Z | {
Version 11.7
Copyright (c) 2014-2016 by HtmlViewer Team
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note that the source modules HTMLGIF1.PAS and DITHERUNIT.PAS
are covered by separate copyright notices located in those modules.
}
{$I htmlcons.inc}
unit HtmlSymb;
interface
uses
{$ifdef MSWINDOWS}
Windows, SysUtils,
{$endif}
HtmlGlobals;
type
TElemSymb = (
OtherChar, CommandSy, StringSy {was TextSy}, EolSy, EofSy,
{ doc type tags }
XmlSy, DocTypeSy,
{ html elements }
HtmlSy, HeadSy,
HtmlEndSy, HeadEndSy,
{ frame set elements }
FrameSetSy, FrameSetEndSy,
FrameSy,
NoFramesSy, NoFramesEndSy,
{ metadata elements }
TitleElemSy, TitleEndSy,
BaseSy,
LinkElemSy,
MetaSy,
StyleSy, StyleEndSy,
ScriptSy, ScriptEndSy,
{ misc elements }
BaseFontSy,
BgSoundSy,
HRSy,
BRSy,
ImageSy,
PanelSy,
IFrameSy, IFrameEndSy,
ProgressSy, ProgressEndSy,
MeterSy, MeterEndSy,
MapSy, MapEndSy,
AreaSy,
PageSy,
ObjectSy, ObjectEndSy,
ParamSy,
{ inline elements }
SpanSy, NoBrSy,
SpanEndSy, NoBrEndSy,
WbrSy,
FontSy, BSy, ISy, SSy, StrikeSy, USy, SubSy, SupSy, BigSy, SmallSy, TTSy,
FontEndSy, BEndSy, IEndSy, SEndSy, StrikeEndSy, UEndSy, SubEndSy, SupEndSy, BigEndSy, SmallEndSy, TTEndSy,
EmSy, StrongSy, CodeSy, KbdSy, SampSy, CiteSy, VarSy, AbbrSy, AcronymSy, DfnSy,
EmEndSy, StrongEndSy, CodeEndSy, KbdEndSy, SampEndSy, CiteEndSy, VarEndSy, AbbrEndSy, AcronymEndSy, DfnEndSy,
DelSy, InsSy, MarkSy, TimeSy,
DelEndSy, InsEndSy, MarkEndSy, TimeEndSy,
ASy,
AEndSy,
{ block elements }
BodySy, PSy, DivSy, CenterSy,
BodyEndSy, PEndSy, DivEndSy, CenterEndSy,
ArticleSy, SectionSy, MainSy, NavSy, AsideSy,
ArticleEndSy, SectionEndSy, MainEndSy, NavEndSy, AsideEndSy,
{Keep order} H1Sy, H2Sy, H3Sy, H4Sy, H5Sy, H6Sy, {end order}
{Keep order} H1EndSy, H2EndSy, H3EndSy, H4EndSy, H5EndSy, H6EndSy, {end order}
HGroupSy, HeaderSy, FooterSy, AddressSy, BlockQuoteSy, PreSy,
HGroupEndSy, HeaderEndSy, FooterEndSy, AddressEndSy, BlockQuoteEndSy, PreEndSy,
OLSy, LISy, ULSy, DirSy, MenuSy, DLSy, DDSy, DTSy,
OLEndSy, LIEndSy, ULEndSy, DirEndSy, MenuEndSy, DLEndSy, DDEndSy, DTEndSy,
liAloneSy,
{ table elements }
TableSy, TableEndSy,
ColGroupSy, ColGroupEndSy, ColSy,
CaptionSy, CaptionEndSy,
THeadSy, TBodySy, TFootSy,
THeadEndSy, TBodyEndSy, TFootEndSy,
TRSy, TREndSy,
THSy, TDSy,
THEndSy, TDEndSy,
{ form elements }
FormSy, FormEndSy,
FieldsetSy, FieldsetEndSy,
LegendSy, LegendEndSy,
LabelSy, LabelEndSy,
TextAreaSy, SelectSy, OptionSy, ButtonSy, ButtonEndSy, InputSy,
TextAreaEndSy, SelectEndSy, OptionEndSy
);
TElemSymbSet = set of TElemSymb;
TAttrSymb = (
OtherAttribute,
ActionSy,
ActiveSy,
AlignSy,
AltSy,
BackgroundSy,
BGColorSy,
BGPropertiesSy,
BorderSy,
BorderColorSy,
BorderColorDarkSy,
BorderColorLightSy,
CellPaddingSy,
CellSpacingSy,
CharSetSy,
CheckBoxSy,
CheckedSy,
ClassSy,
ClearSy,
ColorSy,
ColsSy,
ColSpanSy,
ContentSy,
CoordsSy,
DisabledSy,
EncodingSy,
EncTypeSy,
FaceSy,
FrameAttrSy,
FrameBorderSy,
HeightSy,
HighSy,
HrefSy,
HSpaceSy,
HttpEqSy,
IDSy,
IsMapSy,
LabelAttrSy,
LanguageSy,
LeftMarginSy,
LinkSy,
LoopSy,
LowSy,
MarginHeightSy,
MarginWidthSy,
MaxSy,
MaxLengthSy,
MediaSy,
MethodSy,
MinSy,
MultipleSy,
NameSy,
NoHrefSy,
NoResizeSy,
NoShadeSy,
NoWrapSy,
OLinkSy,
OnBlurSy,
OnChangeSy,
OnClickSy,
OnFocusSy,
OptimumSy,
PlaceholderSy,
PlainSy,
RadioSy,
RatioSy,
ReadonlySy,
RelSy,
RevSy,
RowsSy,
RowSpanSy,
RulesSy,
ScrollingSy,
SelectedSy,
ShapeSy,
SizeSy,
SpanAttrSy,
SpellCheckSy,
SrcSy,
StartSy,
StyleAttrSy,
TabIndexSy,
TargetSy,
TextSy,
TitleSy,
TopMarginSy,
TranspSy,
TypeSy,
UseMapSy,
VAlignSy,
ValueSy,
VersionSy,
VLinkSy,
VSpaceSy,
WidthSy,
WrapSy);
TAttrSymbSet = set of TAttrSymb;
PEntity = ^TEntity;
TEntity = record
Name: ThtString;
Value: Integer;
end;
PResWord = ^TResWord;
TResWord = record
Name: ThtString;
Symbol: TElemSymb;
EndSym: TElemSymb; // CommandSy == no end symbol
end;
PSymbol = ^TSymbolRec;
TSymbolRec = record
Name: ThtString;
Value: TAttrSymb;
end;
var
Entities: ThtStringList;
ElementNames: ThtStringList;
AttributeNames: ThtStringList;
procedure SetSymbolName(Sy: TElemSymb; Name: ThtString); overload;
procedure SetSymbolName(Sy: TAttrSymb; Name: ThtString); overload;
function SymbToStr(Sy: TElemSymb): ThtString; overload;
function SymbToStr(Sy: TAttrSymb): ThtString; overload;
function EndSymbToStr(Sy: TElemSymb): ThtString;
function EndSymbToSymb(Sy: TElemSymb): TElemSymb;
function EndSymbFromSymb(Sy: TElemSymb): TElemSymb;
implementation
var
ElementNamesIndex: array [TElemSymb] of Integer;
ElemSymbolNames: array [TElemSymb] of ThtString;
AttrSymbolNames: array [TAttrSymb] of ThtString;
procedure SetSymbolName(Sy: TElemSymb; Name: ThtString); overload;
begin
Name := htLowerCase(Name);
if ElemSymbolNames[Sy] <> '' then
assert(ElemSymbolNames[Sy] = Name, 'Different names for same element symbol!');
ElemSymbolNames[Sy] := Name;
end;
procedure SetSymbolName(Sy: TAttrSymb; Name: ThtString); overload;
begin
Name := htLowerCase(Name);
if AttrSymbolNames[Sy] <> '' then
assert(AttrSymbolNames[Sy] = Name, 'Different names for same attribute symbol!');
AttrSymbolNames[Sy] := Name;
end;
function SymbToStr(Sy: TElemSymb): ThtString;
begin
Result := ElemSymbolNames[Sy];
end;
function SymbToStr(Sy: TAttrSymb): ThtString;
begin
Result := AttrSymbolNames[Sy];
end;
function EndSymbToStr(Sy: TElemSymb): ThtString;
begin
Result := ElemSymbolNames[Sy];
end;
function EndSymbToSymb(Sy: TElemSymb): TElemSymb;
var
I: Integer;
begin
I := ElementNamesIndex[Sy];
if I >= 0 then
Result := PResWord(ElementNames.Objects[I]).Symbol
else
Result := CommandSy; // no match
end;
function EndSymbFromSymb(Sy: TElemSymb): TElemSymb;
var
I: Integer;
begin
I := ElementNamesIndex[Sy];
if I >= 0 then
Result := PResWord(ElementNames.Objects[I]).EndSym
else
Result := CommandSy; // no match
end;
procedure InitEntities;
const
// Taken from http://www.w3.org/TR/REC-html40/sgml/entities.html.
// Note: the entities will be sorted into a ThtStringList to make binary search possible.
EntityDefinitions: array[1..253] of TEntity = (
// ISO 8859-1 characters
(Name: 'nbsp'; Value: 160), // no-break space = non-breaking space, U+00A0 ISOnum
(Name: 'iexcl'; Value: 161), // inverted exclamation mark, U+00A1 ISOnum
(Name: 'cent'; Value: 162), // cent sign, U+00A2 ISOnum
(Name: 'pound'; Value: 163), // pound sign, U+00A3 ISOnum
(Name: 'curren'; Value: 164), // currency sign, U+00A4 ISOnum
(Name: 'yen'; Value: 165), // yen sign = yuan sign, U+00A5 ISOnum
(Name: 'brvbar'; Value: 166), // broken bar = broken vertical bar, U+00A6 ISOnum
(Name: 'sect'; Value: 167), // section sign, U+00A7 ISOnum
(Name: 'uml'; Value: 168), // diaeresis = spacing diaeresis, U+00A8 ISOdia
(Name: 'copy'; Value: 169), // copyright sign, U+00A9 ISOnum
(Name: 'ordf'; Value: 170), // feminine ordinal indicator, U+00AA ISOnum
(Name: 'laquo'; Value: 171), // left-pointing double angle quotation mark = left pointing guillemet, U+00AB ISOnum
(Name: 'not'; Value: 172), // not sign, U+00AC ISOnum
(Name: 'shy'; Value: 173), // soft hyphen = discretionary hyphen, U+00AD ISOnum
(Name: 'reg'; Value: 174), // registered sign = registered trade mark sign, U+00AE ISOnum
(Name: 'macr'; Value: 175), // macron = spacing macron = overline = APL overbar, U+00AF ISOdia
(Name: 'deg'; Value: 176), // degree sign, U+00B0 ISOnum
(Name: 'plusmn'; Value: 177), // plus-minus sign = plus-or-minus sign, U+00B1 ISOnum
(Name: 'sup2'; Value: 178), // superscript two = superscript digit two = squared, U+00B2 ISOnum
(Name: 'sup3'; Value: 179), // superscript three = superscript digit three = cubed, U+00B3 ISOnum
(Name: 'acute'; Value: 180), // acute accent = spacing acute, U+00B4 ISOdia
(Name: 'micro'; Value: 181), // micro sign, U+00B5 ISOnum
(Name: 'para'; Value: 182), // pilcrow sign = paragraph sign, U+00B6 ISOnum
(Name: 'middot'; Value: 183), // middle dot = Georgian comma = Greek middle dot, U+00B7 ISOnum
(Name: 'cedil'; Value: 184), // cedilla = spacing cedilla, U+00B8 ISOdia
(Name: 'sup1'; Value: 185), // superscript one = superscript digit one, U+00B9 ISOnum
(Name: 'ordm'; Value: 186), // masculine ordinal indicator, U+00BA ISOnum
(Name: 'raquo'; Value: 187), // right-pointing double angle quotation mark = right pointing guillemet, U+00BB ISOnum
(Name: 'frac14'; Value: 188), // vulgar fraction one quarter = fraction one quarter, U+00BC ISOnum
(Name: 'frac12'; Value: 189), // vulgar fraction one half = fraction one half, U+00BD ISOnum
(Name: 'frac34'; Value: 190), // vulgar fraction three quarters = fraction three quarters, U+00BE ISOnum
(Name: 'iquest'; Value: 191), // inverted question mark = turned question mark, U+00BF ISOnum
(Name: 'Agrave'; Value: 192), // latin capital letter A with grave = latin capital letter A grave, U+00C0 ISOlat1
(Name: 'Aacute'; Value: 193), // latin capital letter A with acute, U+00C1 ISOlat1
(Name: 'Acirc'; Value: 194), // latin capital letter A with circumflex, U+00C2 ISOlat1
(Name: 'Atilde'; Value: 195), // latin capital letter A with tilde, U+00C3 ISOlat1
(Name: 'Auml'; Value: 196), // latin capital letter A with diaeresis, U+00C4 ISOlat1
(Name: 'Aring'; Value: 197), // latin capital letter A with ring above = latin capital letter A ring, U+00C5 ISOlat1
(Name: 'AElig'; Value: 198), // latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
(Name: 'Ccedil'; Value: 199), // latin capital letter C with cedilla, U+00C7 ISOlat1
(Name: 'Egrave'; Value: 200), // latin capital letter E with grave, U+00C8 ISOlat1
(Name: 'Eacute'; Value: 201), // latin capital letter E with acute, U+00C9 ISOlat1
(Name: 'Ecirc'; Value: 202), // latin capital letter E with circumflex, U+00CA ISOlat1
(Name: 'Euml'; Value: 203), // latin capital letter E with diaeresis, U+00CB ISOlat1
(Name: 'Igrave'; Value: 204), // latin capital letter I with grave, U+00CC ISOlat1
(Name: 'Iacute'; Value: 205), // latin capital letter I with acute, U+00CD ISOlat1
(Name: 'Icirc'; Value: 206), // latin capital letter I with circumflex, U+00CE ISOlat1
(Name: 'Iuml'; Value: 207), // latin capital letter I with diaeresis, U+00CF ISOlat1
(Name: 'ETH'; Value: 208), // latin capital letter ETH, U+00D0 ISOlat1
(Name: 'Ntilde'; Value: 209), // latin capital letter N with tilde, U+00D1 ISOlat1
(Name: 'Ograve'; Value: 210), // latin capital letter O with grave, U+00D2 ISOlat1
(Name: 'Oacute'; Value: 211), // latin capital letter O with acute, U+00D3 ISOlat1
(Name: 'Ocirc'; Value: 212), // latin capital letter O with circumflex, U+00D4 ISOlat1
(Name: 'Otilde'; Value: 213), // latin capital letter O with tilde, U+00D5 ISOlat1
(Name: 'Ouml'; Value: 214), // latin capital letter O with diaeresis, U+00D6 ISOlat1
(Name: 'times'; Value: 215), // multiplication sign, U+00D7 ISOnum
(Name: 'Oslash'; Value: 216), // latin capital letter O with stroke = latin capital letter O slash, U+00D8 ISOlat1
(Name: 'Ugrave'; Value: 217), // latin capital letter U with grave, U+00D9 ISOlat1
(Name: 'Uacute'; Value: 218), // latin capital letter U with acute, U+00DA ISOlat1
(Name: 'Ucirc'; Value: 219), // latin capital letter U with circumflex, U+00DB ISOlat1
(Name: 'Uuml'; Value: 220), // latin capital letter U with diaeresis, U+00DC ISOlat1
(Name: 'Yacute'; Value: 221), // latin capital letter Y with acute, U+00DD ISOlat1
(Name: 'THORN'; Value: 222), // latin capital letter THORN, U+00DE ISOlat1
(Name: 'szlig'; Value: 223), // latin small letter sharp s = ess-zed, U+00DF ISOlat1
(Name: 'agrave'; Value: 224), // latin small letter a with grave = latin small letter a grave, U+00E0 ISOlat1
(Name: 'aacute'; Value: 225), // latin small letter a with acute, U+00E1 ISOlat1
(Name: 'acirc'; Value: 226), // latin small letter a with circumflex, U+00E2 ISOlat1
(Name: 'atilde'; Value: 227), // latin small letter a with tilde, U+00E3 ISOlat1
(Name: 'auml'; Value: 228), // latin small letter a with diaeresis, U+00E4 ISOlat1
(Name: 'aring'; Value: 229), // latin small letter a with ring above = latin small letter a ring, U+00E5 ISOlat1
(Name: 'aelig'; Value: 230), // latin small letter ae = latin small ligature ae, U+00E6 ISOlat1
(Name: 'ccedil'; Value: 231), // latin small letter c with cedilla, U+00E7 ISOlat1
(Name: 'egrave'; Value: 232), // latin small letter e with grave, U+00E8 ISOlat1
(Name: 'eacute'; Value: 233), // latin small letter e with acute, U+00E9 ISOlat1
(Name: 'ecirc'; Value: 234), // latin small letter e with circumflex, U+00EA ISOlat1
(Name: 'euml'; Value: 235), // latin small letter e with diaeresis, U+00EB ISOlat1
(Name: 'igrave'; Value: 236), // latin small letter i with grave, U+00EC ISOlat1
(Name: 'iacute'; Value: 237), // latin small letter i with acute, U+00ED ISOlat1
(Name: 'icirc'; Value: 238), // latin small letter i with circumflex, U+00EE ISOlat1
(Name: 'iuml'; Value: 239), // latin small letter i with diaeresis, U+00EF ISOlat1
(Name: 'eth'; Value: 240), // latin small letter eth, U+00F0 ISOlat1
(Name: 'ntilde'; Value: 241), // latin small letter n with tilde, U+00F1 ISOlat1
(Name: 'ograve'; Value: 242), // latin small letter o with grave, U+00F2 ISOlat1
(Name: 'oacute'; Value: 243), // latin small letter o with acute, U+00F3 ISOlat1
(Name: 'ocirc'; Value: 244), // latin small letter o with circumflex, U+00F4 ISOlat1
(Name: 'otilde'; Value: 245), // latin small letter o with tilde, U+00F5 ISOlat1
(Name: 'ouml'; Value: 246), // latin small letter o with diaeresis, U+00F6 ISOlat1
(Name: 'divide'; Value: 247), // division sign, U+00F7 ISOnum
(Name: 'oslash'; Value: 248), // latin small letter o with stroke, = latin small letter o slash, U+00F8 ISOlat1
(Name: 'ugrave'; Value: 249), // latin small letter u with grave, U+00F9 ISOlat1
(Name: 'uacute'; Value: 250), // latin small letter u with acute, U+00FA ISOlat1
(Name: 'ucirc'; Value: 251), // latin small letter u with circumflex, U+00FB ISOlat1
(Name: 'uuml'; Value: 252), // latin small letter u with diaeresis, U+00FC ISOlat1
(Name: 'yacute'; Value: 253), // latin small letter y with acute, U+00FD ISOlat1
(Name: 'thorn'; Value: 254), // latin small letter thorn, U+00FE ISOlat1
(Name: 'yuml'; Value: 255), // latin small letter y with diaeresis, U+00FF ISOlat1
// symbols, mathematical symbols, and Greek letters
// Latin Extended-B
(Name: 'fnof'; Value: 402), // latin small f with hook = function = florin, U+0192 ISOtech
// Greek
(Name: 'Alpha'; Value: 913), // greek capital letter alpha, U+0391
(Name: 'Beta'; Value: 914), // greek capital letter beta, U+0392
(Name: 'Gamma'; Value: 915), // greek capital letter gamma, U+0393 ISOgrk3
(Name: 'Delta'; Value: 916), // greek capital letter delta, U+0394 ISOgrk3
(Name: 'Epsilon'; Value: 917), // greek capital letter epsilon, U+0395
(Name: 'Zeta'; Value: 918), // greek capital letter zeta, U+0396
(Name: 'Eta'; Value: 919), // greek capital letter eta, U+0397
(Name: 'Theta'; Value: 920), // greek capital letter theta, U+0398 ISOgrk3
(Name: 'Iota'; Value: 921), // greek capital letter iota, U+0399
(Name: 'Kappa'; Value: 922), // greek capital letter kappa, U+039A
(Name: 'Lambda'; Value: 923), // greek capital letter lambda, U+039B ISOgrk3
(Name: 'Mu'; Value: 924), // greek capital letter mu, U+039C
(Name: 'Nu'; Value: 925), // greek capital letter nu, U+039D
(Name: 'Xi'; Value: 926), // greek capital letter xi, U+039E ISOgrk3
(Name: 'Omicron'; Value: 927), // greek capital letter omicron, U+039F
(Name: 'Pi'; Value: 928), // greek capital letter pi, U+03A0 ISOgrk3
(Name: 'Rho'; Value: 929), // greek capital letter rho, U+03A1
(Name: 'Sigma'; Value: 931), // greek capital letter sigma, U+03A3 ISOgrk3,
// there is no Sigmaf, and no U+03A2 character either
(Name: 'Tau'; Value: 932), // greek capital letter tau, U+03A4
(Name: 'Upsilon'; Value: 933), // greek capital letter upsilon, U+03A5 ISOgrk3
(Name: 'Phi'; Value: 934), // greek capital letter phi, U+03A6 ISOgrk3
(Name: 'Chi'; Value: 935), // greek capital letter chi, U+03A7
(Name: 'Psi'; Value: 936), // greek capital letter psi, U+03A8 ISOgrk3
(Name: 'Omega'; Value: 937), // greek capital letter omega, U+03A9 ISOgrk3
(Name: 'alpha'; Value: 945), // greek small letter alpha, U+03B1 ISOgrk3
(Name: 'beta'; Value: 946), // greek small letter beta, U+03B2 ISOgrk3
(Name: 'gamma'; Value: 947), // greek small letter gamma, U+03B3 ISOgrk3
(Name: 'delta'; Value: 948), // greek small letter delta, U+03B4 ISOgrk3
(Name: 'epsilon'; Value: 949), // greek small letter epsilon, U+03B5 ISOgrk3
(Name: 'zeta'; Value: 950), // greek small letter zeta, U+03B6 ISOgrk3
(Name: 'eta'; Value: 951), // greek small letter eta, U+03B7 ISOgrk3
(Name: 'theta'; Value: 952), // greek small letter theta, U+03B8 ISOgrk3
(Name: 'iota'; Value: 953), // greek small letter iota, U+03B9 ISOgrk3
(Name: 'kappa'; Value: 954), // greek small letter kappa, U+03BA ISOgrk3
(Name: 'lambda'; Value: 955), // greek small letter lambda, U+03BB ISOgrk3
(Name: 'mu'; Value: 956), // greek small letter mu, U+03BC ISOgrk3
(Name: 'nu'; Value: 957), // greek small letter nu, U+03BD ISOgrk3
(Name: 'xi'; Value: 958), // greek small letter xi, U+03BE ISOgrk3
(Name: 'omicron'; Value: 959), // greek small letter omicron, U+03BF NEW
(Name: 'pi'; Value: 960), // greek small letter pi, U+03C0 ISOgrk3
(Name: 'rho'; Value: 961), // greek small letter rho, U+03C1 ISOgrk3
(Name: 'sigmaf'; Value: 962), // greek small letter final sigma, U+03C2 ISOgrk3
(Name: 'sigma'; Value: 963), // greek small letter sigma, U+03C3 ISOgrk3
(Name: 'tau'; Value: 964), // greek small letter tau, U+03C4 ISOgrk3
(Name: 'upsilon'; Value: 965), // greek small letter upsilon, U+03C5 ISOgrk3
(Name: 'phi'; Value: 966), // greek small letter phi, U+03C6 ISOgrk3
(Name: 'chi'; Value: 967), // greek small letter chi, U+03C7 ISOgrk3
(Name: 'psi'; Value: 968), // greek small letter psi, U+03C8 ISOgrk3
(Name: 'omega'; Value: 969), // greek small letter omega, U+03C9 ISOgrk3
(Name: 'thetasym'; Value: 977), // greek small letter theta symbol, U+03D1 NEW
(Name: 'upsih'; Value: 978), // greek upsilon with hook symbol, U+03D2 NEW
(Name: 'piv'; Value: 982), // greek pi symbol, U+03D6 ISOgrk3
// General Punctuation
(Name: 'apos'; Value: 8217), // curly apostrophe,
(Name: 'bull'; Value: 8226), // bullet = black small circle, U+2022 ISOpub,
// bullet is NOT the same as bullet operator, U+2219
(Name: 'hellip'; Value: 8230), // horizontal ellipsis = three dot leader, U+2026 ISOpub
(Name: 'prime'; Value: 8242), // prime = minutes = feet, U+2032 ISOtech
(Name: 'Prime'; Value: 8243), // double prime = seconds = inches, U+2033 ISOtech
(Name: 'oline'; Value: 8254), // overline = spacing overscore, U+203E NEW
(Name: 'frasl'; Value: 8260), // fraction slash, U+2044 NEW
// Letterlike Symbols
(Name: 'weierp'; Value: 8472), // script capital P = power set = Weierstrass p, U+2118 ISOamso
(Name: 'image'; Value: 8465), // blackletter capital I = imaginary part, U+2111 ISOamso
(Name: 'real'; Value: 8476), // blackletter capital R = real part symbol, U+211C ISOamso
(Name: 'trade'; Value: 8482), // trade mark sign, U+2122 ISOnum
(Name: 'alefsym'; Value: 8501), // alef symbol = first transfinite cardinal, U+2135 NEW
// alef symbol is NOT the same as hebrew letter alef, U+05D0 although the same
// glyph could be used to depict both characters
// Arrows
(Name: 'larr'; Value: 8592), // leftwards arrow, U+2190 ISOnum
(Name: 'uarr'; Value: 8593), // upwards arrow, U+2191 ISOnu
(Name: 'rarr'; Value: 8594), // rightwards arrow, U+2192 ISOnum
(Name: 'darr'; Value: 8595), // downwards arrow, U+2193 ISOnum
(Name: 'harr'; Value: 8596), // left right arrow, U+2194 ISOamsa
(Name: 'crarr'; Value: 8629), // downwards arrow with corner leftwards = carriage return, U+21B5 NEW
(Name: 'lArr'; Value: 8656), // leftwards double arrow, U+21D0 ISOtech
// ISO 10646 does not say that lArr is the same as the 'is implied by' arrow but
// also does not have any other charater for that function. So ? lArr can be used
// for 'is implied by' as ISOtech sugg
(Name: 'uArr'; Value: 8657), // upwards double arrow, U+21D1 ISOamsa
(Name: 'rArr'; Value: 8658), // rightwards double arrow, U+21D2 ISOtech
// ISO 10646 does not say this is the 'implies' character but does not have another
// character with this function so ? rArr can be used for 'implies' as ISOtech suggests
(Name: 'dArr'; Value: 8659), // downwards double arrow, U+21D3 ISOamsa
(Name: 'hArr'; Value: 8660), // left right double arrow, U+21D4 ISOamsa
// Mathematical Operators
(Name: 'forall'; Value: 8704), // for all, U+2200 ISOtech
(Name: 'part'; Value: 8706), // partial differential, U+2202 ISOtech
(Name: 'exist'; Value: 8707), // there exists, U+2203 ISOtech
(Name: 'empty'; Value: 8709), // empty set = null set = diameter, U+2205 ISOamso
(Name: 'nabla'; Value: 8711), // nabla = backward difference, U+2207 ISOtech
(Name: 'isin'; Value: 8712), // element of, U+2208 ISOtech
(Name: 'notin'; Value: 8713), // not an element of, U+2209 ISOtech
(Name: 'ni'; Value: 8715), // contains as member, U+220B ISOtech
(Name: 'prod'; Value: 8719), // n-ary product = product sign, U+220F ISOamsb
// prod is NOT the same character as U+03A0 'greek capital letter pi' though the
// same glyph might be used for both
(Name: 'sum'; Value: 8721), // n-ary sumation, U+2211 ISOamsb
// sum is NOT the same character as U+03A3 'greek capital letter sigma' though the
// same glyph might be used for both
(Name: 'minus'; Value: 8722), // minus sign, U+2212 ISOtech
(Name: 'lowast'; Value: 8727), // asterisk operator, U+2217 ISOtech
(Name: 'radic'; Value: 8730), // square root = radical sign, U+221A ISOtech
(Name: 'prop'; Value: 8733), // proportional to, U+221D ISOtech
(Name: 'infin'; Value: 8734), // infinity, U+221E ISOtech
(Name: 'ang'; Value: 8736), // angle, U+2220 ISOamso
(Name: 'and'; Value: 8743), // logical and = wedge, U+2227 ISOtech
(Name: 'or'; Value: 8744), // logical or = vee, U+2228 ISOtech
(Name: 'cap'; Value: 8745), // intersection = cap, U+2229 ISOtech
(Name: 'cup'; Value: 8746), // union = cup, U+222A ISOtech
(Name: 'int'; Value: 8747), // integral, U+222B ISOtech
(Name: 'there4'; Value: 8756), // therefore, U+2234 ISOtech
(Name: 'sim'; Value: 8764), // tilde operator = varies with = similar to, U+223C ISOtech
// tilde operator is NOT the same character as the tilde, U+007E, although the same
// glyph might be used to represent both
(Name: 'cong'; Value: 8773), // approximately equal to, U+2245 ISOtech
(Name: 'asymp'; Value: 8776), // almost equal to = asymptotic to, U+2248 ISOamsr
(Name: 'ne'; Value: 8800), // not equal to, U+2260 ISOtech
(Name: 'equiv'; Value: 8801), // identical to, U+2261 ISOtech
(Name: 'le'; Value: 8804), // less-than or equal to, U+2264 ISOtech
(Name: 'ge'; Value: 8805), // greater-than or equal to, U+2265 ISOtech
(Name: 'sub'; Value: 8834), // subset of, U+2282 ISOtech
(Name: 'sup'; Value: 8835), // superset of, U+2283 ISOtech
// note that nsup, 'not a superset of, U+2283' is not covered by the Symbol font
// encoding and is not included.
(Name: 'nsub'; Value: 8836), // not a subset of, U+2284 ISOamsn
(Name: 'sube'; Value: 8838), // subset of or equal to, U+2286 ISOtech
(Name: 'supe'; Value: 8839), // superset of or equal to, U+2287 ISOtech
(Name: 'oplus'; Value: 8853), // circled plus = direct sum, U+2295 ISOamsb
(Name: 'otimes'; Value: 8855), // circled times = vector product, U+2297 ISOamsb
(Name: 'perp'; Value: 8869), // up tack = orthogonal to = perpendicular, U+22A5 ISOtech
(Name: 'sdot'; Value: 8901), // dot operator, U+22C5 ISOamsb
// dot operator is NOT the same character as U+00B7 middle dot
// Miscellaneous Technical
(Name: 'lceil'; Value: 8968), // left ceiling = apl upstile, U+2308 ISOamsc
(Name: 'rceil'; Value: 8969), // right ceiling, U+2309 ISOamsc
(Name: 'lfloor'; Value: 8970), // left floor = apl downstile, U+230A ISOamsc
(Name: 'rfloor'; Value: 8971), // right floor, U+230B ISOamsc
(Name: 'lang'; Value: 9001), // left-pointing angle bracket = bra, U+2329 ISOtech
// lang is NOT the same character as U+003C 'less than' or U+2039 'single
// left-pointing angle quotation mark'
(Name: 'rang'; Value: 9002), // right-pointing angle bracket = ket, U+232A ISOtech
// rang is NOT the same character as U+003E 'greater than' or U+203A 'single
// right-pointing angle quotation mark'
// Geometric Shapes
(Name: 'loz'; Value: 9674), // lozenge, U+25CA ISOpub
// Miscellaneous Symbols
(Name: 'spades'; Value: 9824), // black spade suit, U+2660 ISOpub
// black here seems to mean filled as opposed to hollow
(Name: 'clubs'; Value: 9827), // black club suit = shamrock, U+2663 ISOpub
(Name: 'hearts'; Value: 9829), // black heart suit = valentine, U+2665 ISOpub
(Name: 'diams'; Value: 9830), // black diamond suit, U+2666 ISOpub
// markup-significant and internationalization characters
// C0 Controls and Basic Latin
(Name: 'quot'; Value: 34), // quotation mark = APL quote, U+0022 ISOnum
(Name: 'amp'; Value: 38), // ampersand, U+0026 ISOnum
(Name: 'lt'; Value: 60), // less-than sign, U+003C ISOnum
(Name: 'gt'; Value: 62), // greater-than sign, U+003E ISOnum
// Latin Extended-A
(Name: 'OElig'; Value: 338), // latin capital ligature OE, U+0152 ISOlat2
(Name: 'oelig'; Value: 339), // latin small ligature oe, U+0153 ISOlat2
// ligature is a misnomer, this is a separate character in some languages
(Name: 'Scaron'; Value: 352), // latin capital letter S with caron, U+0160 ISOlat2
(Name: 'scaron'; Value: 353), // latin small letter s with caron, U+0161 ISOlat2
(Name: 'Yuml'; Value: 376), // latin capital letter Y with diaeresis, U+0178 ISOlat2
// Spacing Modifier Letters
(Name: 'circ'; Value: 710), // modifier letter circumflex accent, U+02C6 ISOpub
(Name: 'tilde'; Value: 732), // small tilde, U+02DC ISOdia
// General Punctuation
(Name: 'ensp'; Value: 8194), // en space, U+2002 ISOpub
(Name: 'emsp'; Value: 8195), // em space, U+2003 ISOpub
(Name: 'thinsp'; Value: 8201), // thin space, U+2009 ISOpub
(Name: 'zwnj'; Value: 8204), // zero width non-joiner, U+200C NEW RFC 2070
(Name: 'zwj'; Value: 8205), // zero width joiner, U+200D NEW RFC 2070
(Name: 'lrm'; Value: 8206), // left-to-right mark, U+200E NEW RFC 2070
(Name: 'rlm'; Value: 8207), // right-to-left mark, U+200F NEW RFC 2070
(Name: 'ndash'; Value: 8211), // en dash, U+2013 ISOpub
(Name: 'mdash'; Value: 8212), // em dash, U+2014 ISOpub
(Name: 'lsquo'; Value: 8216), // left single quotation mark, U+2018 ISOnum
(Name: 'rsquo'; Value: 8217), // right single quotation mark, U+2019 ISOnum
(Name: 'sbquo'; Value: 8218), // single low-9 quotation mark, U+201A NEW
(Name: 'ldquo'; Value: 8220), // left double quotation mark, U+201C ISOnum
(Name: 'rdquo'; Value: 8221), // right double quotation mark, U+201D ISOnum
(Name: 'bdquo'; Value: 8222), // double low-9 quotation mark, U+201E NEW
(Name: 'dagger'; Value: 8224), // dagger, U+2020 ISOpub
(Name: 'Dagger'; Value: 8225), // double dagger, U+2021 ISOpub
(Name: 'permil'; Value: 8240), // per mille sign, U+2030 ISOtech
(Name: 'lsaquo'; Value: 8249), // single left-pointing angle quotation mark, U+2039 ISO proposed
// lsaquo is proposed but not yet ISO standardized
(Name: 'rsaquo'; Value: 8250), // single right-pointing angle quotation mark, U+203A ISO proposed
// rsaquo is proposed but not yet ISO standardized
(Name: 'euro'; Value: 8364)); // euro sign, U+20AC NEW
var
I: Integer;
begin
// Put the Entities into a sorted StringList for faster access.
if Entities = nil then
begin
Entities := ThtStringList.Create;
Entities.CaseSensitive := True;
for I := low(EntityDefinitions) to high(EntityDefinitions) do
Entities.AddObject(EntityDefinitions[I].Name, @EntityDefinitions[I]);
Entities.Sort;
end;
end;
procedure InitElements;
const
ElementDefinitions: array[1..104] of TResWord = (
(Name: '?XML'; Symbol: XmlSy; EndSym: CommandSy),
(Name: '!DOCTYPE'; Symbol: DocTypeSy; EndSym: CommandSy),
{HTML}
(Name: 'HTML'; Symbol: HtmlSy; EndSym: HtmlEndSy),
(Name: 'TITLE'; Symbol: TitleElemSy; EndSym: TitleEndSy),
(Name: 'BODY'; Symbol: BodySy; EndSym: BodyEndSy),
(Name: 'HEAD'; Symbol: HeadSy; EndSym: HeadEndSy),
(Name: 'B'; Symbol: BSy; EndSym: BEndSy),
(Name: 'I'; Symbol: ISy; EndSym: IEndSy),
(Name: 'H1'; Symbol: H1Sy; EndSym: H1EndSy),
(Name: 'H2'; Symbol: H2Sy; EndSym: H2EndSy),
(Name: 'H3'; Symbol: H3Sy; EndSym: H3EndSy),
(Name: 'H4'; Symbol: H4Sy; EndSym: H4EndSy),
(Name: 'H5'; Symbol: H5Sy; EndSym: H5EndSy),
(Name: 'H6'; Symbol: H6Sy; EndSym: H6EndSy),
(Name: 'EM'; Symbol: EmSy; EndSym: EmEndSy),
(Name: 'STRONG'; Symbol: StrongSy; EndSym: StrongEndSy),
(Name: 'U'; Symbol: USy; EndSym: UEndSy),
//
(Name: 'INS'; Symbol: InsSy; EndSym: InsEndSy),
(Name: 'DEL'; Symbol: DelSy; EndSym: DelEndSy),
//
(Name: 'CITE'; Symbol: CiteSy; EndSym: CiteEndSy),
(Name: 'VAR'; Symbol: VarSy; EndSym: VarEndSy),
(Name: 'ABBR'; Symbol: AbbrSy; EndSym: AbbrEndSy),
(Name: 'ACRONYM'; Symbol: AcronymSy; EndSym: AcronymEndSy),
(Name: 'DFN'; Symbol: DfnSy; EndSym: DfnEndSy),
(Name: 'TT'; Symbol: TTSy; EndSym: TTEndSy),
(Name: 'CODE'; Symbol: CodeSy; EndSym: CodeEndSy),
(Name: 'KBD'; Symbol: KbdSy; EndSym: KbdEndSy),
(Name: 'SAMP'; Symbol: SampSy; EndSym: SampEndSy),
(Name: 'OL'; Symbol: OLSy; EndSym: OLEndSy),
(Name: 'UL'; Symbol: ULSy; EndSym: ULEndSy),
(Name: 'DIR'; Symbol: DirSy; EndSym: DirEndSy),
(Name: 'MENU'; Symbol: MenuSy; EndSym: MenuEndSy),
(Name: 'DL'; Symbol: DLSy; EndSym: DLEndSy),
(Name: 'A'; Symbol: ASy; EndSym: AEndSy),
(Name: 'ADDRESS'; Symbol: AddressSy; EndSym: AddressEndSy),
(Name: 'BLOCKQUOTE'; Symbol: BlockQuoteSy; EndSym: BlockQuoteEndSy),
(Name: 'PRE'; Symbol: PreSy; EndSym: PreEndSy),
(Name: 'CENTER'; Symbol: CenterSy; EndSym: CenterEndSy),
(Name: 'TABLE'; Symbol: TableSy; EndSym: TableEndSy),
(Name: 'TD'; Symbol: TDsy; EndSym: TDEndSy),
(Name: 'TH'; Symbol: THSy; EndSym: THEndSy),
(Name: 'CAPTION'; Symbol: CaptionSy; EndSym: CaptionEndSy),
(Name: 'FORM'; Symbol: FormSy; EndSym: FormEndSy),
(Name: 'TEXTAREA'; Symbol: TextAreaSy; EndSym: TextAreaEndSy),
(Name: 'SELECT'; Symbol: SelectSy; EndSym: SelectEndSy),
(Name: 'OPTION'; Symbol: OptionSy; EndSym: OptionEndSy),
(Name: 'FONT'; Symbol: FontSy; EndSym: FontEndSy),
(Name: 'SUB'; Symbol: SubSy; EndSym: SubEndSy),
(Name: 'SUP'; Symbol: SupSy; EndSym: SupEndSy),
(Name: 'BIG'; Symbol: BigSy; EndSym: BigEndSy),
(Name: 'SMALL'; Symbol: SmallSy; EndSym: SmallEndSy),
(Name: 'P'; Symbol: PSy; EndSym: PEndSy),
(Name: 'MAP'; Symbol: MapSy; EndSym: MapEndSy),
(Name: 'FRAMESET'; Symbol: FrameSetSy; EndSym: FrameSetEndSy),
(Name: 'NOFRAMES'; Symbol: NoFramesSy; EndSym: NoFramesEndSy),
(Name: 'SCRIPT'; Symbol: ScriptSy; EndSym: ScriptEndSy),
(Name: 'DIV'; Symbol: DivSy; EndSym: DivEndSy),
(Name: 'S'; Symbol: SSy; EndSym: SEndSy),
(Name: 'STRIKE'; Symbol: StrikeSy; EndSym: StrikeEndSy),
(Name: 'TR'; Symbol: TRSy; EndSym: TREndSy),
(Name: 'NOBR'; Symbol: NoBrSy; EndSym: NoBrEndSy),
(Name: 'STYLE'; Symbol: StyleSy; EndSym: StyleEndSy),
(Name: 'SPAN'; Symbol: SpanSy; EndSym: SpanEndSy),
(Name: 'COLGROUP'; Symbol: ColGroupSy; EndSym: ColGroupEndSy),
(Name: 'LABEL'; Symbol: LabelSy; EndSym: LabelEndSy),
(Name: 'THEAD'; Symbol: THeadSy; EndSym: THeadEndSy),
(Name: 'TBODY'; Symbol: TBodySy; EndSym: TBodyEndSy),
(Name: 'TFOOT'; Symbol: TFootSy; EndSym: TFootEndSy),
(Name: 'OBJECT'; Symbol: ObjectSy; EndSym: ObjectEndSy),
(Name: 'DD'; Symbol: DDSy; EndSym: DDEndSy),
(Name: 'DT'; Symbol: DTSy; EndSym: DTEndSy),
(Name: 'LI'; Symbol: LISy; EndSym: LIEndSy),
(Name: 'FIELDSET'; Symbol: FieldsetSy; EndSym: FieldsetEndSy),
(Name: 'LEGEND'; Symbol: LegendSy; EndSym: LegendEndSy),
(Name: 'BR'; Symbol: BRSy; EndSym: CommandSy),
(Name: 'HR'; Symbol: HRSy; EndSym: CommandSy),
(Name: 'IMG'; Symbol: ImageSy; EndSym: CommandSy),
(Name: 'IFRAME'; Symbol: IFrameSy; EndSym: IFrameEndSy),
(Name: 'BASE'; Symbol: BaseSy; EndSym: CommandSy),
(Name: 'BUTTON'; Symbol: ButtonSy; EndSym: ButtonEndSy),
(Name: 'INPUT'; Symbol: InputSy; EndSym: CommandSy),
(Name: 'BASEFONT'; Symbol: BaseFontSy; EndSym: CommandSy),
(Name: 'AREA'; Symbol: AreaSy; EndSym: CommandSy),
(Name: 'FRAME'; Symbol: FrameSy; EndSym: CommandSy),
(Name: 'PAGE'; Symbol: PageSy; EndSym: CommandSy),
(Name: 'BGSOUND'; Symbol: BgSoundSy; EndSym: CommandSy),
(Name: 'META'; Symbol: MetaSy; EndSym: CommandSy),
(Name: 'PANEL'; Symbol: PanelSy; EndSym: CommandSy),
(Name: 'WBR'; Symbol: WbrSy; EndSym: CommandSy),
(Name: 'LINK'; Symbol: LinkElemSy; EndSym: CommandSy),
(Name: 'COL'; Symbol: ColSy; EndSym: CommandSy),
(Name: 'PARAM'; Symbol: ParamSy; EndSym: CommandSy),
{HTML5 }
(Name: 'MAIN'; Symbol: MainSy; EndSym: MainEndSy),
(Name: 'HEADER'; Symbol: HeaderSy; EndSym: HeaderEndSy),
(Name: 'SECTION'; Symbol: SectionSy; EndSym: SectionEndSy),
(Name: 'NAV'; Symbol: NavSy; EndSym: NavEndSy),
(Name: 'ARTICLE'; Symbol: ArticleSy; EndSym: ArticleEndSy),
(Name: 'ASIDE'; Symbol: AsideSy; EndSym: AsideEndSy),
(Name: 'FOOTER'; Symbol: FooterSy; EndSym: FooterEndSy),
(Name: 'HGROUP'; Symbol: HGroupSy; EndSym: HGroupEndSy),
(Name: 'MARK'; Symbol: MarkSy; EndSym: MarkEndSy),
(Name: 'TIME'; Symbol: TimeSy; EndSym: TimeEndSy),
(Name: 'PROGRESS'; Symbol: ProgressSy; EndSym: ProgressEndSy),
(Name: 'METER'; Symbol: MeterSy; EndSym: MeterEndSy));
var
I: Integer;
P: PResWord;
S: TElemSymb;
begin
// Put the Attributes into a sorted StringList for faster access.
if ElementNames = nil then
begin
ElementNames := ThtStringList.Create;
ElementNames.CaseSensitive := True;
for I := low(ElementDefinitions) to high(ElementDefinitions) do
ElementNames.AddObject(ElementDefinitions[I].Name, @ElementDefinitions[I]);
ElementNames.Sort;
// initialize ElementNamesIndex and ElemSymbolNames
for S := low(TElemSymb) to high(TElemSymb) do
ElementNamesIndex[S] := -1;
for I := 0 to ElementNames.Count - 1 do
begin
P := PResWord(ElementNames.Objects[I]);
ElementNamesIndex[P.Symbol] := I;
SetSymbolName(P.Symbol, P.Name);
if P.EndSym <> CommandSy then
begin
ElementNamesIndex[P.EndSym] := I;
SetSymbolName(P.EndSym, P.Name);
end;
end;
end;
end;
procedure InitAttributes;
const
AttribDefinitions: array[1..95] of TSymbolRec = (
(Name: 'ACTION'; Value: ActionSy),
(Name: 'ACTIVE'; Value: ActiveSy),
(Name: 'ALIGN'; Value: AlignSy),
(Name: 'ALT'; Value: AltSy),
(Name: 'BACKGROUND'; Value: BackgroundSy),
(Name: 'BGCOLOR'; Value: BGColorSy),
(Name: 'BGPROPERTIES'; Value: BGPropertiesSy),
(Name: 'BORDER'; Value: BorderSy),
(Name: 'BORDERCOLOR'; Value: BorderColorSy),
(Name: 'BORDERCOLORDARK'; Value: BorderColorDarkSy),
(Name: 'BORDERCOLORLIGHT'; Value: BorderColorLightSy),
(Name: 'CELLPADDING'; Value: CellPaddingSy),
(Name: 'CELLSPACING'; Value: CellSpacingSy),
(Name: 'CHARSET'; Value: CharSetSy),
(Name: 'CHECKBOX'; Value: CheckBoxSy),
(Name: 'CHECKED'; Value: CheckedSy),
(Name: 'CLASS'; Value: ClassSy),
(Name: 'CLEAR'; Value: ClearSy),
(Name: 'COLOR'; Value: ColorSy),
(Name: 'COLS'; Value: ColsSy),
(Name: 'COLSPAN'; Value: ColSpanSy),
(Name: 'CONTENT'; Value: ContentSy),
(Name: 'COORDS'; Value: CoordsSy),
(Name: 'DISABLED'; Value: DisabledSy),
(Name: 'ENCODING'; Value: EncodingSy),
(Name: 'ENCTYPE'; Value: EncTypeSy),
(Name: 'FACE'; Value: FaceSy),
(Name: 'FRAME'; Value: FrameAttrSy),
(Name: 'FRAMEBORDER'; Value: FrameBorderSy),
(Name: 'HEIGHT'; Value: HeightSy),
(Name: 'HIGH'; Value: HighSy),
(Name: 'HREF'; Value: HrefSy),
(Name: 'HSPACE'; Value: HSpaceSy),
(Name: 'HTTP-EQUIV'; Value: HttpEqSy),
(Name: 'ID'; Value: IDSy),
(Name: 'ISMAP'; Value: IsMapSy),
(Name: 'LABEL'; Value: LabelAttrSy),
(Name: 'LANGUAGE'; Value: LanguageSy),
(Name: 'LEFTMARGIN'; Value: LeftMarginSy),
(Name: 'LINK'; Value: LinkSy),
(Name: 'LOOP'; Value: LoopSy),
(Name: 'LOW'; Value: LowSy),
(Name: 'MARGINHEIGHT'; Value: MarginHeightSy),
(Name: 'MARGINWIDTH'; Value: MarginWidthSy),
(Name: 'MAX'; Value: MaxSy),
(Name: 'MAXLENGTH'; Value: MaxLengthSy),
(Name: 'MEDIA'; Value: MediaSy),
(Name: 'METHOD'; Value: MethodSy),
(Name: 'MIN'; Value: MinSy),
(Name: 'MULTIPLE'; Value: MultipleSy),
(Name: 'NAME'; Value: NameSy),
(Name: 'NOHREF'; Value: NoHrefSy),
(Name: 'NORESIZE'; Value: NoResizeSy),
(Name: 'NOSHADE'; Value: NoShadeSy),
(Name: 'NOWRAP'; Value: NoWrapSy),
(Name: 'OLINK'; Value: OLinkSy),
(Name: 'ONBLUR'; Value: OnBlurSy),
(Name: 'ONCHANGE'; Value: OnChangeSy),
(Name: 'ONCLICK'; Value: OnClickSy),
(Name: 'ONFOCUS'; Value: OnFocusSy),
(Name: 'OPTIMUM'; Value: OptimumSy),
(Name: 'PLACEHOLDER'; Value: PlaceholderSy),
(Name: 'PLAIN'; Value: PlainSy),
(Name: 'RADIO'; Value: RadioSy),
(Name: 'RATIO'; Value: RatioSy),
(Name: 'READONLY'; Value: ReadonlySy),
(Name: 'REL'; Value: RelSy),
(Name: 'REV'; Value: RevSy),
(Name: 'ROWS'; Value: RowsSy),
(Name: 'ROWSPAN'; Value: RowSpanSy),
(Name: 'RULES'; Value: RulesSy),
(Name: 'SCROLLING'; Value: ScrollingSy),
(Name: 'SELECTED'; Value: SelectedSy),
(Name: 'SHAPE'; Value: ShapeSy),
(Name: 'SIZE'; Value: SizeSy),
(Name: 'SPAN'; Value: SpanAttrSy),
(Name: 'SPELLCHECK'; Value: spellcheckSy),
(Name: 'SRC'; Value: SrcSy),
(Name: 'START'; Value: StartSy),
(Name: 'STYLE'; Value: StyleAttrSy),
(Name: 'TABINDEX'; Value: TabIndexSy),
(Name: 'TARGET'; Value: TargetSy),
(Name: 'TEXT'; Value: TextSy),
(Name: 'TITLE'; Value: TitleSy),
(Name: 'TOPMARGIN'; Value: TopMarginSy),
(Name: 'TRANSP'; Value: TranspSy),
(Name: 'TYPE'; Value: TypeSy),
(Name: 'USEMAP'; Value: UseMapSy),
(Name: 'VALIGN'; Value: VAlignSy),
(Name: 'VALUE'; Value: ValueSy),
(Name: 'VERSION'; Value: VersionSy),
(Name: 'VLINK'; Value: VLinkSy),
(Name: 'VSPACE'; Value: VSpaceSy),
(Name: 'WIDTH'; Value: WidthSy),
(Name: 'WRAP'; Value: WrapSy));
var
I: Integer;
P: PSymbol;
begin
// Put the Attributes into a sorted StringList for faster access.
if AttributeNames = nil then
begin
AttributeNames := ThtStringList.Create;
AttributeNames.CaseSensitive := True;
for I := low(AttribDefinitions) to high(AttribDefinitions) do
begin
P := @AttribDefinitions[I];
AttributeNames.AddObject(P.Name, Pointer(P));
SetSymbolName(P.Value, P.Name);
end;
AttributeNames.Sort;
end;
end;
initialization
InitEntities;
InitAttributes;
InitElements;
finalization
Entities.Free;
AttributeNames.Free;
ElementNames.Free;
end.
| 48.6548 | 125 | 0.60721 |
474a2343874505a87d0c4c0c9c54f31627046ba9 | 290 | dpr | Pascal | DelphiLanguageCodeRage2018/07_BlockScope/BlockScope.dpr | xchinjo/DelphiSessions | 0679d97a78ff232c6bbec1217c4f8c2104d58210 | [
"MIT"
]
| 44 | 2017-05-30T20:54:06.000Z | 2022-02-25T16:44:23.000Z | DelphiLanguageCodeRage2018/07_BlockScope/BlockScope.dpr | jpluimers/DelphiSessions | 0679d97a78ff232c6bbec1217c4f8c2104d58210 | [
"MIT"
]
| null | null | null | DelphiLanguageCodeRage2018/07_BlockScope/BlockScope.dpr | jpluimers/DelphiSessions | 0679d97a78ff232c6bbec1217c4f8c2104d58210 | [
"MIT"
]
| 19 | 2017-07-25T10:03:13.000Z | 2021-10-17T11:40:38.000Z | program BlockScope;
uses
Vcl.Forms,
BlockScope_Form in 'BlockScope_Form.pas' {Form3},
SmartPointerClass in 'SmartPointerClass.pas';
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm3, Form3);
Application.Run;
end.
| 18.125 | 51 | 0.755172 |
f1c6aa4d28a65b2e2630efa13ad9311657af896f | 60,591 | dfm | Pascal | gui/DriverNameWatchAddForm.dfm | DavidXanatos/IRPMon | 88c82499e84f0cd4e15252b03f68b03100089c57 | [
"MIT"
]
| 1 | 2020-03-27T12:28:10.000Z | 2020-03-27T12:28:10.000Z | gui/DriverNameWatchAddForm.dfm | DavidXanatos/IRPMon | 88c82499e84f0cd4e15252b03f68b03100089c57 | [
"MIT"
]
| null | null | null | gui/DriverNameWatchAddForm.dfm | DavidXanatos/IRPMon | 88c82499e84f0cd4e15252b03f68b03100089c57 | [
"MIT"
]
| null | null | null | object DriverNameWatchAddFrm: TDriverNameWatchAddFrm
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
Caption = 'Watch for a driver'
ClientHeight = 203
ClientWidth = 311
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Icon.Data = {
0000010001005A60000001001800A86A000016000000280000005A000000C000
0000010018000000000000000000480000004800000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000100000100000000000000
0000000000000000000000000000000000000000000000000000000000000101
0100000000000000000000000000000000000000000000000000000000000000
0000020000020000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000020001020001000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000001010100000000000000000000000000000000000000
0000000000000000010101000000000000000000000000000000000000000000
0000000000000000000000000000000000000200000200000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000200010200010000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000020000020001020001020001
0000000000000000010000010000000000000000000000000000000000000000
0000000000000000000002000002000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0002000107000710050F11000D11000D0C000A0B000809000807000705000605
0004040003040003030002020001000001000000000000000000020000020000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000010400031A091743243F592751561B4D
4912413F0D3732072C2601211B00171400110C000A0900070700060400040200
0302000100000000000002000002000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0104000312010F42203E8A4C80A95D9DA554999A498E8D41817C36726C2E6460
2859521F4B44173E380F342A08271E011B11000C0C000A090006050004040001
0200000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000020001040004140010491C43954F8C
BC5CB0C355B5C756B7C254B4C055B2BC53AEB54FA7A8489C9F4293903B868232
776925604A134226001F0E000B07000402000100000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000200010700061B0017561E4FA54C9BC557B7CE51BED24FC0CF4CBDD1
4EBFCE4EBDCB4EBBCA50BCC651B8C052B2B650A8A14995853F7C56204F1F001C
0E000B0700060400010000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000200010700061B0018
5B2053A7529DC857B9D050BFD14EBFCF4CBDD04DBECD4DBDCF4CBDCD4DBCCA4D
BAC94FB9C650B7C253B5AF4BA385347D460E3F19001309000602000100000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000200010700071D001960245AAD50A1C955B9CE51BED0
4DBED14EBFD04DBED04BBFD04BBFCF4ABECF4ABED04BC0D04DC0CA4CBCBF4FB3
A34A9961235920001A0B00080500040200010000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000101010000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000001000001000000000000000000040003
070007190017692860AF52A3C953BACF4BBCD14CC0D14CC0D24AC0D34BC1D34B
C1D24AC0D14CC1D04BC0CF4ABECB4BBBC64FB8B24EA67029682B00260D000B04
0003020001000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000001
0000010000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0100000100000000000000000000000002000109000721001A722E69BA52AACC
50BAD14EBFD24DC1D34BC1D24AC0D24AC0D34BC1D34BC1D24AC0D048BED048BE
D04AC2CA4FBDB753AD7E3678380C351300120500060200010000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000100000100000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000001000001000000000000
0000000400030B000726001F843578C055B1CC4FBCD54DC3D44BC4D44BC4D44B
C4D44BC4D44BC4D34AC3D148C1D148C1D249C3CF4BC0CA4EBEBD52B38B3C8545
1141140013040004000001000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000020001020001000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000010000010000000000000000000000000200010C000A36032F98
468EC554B5D14FBED24DC2D34AC3D44BC4D64DC6D64AC5D549C4D34AC4D148C2
D34AC4D249C3D249C3CB4CBFB84DAE85367F3F133C0F000E0400040000010000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000200010400030800070A00091106100901080200010000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000101000000000000000000
00000000000000000105000611000E481541A04692C854B7D250BFD44CC2D64B
C4D54AC3D34AC4D249C3D549C4D448C3D448C3D249C2D34AC4D04CC1C84DBBA5
409C752D6F360A330E000D020003020001000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000001000000000400030D000A1F001B3F
1A3A4526411B0819040003000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000102000105000417
0013531549A44897CA54B9D34FC0D44CC2D64BC4D34AC4D34AC4D448C5D347C2
D347C2D448C3D34AC4D24BC5D04BC3B942AE8F32876A2A662D0B2A0B000A0400
0300000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
04000307000618001544193E74396C8E5386663B601E041B0500040000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000001000001000000000000000000000000
0000000000000000000000000200010900061A00165A1C50AF4DA1CE52BCD34E
C2D74CC5D549C4D64AC5D84AC5D648C3D448C3D448C5D549C6D349C6D14AC4C2
46B89B329384327F61275D290928080008020001000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000400030B000824001F6A2C62A04F94B65BAAAF
5FA460325C160013050004000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0100000100000000000000000000000000000000000000000000000000000004
000109000622001C712565BC53AECF52BFD54CC5D64AC5D549C4D749C4D748C6
D64AC7D548C7D548C7D447C6D247C6CA48BFA8349F902E887D31785521511900
1705000602000100000000000000000000000000000000000000000000000000
000000000000000000000000000001010101010100000002000105000410000C
370D307F3E75B258A4C159B1C257B4AD55A153254F10000E0400040000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000200010400030C000A30032A873A7DC756
B8D44FC4D64DC7D64AC7D549C6D548C7D74AC9D749CAD949CAD949CAD749CAD0
49C3B33AA993278A8B2D82792F71471944170015050006020001000000000000
0000000000000000000000000000000000000000000000000000000200000000
0000000002000107000614000F45133D944888B758A9C659B5C857B8C557B7A4
4F99461B400A0009040003000001000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000002000005000410000F4A1645A74A9BCB54BDD34FC4D74BC8D649C8D649C8
D648C9D648C9D847CBD847CBD848C9D349C6BD3EB299268E922A898930807431
6F43153F14001306000502000100000000000000000000000000000000000000
00000000000101010000000200000400010700060F000D23011F5822519C5090
BE59AFC854B7C953B8C955B8C557B59B49913914340700060200030000010000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000010000010000000000000000000000000000000200010500041B00176C28
63B352A8CD52C0D64DC7D74BC8D74BC8D849C8D747C8D847CBD948CCD847CBD4
49C8C343BAA12A97982A908F2C88883083702A693B0E35160013050004020001
0000000000000000000000000000000000000000010000010000000400010A00
071C00184814437F3877AE54A0C159B1C756B7C852B7CB52BAC955B8C259B48F
42852C0A28050004030002000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000100000100000000000000000000
00000001000000000000000900072D022783397BC455B7D34FC4D74EC8D84CC9
D849C8D848C9D948CCD948CCD948CCD348C8C946BFA42A9C9A289396298F902A
89872D806D2A673E103A15001205000402000100000000000000000000000000
00000000010200030600070E000C2A082660295A9F4F96B958AFC456B6C953B8
CB52BACC53BBCC53BBCA56B9C05AB2853B7B23041F0500040200010000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000100000100
0000000000000000000000000001000001000101010000000000000400030D00
0B43133DA4469ACE54C0D54FC7DB4CCBDB4ACBDB4ACBDB49CDDA47CDDA49CED7
49CCCE47C5A729A09E269598269195288F90298A8A2F847730723E123910000F
0500040000000000000000000000000000000000010500061300113E103B7E37
76AC50A1BF55B2C654B8CA54BBCB52BACC52BCCF53BDCC52BCC756B8BB58AE79
34711D0019040003020001000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000010000010000000000000000000000000000000001
02000000000000000000000000010400031900156C2264C256B6D753C8DD4DCE
DC4BCCDB49CDDA47CDDA46CFDA46CFD748CDD048C6AC2BA4A025999C26959926
9397289093298C8A2F84702D6A3F133A0F000D04000302000100000002000104
00040C00092506235420508F4488B655ACC152B4C852B9CB51BBCC52BCCC52BC
CF53BDD054BECD53BDC756B8B656AA6E2C671600130200010000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000010000000000000000000000000000000000010200010200
010C000A3B0235AB4FA0D555C5DD4CCDDB46CCDA44CDD943CCDA43CEDB44CFD8
46CED045C5AF2CA5A3259C9E25989D259499249196278F92298A8C2F84762F6E
380D320E000C04000302000105000412000F390B3575306DA34798BB50B0C252
B6C650B9C750B9CB51BDCC52BECD53BDCE54BECD54BCCE53BBC655B6B455A669
286014000F020001000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000100000100000000
00000000000000000200010200010400030E000B2E00279F4695D052C2D846CA
D741CAD83FCAD53ECAD63FCBD73FCED642CCD044C7B02AA6A6259EA1269C9F24
989D249699239296248F93268C8B2E836D2A6735073114001111000E20001D4E
1A4984397DA5479CB949AFC34AB8C64EBAC94FBBCB51BDCC52BECD53BFCE54C0
CC52BCCC53BBCD52BAC756B7AF53A262245A11000E0200010000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000100000100
0000000000000000000000000000000000000000000000000000000400030900
071D001967265DB757ABCD4BC0D43EC7D339C6D336C7D236CAD438CCD63BCCD4
3ECDCA3CC4B129A9A826A2A4259EA1269CA0259B9C23969B229499239295288E
8D2D877825705C16555A145374256E953A8FA842A1B444AABC45B2C64ABAC84D
BBC94EBCCA50BCCC52BECC54C0CD55C1CD53BDCC52BCCE52BCC857B8AC51A05C
1E5210000D020001000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000010000010000000000000000000000000000000000
00000000000200000400030B00082904247C4173B15FA7D065C2C843BBCC36BF
CC2FC0CF2FC5CF30C6CF32C8D134CAD239CACA39C3B32BADAD28A6A927A3A425
A0A1259DA0249CA0259B9D249799239298269192268988268085227E972A90A5
339EB23BA8B83FAEC044B4C74BBBCB4EBCCE51BFCE51BECC52BECD53BFCE54C0
CD53BFCE54C0CE51BEC857B8A8509C531B4C0E000C0200010000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000101010200000200000200000400010900072402207933
70B659AAC459B6D056C2CE47C1C22FB5C628BCC827BFCC2BC3CD2EC4D031C7CF
36C7C736C0B42AADB129A9AB29A6A627A2A627A2A326A1A0249C9D23999C2396
9D24969C269598259293208D981F91A52A9EB337A9BA3EAEBE42B2C54AB8CB4E
BCCF4FBED151C0CF52C0D053C0D154C1D053C1D255C3D154C2C758BA9E4C9545
123E0C0009000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000002000002
00000400010900071E001A692E61B456AACB57BBCF55C1D453C6D750CAC635B9
BF24B5C323BBC424BEC828C0CA2AC2CB32C5C532BCB52BAEB52DAFAE29A7AB29
A6A627A2A425A0A2269EA0249C9F259B9F239B9E23999C22989B21979D1E97A4
269DB132A6BC3DB0C244B4CA4DBBCE4EBECF4FBED050C0D252C1D053C1D154C2
D052C2CF51C1CF51C1C356B893468935082F0900070000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000020000020000000000000000
0000000000000000000000000000000200010800051B00175E2056A84F9EC758
BAD154C2D153C3D554C7D854C9D146C5C22CBBBE21B8C022BCC524C0C827C3C6
2CC1C330BAB72DB0B52DAFB52EACB02BA9AC28A4A7269FA5269FA3279FA1259D
9F229D9E229A9E239B9D229A9C1D98A3229BB12FA6BC3BAEC243B6C94BBBCE4D
C0D252C2D251C4D252C2D252C2D252C2D252C2D050C0CE51BFBF55B2823E7926
0121070006000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000002000002000000000000000000000000000000000000000002000107
00061A0016582251A64E9AC759B9CE54C0D353C3D554C7D756C9DA56CBD64CC9
CF3CC6C027BABB1DB7BE1FBBC322BEC228BDC130BABA30B3B830B0B730AEB42E
AAB12BA7AC28A4A927A3A627A2A225A0A3249F9F229D9F229D9D209B9B1C97A2
209CAE2CA3BC38ADC442B7C94ABDCF4EC1D150C3D150C3D251C4D353C3D353C3
D350C1CF4FBFCD50BDB652AA682F621800140500040000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000010101000000000000010101000000000000
0000000000000000000200010500041900155C2154A54D99C658B8CE54C0D353
C2D555C4D757C7D655C8D551C6D349C6D544C9CD37C6C023BABC1CB6BE1EB8C0
26BBC133BBBC34B4BB35B1B933AFB630ACB32DA9B22CA8B02BA9AA28A5A525A2
A725A2A2229FA0209DA01E9B9D1B98A31E9CAE28A2BC37AFC745BACD4BC0D04E
C3D04EC3D350C3D552C5D24FC2D350C3D24DC1CE4EBDC750B9A6499A4618420C
0009040003000000000100000100000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000002000107000614001059
2352AC54A0C658B8CE54C0D353C3D454C3D656C5D656C6D451C4D34DC5D248C5
D345C8D43FCBCE32C6BF22B9BA1DB4BE28B8C134B9BF38B6BD37B3BA34B0B832
AEB630ACB32CAAB12AA8AE29A7AA28A5A926A5A623A2A522A1A11D9FA01A9CA6
21A0B12BA7BE38B2C947BECD4BC0D04EC3D04EC3D34FC4D350C3D350C3D14EC1
D14CC0CD4DBCBF50B2903E862803230700060200010000000001000001000000
0000000000000000000000000000000000000000000000000000000000000200
0002000000000000000000000000000000000000000000000000000000000000
0000000000000000020000020000000000000000000000000000000000000000
000000020001050004150011551A4DAB539FC559B9CF55C1D154C2D457C5D457
C5D658C8D451C4D14CC1D049C3D045C4D143C6D542CCD73ECFCD34C7BD24B7C1
2DBBC236B9C038B6BE37B5BC36B2BA34B0B933AFB630ACB22CA8B02CA8AE29A7
AE29A8AB25A7A720A4A31CA0A51CA0AB23A5B52EACC13BB7CA44BECF4AC2D24D
C5D24DC5D34DC5D24DC2D04CC1CD49BECF4ABFC84EBAB453A9712F6A16001304
0003020001000000000000000000000000000000000000000000000000000000
0000000000000000000000000000020000020000000000000000000000000000
0000000000000000000000000000000000000000000000000200000200000000
0000000000000000000000000000000002000107000613001153204CA7529CC5
57B7CD53BFD252C2D255C3D457C5D557C7D454C4D24EC3D04AC2D148C2CF44C3
D042C5D341C9D641CDD83FD0CB35C4C734BEC236B9C23BB9C039B7BE37B5BD37
B3BB35B1B832AEB630ACB430ACB42DABB22AACAE25A9A51BA2A51BA2A61CA3A9
21A3B22AAABE37B5C741BDCC46C0CE48C2CF4AC2D14BC3D04AC2CD49BECA49BC
C84BB9BE54B18E448630042B0B00080200010000000101010000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000100000100000000000000000000000000000100
0001000000000000000000000000000001000001000000000000000000020001
0500041800145B2053A8539DC459B6CC55BED053C1D454C4D254C4D557C7D655
C8D14DC2D14CC1D047C0CE47C1CB43C0CE43C3D142C7D540CCD73FCED540CCC9
39C1C33ABAC03CB8BE3AB6BE3AB6BD39B5BB37B3B936AFB633ACB730AEB72FB1
B328AFA81CA5A518A3A518A3A51AA1AA20A4B32AAABB33B1C23AB7C740BAC841
BBC841BBC841BBC742BAC644B9BF46B4B54DAA93468A30072D0B000A04000400
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000010000010000000000000000000000000100
020100020000000000000200010700061A0016531F4EA5509BC458B8CC55BED1
54C2D255C3D456C6D656C6D554C7D34FC4D14CC1CF49C1CC45BFCB44BECC44C1
CC41C1CF40C5D43FCBD641CDD23FC9C73ABFC53EBCC03CB8C03CB8BF3BB7BE3A
B6BD3AB3BB38B1B835AEB931B1B52BAFA91DA6A316A1A619A6A619A4A71BA4AD
23A7B52CACBB33B1C038B5C23AB7C23CB6C13CB4BE3CB1B83FAEB242A8A04198
7F35773B0A360D000B0300040000010000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000010500041A0018
571F509E4C95C359B6CC56BFD055C3D156C4D257C5D658C8D554C7D24EC3D04C
C1CF49C1CC45BFCB44BECB43C0C841BFC83FBFCB3EC3D23ECAD541CDCF3EC8C7
3DC1C53EBCC13DB9BF3EB7BF3EB7C03DB6C03DB6BF39B3BD37B3B92FB2AB20A7
A619A4A417A4A417A2A51AA4A91EA7AF25ACB42CAEB831AFBE38B4BD37B1BA38
AFB63AACB03CA7A33E9A84367D531B4E2301200C000B04000400000100000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000100000100
0000000000000000000000000000000000000000000000000000000000000000
000101010000010500061800154F1E4A9F4D95C258B5CB55BED055C3D155C5D2
56C6D357C7D557C7D450C5D14DC2D04AC2CF49C1CD46C0CB43C0C943BFC841BF
C53DBDC73DC1CE3BC5CF3EC8CA40C4C840C0C33FBBBF3EB7BF3EB7C03FB8C13E
B7C13FB6C13FB6C441BABF38B6B931B3B42BAFB127AEB026ADAE27ABB22BAFB4
2EB0B631AFB935B1B938B1B73AAEB13AA7A93DA0993C91722A6C390B36140012
0700060200010000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000200010400031400114F194899478F
C158B3CB56BDCF54C2D155C5D457C5D557C7D557C7D251C4D24EC3D04AC2D14A
C4CF48C2CD45C2CA42BFCA44C0C740BEC53DBDC53DBFCD3EC3CD40C5C73FBFC1
3FBBBD3FB6BD3FB6BF3EB7C340B9C341B8C543B8CB4CBFD253C6D354C7D152C6
CD4DC4C948C1C544BDC342BBC241BAC040B7BE41B5B93FB1B73FAEB241A9A742
9E8D3B865E265B2B082A0F000E06000702000300000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000500040E000C3C0F36944489BF58B3CD58BFCF55C1D055C3D257C5D558C6D4
56C6D352C5D14EC1D04AC2D04AC2D049C3CD46C0CB43C0CA42BFC741BDC43DBB
C23DBBC43CBCC93DC0C940C0C440BCC545BCB53AB0B83DB3C03FB8C340B9C13E
B7CB49BED557C7D459C7D357C7D155C5CF53C5CB4FC1C94ABEC748BBC347B9C0
44B4BC43B2B541ACAB3FA2A0439883377E50194A20031D080008050004000001
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000100000100000000000000000000000000000000
00000000000000000000010000010200010B00083609308C4282BB57AFCB56BD
CE56C2D157C3D258C4D45AC6D558C6D254C4D04FC2D04DC0CF49C1CE48C0CC45
BFCA43BDC941BEC941BEC841BFC53EBCC43DBBC33BBBC63DBDC63EBEC33FBBC4
44BBB537AEBC3EB5C03FB8C340B9C741BBCC47BFD352C5D254C4D253C6D051C4
CE4FC2CA4BBEC448BAC246B8BF43B5BC40B0B83FADAE41A4A145987832713B0F
3614001307000602000302000100000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000001000001
0000000000000000000000000000000000000000000000000200010500040C00
0B2C042787407FBA59AFCA57BECE52C2D456C6D155C5D358C6D459C7D354C7D2
51C4D14DC2D14CC1CF49C1CD46C0CC44C1CA42BFC941BFC941BFC941BFC63FBD
C63DBDC53DBDC83FBFC63EBEC640BCC441BABF3FB6C03FB8C541BDCB45C1D049
C3D24DC5CA46BBC847BACB4CBFCD4EC1C94ABDC647BAC246B8C246B6BB42B0B5
42AAAD42A39D43966D2A672F032A0F000D040003020001010101000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000101
00020000000200010400030C000A31032D7E3776B150A7BE4BB3C145B5C142B6
C442B7C543BAC647BBC949C0C947BECB45BFCC45BFD047C1CE44C1CE44C1CE43
C2CE43C2CF44C4CE43C3CE43C3CB42C2CE42C5CD43C6CD41C4CA41C1C740BEC5
3FBBC43EBAC23CB8CB43C1D149C6D54EC8D651C9D04CC1C847BAC849BCC849BC
C445B8C344B7BF43B5BB42B0B640A9AA429F95448D5D245721001D0C00090500
0402000100000000000002000002000000000000000000000000000000000000
0000000100000100000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000010100020000010400040E000C2E052A7831
70A03F96AD3AA2B236A8B738ACBB39AEBC36B0BE38B2BC39B2BE3BB4C13BB7C0
3AB6C33BB8C73DBACA40BDCE43C2D247C6D54ACAD84ACBD74CCCD84DCDD74ECE
DC51D1DE53D3D84DCDD045C5CA41C1CA41C1BE35B5B82DADCA3FBED048C5D14B
C5D04CC1CF4BC0C948BBC849BCC546B9C344B7BF43B5BB44B1B444AAA7439D8A
3A814C1546190015090006020001000000000000000000000000020000020000
0000000000000000000000000000000000000001000001000000000000000000
0000000000000000000000000000000000000000000000000000000000000200
0002000000010000010000000000000000000000000000000000000002000002
00010200030D000C2F032A6D27669B3C93AC3CA2B33AA9B93AAEBC3AAFBB39AE
BF39B3C03AB4BF3DB4BF3DB4C33DB7C43EB8C53FB9CA43BDCC45BFD248C5D74D
CADA4FCED94ECDDA50CDDA52CFDA54D0DD55D2DE56D3D94FCCCF44C3CE43C3CC
40C3B829AEBD2EB3CB40BFD14AC4D14CC4D04CC1CD4BC0C849BCC647BAC246B8
C145B7BA43B0B242A8A342997B35743D0F391200110700060400010000000000
0000000000000000000000000000000000000000000000000100000100000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000020000000000000100000100000000000000
0000000000000000000000000200000400030B00092907266A27649A3D92AA3C
A2B43BAAB83CAEBA3BAFBD3BB0BF3DB2BE3CB3BE3CB1BD41B1BB44B1B746AEB1
43A9B447AAB749AFC14EB6CC53C1D452C7D852CADB52CCDB54CEDC56D0DC57CF
DD58D0DC57CFD54EC8CD45C3D145C8BF31B9B421ABBB2BB3CD42C2D149C6D14C
C4CD4BC0C94ABDC549BBC246B8C047B6BB44B1B043A69F4196752D6F360A310E
000D040004000000000000000000000000000000000000000000000000000000
0101010000000000010000010000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000003000209
000621001B5D2457973E8EAB3EA1AF3BA6B53CABB93DAFBC3DB1BC3DB1BE3FB3
BF40B4BD42B0B646AAA042977D2F766724616626616A2764782D71A14598C754
BBD555C5DB56CBDB56CBDB57CCDD59CEDA58CDD957CCD351C8D34CCACA3FC6B4
25B0B420AEB925B1C536BBCF44C3D049C3CB49BEC748BBC246B8C044B6BD46B3
B444AA9E41966929642C07290D000B0400030200010000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000003000205000312000F44103F893980A73F9EB33CA8B43B
A9B63DACBB3DADBB3FAFBC40B0BA43B0B646ACAA46A089378058174F2A002517
001516001317001522001F4D10489B3F90C656BAD558C6DA56CBDB58CBDA59CC
D859CCD859CCD755CCD34CCABE30B9B21FAFB51FB2B824B2BD2BB3C638B9CA42
BFC846BDC546BAC145B7BB43B2B345ABA144996B25642702240A000905000400
0100000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000400030A00082B
0626732B6DA14097AC3CA2B53CAAB63DACB63DACBC3EAEBA42AEB845ACAB47A1
8E3D865F235932092E1500120900080500060500060700060900081700154C10
46A34D9BCD5AC1D857CAD857CAD859CCD65ACAD559CBD655CEC63EC0B323B1B3
1DB1B51FB2B923B2BD29B3C332B7C83DBDC842BEC543BABD43B5B743AEA6479E
6A2A652803250A000B0200030000010000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000005000416001353204C973E8DAC3FA2B13AA6B53CAAB73E
ACB740ACB542A9B048A59A41906821603807331C00180B000902000300000100
00000000000000000200010900071C0019783671C159B6D458C8D556C9D758CB
D559C9D95ACED14CCAB92EB5B11EB0B41EB2B720B3B923B2BE29B5C836BECA3E
C1CD45C3C744BDBB43B2A944A06C23672900250A000902000300000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000001000001000000000000000200000200000000000800072F0A2A7E
3C77A34299B13EA6B43DA9B53EABB740ADB346A9A74A9F833B7D44133F1C0018
0D000B0700060400030000010000000000000000000000000000000400030D00
0B491943B054A7CF59C2D355C5D857CAD758CBD956CFC739C1B21FAFB21CB0B5
1DB2B722B2BB27B3C02DB7C836BECC40C3CF46C6D04AC6C04FB782347B2C0028
0C000B0500040000010000000101010000000000010000010000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000100000100000000000000
0200000200000200000D000A3F0E3A924589AA429FB23FA7B340A8AE41A4AC47
A39D479561215C29002410000D05000402000100000000000000000000000000
00000000000000000000000200010500041F001B893C80C55ABACE56C2D856CB
DB56CED047C7B826B4B21CB0B41CB1B620B3B723B1BC29B3C333BBCB3CC1CD41
C4D146C6D24AC7C454BA5F1C5918001407000600000000000000000000000000
0000000001000001000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000010002000002000012000F50144A9C
4694AC41A1B141A7AE43A3A145987D38753B0E3513000F090007050003020001
0000000000000000000000000000000000000000000000000000000000000200
010E000B501548B35AAACC59C0D654CBD850CEC133BBB11BAEB41BB2B51FB3B6
21B1B925B1BD2DB5C437BCCB40C0CE43C2D147C4D24AC7C555BB6922611D0018
0700060000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0001000200000400011900166F2D68A24999A9459FA6459C923F8A64255D2800
230D000B04000300010000000000000000000000000000000000000000000000
0000000000000000000000000000000000090007270021944A8AC85BBDD553CA
CD43C6B523B1B21CB0B41CB1B51FB2B925B3B928B2C033B8C63CBFCB43C1CF45
C2D249C3D24BC5CA54BD9B46903D0A360D000C02000100000101010100000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000100000100000000000000000002000004000320031C7F3B76A1
499598468F7E38754416401A00160B0008040004020001000000000000000000
0200000200000000000000000000000000000000000000000000000000000301
0107000414000F5F2758C45EB6D250C5C437BCB01BABB21CAFB41EB1B520B0B8
24B0BC2CB4C63ABDCA41C1CD45C3CF47C4D049C3D34CC6CE50C0C357B78D3D82
2300200700060200030000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000001000001000000000000
0000000200010400031E041B7B40738D4784672C5F34092E12000F0500040200
0300000100000000000000000000000002000002000000000000000000000000
000000000000000000000000000002000004000109000732072CB558A9CA4EBE
B729B1AF1AAAB11CACB31EAEB622AEB827B1C033B8C83DBDCB42C2CD45C3CD45
C2D04AC2D34DC5D24FC2CC51BFBC58B060245A18001507000600000100000000
0000000000010101000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000200010400031B081763395C50
244921041D0B0008050004020001000001000000020001020001000000000000
0000000000000000000000000000010000010000000000000200000200000000
000200000400031A001694418CC04BB8AA21A5AD1AAAB21DADB521AFB625AFBC
2CB4C337BACB40C0CE43C3D046C3CF48C2D14BC3D34DC5D34FC4D151C1C755B9
A64D9C4C134611000E0200030000010000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000200000400011207112913261600130700060300020000000000000000
0000000002000102000100000000000000000000000000000000000000000100
00010000000000000200000200000000000000000200000F000E692264B248AB
A21C9EAC1AA8B21EACB622AEB929B1C031B6C63ABDCC41C1D045C4D147C4D049
C3D24CC4D34DC5D44FC4D350C3CB51BDC254B4924088350A2F0D000A04000300
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000002000004010308000705
0004020001000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000001000C000B400B3D92398F9E1F9AAC1BA6B11EA8B725ADBC2DB2C4
36B9CA3FBFCC41C1D045C4D248C5D049C3D14BC3D24CC4D24DC2D24FC2D151C1
CC52BEBA53AE7833702700230900070200010000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000102000700061E001E621A60
962293A81DA4B020A8B728ADBF31B4C93BBECC41C1CE43C3D146C5D248C5D049
C3D14BC3D14BC3D24DC2D24FC2D24FC2CF4FBFC853BAAF51A56D2B661D001B07
0006020001000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000010000010000000000
0000000000000000000000000000000001000001000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000101010400030E000D370436832082A323A0B026A9BA2BB0C335B8CB
3DC0CC41C1CE43C3D146C5D349C6D249C3D44BC4D24CC4D24DC2D24FC2D350C3
D24FC2CE51BFC853BAAB4DA1571E511700140500060000000101010000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000001000001000000000000000000000000000000000000000000
0100000100000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000200010500041B001C
61105F992995AD2BA7BC30B3C438BBC93DC0CB40C0CE43C3D045C4D248C5D34A
C4D249C2D14BC3D24DC2D24EC3D14EC1D24FC2D350C3D151C1C455B79B49924D
1647140013040003020001000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000101010000000200010E000F3C033A80277DAB31A3BD34B4C63CBFCB
3FC2CD42C2CF44C4D146C6D247C6D248C5D44BC5D24BC5D24BC5D14CC1D14CC1
D14CC1D14EC1D14EBFCB51BDC256B699479040123C10000E0400030000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000070007
1E001D5D1C5A9D3796B53CABBF42B6C342BBC946BFCC46C2CD45C3D247C6D248
C5D349C6D24AC7D24BC5D24CC4D24DC2D34EC3D24DC2D04DC0CF4FBFCE51BFC1
57B4853F7C2E052A0B0008020001000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000400030E000D300A2E6C26658D3484A23D99B2
45A8C049B5C549BBCD48C0CF48C2D147C4D248C5D34AC4D34AC3D24CC4D34DC5
D34EC3D14CC1D04DC0D14EC1D050C0C954BBB756AC6D29641A00170500040200
0100000000000000000001010100000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000020001
04000410000E2901243E0738510F4A63185C7B2573983A8FAF47A4BE4EB2C44D
B9C84CBCCD4DBDCF4CBFCF4BC0D24DC2D24DC2D14DC2D14EC1D14EC1D24FC2CF
52C0C755B9A9509F4514400F000C050004000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000001
000001000000000000000000000000000200010400030900070C000A10000F18
001521001E34082F4D16476D2A67903F88AC4EA3C153B3C952BBCD50BED04DC0
D04DC0D14EC1D14EC1D04FC2D04FC2CE4EBECE51BFC358B58E44862E01280B00
0702000000010000010000000000000000000000000000000000000000000000
0000000100000100000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000100000100000000010101000000000000
00000000000000000000000002000102000104000307000711000E1C001A3002
2D4B0E46712467963E8AB150A6BF55B2C455B7C853BAC951BDCC51BFCF51C1D0
50C0D451C2CD57BEBA59AF78346F180014050004020000000100000000000000
0000000000000000000000000000000000000001000001000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000100000100000000
00000200010200030500040700060900080F000E1800142500203B0D3762275A
914787B158A7C059B4C755B9CD53BFD151C1D151C1CE54C0C957BBAD54A44D1A
460F000C05000400000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000010000010000000000000000000000000000000000000000
000000000200010500040A000810000D21001D3F07386B256295438CB151A5BD
54AFC256B6C657B9C656BABD5CB395508D360D320C0009020001000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000002000002000000000000000000000000
0000000000000000000000000000000000000000000000020001040003050004
0700070B000A12000F1F001B3C0F3661295A84407BA05097AF53A4B75BACB260
A97A3E7425082205000402000100000000000100000100000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0200000200000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000104000309000712
000F1D001A370731561A507A3572904A898951844C2F480E030D020001000000
0000010000010000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000010000010000000000000000000000000000000000000002000002
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000200010400030500040700060B00080F000C1700152306
20361C3434233111091002000100000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000100000100000000000000
0000000000000000000000000200000200000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000020001020001040004050004050005050004020001000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000002000002000000000000000000000000000000000000
0000000000000000020000020000000000000000000000000000000000000000
0000000000000000000000000000000000000101010000000000000000000200
0102000102000102000100000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000020000020000
0000000000000000000000000000000000000000000000000200000200000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000010101
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000020000020000000000000000000001000001000000000000
0000000000000001000001000001000001000000000000000000000000000000
0100000100000000000000000000000000000100000100000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000200000200000000
0000000000000100000100000000000000000000000000010000010000010000
0100000000000000000000000000000001000001000000000000000000000000
0000010000010000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FFFF
FFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFF
FFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFF
FFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFF
FFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFF
FFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFF
FFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFFFFFFFFFFFFFFFFFFFFC0FFFF
CFFF7FF3FFFFFFFCFFC0FFFFF7FDFFF3FFFFFFFCFFC0FFFFC33FF3FFFFFFFFFF
FFC0FFFF800073FFFFFFFFFFFFC0FFFF000033FFFFFFFFFFFFC0FFFF000001FF
FFFFFFFFFFC0FFFF800001FFFFFFFFFFFFC0FFFFC000007FFFFFFFFFFFC0FFFF
E000003FFFFFFFFFFFC0FFFFF000000FFFFFFFEFFFC0FFFF38000007FFFF3FFF
FFC0FFFF3C000003FFFF3FFFFFC0FFFFCE000001FFFFFFF3FFC0FFFFCF000000
FFFFFF01FFC0FFFFDF0000007FFFFD01FFC0FFFFFF0000007FFFFC01FFC0FFFF
3FC000003FFFF801FFC0FFFF3FE000001FFF2001FFC0FFFFFFE000000FFEC000
FFC0FFFFFFF0000007FA0000FFC0FFFFFCF8000003F20001FFC0FFFFFCF60000
01F00001FFC0FFFFF3C6000001F00001FFC0FFFFF3EE000000400003FFC0FFFF
FF7C000000000003FFC0FFFFFF3C000000000003FFC0FFFFF3FE000000000003
FFC0FFFFF3F8000000000003FFC0FFFFFF80000000000007FFC0FFFFFFC00000
00000007FFC0FFFFCFE0000000000007FFC0FFFFCFC0000000000007FFC0FFFF
6F80000000000004FFC0FFFFFF00000000000004FFC03FFCFE00000000000007
FFC03FFCFC0000000000000BFFC0F3CF380000000000001FFFC0FFCF30000000
0000001FFFC0FFFFE00000000000003FFFC0F3FF80000000000000FFFFC0FFFF
80000000000001FFFFC0FFFF80000000000003FFFFC0F3FC00000000000007FF
FFC0F3FC0000000000000FFFFFC0FFC800000000000033F3FFC0FFC000000000
0000F3F3FFC00FC0000000000001FF3FFFC04FC0000000000007FD3FFFC0FFC0
000000000007FFFFFFC0FF8000000000000FFFFFFFC0FF8000000000001FFFFF
FFC0FF80001C0000007FFFFFFFC0CC80003E00000053FFFFFFC0CC0001FE0000
01F3FFFFFFC0FC0003FF000001FFFFFFFFC0FC000FFF8000003FFFFFFFC0CE00
1CFF0000007FFFFFFFC0CE003CFF0000003BFFFFFFC0FE004FCC8000001FFFFF
FFC0FE03CFCCC000001FFFFFFFC0FF07FFFFC000000FFFFFFFC0FFFFFFFFC000
0007FFFFFFC0FF3F3FFFC0000005FFFFFFC0FF3F3FFFE0000001FFFFFFC0FFFF
FFFFD0000001FFFFFFC0FFFFFFFFF8000000FFFFFFC0FFFFFFFFF800000077FF
FFC0FFFFFFFFF80000007FFFFFC0FFFFFFFF3C0000000FF3FFC0FFFFFFFF2FC0
00000FF3FFC0FFFFFFFFFF3000001FFFFFC0FFFFFFFFFF3FC0000FFFFFC0FFFF
FFFFFCFFE00004FFFFC0FFFFFFFFFCFFFF0004FFFFC0FFFFFFFFCFCFFF8007FF
FFC0FFFFFFFFCFCFFFFC07FFFFC0FFFFFFFFF3FCFFF70FFFFFC0FFFFFFFFF3FC
FFFFFBFFFFC0FFFFFFFFFFFCCF0F3CFFFFC0FFFFFFFFFFFCCF0F3CFFFFC0}
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 311
Height = 161
Align = alTop
TabOrder = 0
object Label1: TLabel
Left = 16
Top = 11
Width = 58
Height = 13
Caption = 'Driver name'
end
object Label2: TLabel
Left = 16
Top = 40
Width = 77
Height = 13
Caption = 'Monitor settings'
end
object DriverNameEdit: TEdit
Left = 99
Top = 8
Width = 198
Height = 21
TabOrder = 0
Text = '\Driver\'
end
object MonitorSettingsCheckListBox: TCheckListBox
Left = 99
Top = 40
Width = 198
Height = 105
ItemHeight = 13
Items.Strings = (
'New devices'
'Data'
'IRP'
'IRP completion'
'Fast I/O'
'Start IO'
'AddDevice'
'Unload')
TabOrder = 1
end
end
object CancelButton: TButton
Left = 238
Top = 167
Width = 65
Height = 33
Caption = 'Cancel'
TabOrder = 1
OnClick = CancelButtonClick
end
object OkButton: TButton
Left = 167
Top = 167
Width = 65
Height = 33
Caption = 'Ok'
TabOrder = 2
OnClick = OkButtonClick
end
end
| 64.458511 | 68 | 0.917777 |
8348c27c9a0233b20ed63156037bb2ac3c5d282c | 6,991 | pas | Pascal | windows/src/ext/jedi/jvcl/help/tools/Common/DtxDiagnoser.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/help/tools/Common/DtxDiagnoser.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/help/tools/Common/DtxDiagnoser.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | unit DtxDiagnoser;
interface
uses
Windows, Classes,
JVCLHelpUtils, DtxParser, SysUtils;
type
TDtxDiagnoser = class
private
FWords: TStringList;
FIdentifiers: TStringList;
FNotWhiteSpace: TSysCharSet;
FIgnoreWordsContainingNumbers: Boolean;
FRemoveBeginQuotes: Boolean;
FRemoveEndQuotes: Boolean;
FCollectIdentifiers: Boolean;
FCollectWords: Boolean;
function GetNotWhiteSpaceStr: string;
procedure SetNotWhiteSpaceStr(const Value: string);
function GetWhiteSpace: TSysCharSet;
function GetWords: TStrings;
function GetIdentifiers: TStrings;
protected
procedure AddWord(const S: string; const ContainsNumbers: Boolean);
procedure AddString(const S: string);
procedure ProcessTopic(ATopic: TDtxTopic);
procedure ProcessSymbolList(ASymbolList: TSymbolList);
procedure ProcessParameterList(AParameterList: TParameterList);
procedure ProcessItems(AItems: TItemsSymbol);
procedure ProcessTable(ATable: TDtxTable);
public
constructor Create; virtual;
destructor Destroy; override;
function Collect(ADtxList: TDtxList): Boolean;
procedure ShowStats;
property NotWhiteSpaceStr: string read GetNotWhiteSpaceStr write SetNotWhiteSpaceStr;
property NotWhiteSpace: TSysCharSet read FNotWhiteSpace write FNotWhiteSpace;
property WhiteSpace: TSysCharSet read GetWhiteSpace;
property IgnoreWordsContainingNumbers: Boolean read FIgnoreWordsContainingNumbers write
FIgnoreWordsContainingNumbers;
property RemoveEndQuotes: Boolean read FRemoveEndQuotes write FRemoveEndQuotes;
property RemoveBeginQuotes: Boolean read FRemoveBeginQuotes write FRemoveBeginQuotes;
property Words: TStrings read GetWords;
property Identifiers: TStrings read GetIdentifiers;
property CollectWords: Boolean read FCollectWords write FCollectWords;
property CollectIdentifiers: Boolean read FCollectIdentifiers write FCollectIdentifiers;
end;
implementation
{ TDtxDiagnoser }
procedure TDtxDiagnoser.AddString(const S: string);
//const
// NotWhiteSpace = [#1..#47] - ['-', '_'] + ['\', '/', '[', ']', ':', ';', ',', '.'];
var
P, Q, R: PChar;
Word: string;
AWhiteSpace: TSysCharSet;
ContainsNumbers: Boolean;
begin
AWhiteSpace := WhiteSpace;
P := PChar(S);
repeat
while (P^ in AWhiteSpace) do
Inc(P);
Q := P;
ContainsNumbers := False;
while not (P^ in ([#0] + AWhiteSpace)) do
begin
ContainsNumbers := ContainsNumbers or (P^ in ['0'..'9']);
Inc(P);
end;
if P > Q then
begin
R := P;
if RemoveEndQuotes then
while (Q < R) and ((R - 1)^ = '''') do
Dec(R);
if RemoveBeginQuotes then
while (Q < R) and (Q^ = '''') do
Inc(Q);
if R > Q then
begin
SetString(Word, Q, R - Q);
AddWord(Word, ContainsNumbers);
end;
end;
until P^ = #0;
end;
function IsIdentifier(const S: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 2 to Length(S) do
if S[i] in ['A'..'Z', '_'] then
begin
Result := True;
Break;
end;
end;
procedure TDtxDiagnoser.AddWord(const S: string; const ContainsNumbers: Boolean);
begin
if IsIdentifier(S) then
begin
if CollectIdentifiers then
FIdentifiers.Add(S);
end
else
if not (ContainsNumbers and IgnoreWordsContainingNumbers) then
begin
if CollectWords then
FWords.Add(LowerCase(S));
end;
end;
constructor TDtxDiagnoser.Create;
begin
inherited Create;
FWords := TStringList.Create;
FWords.Sorted := True;
FWords.Duplicates := dupIgnore;
FWords.CaseSensitive := False;
FIdentifiers := TStringList.Create;
FIdentifiers.Sorted := True;
FIdentifiers.Duplicates := dupIgnore;
FIdentifiers.CaseSensitive := True;
FRemoveBeginQuotes := True;
FRemoveEndQuotes := True;
end;
destructor TDtxDiagnoser.Destroy;
begin
FWords.Free;
FIdentifiers.Free;
inherited Destroy;
end;
function TDtxDiagnoser.Collect(ADtxList: TDtxList): Boolean;
var
I: Integer;
begin
Result := True;
for I := 0 to ADtxList.Count - 1 do
ProcessTopic(ADtxList[i]);
end;
procedure DiffStrings(Source, CheckList, Dest: TStrings);
var
I, J: Integer;
C: Integer;
begin
I := 0;
J := 0;
while (I < Source.Count) and (J < CheckList.Count) do
begin
C := AnsiCompareText(Source[i], CheckList[J]);
if C < 0 then
begin
Dest.Add(Source[i]);
Inc(I);
end
else
if C > 0 then
begin
Inc(J);
end
else
begin
Inc(I);
Inc(J);
end;
end;
while I < Source.Count do
begin
Dest.Add(Source[i]);
Inc(I);
end
end;
function TDtxDiagnoser.GetNotWhiteSpaceStr: string;
var
Ch: Char;
begin
Result := '';
for Ch := Low(Char) to High(Char) do
if Ch in NotWhiteSpace then
Result := Result + Ch;
end;
procedure TDtxDiagnoser.ProcessItems(AItems: TItemsSymbol);
var
I: Integer;
begin
for I := 0 to AItems.Count - 1 do
ProcessSymbolList(AItems.Symbols[i]);
end;
procedure TDtxDiagnoser.ProcessParameterList(
AParameterList: TParameterList);
var
I: Integer;
begin
for I := 0 to AParameterList.Count - 1 do
ProcessSymbolList(AParameterList.Params[i]);
end;
procedure TDtxDiagnoser.ProcessSymbolList(ASymbolList: TSymbolList);
var
I: Integer;
Symbol: TBaseSymbol;
begin
if ASymbolList = nil then
Exit;
for I := 0 to ASymbolList.Count - 1 do
begin
Symbol := ASymbolList[i];
if Symbol is TStringSymbol then
AddString(TStringSymbol(Symbol).Value)
else
if Symbol is TItemsSymbol then
ProcessItems(TItemsSymbol(Symbol))
else
if Symbol is TDtxTable then
ProcessTable(TDtxTable(Symbol));
end;
end;
procedure TDtxDiagnoser.ProcessTable(ATable: TDtxTable);
var
Row, Col: Integer;
begin
for Row := 0 to ATable.RowCount - 1 do
for COl := 0 to ATable.ColCount - 1 do
ProcessSymbolList(ATable.CellsSymbols[Col, Row]);
end;
procedure TDtxDiagnoser.ProcessTopic(ATopic: TDtxTopic);
begin
with ATopic do
begin
ProcessSymbolList(Summary);
ProcessSymbolList(Note);
ProcessSymbolList(ReturnValue);
ProcessSymbolList(Description);
ProcessParameterList(Parameters);
end;
end;
procedure TDtxDiagnoser.SetNotWhiteSpaceStr(const Value: string);
var
I: Integer;
begin
FNotWhiteSpace := [];
for I := 1 to Length(Value) do
Include(FNotWhiteSpace, Value[i]);
end;
function TDtxDiagnoser.GetWhiteSpace: TSysCharSet;
begin
Result := [Low(Char)..High(Char)] -
[#0] - ['A'..'Z'] - ['a'..'z'] - ['0'..'9'] - NotWhiteSpace;
//Result := Result + ['-'];
end;
function TDtxDiagnoser.GetWords: TStrings;
begin
Result := FWords;
end;
function TDtxDiagnoser.GetIdentifiers: TStrings;
begin
Result := FIdentifiers;
end;
procedure TDtxDiagnoser.ShowStats;
begin
if CollectWords then
HintMsgFmt('%d words', [FWords.Count]);
if CollectIdentifiers then
HintMsgFmt('%d identifiers', [FIdentifiers.Count]);
end;
end.
| 23.149007 | 92 | 0.691031 |
83b683b41d0483489db9d6e4e6dc6b208af7511f | 12,657 | pas | Pascal | Source/dlgToolProperties.pas | atkins126/pyscripter | 285faf37ebcc1c0c82751206ea9827785e226876 | [
"MIT"
]
| 769 | 2015-08-26T03:24:37.000Z | 2022-03-31T15:58:00.000Z | Source/dlgToolProperties.pas | atkins126/pyscripter | 285faf37ebcc1c0c82751206ea9827785e226876 | [
"MIT"
]
| 392 | 2015-08-31T05:36:28.000Z | 2022-03-24T10:05:21.000Z | Source/dlgToolProperties.pas | atkins126/pyscripter | 285faf37ebcc1c0c82751206ea9827785e226876 | [
"MIT"
]
| 311 | 2015-08-26T17:42:06.000Z | 2022-03-22T16:32:17.000Z | {-----------------------------------------------------------------------------
Unit Name: dlgToolProperties
Author: Kiriakos Vlahos
Date: 04-Jun-2005
Purpose: Dialog for specifying command-line tool properties
History:
-----------------------------------------------------------------------------}
unit dlgToolProperties;
interface
uses
System.Types, Windows, Messages, SysUtils, Variants, Classes, Controls, Forms,
System.UITypes, Dialogs, cTools, StdCtrls, SynEdit, Menus,
ActnList, SpTBXControls, SpTBXEditors, SpTBXItem, SpTBXTabs, TB2Item,
dlgPyIDEBase, ComCtrls, System.Actions, Vcl.Samples.Spin, Vcl.ExtCtrls,
SynEditMiscClasses, System.ImageList, Vcl.ImgList, Vcl.VirtualImageList;
type
TToolProperties = class(TPyIDEDlgBase)
Panel1: TPanel;
FormatsPopup: TPopupMenu;
Filename1: TMenuItem;
Linenumber1: TMenuItem;
Columnnumber1: TMenuItem;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
SynApplication: TSynEdit;
SynParameters: TSynEdit;
SynWorkDir: TSynEdit;
GroupBox4: TGroupBox;
GroupBox3: TGroupBox;
GroupBox5: TGroupBox;
GroupBox6: TGroupBox;
btnOK: TButton;
btnCancel: TButton;
btnAppDir: TButton;
btnWorkDir: TButton;
btnStdFormats: TButton;
btnHelp: TButton;
cbCaptureOutput: TCheckBox;
cbParseMessages: TCheckBox;
cbParseTraceback: TCheckBox;
cbHideConsole: TCheckBox;
cbUseCustomEnv: TCheckBox;
btnAdd: TButton;
btnDelete: TButton;
btnUpdate: TButton;
ActionList: TActionList;
actUpdateItem: TAction;
actDeleteItem: TAction;
actAddItem: TAction;
Label1: TLabel;
Label5: TLabel;
Label17: TLabel;
Label2: TLabel;
Label6: TLabel;
Label7: TLabel;
Label3: TLabel;
lbShortcut: TLabel;
lbContext: TLabel;
Label13: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label15: TLabel;
Label16: TLabel;
edName: TEdit;
edDescription: TEdit;
edMessagesFormat: TEdit;
edEnvName: TEdit;
edEnvValue: TEdit;
cbContext: TComboBox;
cbSaveFiles: TComboBox;
cbStandardInput: TComboBox;
cbStandardOutput: TComboBox;
TabControl: TSpTBXTabControl;
SpTBXTabItem1: TSpTBXTabItem;
tabProperties: TSpTBXTabSheet;
SpTBXTabItem2: TSpTBXTabItem;
tabEnvironment: TSpTBXTabSheet;
lvItems: TListview;
vilImages: TVirtualImageList;
cbUTF8IO: TCheckBox;
procedure FormShow(Sender: TObject);
procedure Filename1Click(Sender: TObject);
procedure SynApplicationEnter(Sender: TObject);
procedure SynParametersEnter(Sender: TObject);
procedure SynWorkDirEnter(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnWorkDirClick(Sender: TObject);
procedure btnAppDirClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure actAddItemExecute(Sender: TObject);
procedure actDeleteItemExecute(Sender: TObject);
procedure actUpdateItemExecute(Sender: TObject);
procedure ActionListUpdate(Action: TBasicAction; var Handled: Boolean);
procedure btnHelpClick(Sender: TObject);
procedure cbParseMessagesClick(Sender: TObject);
procedure btnStdFormatsClick(Sender: TObject);
procedure lvItemsSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
private
{ Private declarations }
fEnvStrings : TStrings;
hkShortCut: TSynHotKey;
public
{ Public declarations }
end;
function EditTool(Tool : TExternalTool; IsExternalRun : Boolean = False) : Boolean;
function EditToolItem(Item : TCollectionItem) : Boolean;
implementation
uses
Vcl.Graphics,
Vcl.Themes,
Vcl.FileCtrl,
dmCommands,
JclSysInfo,
JvGnugettext,
uCommonFunctions,
StringResources;
{$R *.dfm}
function EditTool(Tool : TExternalTool; IsExternalRun : Boolean = False) : Boolean;
Var
i : integer;
begin
Result := False;
if not Assigned(Tool) then Exit;
with TToolProperties.Create(Application) do
try
with Tool do begin
edName.Text := Caption;
edDescription.Text := Description;
SynApplication.Text := ApplicationName;
SynParameters.Text := Parameters;
SynWorkDir.Text := WorkingDirectory;
cbContext.ItemIndex := Integer(Context);
hkShortCut.HotKey := ShortCut;
cbSaveFiles.ItemIndex := Integer(SaveFiles);
cbStandardInput.ItemIndex := Integer(ProcessInput);
cbStandardOutput.ItemIndex := Integer(ProcessOutput);
cbCaptureOutput.Checked := CaptureOutput;
cbHideConsole.Checked := ConsoleHidden;
cbParseMessages.Checked := ParseMessages;
cbParseTraceback.Checked := ParseTraceback;
edMessagesFormat.Text := MessagesFormat;
cbUTF8IO.Checked := Utf8IO;
cbUseCustomEnv.Checked := UseCustomEnvironment;
if UseCustomEnvironment then
fEnvStrings.Assign(Environment)
else
GetEnvironmentVars(fEnvStrings);
end;
if IsExternalRun then begin
Caption := _('External Run Properties');
hkShortCut.Enabled := False;
lbShortcut.Enabled := False;
cbContext.Enabled := False;
lbContext.Enabled := False;
end;
Result := (ShowModal = mrOK) and (edName.Text <> '');
if Result then with Tool do begin
Caption := edName.Text;
Description := edDescription.Text;
ApplicationName := SynApplication.Text;
Parameters := SynParameters.Text;
WorkingDirectory := SynWorkDir.Text;
Context := TToolContext(cbContext.ItemIndex);
ShortCut := hkShortCut.HotKey;
SaveFiles := TSaveFiles(cbSaveFiles.ItemIndex);
ProcessInput := TProcessStdInputOption(cbStandardInput.ItemIndex);
ProcessOutput := TProcessStdOutputOption(cbStandardOutput.ItemIndex);
CaptureOutput := cbCaptureOutput.Checked;
ConsoleHidden := cbHideConsole.Checked;
ParseMessages := cbParseMessages.Checked;
ParseTraceback := cbParseTraceback.Checked;
MessagesFormat := edMessagesFormat.Text;
Utf8IO := cbUTF8IO.Checked;
UseCustomEnvironment := cbUseCustomEnv.Checked;
Environment.Clear;
if UseCustomEnvironment then begin
for i := 0 to lvItems.Items.Count - 1 do
Environment.Add(lvItems.Items[i].Caption + '=' + lvItems.Items[i].SubItems[0]);
end;
end;
finally
Release;
end;
end;
function EditToolItem(Item : TCollectionItem) : Boolean;
begin
Result := EditTool((Item as TToolItem).ExternalTool);
end;
procedure TToolProperties.Filename1Click(Sender: TObject);
begin
case (Sender as TMenuItem).Tag of
0: edMessagesFormat.SelText := GrepFileNameParam;
1: edMessagesFormat.SelText := GrepLineNumberParam;
2: edMessagesFormat.SelText := GrepColumnNumberParam;
end;
edMessagesFormat.SetFocus;
end;
procedure TToolProperties.SynApplicationEnter(Sender: TObject);
begin
CommandsDataModule.ParameterCompletion.Editor := SynApplication;
CommandsDataModule.ModifierCompletion.Editor := SynApplication;
end;
procedure TToolProperties.SynParametersEnter(Sender: TObject);
begin
CommandsDataModule.ParameterCompletion.Editor := SynParameters;
CommandsDataModule.ModifierCompletion.Editor := SynParameters;
end;
procedure TToolProperties.SynWorkDirEnter(Sender: TObject);
begin
CommandsDataModule.ParameterCompletion.Editor := SynWorkDir;
CommandsDataModule.ModifierCompletion.Editor := SynWorkDir;
end;
procedure TToolProperties.FormCreate(Sender: TObject);
begin
inherited;
fEnvStrings := TStringList.Create;
hkShortCut := TSynHotKey.Create(Self);
with hkShortCut do
begin
Name := 'hkShortCut';
Parent := GroupBox4;
Left := PPIScale(86);
Top := PPIScale(15);
Width := PPIScale(125);
Height := PPIScale(19);
Hint := 'Allows you to specify a menu shortcut for the tool';
HotKey := 0;
InvalidKeys := [hcNone];
Modifiers := [];
TabOrder := 0;
Color := StyleServices.GetSystemColor(clWindow);
Font.Color := StyleServices.GetSystemColor(clWindowText);
end;
SynApplication.Color := StyleServices.GetSystemColor(clWindow);
SynApplication.Font.Color := StyleServices.GetSystemColor(clWindowText);
SynParameters.Color := StyleServices.GetSystemColor(clWindow);
SynParameters.Font.Color := StyleServices.GetSystemColor(clWindowText);
SynWorkDir.Color := StyleServices.GetSystemColor(clWindow);
SynWorkDir.Font.Color := StyleServices.GetSystemColor(clWindowText);
end;
procedure TToolProperties.FormDestroy(Sender: TObject);
begin
fEnvStrings.Free;
CommandsDataModule.ParameterCompletion.Editor := nil;
CommandsDataModule.ModifierCompletion.Editor := nil;
end;
procedure TToolProperties.btnWorkDirClick(Sender: TObject);
var
Directories : TArray<string>;
begin
if SelectDirectory('', Directories, [], _('Select working directory:')) then
begin
SynWorkDir.SelectAll;
SynWorkDir.SelText := Directories[0];
SynWorkDir.SetFocus;
end;
end;
procedure TToolProperties.cbParseMessagesClick(Sender: TObject);
begin
edMessagesFormat.Enabled := cbParseMessages.Checked;
btnStdFormats.Enabled := cbParseMessages.Checked;
end;
procedure TToolProperties.btnAppDirClick(Sender: TObject);
begin
with CommandsDataModule.dlgFileOpen do begin
Title := _(SSelectApplication);
Filter := 'Executable Files (*.exe;*.bat;*.cmd)|*.exe;*.bat;*.cmd|All files|*.*|';
FileName := '';
if Execute then begin
SynApplication.SelectAll;
SynApplication.SelText := FileName;
SynApplication.SetFocus;
end;
end;
end;
procedure TToolProperties.actAddItemExecute(Sender: TObject);
Var
Item : TListItem;
i : Integer;
begin
if edEnvName.Text <> '' then begin
for i := 0 to lvItems.Items.Count - 1 do
if CompareText(lvItems.Items[i].Caption, EdEnvName.Text) = 0 then begin
Item := lvItems.Items[i];
Item.Caption := EdEnvName.Text;
Item.SubItems[0] := EdEnvValue.Text;
Item.Selected := True;
Item.MakeVisible(False);
Exit;
end;
with lvItems.Items.Add() do begin
Caption := edEnvName.Text;
SubItems.Add(edEnvValue.Text);
Selected := True;
MakeVisible(False);
end;
end;end;
procedure TToolProperties.actDeleteItemExecute(Sender: TObject);
begin
if lvItems.ItemIndex >= 0 then
lvItems.Items.Delete(lvItems.ItemIndex);
end;
procedure TToolProperties.actUpdateItemExecute(Sender: TObject);
Var
i : integer;
begin
if (edEnvName.Text <> '') and (lvItems.ItemIndex >= 0) then begin
for i := 0 to lvItems.Items.Count - 1 do
if (CompareText(lvItems.Items[i].Caption, edEnvName.Text) = 0) and
(i <> lvItems.ItemIndex) then
begin
Dialogs.MessageDlg(_(SSameName), mtError, [mbOK], 0);
Exit;
end;
with lvItems.Items[lvItems.ItemIndex] do begin
Caption := EdEnvName.Text;
SubItems[0] := EdEnvValue.Text;
end;
end;
end;
procedure TToolProperties.lvItemsSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
begin
if Selected then begin
edEnvName.Text := Item.Caption;
edEnvValue.Text := Item.SubItems[0];
end;
end;
procedure TToolProperties.ActionListUpdate(Action: TBasicAction;
var Handled: Boolean);
begin
actDeleteItem.Enabled := lvItems.ItemIndex >= 0;
actAddItem.Enabled := edName.Text <> '';
actUpdateItem.Enabled := (edName.Text <> '') and (lvItems.ItemIndex >= 0);
Handled := True;
end;
procedure TToolProperties.btnHelpClick(Sender: TObject);
begin
Application.HelpContext(HelpContext);
end;
procedure TToolProperties.btnStdFormatsClick(Sender: TObject);
var
button: TControl;
lowerLeft: TPoint;
begin
if Sender is TControl then
begin
button := TControl(Sender);
lowerLeft := Point(0, button.Height);
lowerLeft := button.ClientToScreen(lowerLeft);
FormatsPopup.Popup(lowerLeft.X, lowerLeft.Y);
end;
end;
procedure TToolProperties.FormShow(Sender: TObject);
Var
i : integer;
begin
lvItems.Items.Clear;
lvItems.Items.BeginUpdate;
try
for i := 0 to fEnvStrings.Count - 1 do
if fEnvStrings.Names[i] <> '' then
with lvItems.Items.Add() do begin
Caption := fEnvStrings.Names[i];
SubItems.Add(fEnvStrings.Values[Caption]);
end;
finally
lvItems.Items.EndUpdate;
end;
end;
end.
| 31.251852 | 90 | 0.684996 |
f16fe529412be251a07e94511424f3438ace3080 | 2,302 | pas | Pascal | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/fAResize.pas | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 72 | 2015-02-03T02:30:45.000Z | 2020-01-30T17:20:52.000Z | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/fAResize.pas | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 80 | 2016-04-19T12:04:06.000Z | 2020-01-31T14:35:19.000Z | Packages/Order Entry Results Reporting/CPRS/CPRS-Chart/fAResize.pas | rjwinchester/VistA | 6ada05a153ff670adcb62e1c83e55044a2a0f254 | [
"Apache-2.0"
]
| 67 | 2015-01-27T16:47:56.000Z | 2020-02-12T21:23:56.000Z | unit fAResize;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
fPage, ExtCtrls, VA508AccessibilityManager;
type
TfrmAutoResize = class(TfrmPage)
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
private
FSizes: TList;
protected
procedure Loaded; override;
end;
var
frmAutoResize: TfrmAutoResize;
implementation
uses VA508AccessibilityRouter;
{$R *.DFM}
type
TSizeRatio = class // records relative sizes and positions for resizing logic
public
CLeft: Extended;
CTop: Extended;
CWidth: Extended;
CHeight: Extended;
constructor Create(ALeft, ATop, AWidth, AHeight: Extended);
end;
{ TSizeRatio methods }
constructor TSizeRatio.Create(ALeft, ATop, AWidth, AHeight: Extended);
begin
CLeft := ALeft; CTop := ATop; CWidth := AWidth; CHeight := AHeight;
end;
{ TfrmAutoResize methods }
procedure TfrmAutoResize.Loaded;
{ record initial size & position info for resizing logic }
var
SizeRatio: TSizeRatio;
i,H,W: Integer;
begin
FSizes := TList.Create;
H := ClientHeight;
W := ClientWidth;
for i := 0 to ControlCount - 1 do with Controls[i] do
begin
SizeRatio := TSizeRatio.Create(Left/W, Top/H, Width/W, Height/H);
FSizes.Add(SizeRatio);
end;
inherited Loaded;
end;
procedure TfrmAutoResize.FormResize(Sender: TObject);
{ resize child controls using their design time proportions }
var
SizeRatio: TSizeRatio;
i,H,W: Integer;
begin
inherited;
H := Height;
W := Width;
with FSizes do for i := 0 to ControlCount - 1 do
begin
SizeRatio := Items[i];
with SizeRatio do
if Controls[i] is TLabel then with Controls[i] do
SetBounds(Round(CLeft*W), Round(CTop*H), Width, Height)
else
Controls[i].SetBounds(Round(CLeft*W), Round(CTop*H), Round(CWidth*W), Round(CHeight*H));
end; {with FSizes}
end;
procedure TfrmAutoResize.FormDestroy(Sender: TObject);
{ destroy objects used to record size and position information for controls }
var
SizeRatio: TSizeRatio;
i: Integer;
begin
inherited;
with FSizes do for i := 0 to Count-1 do
begin
SizeRatio := Items[i];
SizeRatio.Free;
end;
FSizes.Free;
end;
initialization
SpecifyFormIsNotADialog(TfrmAutoResize);
end.
| 21.92381 | 96 | 0.70808 |
47beb3f7efa294067be30721ed93f880d6841c40 | 2,321 | pas | Pascal | src/cliente desktop/src/views/desktop.views.login.pas | ricardo-pontes/projeto-pousada | e525efab62b3d28b1852c3a581d7a9c4fa6c8fd7 | [
"MIT"
]
| null | null | null | src/cliente desktop/src/views/desktop.views.login.pas | ricardo-pontes/projeto-pousada | e525efab62b3d28b1852c3a581d7a9c4fa6c8fd7 | [
"MIT"
]
| null | null | null | src/cliente desktop/src/views/desktop.views.login.pas | ricardo-pontes/projeto-pousada | e525efab62b3d28b1852c3a581d7a9c4fa6c8fd7 | [
"MIT"
]
| null | null | null | unit desktop.views.login;
interface
uses
System.SysUtils,
System.Types,
System.UITypes,
System.Classes,
System.Variants,
System.Generics.Collections,
FMX.Types,
FMX.Graphics,
FMX.Controls,
FMX.Forms,
FMX.Dialogs,
FMX.StdCtrls,
FMX.Layouts,
FMX.Objects,
FMX.Effects,
FMX.TabControl,
FMX.Edit,
FMX.Controls.Presentation,
desktop.views.base,
cliente.presenter.usuarios,
cliente.presenter.usuarios.interfaces,
entidades.usuario;
type
TViewLogin = class(TViewBase, iPresenterUsuariosView)
Rectangle1: TRectangle;
rectLogin: TRectangle;
ShadowEffect1: TShadowEffect;
Layout1: TLayout;
Button1: TButton;
EditEmail: TEdit;
Label2: TLabel;
EditSenha: TEdit;
Label3: TLabel;
Label4: TLabel;
Layout2: TLayout;
Label1: TLabel;
Layout3: TLayout;
Image1: TImage;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Circle1: TCircle;
Circle2: TCircle;
Circle3: TCircle;
Circle4: TCircle;
Circle5: TCircle;
Circle6: TCircle;
Circle7: TCircle;
Circle8: TCircle;
Circle9: TCircle;
Circle10: TCircle;
Circle11: TCircle;
Circle12: TCircle;
Circle13: TCircle;
Circle14: TCircle;
Circle15: TCircle;
Circle16: TCircle;
Circle17: TCircle;
Circle18: TCircle;
Circle19: TCircle;
Circle20: TCircle;
Line1: TLine;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
procedure CarregarUsuarios(aUsuarios : TObjectList<TUsuario>);
function Instancia : TComponent;
public
{ Public declarations }
end;
var
ViewLogin: TViewLogin;
implementation
uses
Router4D,
desktop.views.principal;
{$R *.fmx}
procedure TViewLogin.Button1Click(Sender: TObject);
begin
inherited;
try
FPresenterUsuarios.Logar(EditEmail.Text, EditSenha.Text);
Application.MainForm := ViewPrincipal;
ViewPrincipal.Show;
Self.Hide;
except on E: Exception do
ShowToast(rectLogin, E);
end;
end;
procedure TViewLogin.CarregarUsuarios(aUsuarios: TObjectList<TUsuario>);
begin
end;
procedure TViewLogin.FormCreate(Sender: TObject);
begin
inherited;
FPresenterUsuarios := TPresenterUsuarios.Create(Self);
end;
function TViewLogin.Instancia: TComponent;
begin
Result := Self;
end;
end.
| 19.341667 | 72 | 0.707023 |
4764ad749844fcec721bb0c7b78e68eca0b9ee4d | 5,683 | dpr | Pascal | Notification Package/xLogonNotify.dpr | Private-Storm/Blog | d38c07ac877ac4de91207e5186d60740077cdb17 | [
"Apache-2.0"
]
| 2 | 2020-01-09T16:10:15.000Z | 2020-10-23T00:58:41.000Z | Notification Package/xLogonNotify.dpr | Private-Storm/Blog | d38c07ac877ac4de91207e5186d60740077cdb17 | [
"Apache-2.0"
]
| null | null | null | Notification Package/xLogonNotify.dpr | Private-Storm/Blog | d38c07ac877ac4de91207e5186d60740077cdb17 | [
"Apache-2.0"
]
| 1 | 2020-10-23T00:58:44.000Z | 2020-10-23T00:58:44.000Z | {******************************************************************************}
{ JEDI API example WinLogon Notification Package }
{ http://jedi-apilib.sourceforge.net }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ Author(s): stOrM!, Christian Wimmer }
{ Creation date: 23th May 2008 }
{ Last modification date: 26th May 2008 }
{ }
{ Description: Demonstrates how to create a Winlogon Notification Package and }
{ draws a transparent window inside Winlogon Process containing a }
{ PNG Image }
{ Preparations: JwaWindows, any layer based graphic apllication e.g. Gimp or }
{ Adobe Photoshop }
{ Article link: }
{ http://blog.delphi-jedi.net/2008/05/27/ }
{ winlogon-notification-packagewinlogon-notification-package/ }
{ Version history: 23/05/2008 first release }
{ }
{ No license. Use this example with no warranty at all and on your own risk. }
{ This example is just for learning purposes and should not be used in }
{ productive environments. }
{ The code has surely some errors that need to be fixed. In such a case }
{ you can contact the author(s) through the JEDI API hompage, the mailinglist }
{ or via the article link. }
{ }
{ Be aware that third party components used by this example may have other }
{ licenses. Please see the corresponding component what they are. }
{ You have to download them manually. }
{ }
{ The JEDI API Logo is copyrighted and must not be used without permission }
{ }
{ External components: }
{ PNG components: http://www.thany.org/article/18/Delphi_components }
{ Graphics32 : http://sourceforge.net/projects/graphics32/ }
{******************************************************************************}
library xLogonNotify;
uses
SysUtils,
Classes,
Windows,
Forms,
LogoAppThread in 'LogoAppThread.pas',
Unit1 in 'Unit1.pas' {Form1};
type
TFnMsgeCallback = function (bVerbose: Boolean; lpMessage: PWideChar): Cardinal; stdcall;
TWlxNotificationInfo = record
Size: Cardinal;
Flags: Cardinal;
UserName: PWideChar;
Domain: PWideChar;
WindowStation: PWideChar;
Token: Cardinal;
Desktop: Cardinal;
StatusCallback: TFnMsgeCallback;
end;
PWlxNotificationInfo = ^TWlxNotificationInfo;
{$R *.res}
var Thread : TLogoThread;
procedure StartupHandler(Info: PWlxNotificationInfo); stdcall;
begin
try
//don't show logo on Failsafe
if GetSystemMetrics(SM_CLEANBOOT) <> 0 then exit;
Thread := TLogoThread.Create(true);
Thread.FreeOnTerminate := true;
Thread.Resume;
except
end;
end;
procedure LogonHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure StartShellHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure LockHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure UnLockHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure StartScreenSaverHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure StopScreenSaverHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure LogoffHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure ShutdownHandler(Info: PWlxNotificationInfo); stdcall;
begin
try
Thread.Terminate;
if WaitForSingleObject(Thread.Handle, 3* 1000{sec}) = WAIT_TIMEOUT then
TerminateThread(Thread.Handle, 0);
except
end;
end;
procedure DisconnectHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure ReconnectHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure PostShellHandler(Info: PWlxNotificationInfo); stdcall;
begin
end;
procedure EntryPointProc(reason: integer);
begin
case reason of
DLL_PROCESS_ATTACH: //1
begin
DisableThreadLibraryCalls(hInstance);
end;
DLL_THREAD_ATTACH: //2
begin
end;
DLL_PROCESS_DETACH: //3
begin
end;
DLL_THREAD_DETACH: //0
begin
end;
end;
end;
exports
StartupHandler,
LogonHandler,
StartShellHandler,
LockHandler,
UnLockHandler,
StartScreenSaverHandler,
StopScreenSaverHandler,
LogoffHandler,
ShutdownHandler,
DisconnectHandler,
ReconnectHandler,
PostShellHandler;
begin
DllProc := @EntryPointProc;
DllProc(DLL_PROCESS_ATTACH);
end.
| 30.88587 | 91 | 0.527362 |
f16ae136f5f515e9862b37d7bdece270056129ac | 2,110 | dfm | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/CreateProcessExample/CreateProcessExampleMainFormU.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/CreateProcessExample/CreateProcessExampleMainFormU.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/CreateProcessExample/CreateProcessExampleMainFormU.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object CreateProcessExampleMainForm: TCreateProcessExampleMainForm
Left = 382
Top = 134
Width = 544
Height = 375
Caption = 'TJvCreateProcess example (with notepad.exe)'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 536
Height = 41
Align = alTop
TabOrder = 0
object RunBtn: TButton
Left = 8
Top = 8
Width = 75
Height = 25
Caption = '&Run'
TabOrder = 0
OnClick = RunBtnClick
end
object QuitBtn: TButton
Left = 288
Top = 8
Width = 97
Height = 25
Caption = 'Send WM_QUIT'
TabOrder = 3
OnClick = QuitBtnClick
end
object CloseBtn: TButton
Left = 184
Top = 8
Width = 97
Height = 25
Caption = 'Send WM_CLOSE'
TabOrder = 2
OnClick = CloseBtnClick
end
object TerminateBtn: TButton
Left = 392
Top = 8
Width = 97
Height = 25
Caption = 'Terminate process'
TabOrder = 4
OnClick = TerminateBtnClick
end
object StopBtn: TButton
Left = 88
Top = 8
Width = 75
Height = 25
Caption = '&Stop waiting'
TabOrder = 1
OnClick = StopBtnClick
end
end
object RichEdit1: TRichEdit
Left = 0
Top = 41
Width = 536
Height = 309
Align = alClient
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
HideScrollBars = False
ParentFont = False
PlainText = True
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
WordWrap = False
end
object JvCreateProcess1: TJvCreateProcess
CommandLine = 'notepad.exe'
OnTerminate = JvCreateProcess1Terminate
Left = 16
Top = 56
end
end
| 21.979167 | 67 | 0.574408 |
f13f63a2f82ae6f23ea32b5d771a132538912a61 | 4,190 | pas | Pascal | Process/Capitalisation/SpecificWordCaps.pas | coolchyni/jcf-cli | 69fd71b962fd1c1386ec4939e94dab70568bf7e6 | [
"MIT"
]
| 22 | 2018-05-31T23:01:15.000Z | 2021-11-16T11:25:36.000Z | Process/Capitalisation/SpecificWordCaps.pas | luridarmawan/jcf-cli | aa61b3ae771ce8c9c45b8f5c3a3109f8ca82fc02 | [
"MIT"
]
| 1 | 2018-08-14T21:15:51.000Z | 2018-08-15T12:42:58.000Z | Process/Capitalisation/SpecificWordCaps.pas | luridarmawan/jcf-cli | aa61b3ae771ce8c9c45b8f5c3a3109f8ca82fc02 | [
"MIT"
]
| 6 | 2018-05-31T06:31:55.000Z | 2022-02-19T03:04:14.000Z | unit SpecificWordCaps;
{(*}
(*------------------------------------------------------------------------------
Delphi Code formatter source code
The Original Code is SpecificWordCaps, released May 2003.
The Initial Developer of the Original Code is Anthony Steele.
Portions created by Anthony Steele are Copyright (C) 1999-2008 Anthony Steele.
All Rights Reserved.
Contributor(s): Anthony Steele.
The contents of this file are subject to the Mozilla Public License Version 1.1
(the "License"). you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and limitations
under the License.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 or later (the "GPL")
See http://www.gnu.org/licenses/gpl.html
------------------------------------------------------------------------------*)
{*)}
{ AFS 30 December 2002
- fix capitalisation on specified words
}
{$I JcfGlobal.inc}
interface
uses SwitchableVisitor;
type
TSpecificWordCaps = class(TSwitchableVisitor)
private
fiCount: integer;
lsLastChange: string;
protected
function EnabledVisitSourceToken(const pcNode: TObject): boolean; override;
public
constructor Create; override;
function IsIncludedInSettings: boolean; override;
{ return true if you want the message logged}
function FinalSummary(out psMessage: string): boolean; override;
end;
implementation
uses
{ delphi }
{$IFNDEF FPC}Windows,{$ENDIF} SysUtils,
{ local }
SourceToken, Tokens, ParseTreeNodeType, JcfSettings, FormatFlags;
function Excluded(const pt: TSourceToken): boolean;
begin
Result := False;
{ directives in context are excluded }
if pt.HasParentNode(DirectiveNodes) then
begin
Result := True;
exit;
end;
// asm has other rules
if pt.HasParentNode(nAsm) then
begin
Result := True;
exit;
end;
{ built in types that are actually being used as types are excluded
eg.
// this use of 'integer' is definitly the type
var li: integer;
// this use is definitely not
function Integer(const ps: string): integer;
// this use is ambigous
li := Integer(SomeVar);
user defined types are things that we often *want* to set a specific caps on
so they are not excluded }
if (pt.TokenType in BuiltInTypes) and (pt.HasParentNode(nType)) then
begin
Result := True;
exit;
end;
end;
{ TSpecificWordCaps }
constructor TSpecificWordCaps.Create;
begin
inherited;
fiCount := 0;
lsLastChange := '';
FormatFlags := FormatFlags + [eCapsSpecificWord];
end;
function TSpecificWordCaps.FinalSummary(out psMessage: string): boolean;
begin
Result := (fiCount > 0);
psMessage := '';
if Result then
begin
psMessage := 'Specific word caps: ';
if fiCount = 1 then
psMessage := psMessage + 'One change was made: ' + lsLastChange
else
psMessage := psMessage + IntToStr(fiCount) + ' changes were made';
end;
end;
function TSpecificWordCaps.EnabledVisitSourceToken(const pcNode: TObject): Boolean;
var
lcSourceToken: TSourceToken;
lsChange: string;
begin
Result := False;
lcSourceToken := TSourceToken(pcNode);
if Excluded(lcSourceToken) then
exit;
{ not in Asm statements}
if lcSourceToken.HasParentNode(nAsm) then
exit;
if FormatSettings.SpecificWordCaps.HasWord(lcSourceToken.SourceCode) then
begin
// get the fixed version
lsChange := FormatSettings.SpecificWordCaps.CapitaliseWord(lcSourceToken.SourceCode);
// case-sensitive test - see if anything to do.
if AnsiCompareStr(lcSourceToken.SourceCode, lsChange) <> 0 then
begin
lsLastChange := lcSourceToken.SourceCode + ' to ' + lsChange;
lcSourceToken.SourceCode := lsChange;
Inc(fiCount);
end;
end;
end;
function TSpecificWordCaps.IsIncludedInSettings: boolean;
begin
Result := FormatSettings.SpecificWordCaps.Enabled;
end;
end.
| 25.393939 | 89 | 0.697852 |
47f1ee7474c7f018804caaf5208bfa884f211167 | 6,453 | pas | Pascal | Components/JVCL/examples/RaLib/RaEditor/fJvEditorTest.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/examples/RaLib/RaEditor/fJvEditorTest.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/examples/RaLib/RaEditor/fJvEditorTest.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | {******************************************************************
JEDI-VCL Demo
Copyright (C) 2002 Project JEDI
Original author:
Contributor(s):
You may retrieve the latest version of this file at the JEDI-JVCL
home page, located at http://jvcl.sourceforge.net
The contents of this file are used with permission, subject to
the Mozilla Public License Version 1.1 (the "License"); you may
not use this file except in compliance with the License. You may
obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1_1Final.html
Software distributed under the License is distributed on an
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
******************************************************************}
unit fJvEditorTest;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
JvEditor, JvHLParser, StdCtrls, ExtCtrls, ComCtrls, JvHLEditor,
ImgList, JvComponent, JvFormPlacement, JvExControls, JvEditorCommon;
type
TfrmEditor = class(TForm)
GutterImages: TImageList;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
JvEditor: TJvHLEditor;
TabSheet2: TTabSheet;
RAEditor1: TJvHLEditor;
TabSheet3: TTabSheet;
RAEditor2: TJvHLEditor;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
RAEditor3: TJvHLEditor;
RAEditor4: TJvEditor;
Panel1: TPanel;
Label1: TLabel;
ilCompletions: TImageList;
RegAuto1: TJvFormStorage;
TabSheet6: TTabSheet;
RAHLEditor1: TJvHLEditor;
TabSheet7: TTabSheet;
RAHLEditor2: TJvHLEditor;
TabSheet8: TTabSheet;
RAHLEditor3: TJvHLEditor;
TabSheet9: TTabSheet;
RAHLEditor4: TJvHLEditor;
StatusBar1: TStatusBar;
TabSheet10: TTabSheet;
RAHLEditor5: TJvHLEditor;
TabSheet11: TTabSheet;
RAHLEditor6: TJvHLEditor;
TabSheet12: TTabSheet;
RAHLEditor7: TJvHLEditor;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure RAEditorPaintGutter(Sender: TObject; Canvas: TCanvas);
procedure PageControl1Change(Sender: TObject);
procedure PageControl1Enter(Sender: TObject);
procedure RAEditorCompletionDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
procedure RegAuto1AfterLoad(Sender: TObject);
procedure RegAuto1AfterSave(Sender: TObject);
procedure RAEditor3ReservedWord(Sender: TObject; Token: string;
var Reserved: Boolean);
procedure RAEditorCompletionApply(Sender: TObject;
const OldString: string; var NewString: string);
private
Parser: TJvIParser;
end;
var
frmEditor: TfrmEditor;
implementation
uses JvJCLUtils, JvConsts;
{$R *.DFM}
procedure TfrmEditor.FormCreate(Sender: TObject);
begin
Application.Title := Caption;
Parser := TJvIParser.Create;
end;
procedure TfrmEditor.FormDestroy(Sender: TObject);
begin
Parser.Free;
end;
procedure TfrmEditor.RAEditorPaintGutter(Sender: TObject; Canvas: TCanvas);
procedure Draw(Y, ImageIndex: integer);
var
Ro: integer;
R: TRect;
begin
if Y <> -1 then
with Sender as TJvEditor do begin
Ro := Y - TopRow;
R := CalcCellRect(0, Ro);
GutterImages.Draw(Canvas,
R.Left - GutterWidth + 1,
R.Top + (CellRect.Height - GutterImages.Height) div 2 + 1,
ImageIndex);
end;
end;
var
i: Integer;
R: TRect;
oldFont: TFont;
begin
oldFont := TFont.Create;
try
oldFont.Assign(Canvas.Font);
Canvas.Font := JvEditor.Font;
with JvEditor do
for i := TopRow to TopRow + VisibleRowCount do
begin
R := Bounds(2, (i - TopRow) * CellRect.Height, GutterWidth - 2 - 5, CellRect.Height);
Windows.DrawText(Canvas.Handle, PChar(IntToStr(i + 1)), -1, R, DT_RIGHT or DT_VCENTER or DT_SINGLELINE);
end;
finally
Canvas.Font := oldFont;
oldFont.Free;
end;
for i := 0 to 9 do
if JvEditor.Bookmarks[i].Valid then
Draw(JvEditor.Bookmarks[i].Y, i);
end;
procedure TfrmEditor.PageControl1Change(Sender: TObject);
begin
Parser.Style := TIParserStyle(not (PageControl1.ActivePage.PageIndex = 0));
JvEditor.Refresh;
RAEditor1.Refresh;
RAEditor2.Refresh;
RAEditor3.Refresh;
end;
procedure TfrmEditor.PageControl1Enter(Sender: TObject);
begin
(PageControl1.ActivePage.Controls[0] as TWinControl).SetFocus;
end;
procedure TfrmEditor.RAEditorCompletionDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
Offset, W: Integer;
S: string;
ImageIndex: integer;
begin
Offset := 3;
with Control as TListBox, (Control.Owner as TJvEditor).Completion do
begin
Canvas.FillRect(Rect);
case Mode of
cmIdentifiers:
begin
ImageIndex := StrToInt(Trim(SubStr(Items[Index], 2, Separator))) - 1;
ilCompletions.Draw(Canvas, Rect.Left + 2, Rect.Top, ImageIndex);
Canvas.TextOut(Rect.Left + 3 * Offset + ilCompletions.Width, Rect.Top + 2, SubStr(Items[Index], 0, Separator));
S := Trim(SubStr(Items[Index], 1, Separator));
W := Canvas.TextWidth(S);
Canvas.TextOut(Rect.Right - 2 * Offset - W, Rect.Top + 2, S);
end;
cmTemplates:
begin
Canvas.TextOut(Rect.Left + Offset, Rect.Top + 2, SubStr(Items[Index], 1, Separator));
Canvas.Font.Style := [fsBold];
S := SubStr(Items[Index], 0, Separator);
W := Canvas.TextWidth(S);
Canvas.TextOut(Rect.Right - 2 * Offset - W, Rect.Top + 2, S);
end;
end;
end;
end;
procedure TfrmEditor.RegAuto1AfterLoad(Sender: TObject);
begin
PageControl1.ActivePage := PageControl1.Pages[RegAuto1.ReadInteger(Name + 'PageIndex', PageControl1.ActivePage.PageIndex)];
PageControl1Change(nil);
end;
procedure TfrmEditor.RegAuto1AfterSave(Sender: TObject);
begin
RegAuto1.WriteInteger(Name + 'PageIndex', PageControl1.ActivePage.PageIndex);
end;
procedure TfrmEditor.RAEditor3ReservedWord(Sender: TObject; Token: string;
var Reserved: Boolean);
begin
Reserved := (Token = 'R') or (Token = '&') or (Token = 'A') or
Cmp(Token, 'Library');
end;
procedure TfrmEditor.RAEditorCompletionApply(Sender: TObject;
const OldString: string; var NewString: string);
begin
NewString := OldString + Copy(NewString, Length(OldString) + 1, 10000);
end;
end.
| 29.199095 | 125 | 0.685728 |
fc13ea9f13a941245b55f0f3aeb6d6de1e4ea85a | 123 | pas | Pascal | Test/SimpleScripts/exception_nested_call2.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| 1 | 2022-02-18T22:14:44.000Z | 2022-02-18T22:14:44.000Z | Test/SimpleScripts/exception_nested_call2.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | Test/SimpleScripts/exception_nested_call2.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | function Test1 : String;
begin
raise Exception.Create('TEST');
end;
procedure Test2;
begin
StrToInt(Test1);
end;
Test2; | 11.181818 | 32 | 0.739837 |
f11ffe5ec7bffbce26c69710c72583c5d8c8e659 | 6,650 | pas | Pascal | BlurBehind/BlurBehindControl.pas | Spelt/CodeRage2019 | 6585f8af9c6c896969a47152e5a5288b7844e993 | [
"BSD-2-Clause"
]
| 1 | 2021-04-25T13:01:00.000Z | 2021-04-25T13:01:00.000Z | BlurBehind/BlurBehindControl.pas | Spelt/CodeRage2019 | 6585f8af9c6c896969a47152e5a5288b7844e993 | [
"BSD-2-Clause"
]
| null | null | null | BlurBehind/BlurBehindControl.pas | Spelt/CodeRage2019 | 6585f8af9c6c896969a47152e5a5288b7844e993 | [
"BSD-2-Clause"
]
| null | null | null | unit BlurBehindControl;
interface
uses
System.Classes,
FMX.Types,
FMX.Controls,
FMX.Graphics,
FMX.Filter.Effects,
FMX.Objects,
System.UITypes;
type
{ A control that blurs whatever is behind it. }
TBlurBehindControl = class(TRectangle)
{$REGION 'Internal Declarations'}
private
FBitmapControlBehind, FBitmapBlend, FBitmapBlurred: TBitmap;
FGaussianBlurEffect: TGaussianBlurEffect;
FBlurAmount: Single;
FBlendEffect: TNormalBlendEffect;
FBlendColor: TAlphaColor;
FBlendColorEnabled: Boolean;
procedure SetBlurAmount(const AValue: Single);
procedure SetBlendColor(const AValue: TAlphaColor);
procedure SetBlendColorEnabled(const AValue: Boolean);
private
procedure UpdateBitmapOfControlBehind;
procedure UpdateBitmapBlurred;
procedure UpdateBitmapBlend;
protected
procedure ParentChanged; override;
procedure Paint; override;
{$ENDREGION 'Internal Declarations'}
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ The blur amount. Defaults to 1.5 }
property BlurAmount: Single read FBlurAmount write SetBlurAmount;
property BlendColor: TAlphaColor read FBlendColor write SetBlendColor;
property BlendColorEnabled: Boolean read FBlendColorEnabled write SetBlendColorEnabled;
property Align;
property Anchors;
property ClipChildren;
property ClipParent;
property Cursor;
property DragMode;
property EnableDragHighlight;
property Enabled;
property Locked;
property Height;
property HitTest default False;
property Padding;
property Opacity;
property Margins;
property PopupMenu;
property Position;
property RotationAngle;
property RotationCenter;
property Scale;
property Size;
property TouchTargetExpansion;
property Visible;
property Width;
property TabOrder;
property TabStop;
property OnPainting;
property OnPaint;
property OnResize;
property OnResized;
property OnDragEnter;
property OnDragLeave;
property OnDragOver;
property OnDragDrop;
property OnDragEnd;
property OnClick;
property OnDblClick;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseEnter;
property OnMouseLeave;
end;
procedure Register;
implementation
uses
System.Types;
procedure Register;
begin
RegisterComponents('Grijjy', [TBlurBehindControl]);
end;
{ TBlurBehindControl }
constructor TBlurBehindControl.Create(AOwner: TComponent);
begin
inherited;
HitTest := False;
// FBitmapBlurred := TBitmap.Create;
FBitmapControlBehind := TBitmap.Create;
FGaussianBlurEffect := TGaussianBlurEffect.Create(Self);
FBlurAmount := 1.5;
FBlendColorEnabled := False;
FBlendEffect := TNormalBlendEffect.Create(Self);
FBitmapBlend := TBitmap.Create;
Fill.Kind := TBrushKind.Bitmap;
Fill.Bitmap.WrapMode := TWrapmode.TileOriginal;
Stroke.Kind := TBrushKind.None;
XRadius := 15;
YRadius := 15;
end;
destructor TBlurBehindControl.Destroy;
begin
// FBitmapBlurred.Free;
FBitmapBlend.Free;
FBitmapControlBehind.Free;
inherited;
end;
procedure TBlurBehindControl.ParentChanged;
begin
inherited;
{ Our code only works if the parent is a TControl (or nil).
So you cannot place this control directly on a form. }
if (Parent <> nil) and (not(Parent is TControl)) then
raise EInvalidOperation.Create('A TBlurBehindControl can only be placed inside another control');
end;
procedure TBlurBehindControl.SetBlurAmount(const AValue: Single);
begin
if (AValue <> FBlurAmount) then
begin
FBlurAmount := AValue;
Repaint;
end;
end;
procedure TBlurBehindControl.SetBlendColor(const AValue: TAlphaColor);
begin
if (AValue <> FBlendColor) then
begin
FBlendColor := AValue;
Repaint;
end;
end;
procedure TBlurBehindControl.SetBlendColorEnabled(const AValue: Boolean);
begin
if (AValue <> FBlendColorEnabled) then
begin
FBlendColorEnabled := AValue;
Repaint;
end;
end;
procedure TBlurBehindControl.Paint;
begin
{ Copy the visual of the parent control to FBitmapOfControlBehind. }
UpdateBitmapOfControlBehind;
{ Resize the bitmap to a smaller size before image effect processing to reduce processing time. }
FBitmapBlurred := FBitmapControlBehind.CreateThumbnail(round(FBitmapControlBehind.Width / 2), round(FBitmapControlBehind.Height / 2));
UpdateBitmapBlend;
UpdateBitmapBlurred;
{ Resize the bitmap to the original size for painting. }
var bitmapforPainting := FBitmapBlurred.CreateThumbnail(FBitmapControlBehind.Width, FBitmapControlBehind.Height);
try
Fill.Bitmap.Bitmap := bitmapforPainting;
inherited Paint;
finally
bitmapforPainting.Free;
FBitmapBlurred.Free;
end;
end;
procedure TBlurBehindControl.UpdateBitmapBlend();
begin
if (not FBlendColorEnabled) then
Exit;
FBitmapBlend.SetSize(FBitmapBlurred.Size);
FBitmapBlend.Clear(FBlendColor);
FBlendEffect.Target := FBitmapBlend;
FBlendEffect.ProcessEffect(
{ Canvas. Not used for GPU accelerated effects. }
nil,
{ Bitmap to apply effect to. }
FBitmapBlurred,
{ Any data to pass to effect. Not used. }
0);
end;
procedure TBlurBehindControl.UpdateBitmapBlurred;
begin
{ Apply blur }
FGaussianBlurEffect.BlurAmount := FBlurAmount;
FGaussianBlurEffect.ProcessEffect(
{ Canvas. Not used for GPU accelerated effects. }
nil,
{ Bitmap to apply effect to. }
FBitmapBlurred,
{ Any data to pass to effect. Not used. }
0);
{ Blur a second time at a lower amount to reduce the "box blur" effect. }
FGaussianBlurEffect.BlurAmount := FBlurAmount * 0.4;
FGaussianBlurEffect.ProcessEffect(nil, FBitmapBlurred, 0);
end;
procedure TBlurBehindControl.UpdateBitmapOfControlBehind;
var
ControlBehind: TControl;
TargetWidth, TargetHeight: Integer;
procedure PaintPartToBitmap(const Control: TControl; const SourceRect, TargetRect: TRect; const Bitmap: TBitmap);
var ClipRects: TClipRects;
X, Y: Single;
begin
ClipRects := [TRectF.Create(TargetRect)];
if (Bitmap.Canvas.BeginScene(@ClipRects)) then
try
FDisablePaint := True;
X := TargetRect.Left - SourceRect.Left;
Y := TargetRect.Top - SourceRect.Top;
Control.PaintTo(Bitmap.Canvas, RectF(X, Y, X + Control.Width, Y + Control.Height));
finally
FDisablePaint := False;
Bitmap.Canvas.EndScene;
end;
end;
begin
{ The parent should be a TControl. This is checked in ParentChanged. }
Assert(Parent is TControl);
ControlBehind := TControl(Parent);
TargetWidth := round(Width);
TargetHeight := round(Height);
FBitmapControlBehind.SetSize(TargetWidth, TargetHeight);
PaintPartToBitmap(ControlBehind, BoundsRect.round, TRect.Create(0, 0, TargetWidth, TargetHeight), FBitmapControlBehind);
end;
end.
| 23.66548 | 135 | 0.770827 |
834a3cb74f53e7713c331c9a70810aab9ca1b179 | 2,822 | pas | Pascal | Oxygene/Echoes/Framework/WCF/IndigoClient/Main.pas | remobjects/ElementsSamples | 744647f59424c18ccb06c0c776b2dcafdabb0513 | [
"MIT"
]
| 19 | 2016-04-09T12:40:27.000Z | 2022-02-22T12:15:03.000Z | Oxygene/Echoes/Framework/WCF/IndigoClient/Main.pas | remobjects/ElementsSamples | 744647f59424c18ccb06c0c776b2dcafdabb0513 | [
"MIT"
]
| 3 | 2017-09-05T09:31:29.000Z | 2019-09-11T04:49:27.000Z | Oxygene/Echoes/Framework/WCF/IndigoClient/Main.pas | remobjects/ElementsSamples | 744647f59424c18ccb06c0c776b2dcafdabb0513 | [
"MIT"
]
| 11 | 2016-12-29T19:30:39.000Z | 2021-08-31T12:20:27.000Z | namespace Indigo;
interface
uses
System.Drawing,
System.Collections,
System.Collections.Generic,
System.Linq,
System.Windows.Forms,
System.ComponentModel,
System.ServiceModel, System.ServiceModel.Description;
type
/// <summary>
/// Summary description for MainForm.
/// </summary>
MainForm = partial class(System.Windows.Forms.Form)
private
method bGetServerTime_Click(sender: System.Object; e: System.EventArgs);
method bArithm_Click(sender: System.Object; e: System.EventArgs);
method InitChannel();
var
factory : ChannelFactory<IndigoServiceChannel>;
proxy : IndigoServiceChannel;
endpointChanged : Boolean;
method comboBoxEndpoints_SelectedIndexChanged(sender: System.Object; e: System.EventArgs);
protected
method Dispose(disposing: Boolean); override;
public
constructor;
end;
implementation
{$REGION Construction and Disposition}
constructor MainForm;
begin
//
// Required for Windows Form Designer support
//
InitializeComponent();
comboBoxEndpoints.SelectedIndex := 0;
end;
method MainForm.Dispose(disposing: Boolean);
begin
if disposing then begin
if assigned(components) then
components.Dispose();
//
// TODO: Add custom disposition code here
//
end;
inherited Dispose(disposing);
end;
{$ENDREGION}
method MainForm.bGetServerTime_Click(sender: System.Object; e: System.EventArgs);
begin
InitChannel;
MessageBox.Show("Server time is: " + proxy.GetServerTime().ToString() + Environment.NewLine + "Invoked endpoint: " + factory.Endpoint.Name);
end;
method MainForm.bArithm_Click(sender: System.Object; e: System.EventArgs);
var responce : CalculationMessage := new CalculationMessage();
operation : Char; Res : Decimal;
begin
if (radioButtonPlus.Checked) then operation := '+'
else
if (radioButtonMinus.Checked) then operation := '-'
else
if (radioButtonMult.Checked) then operation := '*'
else
if (radioButtonDiv.Checked) then operation := '/';
var numbers : Operands := new Operands;
numbers.operand1 := nudA.Value; numbers.operand2 := nudB.Value;
var request : CalculationMessage := new CalculationMessage(operation, numbers, Res);
InitChannel;
responce := proxy.Calculate(request);
MessageBox.Show("Result: " + responce.Res.ToString() + Environment.NewLine + "Invoked endpoint: " + factory.Endpoint.Name);
end;
method MainForm.InitChannel;
begin
if (endpointChanged) then
begin
factory := new ChannelFactory<IndigoServiceChannel>(comboBoxEndpoints.SelectedItem.ToString);
proxy := factory.CreateChannel();
endpointChanged := false;
end;
end;
method MainForm.comboBoxEndpoints_SelectedIndexChanged(sender: System.Object; e: System.EventArgs);
begin
endpointChanged := true;
end;
end. | 26.87619 | 142 | 0.725018 |
851f35be93e585d557a3bfa1dd980ed192b9ba60 | 24,236 | pas | Pascal | Generation/uDUnitXTestGen.pas | GDKsoftware/OpenTestGrip | a06f7840aea852c9d84ea2178e792d93866bf797 | [
"MIT"
]
| null | null | null | Generation/uDUnitXTestGen.pas | GDKsoftware/OpenTestGrip | a06f7840aea852c9d84ea2178e792d93866bf797 | [
"MIT"
]
| null | null | null | Generation/uDUnitXTestGen.pas | GDKsoftware/OpenTestGrip | a06f7840aea852c9d84ea2178e792d93866bf797 | [
"MIT"
]
| null | null | null | unit uDUnitXTestGen;
interface
uses
Classes, uTestDefs,
uPascalFileGen,
uUnitTestGenIntf, uUnitTestGenBase, uCommonFunctions;
type
TDUnitXTestClassFileGen = class(TUnitTestClassFileGenBase, IUnitTestClassFileGen)
private
procedure AddImpliesChecks(const ComposedTestFunction: TUnitTestFunctionGen; const ATest: TInputTest);
protected
function RequoteValueForCode(const AValue: string): string;
procedure AddPreImpliesCode(const ComposedTestFunction: TUnitTestFunctionGen; const ATest: TInputTest);
procedure AddCheckForTestResult(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; const ATest: TInputTest; const sTestResultVar: string);
procedure AddCustomInitializationCode(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; const sTestClassName: string; const AClass: TInputTestClass; const ATest: TInputTest);
procedure AddParameterInitializations(const ComposedTestFunction: TUnitTestFunctionGen; const ATest: TInputTest);
procedure AddCustomVars(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; const AClass: TInputTestClass; const ATest: TInputTest);
function AddTestResultVarIfNeeded(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; IsProcedure: Boolean; const AClass: TInputTestClass): string;
procedure FixParameterType(const Parameter: TInputParam);
function GenerateTemplate: string; override;
function GenerateTestInterfaceSection: string;
function GenerateTestImplementationSection: string;
public
procedure GenerateTest(const AClass: TInputTestClass; const AFunction: TInputFunction; const ATest: TInputTest; const sTestClassName: string; const lstFunctionRef: TList = nil); override;
function GetTemplateCode: string; override;
end;
implementation
uses
StrUtils, SysUtils, Variants, uD7Functions;
{ TDUnitXTestClassFileGen }
function TDUnitXTestClassFileGen.GenerateTemplate: string;
var
sTypeDef: string;
sImplementation: string;
begin
FOuterUses.Add('DUnitX.TestFramework');
Result := inherited GenerateTemplate;
// TypeDefs -> class
sTypeDef := GenerateTestInterfaceSection;
sImplementation := GenerateTestImplementationSection;
// fill in template
Result := ReplaceText( Result, '<TypeDefs>', sTypeDef );
Result := ReplaceText( Result, '<Implementation>', sImplementation );
end;
procedure TDUnitXTestClassFileGen.GenerateTest(const AClass: TInputTestClass; const AFunction: TInputFunction;
const ATest: TInputTest; const sTestClassName: string; const lstFunctionRef: TList);
var
ComposedTestFunction: TUnitTestFunctionGen;
ReturnType: string;
TestIdx: Integer;
IsProcedure: Boolean;
c: Integer;
Parameters: string;
i: Integer;
Parameter: TInputParam;
sCall: string;
sTestResultVar: string;
CurrentTestMethodName: string;
begin
ComposedTestFunction := TUnitTestFunctionGen.Create;
FTests.Add(ComposedTestFunction);
TestIdx := FTests.Count;
CurrentTestMethodName := 'Test_' + AFunction.MethodName + IntToStr(TestIdx);
ComposedTestFunction.Def := 'procedure ' + CurrentTestMethodName;
ReturnType := GetReturnType(lstFunctionRef, AFunction);
if ReturnType <> '' then
AFunction.CachedType := ReturnType;
IsProcedure := SameStr(ReturnType, 'void');
ComposedTestFunction.Imp :=
'procedure ' + FUnitTestClassName + '.' + CurrentTestMethodName + ';' + #13#10 +
'var'#13#10 +
' TestObj: ' + sTestClassName + ';' + #13#10;
sTestResultVar := AddTestResultVarIfNeeded(ComposedTestFunction, AFunction, IsProcedure, AClass);
Parameters := '';
c := aTest.ParamList.Count - 1;
for i := 0 to c do
begin
Parameter := TInputParam(aTest.ParamList[i]);
FixParameterType(Parameter);
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' ' + Parameter.ParamName + ': ' + Parameter.ParamType + ';' + #13#10;
if i <> 0 then
begin
Parameters := Parameters + ', ' + Parameter.ParamName;
end
else
begin
Parameters := Parameter.ParamName;
end;
end;
AddCustomVars(ComposedTestFunction, AFunction, AClass, ATest);
ComposedTestFunction.Imp := ComposedTestFunction.Imp +
'begin'#13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' TestObj := nil;' + #13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' // start assignments' + #13#10;
AddParameterInitializations(ComposedTestFunction, aTest);
ComposedTestFunction.Imp := ComposedTestFunction.Imp + #13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' // start initcode' + #13#10;
AddCustomInitializationCode(ComposedTestFunction, AFunction, sTestClassName, AClass, ATest);
ComposedTestFunction.Imp := ComposedTestFunction.Imp +
' Assert.IsNotNull(TestObj, ''TestObj has not been created yet'');' + #13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp +
' try' + #13#10;
sCall := 'TestObj' + '.' + 'TEST_' + aFunction.MethodName + '(' + Parameters + ')';
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' // call' + #13#10;
if not IsProcedure then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' ' + sTestResultVar + ' := ' + sCall + ';' + #13#10 + #13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' // start test equals' + #13#10;
AddCheckForTestResult(ComposedTestFunction, AFunction, ATest, sTestResultVar);
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' ' + sCall + ';' + #13#10;
end;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + '' + #13#10;
AddPreImpliesCode(ComposedTestFunction, ATest);
AddImpliesChecks(ComposedTestFunction, ATest);
ComposedTestFunction.Imp := ComposedTestFunction.Imp + '' + #13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp +
' finally' + #13#10 +
' TestObj.Free;' + #13#10 +
' end;'+ #13#10;
ComposedTestFunction.Imp := ComposedTestFunction.Imp +
'end;'#13#10;
end;
function TDUnitXTestClassFileGen.GetTemplateCode: string;
begin
Result := GenerateTemplate;
end;
procedure TDUnitXTestClassFileGen.AddImpliesChecks(const ComposedTestFunction: TUnitTestFunctionGen; const ATest: TInputTest);
var
i, c: Integer;
implies: TInputImplier;
p: Integer;
sTmp: string;
TrimmedEval: string;
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' // start test implies'#13#10;
c := aTest.Implies.Count - 1;
for i := 0 to c do
begin
implies := TInputImplier(aTest.Implies[i]);
TrimmedEval := implies.Eval;
if StartsText('Assert.', TrimmedEval) then
begin
if not EndsText(';', TrimmedEval) then
TrimmedEval := TrimmedEval + ';';
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' ' + TrimmedEval + #13#10;
end
else
begin
if not ContainsStr(implies.Eval, '(') and not ContainsStr(implies.Eval, ')') and ContainsStr(implies.Eval, '=') then
begin
p := Pos('=', implies.Eval);
sTmp := Copy(implies.Eval, p + 1);
if not ContainsStr(implies.Eval, '''') then
begin
if SameText(Trim(sTmp), 'nil') then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsNull(' + Copy(implies.Eval, 1, p - 1) + ', ''test_implies_' + IntToStr(i + 1) + ''');'#13#10;
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual(' + Copy(implies.Eval, p + 1) + ', ' + Copy(implies.Eval, 1, p - 1) + ', ''test_implies_' + IntToStr(i + 1) + ''');'#13#10;
end;
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual(' + Copy(implies.Eval, p + 1) + ', ' + Copy(implies.Eval, 1, p - 1) + ', ''test_implies_' + IntToStr(i + 1) + ''');'#13#10;
end;
end
else if not ContainsStr(implies.Eval, '(') and not ContainsStr(implies.Eval, ')') and ContainsStr(implies.Eval, '<>') then
begin
p := Pos('<>', implies.Eval);
sTmp := Copy(implies.Eval, p + 2);
if not ContainsStr(implies.Eval, '''') then
begin
if SameText(Trim(sTmp), 'nil') then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsNotNull(' + Copy(implies.Eval, 1, p - 1) + ', ''test_implies_' + IntToStr(i + 1) + ''');'#13#10;
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual(' + Copy(implies.Eval, p + 2) + ', ' + Copy(implies.Eval, 1, p - 1) + ', ''test_implies_' + IntToStr(i + 1) + ''');'#13#10;
end;
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual(' + Copy(implies.Eval, p + 2) + ', ' + Copy(implies.Eval, 1, p - 1) + ', ''test_implies_' + IntToStr(i + 1) + ''');'#13#10;
end;
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsTrue( ' + implies.Eval + ', ''test_implies_' + IntToStr(i + 1) + ''' );'#13#10;
end;
end;
end;
end;
procedure TDUnitXTestClassFileGen.AddPreImpliesCode(const ComposedTestFunction: TUnitTestFunctionGen; const ATest: TInputTest);
var
lstInitCode: TStringList;
LineIdx, LineCount: Integer;
begin
if ATest.PreImpliesCode <> '' then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' // start pre-implies code'#13#10;
lstInitCode := TStringList.Create;
try
lstInitCode.Text := ATest.PreImpliesCode;
LineCount := lstInitCode.Count - 1;
for LineIdx := 0 to LineCount do
begin
lstInitCode.Strings[LineIdx] := ' ' + lstInitCode.Strings[LineIdx];
end;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + lstInitCode.Text;
finally
lstInitCode.Free;
end;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + #13#10;
end;
end;
procedure TDUnitXTestClassFileGen.AddCheckForTestResult(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; const ATest: TInputTest; const sTestResultVar: string);
var
sQuotedStr: string;
begin
if SameText(aFunction.CachedType, 'string') or SameText(aFunction.CachedType, 'ansistring') or SameText(aFunction.CachedType, 'widestring') then
begin
if VarIsNull(aTest.Equals) then
begin
aTest.Equals := '';
end;
sQuotedStr := RequoteValueForCode(aTest.Equals);
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ''' + sQuotedStr + ''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ''' + sQuotedStr + ''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else if SameText(aFunction.CachedType, 'boolean') then
begin
if SameText('true', aTest.Equals) then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsTrue( ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else if SameText('false', aTest.Equals) then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsFalse( ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else if SameText(aFunction.CachedType, 'integer') or SameText(aFunction.CachedType, 'longint') or SameText(aFunction.CachedType, 'int64') or SameText(aFunction.CachedType, 'double') or SameText(aFunction.CachedType, 'float') or SameText(aFunction.CachedType, 'extended') then
begin
if TCommonStringFunctions.IsNumeric('' + aTest.Equals) then
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else
begin
// hex, oct, etc????
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end;
end
else if SameText(aFunction.CachedType, 'char') or SameText(aFunction.CachedType, 'ansichar') or SameText(aFunction.CachedType, 'widechar') then
begin
if StartsText('#', '' + aTest.Equals) then
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ''' + aTest.Equals + ''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ''' + aTest.Equals + ''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end;
end
else if SameText(aFunction.CachedType, 'tdatetime') then
begin
if TCommonStringFunctions.IsNumeric(aTest.Equals) then
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ' + aTest.Equals + ' * 1.0, Double(' + sTestResultVar + '), 0, ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ' + aTest.Equals + ' * 1.0, Double(' + sTestResultVar + '), 0, ''test_equals'' );' + ''#13''#10'';
end;
end
else if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ''' + aTest.Equals + ''', FormatDateTime(''yyyy-mm-dd hh:nn:ss'', ' + sTestResultVar + '), ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ''' + aTest.Equals + ''', FormatDateTime(''yyyy-mm-dd hh:nn:ss'', ' + sTestResultVar + '), ''test_equals'' );' + ''#13''#10'';
end;
end
else if VarIsNull(aTest.Equals) then
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( '''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( '''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else
begin
if TCommonStringFunctions.IsNumeric('' + aTest.Equals) then
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ' + aTest.Equals + ', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else if StartsText('nil', '' + aTest.Equals) then
begin
if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsNotNull( ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsNull( ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end
else if SameText('true', aTest.Equals) then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsTrue( ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else if SameText('false', aTest.Equals) then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.IsFalse( ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else if aTest.EqualsNot then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreNotEqual( ''' + Copy('' + aTest.Equals, 2) + ''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end
else
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' Assert.AreEqual( ''' + aTest.Equals + ''', ' + sTestResultVar + ', ''test_equals'' );' + ''#13''#10'';
end;
end;
end;
function TDUnitXTestClassFileGen.RequoteValueForCode(const AValue: string): string;
begin
Result := ReplaceStr('' + AValue, '''', '''''');
Result := ReplaceStr(Result, #13#10, ''' + #13#10 + ' + #1 + '''');
Result := ReplaceStr(Result, #10, ''' + #10 + ' + #1 + '''');
Result := ReplaceStr(Result, #13, ''' + #13 + ' + #1 + '''');
Result := ReplaceStr(Result, #1, #13#10);
end;
procedure TDUnitXTestClassFileGen.AddCustomInitializationCode(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; const sTestClassName: string; const AClass: TInputTestClass; const ATest: TInputTest);
var
CustomInitializationCode: string;
lstInitCode: TStringList;
InitLineCount: Integer;
InitLineIdx: Integer;
begin
CustomInitializationCode := '';
if aClass.InitCode <> '' then
begin
CustomInitializationCode := aClass.InitCode + ''#13''#10'';
end;
if aFunction.InitCode <> '' then
begin
CustomInitializationCode := aFunction.InitCode + ''#13''#10'';
end;
if aTest.InitCode <> '' then
begin
CustomInitializationCode := aTest.InitCode + ''#13''#10'';
end;
if aClass.ClassName <> '' then
begin
CustomInitializationCode := ReplaceText(CustomInitializationCode, aClass.ClassName + '.Create', sTestClassName + '.Create');
end;
lstInitCode := TStringList.Create;
try
lstInitCode.Text := CustomInitializationCode;
InitLineCount := lstInitCode.Count - 1;
for InitLineIdx := 0 to InitLineCount do
begin
lstInitCode.Strings[InitLineIdx] := ' ' + lstInitCode.Strings[InitLineIdx];
end;
ComposedTestFunction.Imp := ComposedTestFunction.Imp + lstInitCode.Text;
finally
lstInitCode.Free;
end;
end;
procedure TDUnitXTestClassFileGen.FixParameterType(const Parameter: TInputParam);
begin
if SameText(Parameter.ParamValue, 'nil') and SameText(Parameter.ParamType, 'Variant') then
begin
Parameter.ParamType := 'pointer';
end;
end;
procedure TDUnitXTestClassFileGen.AddParameterInitializations(const ComposedTestFunction: TUnitTestFunctionGen; const ATest: TInputTest);
var
Parameter: TInputParam;
ParamIdx, ParamCount: Integer;
InitializationValueInCode: string;
QuotedStr : string;
begin
ParamCount := aTest.ParamList.Count - 1;
for ParamIdx := 0 to ParamCount do
begin
Parameter := TInputParam(ATest.ParamList[ParamIdx]);
InitializationValueInCode := '';
if SameText(Parameter.ParamType, 'string') or SameText(Parameter.ParamType, 'ansistring') or SameText(Parameter.ParamType, 'widestring') then
begin
QuotedStr := RequoteValueForCode(Parameter.ParamValue);
InitializationValueInCode := '''' + QuotedStr + '''';
end
else if SameText(Parameter.ParamType, 'char') or SameText(Parameter.ParamType, 'ansichar') or SameText(Parameter.ParamType, 'widechar') then
begin
if StartsStr('''', Parameter.ParamValue) and EndsStr('''', Parameter.ParamValue) then
begin
InitializationValueInCode := Parameter.ParamValue;
end
else if StartsText( '#', '' + Parameter.ParamValue ) then
begin
InitializationValueInCode := Parameter.ParamValue;
end
else
begin
InitializationValueInCode := '''' + Parameter.ParamValue + '''';
end;
end
else if SameText(Parameter.ParamType, 'tdatetime') then
begin
if TCommonStringFunctions.IsNumeric(Parameter.ParamValue) then
begin
InitializationValueInCode := 'TDateTime(' + Parameter.ParamValue + ')';
end
else if StartsStr('''', Parameter.ParamValue) and EndsStr('''', Parameter.ParamValue) then
begin
InitializationValueInCode := 'StrToDateTime(''' + Parameter.ParamValue + ''')';
end
else
begin
InitializationValueInCode := 'StrToDateTime(''' + Parameter.ParamValue + ''')';
end;
end
else
begin
InitializationValueInCode := Parameter.ParamValue;
end;
ComposedTestFunction.Imp := ComposedTestFunction.Imp +
' ' + Parameter.ParamName + ' := ' + InitializationValueInCode + ';'#13#10;
end;
end;
function TDUnitXTestClassFileGen.AddTestResultVarIfNeeded(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; IsProcedure: Boolean; const AClass: TInputTestClass): string;
var
TestResultVar: string;
begin
TestResultVar := 'TestResult';
if not IsProcedure then
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' ' + TestResultVar + ': ' + AFunction.CachedType + ';' + ''#13''#10'';
end;
Result := TestResultVar;
end;
procedure TDUnitXTestClassFileGen.AddCustomVars(const ComposedTestFunction: TUnitTestFunctionGen; const AFunction: TInputFunction; const AClass: TInputTestClass; const ATest: TInputTest);
var
Vars: string;
VarsCode: TStringList;
C: Integer;
VarIdx: Integer;
begin
Vars := '';
if trim(aClass.Vars) <> '' then
Vars := aClass.Vars;
if trim(aFunction.Vars) <> '' then
Vars := aFunction.Vars;
if trim(aTest.Vars) <> '' then
Vars := aTest.Vars;
if Vars <> '' then
begin
VarsCode := TStringList.Create;
try
VarsCode.Text := Vars;
C := VarsCode.Count - 1;
for VarIdx := 0 to C do
begin
ComposedTestFunction.Imp := ComposedTestFunction.Imp + ' ' + Trim(VarsCode[VarIdx]) + #13#10;
end;
finally
VarsCode.Free;
end;
end;
end;
function TDUnitXTestClassFileGen.GenerateTestImplementationSection: string;
var
c: Integer;
i: Integer;
functiontest: TUnitTestFunctionGen;
SetupProc: string;
TearDownProc: string;
begin
SetupProc :=
'procedure ' + FUnitTestClassName + '.Setup;'#13#10 +
'begin'#13#10 +
'end;'#13#10;
TearDownProc :=
'procedure ' + FUnitTestClassName + '.TearDown;'#13#10 +
'begin'#13#10 +
'end;'#13#10;
Result := SetupProc + #13#10 + TearDownProc + #13#10;
c := FTests.Count - 1;
for i := 0 to c do
begin
functiontest := FTests[i];
Result := Result + functiontest.Imp + #13#10;
end;
Result := Result + #13#10 +
'initialization' + #13#10 +
' TDUnitX.RegisterTestFixture(' + FUnitTestClassName + ');';
end;
function TDUnitXTestClassFileGen.GenerateTestInterfaceSection: string;
var
c, TestIdx: Integer;
functiontest: TUnitTestFunctionGen;
begin
Result :=
' [TestFixture]'#13#10 +
' ' + FUnitTestClassName + ' = class'#13#10 +
' protected'#13#10 +
' public'#13#10 +
' [Setup]'#13#10 +
' procedure Setup;'#13#10 +
' [TearDown]'#13#10 +
' procedure TearDown;'#13#10 +
''#13#10;
c := FTests.Count - 1;
for TestIdx := 0 to c do
begin
functiontest := FTests[TestIdx];
Result := Result +
' [Test]'#13#10 +
' ' + functiontest.Def + ';' + #13#10;
end;
Result := Result + ' end;'#13#10;
end;
end.
| 36.665658 | 277 | 0.661825 |
47fde3692f967a56c0ef73596d7fddfeb6ca79d2 | 1,472 | pas | Pascal | Source/TextEditor.Search.Highlighter.pas | edwinyzh/TTextEditor | d1844c5ff10fe302457b8d58348c7dbd015703e7 | [
"MIT"
]
| 74 | 2021-06-14T12:58:47.000Z | 2022-03-15T13:36:42.000Z | Source/TextEditor.Search.Highlighter.pas | edwinyzh/TTextEditor | d1844c5ff10fe302457b8d58348c7dbd015703e7 | [
"MIT"
]
| null | null | null | Source/TextEditor.Search.Highlighter.pas | edwinyzh/TTextEditor | d1844c5ff10fe302457b8d58348c7dbd015703e7 | [
"MIT"
]
| 20 | 2021-06-13T15:17:23.000Z | 2022-03-26T03:30:59.000Z | unit TextEditor.Search.Highlighter;
interface
uses
System.Classes, Vcl.Graphics, TextEditor.Search.Highlighter.Colors, TextEditor.Types;
type
TTextEditorSearchHighlighter = class(TPersistent)
strict private
FColors: TTextEditorSearchColors;
FOnChange: TTextEditorSearchChangeEvent;
procedure SetColors(const AValue: TTextEditorSearchColors);
procedure DoChange;
public
constructor Create;
destructor Destroy; override;
procedure Assign(ASource: TPersistent); override;
published
property Colors: TTextEditorSearchColors read FColors write SetColors;
property OnChange: TTextEditorSearchChangeEvent read FOnChange write FOnChange;
end;
implementation
constructor TTextEditorSearchHighlighter.Create;
begin
inherited;
FColors := TTextEditorSearchColors.Create;
end;
destructor TTextEditorSearchHighlighter.Destroy;
begin
FColors.Free;
inherited;
end;
procedure TTextEditorSearchHighlighter.Assign(ASource: TPersistent);
begin
if Assigned(ASource) and (ASource is TTextEditorSearchHighlighter) then
with ASource as TTextEditorSearchHighlighter do
begin
Self.FColors.Assign(Colors);
Self.DoChange;
end
else
inherited Assign(ASource);
end;
procedure TTextEditorSearchHighlighter.DoChange;
begin
if Assigned(FOnChange) then
FOnChange(scRefresh);
end;
procedure TTextEditorSearchHighlighter.SetColors(const AValue: TTextEditorSearchColors);
begin
FColors.Assign(AValue);
end;
end.
| 23.365079 | 88 | 0.800272 |
f169a42fed62d12f792f1441b577d48bb3817a9c | 12,557 | pas | Pascal | UT_ThreadingAdvanced.pas | randydom/commonx | 2315f1acf41167bd77ba4d040b3f5b15a5c5b81a | [
"MIT"
]
| 48 | 2018-11-19T22:13:00.000Z | 2021-11-02T17:25:41.000Z | UT_ThreadingAdvanced.pas | randydom/commonx | 2315f1acf41167bd77ba4d040b3f5b15a5c5b81a | [
"MIT"
]
| 6 | 2018-11-24T17:15:29.000Z | 2019-05-15T14:59:56.000Z | UT_ThreadingAdvanced.pas | adaloveless/commonx | ed37b239e925119c7ceb3ac7949eefb0259c7f77 | [
"MIT"
]
| 12 | 2018-11-20T15:15:44.000Z | 2021-09-14T10:12:43.000Z | unit UT_ThreadingAdvanced;
interface
uses
unittest, systemx, System.SyncObjs, managedthread, sysutils, tickcount, signals;
type
TThread_WaitsForSignal= class(TManagedThread)
protected
waitingon: TEvent;
public
ut: TUnitTest;
result : string;
DelayAfterReceivingSignal: ticker;
procedure DoExecute;override;
end;
TThread_SetsSignal = class(TManagedThread)
public
my_external_signal: TEvent;
ut: TUnitTest;
time_to_wait_before_set: nativeint;
procedure Init;override;
destructor Destroy;override;
procedure DoExecute;override;
end;
TThread_SetsSignal2 = class(TThread_SetsSignal)
public
ping_count: integer;
procedure DoExecute;override;
procedure Ping;
end;
TThread_WaitsForSignal2 = class(TThread_WaitsForSignal)
public
ss: TThread_SetsSignal2;
procedure DoExecute;override;
end;
TUT_ThreadingAdvanced = class(TUnitTest)
private
protected
LTPM: TMasterThreadPool;
procedure PoolTest0;
procedure ThreadTerminationTest(bOneShot, bStartFromPool, bEndToPool,
bFinishedAtEnd: boolean);
procedure EventTest;
procedure EventTestRepeated;
procedure WaitForThreadPoolToShrink(tp: TThreadPoolBase);
procedure WAitForThreadPoolToFullyInductThread;
procedure PoolTest1;
procedure PoolTest2;
procedure PoolTest3;
procedure PoolTest4;
public
procedure Init;override;
procedure Detach;override;
end;
TUT_ThreadSubSet_Termination = class(TUT_ThreadingAdvanced)
procedure DoExecute;override;
end;
TUT_ThreadSubSet_Other = class(TUT_ThreadingAdvanced)
procedure DoExecute;override;
end;
implementation
{ TUT_ThreadingAdvanced }
procedure TUT_ThreadingAdvanced.Detach;
begin
inherited;
LTPM.Free;
LTPM := nil;
end;
procedure TUT_ThreadSubSet_Termination.DoExecute;
var
tmStarT: ticker;
begin
inherited;
case Variation of
1: begin
PoolTest0;
VariationNAme := 'Wait For Thread Pool To Shrink';
end;
10: begin
VariationName := 'Pool Finished One-shot thread';
ThreadTerminationTest(true, true, true, true);
end;
20: begin
variationName := 'Pool Unfinished One-shot thread';
ThreadTerminationTest(true, true, true, false);
end;
30: begin
VariationName := 'Terminate Finished One-shot thread';
ThreadTerminationTest(true, false, false, true);
end;
40: begin
variationName := 'Terminate Unfinished One-shot thread';
ThreadTerminationTest(true, false, false, false);
end;
50: begin
variationName := 'Pool Unfinished Loop thread';
ThreadTerminationTest(false, false, false, false);
end;
60: begin
variationName := 'Pool Finished Loop thread';
ThreadTerminationTest(false, false, false, true);
end;
70: begin
variationName := 'Misuse a thread by pooling an unpooled thread (should work).';
ThreadTerminationTest(true, false, true, true);
end;
80: begin
variationName := 'Misuse a thread by terminating a thread created from the pool (should work and still deregister with pool, check pool counts)';
ThreadTerminationTest(true, true, false, true);
end;
end;
end;
procedure TUT_ThreadingAdvanced.EventTest;
var
ev: TEvent;
t1: TThread_WaitsForSignal;
t2: TThread_SetsSignal;
begin
VariationName := 'Event Test';
ev := TEvent.create;
try
t1 := LTPM.Needthread<TThread_WaitsForSignal>(nil);
try
t2 := LTPM.Needthread<TThread_SetsSignal>(nil);
try
t1.ut := self;
t2.ut := self;
t1.waitingon := ev;
t2.my_external_signal := ev;
t1.SafeResume;
t2.SafeResume;
t1.SafeWaitFor;
t2.SafeWaitFor;
utresult := t1.result;
finally
LTPM.NoNeedthread(t2);
end;
finally
LTPM.NoNeedthread(t1);
end;
finally
ev.free;
end;
end;
procedure TUT_ThreadingAdvanced.EventTestRepeated;
var
ev: TEvent;
t1: TThread_WaitsForSignal2;
t2: TThread_SetsSignal2;
begin
VariationName := 'Event Test';
ev := TEvent.create;
try
t1 := LTPM.Needthread<TThread_WaitsForSignal2>(nil);
try
t2 := LTPM.Needthread<TThread_SetsSignal2>(nil);
try
t1.ut := self;
t2.ut := self;
t1.waitingon := ev;
t2.my_external_signal := ev;
t1.ss := t2;
t1.SafeResume;
t2.SafeResume;
t1.SafeWaitFor;
t2.SafeWaitFor;
utresult := t1.result;
finally
LTPM.NoNeedthread(t2);
end;
finally
LTPM.NoNeedthread(t1);
end;
finally
ev.free;
end;
end;
procedure TUT_ThreadingAdvanced.Init;
begin
inherited;
LTPM := TMasterThreadPOol.create;
end;
procedure TUT_ThreadingAdvanced.PoolTest1;
var
ev: TEvent;
t2: TThread_SetsSignal;
s: string;
begin
VariationName := 'Run a Thread, check stats';
s := LTPM.NeedThreadPool(TThread_SetsSignal).GetStatMessage;
ev := TEvent.create;
try
t2 := LTPM.Needthread<TThread_SetsSignal>(nil);
try
t2.ut := self;
t2.my_external_signal := ev;
t2.SafeResume;
utresult := LTPM.NeedThreadPool(TThread_SetsSignal).GetStatMessage+' }} Originally: '+s ;
t2.SafeWaitFor;
finally
LTPM.NoNeedthread(t2);
end;
finally
ev.free;
end;
end;
procedure TUT_ThreadingAdvanced.PoolTest0;
begin
self.WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_SetsSignal));
self.WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_WAitsForSignal));
VariationName := 'Wait For Thread Pool to Shrink (so stats are clean before running more thread tests)';
end;
procedure TUT_ThreadingAdvanced.PoolTest2;
var
ev: TEvent;
t1: TThread_WaitsForSignal;
t2: TThread_SetsSignal;
begin
VariationName := 'Run a Thread, send to pool, check stats';
ev := TEvent.create;
try
t2 := LTPM.Needthread<TThread_SetsSignal>(nil);
try
t2.ut := self;
t2.my_external_signal := ev;
t2.SafeResume;
t2.SafeWaitFor;
finally
LTPM.NoNeedthread(t2);
utresult := LTPM.NeedThreadPool(TThread_SetsSignal).GetStatMessage;
end;
finally
ev.free;
end;
end;
procedure TUT_ThreadingAdvanced.PoolTest3;
begin
// raise Exception.create('unimplemented');
//TODO -cunimplemented: unimplemented block
end;
procedure TUT_ThreadingAdvanced.PoolTest4;
begin
// raise Exception.create('unimplemented');
//TODO -cunimplemented: unimplemented block
end;
procedure TUT_ThreadingAdvanced.ThreadTerminationTest(bOneShot, bStartFromPool,
bEndToPool, bFinishedAtEnd: boolean);
var
tp: TThreadPoolBase;
thr: TThread_WaitsForSignal;
ev: TEvent;
tm: ticker;
begin
tm := Getticker;
WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_WaitsForSignal));
if bStartFromPool then begin
thr := LTPM.Needthread<TTHread_WaitsForSignal>(nil);
end else begin
thr := TPM.Needthread<TThread_WaitsForSignal>(nil);
end;
thr.Loop := not bOneShot;
ev := TEvent.Create;
try
try
thr.waitingon := ev;
thr.ut := self;
if not bFinishedAtEnd then
thr.DelayAfterReceivingSignal := 1000;
thr.Start;
Signal(ev);
if bFinishedAtEnd then begin
sleep(1000);
end;
finally
if bEndToPool then begin
LTPM.NoNeedthread(thr);
end else begin
thr.Terminate;
thr.SafeWaitFor;
thr.Detach;
thr.Free;
thr := nil;
end;
end;
finally
ev.Free;
ev := nil;
end;
utresult := LTPM.NeedthreadPool(TThread_WaitsForSignal).GetStatMessage+' }} Time='+inttostr(getTimeSince(tm));
end;
procedure TUT_ThreadingAdvanced.WAitForThreadPoolToFullyInductThread;
var
tp: TThreadPoolBase;
i1, i2 ,i3: nativeint;
s: string;
begin
VariationNAme := 'Wait For Thread Pool To Shrink';
tp := LTPM.NeedthreadPool(TThread_SetsSignal);
s := tp.GetStatMessage;
repeat
tp.GetStats(i1,i2,i3);
utresult := inttostr(i2);
until i1 = 0;
utresult := tp.GetStatMessage+' }} '+s
end;
procedure TUT_ThreadingAdvanced.WaitForThreadPoolToShrink(tp: TThreadPoolBase);
var
i1, i2 ,i3: nativeint;
tm: ticker;
s: string;
begin
tp.ThreadPoolTimeout := 8000;
s := tp.GetStatMessage;
tm := tickcount.GetTicker;
while tp.GetStats(i1, i2, i3) > 0 do begin
sleep(1000);
if GetTimeSince(tm) > 12000 then begin
utresult := 'Timeout! '+tp.GetStatMessage;
exit;
end;
end;
utresult := tp.GetStatMessage+'}}Originally:'+s;
end;
{ TThread_SetsSignal }
destructor TThread_SetsSignal.Destroy;
begin
inherited;
end;
procedure TThread_SetsSignal.DoExecute;
begin
inherited;
ut.UTLog('Waiting for some time before setting event');
sleep(time_to_wait_before_set);
ut.UTLog('Setting event as signalled');
my_external_signal.SetEvent;
end;
procedure TThread_SetsSignal.Init;
begin
inherited;
time_to_wait_before_set := 3000;
end;
{ TThread_WaitsForSignal }
procedure TThread_WaitsForSignal.DoExecute;
var
s: string;
begin
inherited;
while waitingon.WaitFor(1000) = wrTimeout do begin
ut.UTLog('Still Waiting for signal');
end;
case waitingon.WaitFor(1) of
wrSignaled: s := 'Got Signal';
wrTimeout: s := 'Timed out';
wrAbandoned: s := 'Abandoned';
wrIOCompletion: s := 'IOCompletion';
{$IFDEF WINDOWS}
wrError: s := 'Error '+inttostr(waitingon.LastError);
{$ELSE}
wrError: s := 'Error (android provides no error details)';
{$ENDIF}
end;
ut.utlog(s);
sleep(100);/// only because on slow devices some tests will flood the logs.
result := s;
end;
{ TThread_WaitsForSignal2 }
procedure TThread_WaitsForSignal2.DoExecute;
var
i: nativeint;
tmStart, tmEnd: ticker;
begin
//inherited; <<<---- DONT
i := 0;
tmStart := tickcount.GetTicker;
while ss.ping_count < 1000 do begin
if (Self.waitingon.WaitFor(3000) = wrSignaled) then begin
ss.ping;
i := 1000;
end;
end;
tmEnd := tickcount.GetTicker;
self.result := 'Called '+inttostr(i)+' times }} in '+inttostr(GetTimeSince(tmEnd, tmStart))+' ms.';
if DelayAfterReceivingSignal > 0 then
Sleep(DelayAfterReceivingSignal);
end;
{ TThread_SetsSignal2 }
procedure TThread_SetsSignal2.DoExecute;
begin
//inherited;<<--done
while ping_count < 1000 do begin
my_external_signal.SetEvent;
end;
end;
procedure TThread_SetsSignal2.Ping;
begin
inc(ping_count);
self.my_external_signal.ResetEvent;
end;
{ TUT_ThreadSubSet_Other }
procedure TUT_ThreadSubSet_Other.DoExecute;
var
tmStart: ticker;
begin
inherited;
case Variation of
1: PoolTest0;
2: begin
tmSTart := GEtTicker;
VariationName := 'Destroy Empty Thread Pool';
LTPM.Free;
LTPM := nil;
utresult := 'COMPLETED }} Time='+inttostr(GEtTimeSince(tmStart));
end;
3: begin
tmSTart := GEtTicker;
VariationName := 'Recreate Destroyed Thread Pool';
LTPM := TMAsterThreadPool.Create;
utresult := 'COMPLETED }} Time='+inttostr(GEtTimeSince(tmStart));
end;
10: PoolTest1;
11: begin
WAitForThreadPoolToFullyInductThread;
VariationName := 'Thread Pool should induct thread fully';
end;
20: begin
PoolTest1;
VariationName := 'Repeat #10, should have reused same thread, verify thread pool counts.'
end;
21: begin
WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_WaitsForSignal));
WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_SetsSignal));
WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_WaitsForSignal2));
WaitForThreadPoolToShrink(LTPM.NeedthreadPool(TThread_SetsSignal2));
VariationName := 'Wait For Thread Pool to shrink completely';
end;
22: begin
tmSTart := GEtTicker;
VariationName := 'Destroy Empty Thread Pool after it has been used.';
try
LTPM.Free;
LTPM := nil;
utresult := 'COMPLETED }} Time='+inttostr(GEtTimeSince(tmStart));
finally
LTPM := TMAsterThreadPool.Create;
end;
end;
30: begin
tmSTart := GEtTicker;
PoolTest1;
VariationName := 'Destroy Thread POol Immediately after use.';
try
LTPM.Free;
LTPM := nil;
utresult := 'COMPLETED }} Time='+inttostr(GEtTimeSince(tmStart));
finally
LTPM := TMAsterThreadPool.Create;
end;
end;
40: EventTest;
50: EventTestRepeated;
end;
end;
initialization
UTF.RegisterClass(TUT_ThreadSubset_Termination);
UTF.RegisterClass(TUT_ThreadSubSet_Other);
end.
| 22.748188 | 151 | 0.685753 |
473150c8e1c24eb2feaa2c59190ec7f4ded0ae01 | 113 | pas | Pascal | Libraries/SynEdit/Source/QSynHighlighterJScript.pas | Patiencer/Concepts | e63910643b2401815dd4f6b19fbdf0cd7d443392 | [
"Apache-2.0"
]
| 19 | 2018-10-22T23:45:31.000Z | 2021-05-16T00:06:49.000Z | package/synedit-201b/SynEdit/Source/QSynHighlighterJScript.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| 16 | 2019-02-02T19:54:54.000Z | 2019-02-28T05:22:36.000Z | package/synedit-201b/SynEdit/Source/QSynHighlighterJScript.pas | RonaldoSurdi/Sistema-gerenciamento-websites-delphi | 8cc7eec2d05312dc41f514bbd5f828f9be9c579e | [
"MIT"
]
| 6 | 2018-08-30T05:16:21.000Z | 2021-05-12T20:25:43.000Z | unit QSynHighlighterJScript;
{$DEFINE SYN_CLX}
{$DEFINE QSYNHIGHLIGHTERJSCRIPT}
{$I SynHighlighterJScript.pas}
| 16.142857 | 32 | 0.814159 |
471f95fe5e7a25cdc622bab66fc890132239e8e2 | 3,587 | pas | Pascal | src/Main.pas | bogdanpolak/delphi-static-code-analyser | a13559bdd79faed64dfc34e29eb7f5ffe1bf1676 | [
"MIT"
]
| 1 | 2020-12-02T10:10:04.000Z | 2020-12-02T10:10:04.000Z | src/Main.pas | bogdanpolak/delphi-static-code-analyser | a13559bdd79faed64dfc34e29eb7f5ffe1bf1676 | [
"MIT"
]
| null | null | null | src/Main.pas | bogdanpolak/delphi-static-code-analyser | a13559bdd79faed64dfc34e29eb7f5ffe1bf1676 | [
"MIT"
]
| 2 | 2020-12-02T10:10:43.000Z | 2020-12-07T13:15:27.000Z | unit Main;
interface
uses
System.SysUtils,
System.Classes,
System.IOUtils,
System.Math,
System.Generics.Collections,
{}
Configuration.AppConfig,
Command.AnalyseProject,
Filters.Method;
type
TApplicationMode = (amComplexityAnalysis, amOneFile, amGenerateXml);
const
ApplicationMode: TApplicationMode = amOneFile;
SINGLE_FileName ='..\test\data\test05.UnitWithClass.pas';
XML_FileName = '..\test\data\testunit.pas';
type
TMain = class
private
fAppConfiguration: IAppConfiguration;
cmdAnalyseProject: TAnalyseProjectCommand;
fMethodFilters: TMethodFilters;
function GetUnits: TArray<string>;
procedure WriteApplicationTitle;
procedure DefineFiltersUsingConfiguration;
procedure ApplicationRun;
public
constructor Create(const aAppConfiguration: IAppConfiguration);
destructor Destroy; override;
class procedure Run(const aAppConfiguration: IAppConfiguration); static;
end;
implementation
uses
Command.GenerateXml,
Filters.Concrete;
constructor TMain.Create(const aAppConfiguration: IAppConfiguration);
begin
Assert(aAppConfiguration <> nil);
fAppConfiguration := aAppConfiguration;
cmdAnalyseProject := TAnalyseProjectCommand.Create;
fMethodFilters := TMethodFilters.Create;
end;
destructor TMain.Destroy;
begin
fMethodFilters.Free;
cmdAnalyseProject.Free;
inherited;
end;
procedure TMain.WriteApplicationTitle();
begin
if ApplicationMode in [amComplexityAnalysis, amOneFile] then
begin
writeln('DelphiAST - Static Code Analyser');
writeln('----------------------------------');
end;
end;
function TMain.GetUnits(): TArray<string>;
var
folders: TArray<string>;
folder: string;
strList: TList<string>;
begin
strList := TList<string>.Create();
folders := fAppConfiguration.GetSourceFolders();
try
for folder in folders do
begin
strList.AddRange(TDirectory.GetFiles(folder, '*.pas',
TSearchOption.soAllDirectories));
end;
Result := strList.ToArray;
finally
strList.Free;
end;
end;
procedure TMain.DefineFiltersUsingConfiguration();
var
complexityLevel: Integer;
methodLength: Integer;
begin
fMethodFilters.Clear;
complexityLevel := fAppConfiguration.GetFilterComplexityLevel();
methodLength := fAppConfiguration.GetFilterMethodLength();
if fAppConfiguration.HasFilters() then
begin
fMethodFilters.AddRange([
{ } TComplexityGreaterEqual.Create(complexityLevel),
{ } TLengthGreaterEqual.Create(methodLength)]);
end;
end;
procedure TMain.ApplicationRun();
var
files: TArray<string>;
begin
fAppConfiguration.Initialize;
case ApplicationMode of
amComplexityAnalysis:
begin
WriteApplicationTitle();
files := GetUnits();
DefineFiltersUsingConfiguration();
cmdAnalyseProject.Execute(files, fMethodFilters);
cmdAnalyseProject.SaveReportToFile(fAppConfiguration.GetOutputFile());
end;
amOneFile:
begin
cmdAnalyseProject.Execute([SINGLE_FileName]);
end;
amGenerateXml:
begin
fMethodFilters.Clear;
TGenerateXmlCommand.Generate(XML_FileName);
end;
end;
end;
class procedure TMain.Run(const aAppConfiguration: IAppConfiguration);
var
Main: TMain;
begin
Main := TMain.Create(aAppConfiguration);
try
try
Main.ApplicationRun();
finally
Main.Free;
end
except
on E: Exception do
writeln(E.ClassName, ': ', E.Message);
end;
{$IFDEF DEBUG}
ReportMemoryLeaksOnShutdown := True;
Write('... [press enter to close]');
readln;
{$ENDIF}
end;
end.
| 23.141935 | 78 | 0.724282 |
47d2a226e3d00ecef051705ba83a7aef07cec38c | 2,438 | pas | Pascal | Lib/Classes/Common/BarcodeFormat.pas | mmatsinger/ZXing.Delphi | 1306e37da6eaad2feb090dd2d7b8fb1660a35817 | [
"Apache-2.0"
]
| 2 | 2019-09-28T05:47:00.000Z | 2020-04-29T10:10:41.000Z | Lib/Classes/Common/BarcodeFormat.pas | gkobler/ZXing.Delphi | 1306e37da6eaad2feb090dd2d7b8fb1660a35817 | [
"Apache-2.0"
]
| null | null | null | Lib/Classes/Common/BarcodeFormat.pas | gkobler/ZXing.Delphi | 1306e37da6eaad2feb090dd2d7b8fb1660a35817 | [
"Apache-2.0"
]
| 1 | 2021-08-04T12:35:31.000Z | 2021-08-04T12:35:31.000Z | unit BarcodeFormat;
{
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Implemented by E. Spelt for Delphi
}
interface
type
TBarcodeFormat = (
/// <summary>No format set. All formats will be used</summary>
Auto = 0,
/// <summary>Aztec 2D barcode format.</summary>
AZTEC = 1,
/// <summary>CODABAR 1D format.</summary>
CODABAR = 2,
/// <summary>Code 39 1D format.</summary>
CODE_39 = 4,
/// <summary>Code 93 1D format.</summary>
CODE_93 = 8,
/// <summary>Code 128 1D format.</summary>
CODE_128 = 16,
/// <summary>Data Matrix 2D barcode format.</summary>
DATA_MATRIX = 32,
/// <summary>EAN-8 1D format.</summary>
EAN_8 = 64,
/// <summary>EAN-13 1D format.</summary>
EAN_13 = 128,
/// <summary>ITF (Interleaved Two of Five) 1D format.</summary>
ITF = 256,
/// <summary>MaxiCode 2D barcode format.</summary>
MAXICODE = 512,
/// <summary>PDF417 format.</summary>
PDF_417 = 1024,
/// <summary>QR Code 2D barcode format.</summary>
QR_CODE = 2048,
/// <summary>RSS 14</summary>
RSS_14 = 4096,
/// <summary>RSS EXPANDED</summary>
RSS_EXPANDED = 8192,
/// <summary>UPC-A 1D format.</summary>
UPC_A = 16384,
/// <summary>UPC-E 1D format.</summary>
UPC_E = 32768,
/// <summary>UPC/EAN extension format. Not a stand-alone format.</summary>
UPC_EAN_EXTENSION = 65536,
/// <summary>MSI</summary>
MSI = 131072,
/// <summary>Plessey</summary>
PLESSEY = 262144,
/// <summary>
/// UPC_A | UPC_E | EAN_13 | EAN_8 | CODABAR | CODE_39 | CODE_93 | CODE_128 | ITF | RSS_14 | RSS_EXPANDED
/// without MSI (to many false-positives)
/// </summary>
All_1D = UPC_A or UPC_E or EAN_13 or EAN_8 or CODABAR or CODE_39 or
CODE_93 or CODE_128 or ITF or RSS_14 or RSS_EXPANDED
);
implementation
end.
| 25.395833 | 109 | 0.640689 |
47c2827f3175e5b41b0c55dce8c8675e5411eae0 | 2,174 | pas | Pascal | iaimp/aimp_sdk/Sources/Delphi/apiSkins.pas | ark0f/aimp.rs | dc2e650dd8b9b7751d40a2ff9b97cfbb3fd18967 | [
"Apache-2.0"
]
| null | null | null | iaimp/aimp_sdk/Sources/Delphi/apiSkins.pas | ark0f/aimp.rs | dc2e650dd8b9b7751d40a2ff9b97cfbb3fd18967 | [
"Apache-2.0"
]
| null | null | null | iaimp/aimp_sdk/Sources/Delphi/apiSkins.pas | ark0f/aimp.rs | dc2e650dd8b9b7751d40a2ff9b97cfbb3fd18967 | [
"Apache-2.0"
]
| null | null | null | {************************************************}
{* *}
{* AIMP Programming Interface *}
{* v4.50 build 2000 *}
{* *}
{* Artem Izmaylov *}
{* (C) 2006-2017 *}
{* www.aimp.ru *}
{* Mail: support@aimp.ru *}
{* *}
{************************************************}
unit apiSkins;
{$I apiConfig.inc}
interface
uses
Windows, apiObjects, apiCore;
const
SID_IAIMPSkinInfo = '{41494D50-536B-696E-496E-666F00000000}';
IID_IAIMPSkinInfo: TGUID = SID_IAIMPSkinInfo;
SID_IAIMPServiceSkinsManager = '{41494D50-5372-7653-6B69-6E734D6E6772}';
IID_IAIMPServiceSkinsManager: TGUID = SID_IAIMPServiceSkinsManager;
// SkinInfo Properties
AIMP_SKININFO_PROPID_NAME = 1;
AIMP_SKININFO_PROPID_AUTHOR = 2;
AIMP_SKININFO_PROPID_DESCRIPTION = 3;
AIMP_SKININFO_PROPID_PREVIEW = 4;
// SkinsManager Properties
AIMP_SERVICE_SKINSMAN_PROPID_SKIN = 1;
AIMP_SERVICE_SKINSMAN_PROPID_HUE = 2;
AIMP_SERVICE_SKINSMAN_PROPID_HUE_INTENSITY = 3;
// Flags for IAIMPServiceSkinsManager.Install
AIMP_SERVICE_SKINSMAN_FLAGS_INSTALL_FOR_ALL_USERS = 1;
type
{ IAIMPSkinInfo }
IAIMPSkinInfo = interface(IAIMPPropertyList)
[SID_IAIMPSkinInfo]
end;
{ IAIMPServiceSkinsManager }
IAIMPServiceSkinsManager = interface(IUnknown)
[SID_IAIMPServiceSkinsManager]
function EnumSkins(out List: IAIMPObjectList): HRESULT; stdcall;
function GetSkinInfo(FileName: IAIMPString; out Info: IAIMPSkinInfo): HRESULT; stdcall;
function Select(FileName: IAIMPString): HRESULT; stdcall;
//
function Install(FileName: IAIMPString; Flags: DWORD): HRESULT; stdcall;
function Uninstall(FileName: IAIMPString): HRESULT; stdcall;
// Tools
function HSLToRGB(H, S, L: Byte; out R, G, B: Byte): HRESULT; stdcall;
function RGBToHSL(R, G, B: Byte; out H, S, L: Byte): HRESULT; stdcall;
end;
implementation
end.
| 31.507246 | 91 | 0.590616 |
f1eed769238f6f02be469c58d50e2ae557af6741 | 787 | dpr | Pascal | TString/Test/TStringTests.dpr | dimsa/sv-utils | cc527656cfb17fad2ab857c82935b332dc7dd2e9 | [
"MIT"
]
| 5 | 2015-10-11T07:33:12.000Z | 2021-03-19T05:58:27.000Z | TString/Test/TStringTests.dpr | AArhin/sv-utils | ba1509407b7966d4821d43df0b9e5f009fe90f18 | [
"MIT"
]
| null | null | null | TString/Test/TStringTests.dpr | AArhin/sv-utils | ba1509407b7966d4821d43df0b9e5f009fe90f18 | [
"MIT"
]
| 3 | 2017-05-04T13:36:22.000Z | 2019-02-20T18:16:38.000Z | program TStringTests;
{
Delphi DUnit Test Project
-------------------------
This project contains the DUnit test framework and the GUI/Console test runners.
Add "CONSOLE_TESTRUNNER" to the conditional defines entry in the project options
to use the console test runner. Otherwise the GUI test runner will be used by
default.
}
{$IFDEF CONSOLE_TESTRUNNER}
{$APPTYPE CONSOLE}
{$ENDIF}
uses
Forms,
TestFramework,
GUITestRunner,
TextTestRunner,
TestTString in 'TestTString.pas',
uSvStrings in '..\uSvStrings.pas';
{$R *.RES}
begin
Application.Initialize;
ReportMemoryLeaksOnShutdown := True;
if IsConsole then
with TextTestRunner.RunRegisteredTests do
Free
else
GUITestRunner.RunRegisteredTests;
end.
| 21.27027 | 83 | 0.691233 |
f1dc9c56e8a93ad1bf26c65fab053b53617d50f6 | 290 | lpr | Pascal | fireball_CPU.hw/fireball_CPU.lpr | fire219/FireballCPU | 1f55a1611cd529d763dce94a868992114fb0bfb2 | [
"Unlicense"
]
| null | null | null | fireball_CPU.hw/fireball_CPU.lpr | fire219/FireballCPU | 1f55a1611cd529d763dce94a868992114fb0bfb2 | [
"Unlicense"
]
| null | null | null | fireball_CPU.hw/fireball_CPU.lpr | fire219/FireballCPU | 1f55a1611cd529d763dce94a868992114fb0bfb2 | [
"Unlicense"
]
| null | null | null | <?xml version="1.0" encoding="UTF-8"?>
<!-- Product Version: Vivado v2021.1 (64-bit) -->
<!-- -->
<!-- Copyright 1986-2021 Xilinx, Inc. All Rights Reserved. -->
<labtools version="1" minor="0"/>
| 41.428571 | 70 | 0.413793 |
83760d832f9b13770bd9acedf5dcfa2737d8c8c1 | 1,577 | pas | Pascal | out/production/pascalet/Input.pas | patricklatorre/pascalet | 14f819c98b71fba82359b7fd8537bac6888b77a5 | [
"MIT"
]
| null | null | null | out/production/pascalet/Input.pas | patricklatorre/pascalet | 14f819c98b71fba82359b7fd8537bac6888b77a5 | [
"MIT"
]
| null | null | null | out/production/pascalet/Input.pas | patricklatorre/pascalet | 14f819c98b71fba82359b7fd8537bac6888b77a5 | [
"MIT"
]
| null | null | null | program Input;
{integer global vars}
{i is used as an iterator}
var someint, i : integer;
{boolea global vars}
var somebool : boolean;
{increment a given parameter and return the value}
function increment(number:integer) : integer;
begin
increment := number + 1;
end;
{takes 3 strings and prints them in a letter structure}
procedure sendLetter(name:string; msg:string; closing:string);
var spacing: integer;
begin
{ margin width }
spacing := 4;
{ top margin }
for i := 0 to spacing do
begin
WriteLn('');
end;
WriteLn('Dear ', name, ',');
writeln('');
WriteLn(msg);
WriteLn('');
WriteLn('Regards,');
WriteLn(closing);
{ bottom margin }
for i := 0 to spacing do
begin
WriteLn('');
end;
end;
begin
someint := 3 * 2;
someint := 3 / 2;
someint := 3 mod 2;
somebool := 3 * 2 = 6;
somebool := 3 * 2 = 7;
somebool := (3 * 2 = 6) and (3 * 2 = 7);
{ 'wow' }
{ someint }
{ 1 }
WriteLn('wow' + ' ', (-2 + 5) + ' ', true = someint = someint);
if (someint < 5) then
begin
for i := 0 to 5 do
begin
Write('looping: ');
WriteLn('iterator = ' + i);
end;
end;
senDLetter('Patrick',
'This is a letter to say to say goodbye.',
'Spongebob'
);
increment(1);
Write(increment);
writeln(increment);
end. | 19.231707 | 67 | 0.490171 |
83cd87940fb2536625daeda33a510a1ee1d80679 | 6,043 | pas | Pascal | MC/ueditalarmelement.pas | itfx3035/lazarus-freepascal-ims | b411f18490dbee0a7b37fe6bb74cb96ba523bae0 | [
"MIT"
]
| null | null | null | MC/ueditalarmelement.pas | itfx3035/lazarus-freepascal-ims | b411f18490dbee0a7b37fe6bb74cb96ba523bae0 | [
"MIT"
]
| null | null | null | MC/ueditalarmelement.pas | itfx3035/lazarus-freepascal-ims | b411f18490dbee0a7b37fe6bb74cb96ba523bae0 | [
"MIT"
]
| null | null | null | unit uEditAlarmElement;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
uCustomTypes, uStrUtils;
type
{ TfEditAlarmElement }
TfEditAlarmElement = class(TForm)
bCancel: TButton;
bOK: TButton;
cbAlarmType: TComboBox;
eEMailLogin: TEdit;
eEMailPassword: TEdit;
eEMailSender: TEdit;
eEMailSendTo: TEdit;
eEMailSMTPPort: TEdit;
eEMailSMTPServer: TEdit;
eEMailSubject: TEdit;
gbEMailSettings: TGroupBox;
Label1: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label7: TLabel;
procedure bCancelClick(Sender: TObject);
procedure bOKClick(Sender: TObject);
procedure cbAlarmTypeChange(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
private
{ private declarations }
public
{ public declarations }
end;
var
fEditAlarmElement: TfEditAlarmElement;
res:TDecodedAlarmTemplateElementResult;
procedure OnEditAlarmType;
function EditAlarmElement(in_el:TDecodedAlarmTemplateElement):TDecodedAlarmTemplateElementResult;
implementation
function EditAlarmElement(in_el:TDecodedAlarmTemplateElement):TDecodedAlarmTemplateElementResult;
begin
Application.CreateForm(TfEditAlarmElement, fEditAlarmElement);
res.res:=false;
fEditAlarmElement.cbAlarmType.Items.Clear;
fEditAlarmElement.cbAlarmType.Items.Add('Active alarm in information agent');
fEditAlarmElement.cbAlarmType.Items.Add('Send e-mail');
fEditAlarmElement.cbAlarmType.ItemIndex:=in_el.ate_type-1;
OnEditAlarmType;
if in_el.ate_type=2 then
begin
fEditAlarmElement.eEMailSender.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,1);
fEditAlarmElement.eEMailSendTo.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,2);
fEditAlarmElement.eEMailSMTPServer.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,3);
fEditAlarmElement.eEMailSMTPPort.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,4);
fEditAlarmElement.eEMailLogin.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,5);
fEditAlarmElement.eEMailPassword.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,6);
fEditAlarmElement.eEMailSubject.Text:=uStrUtils.GetFieldFromString(in_el.ate_param,ParamLimiter2,7);
end;
fEditAlarmElement.ShowModal;
result:=res;
end;
{ TfEditAlarmElement }
procedure TfEditAlarmElement.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
CloseAction:=caFree;
end;
procedure TfEditAlarmElement.bCancelClick(Sender: TObject);
begin
Close;
end;
procedure TfEditAlarmElement.bOKClick(Sender: TObject);
var
tmp_int:integer;
begin
if fEditAlarmElement.cbAlarmType.ItemIndex=0 then
begin
res.daer_alarm_element.ate_type:=1;
res.daer_alarm_element.ate_param:='';
end;
if fEditAlarmElement.cbAlarmType.ItemIndex=1 then
begin
if trim(eEMailSender.Text)='' then
begin
ShowMessage('Invalid sender e-mail!');
Exit;
end;
if not ValidSymbols(eEMailSender.Text) then
begin
ShowMessage('Invalid symbols in sender e-mail!');
Exit;
end;
if trim(eEMailSendTo.Text)='' then
begin
ShowMessage('Invalid "send to" e-mail!');
Exit;
end;
if not ValidSymbols(eEMailSendTo.Text) then
begin
ShowMessage('Invalid symbols in "send to" e-mail!');
Exit;
end;
if trim(eEMailSMTPServer.Text)='' then
begin
ShowMessage('Invalid SMTP server!');
Exit;
end;
if not ValidSymbols(eEMailSMTPServer.Text) then
begin
ShowMessage('Invalid symbols in SMTP server!');
Exit;
end;
try
tmp_int:=strtoint(eEMailSMTPPort.Text);
except
ShowMessage('Invalid SMTP port!');
Exit;
end;
if trim(eEMailLogin.Text)='' then
begin
ShowMessage('Invalid login!');
Exit;
end;
if not ValidSymbols(eEMailLogin.Text) then
begin
ShowMessage('Invalid symbols in login!');
Exit;
end;
if not ValidSymbols(eEMailPassword.Text) then
begin
ShowMessage('Invalid symbols in password!');
Exit;
end;
if not ValidSymbols(eEMailSubject.Text) then
begin
ShowMessage('Invalid symbols in e-mail subject!');
Exit;
end;
res.daer_alarm_element.ate_type:=2;
res.daer_alarm_element.ate_param:='';
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailSender.Text+ParamLimiter2;
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailSendTo.Text+ParamLimiter2;
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailSMTPServer.Text+ParamLimiter2;
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailSMTPPort.Text+ParamLimiter2;
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailLogin.Text+ParamLimiter2;
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailPassword.Text+ParamLimiter2;
res.daer_alarm_element.ate_param:=res.daer_alarm_element.ate_param+fEditAlarmElement.eEMailSubject.Text;
end;
res.res:=true;
Close;
end;
procedure TfEditAlarmElement.cbAlarmTypeChange(Sender: TObject);
begin
OnEditAlarmType;
end;
procedure OnEditAlarmType;
begin
if fEditAlarmElement.cbAlarmType.ItemIndex=0 then
begin
fEditAlarmElement.gbEMailSettings.Visible:=false;
end;
if fEditAlarmElement.cbAlarmType.ItemIndex=1 then
begin
fEditAlarmElement.gbEMailSettings.Visible:=true;
end;
end;
{$R *.lfm}
end.
| 30.675127 | 126 | 0.720834 |
83217431fdcda30bcc3a3636bde2cd73219f4625 | 734 | dfm | Pascal | Source/experiments/ProjectRCL/OneButtonLabelAndRadioButton.dfm | atkins126/DelphiRTL | f0ea29598025346577870cc9a27338592c4dac1b | [
"BSD-2-Clause"
]
| 40 | 2016-09-28T21:34:23.000Z | 2021-12-25T23:02:09.000Z | Source/experiments/ProjectRCL/OneButtonLabelAndRadioButton.dfm | anomous/DelphiRTL | 0bd427025b479a1356da846b7788e3ba3bc9a3c8 | [
"BSD-2-Clause"
]
| 11 | 2017-08-30T13:03:00.000Z | 2020-08-25T13:46:05.000Z | Source/experiments/ProjectRCL/OneButtonLabelAndRadioButton.dfm | anomous/DelphiRTL | 0bd427025b479a1356da846b7788e3ba3bc9a3c8 | [
"BSD-2-Clause"
]
| 15 | 2016-11-24T05:52:39.000Z | 2021-11-11T00:50:12.000Z | object Form6: TForm6
Left = 0
Top = 0
Caption = 'Form6'
ClientHeight = 336
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 232
Top = 208
Width = 31
Height = 13
Caption = 'Label1'
end
object Button1: TButton
Left = 160
Top = 80
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object RadioButton1: TRadioButton
Left = 432
Top = 176
Width = 113
Height = 17
Caption = 'RadioButton1'
TabOrder = 1
end
end
| 17.902439 | 35 | 0.621253 |
fc14422b79e905cc54a5f6da095787937afae318 | 256 | dpr | Pascal | Demos/NetComVSIndy/Server/NetComVSIndyServer.dpr | megatkurniawan/NetCom7 | 052027c74f8e5aee9e936125931b1510b5739b25 | [
"MIT"
]
| 139 | 2020-04-13T10:05:09.000Z | 2022-03-16T00:35:50.000Z | Demos/NetComVSIndy/Server/NetComVSIndyServer.dpr | mrandreastoth/NetCom7 | 1bb22d8e8f66ca6fd7b70925024525f845a8899d | [
"MIT"
]
| 22 | 2020-04-15T03:17:53.000Z | 2022-02-09T13:08:31.000Z | Demos/NetComVSIndy/Server/NetComVSIndyServer.dpr | mrandreastoth/NetCom7 | 1bb22d8e8f66ca6fd7b70925024525f845a8899d | [
"MIT"
]
| 34 | 2020-04-13T11:26:35.000Z | 2022-01-26T04:23:44.000Z | program NetComVSIndyServer;
uses
Vcl.Forms,
ufrmMain in 'ufrmMain.pas' {frmMain};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
| 17.066667 | 45 | 0.703125 |
fc1b1e667008e0bcfdcb1e3ade08b1644db603b3 | 3,896 | pas | Pascal | src/libraries/hashlib4pascal/Base/HlpHashBuffer.pas | SkybuckFlying/PascalCoinSimplified | a3dbc67aa47bfe87a207e15abe8a31ea238fa74a | [
"MIT"
]
| 1 | 2019-02-05T18:33:02.000Z | 2019-02-05T18:33:02.000Z | src/libraries/hashlib4pascal/Base/HlpHashBuffer.pas | SkybuckFlying/PascalCoinSimplified | a3dbc67aa47bfe87a207e15abe8a31ea238fa74a | [
"MIT"
]
| 1 | 2018-07-20T21:18:54.000Z | 2018-07-20T21:18:54.000Z | src/libraries/hashlib4pascal/Base/HlpHashBuffer.pas | SkybuckFlying/PascalCoinSimplified | a3dbc67aa47bfe87a207e15abe8a31ea238fa74a | [
"MIT"
]
| null | null | null | unit HlpHashBuffer;
{$I ..\Include\HashLib.inc}
interface
uses
{$IFDEF HAS_UNITSCOPE}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF HAS_UNITSCOPE}
HlpHashLibTypes;
type
THashBuffer = record
strict private
Fm_data: THashLibByteArray;
Fm_pos: Int32;
function GetIsEmpty: Boolean; inline;
function GetIsFull: Boolean; inline;
function GetPos: Int32; inline;
function GetLength: Int32; inline;
public
constructor Create(a_length: Int32);
procedure Initialize();
function GetBytes(): THashLibByteArray; inline;
function GetBytesZeroPadded(): THashLibByteArray; inline;
function Feed(a_data: PByte; a_length_a_data: Int32;
var a_start_index: Int32; var a_length: Int32;
var a_processed_bytes: UInt64): Boolean; overload;
function Feed(a_data: PByte; a_length_a_data: Int32; a_length: Int32)
: Boolean; overload;
function ToString(): String;
property IsEmpty: Boolean read GetIsEmpty;
property IsFull: Boolean read GetIsFull;
property Pos: Int32 read GetPos;
property Length: Int32 read GetLength;
end;
implementation
{ THashBuffer }
constructor THashBuffer.Create(a_length: Int32);
begin
{$IFDEF DEBUG}
System.Assert(a_length > 0);
{$ENDIF DEBUG}
System.SetLength(Fm_data, a_length);
Initialize();
end;
function THashBuffer.GetIsFull: Boolean;
begin
result := Fm_pos = System.Length(Fm_data);
end;
function THashBuffer.Feed(a_data: PByte; a_length_a_data: Int32;
a_length: Int32): Boolean;
var
&Length: Int32;
begin
{$IFDEF DEBUG}
System.Assert(a_length >= 0);
System.Assert(a_length <= a_length_a_data);
System.Assert(not IsFull);
{$ENDIF DEBUG}
if (a_length_a_data = 0) then
begin
result := false;
Exit;
end;
if (a_length = 0) then
begin
result := false;
Exit;
end;
Length := System.Length(Fm_data) - Fm_pos;
if (Length > a_length) then
begin
Length := a_length;
end;
System.Move(a_data[0], Fm_data[Fm_pos], Length * System.SizeOf(Byte));
Fm_pos := Fm_pos + Length;
result := IsFull;
end;
function THashBuffer.Feed(a_data: PByte; a_length_a_data: Int32;
var a_start_index, a_length: Int32; var a_processed_bytes: UInt64): Boolean;
var
&Length: Int32;
begin
{$IFDEF DEBUG}
System.Assert(a_start_index >= 0);
System.Assert(a_length >= 0);
System.Assert((a_start_index + a_length) <= a_length_a_data);
System.Assert(not IsFull);
{$ENDIF DEBUG}
if (a_length_a_data = 0) then
begin
result := false;
Exit;
end;
if (a_length = 0) then
begin
result := false;
Exit;
end;
Length := System.Length(Fm_data) - Fm_pos;
if (Length > a_length) then
begin
Length := a_length;
end;
System.Move(a_data[a_start_index], Fm_data[Fm_pos],
Length * System.SizeOf(Byte));
Fm_pos := Fm_pos + Length;
a_start_index := a_start_index + Length;
a_length := a_length - Length;
a_processed_bytes := a_processed_bytes + UInt64(Length);
result := IsFull;
end;
function THashBuffer.GetBytes: THashLibByteArray;
begin
{$IFDEF DEBUG}
System.Assert(IsFull);
{$ENDIF DEBUG}
Fm_pos := 0;
result := Fm_data;
end;
function THashBuffer.GetBytesZeroPadded: THashLibByteArray;
begin
System.FillChar(Fm_data[Fm_pos], (System.Length(Fm_data) - Fm_pos) *
System.SizeOf(Byte), 0);
Fm_pos := 0;
result := Fm_data;
end;
function THashBuffer.GetIsEmpty: Boolean;
begin
result := Fm_pos = 0;
end;
function THashBuffer.GetLength: Int32;
begin
result := System.Length(Fm_data);
end;
function THashBuffer.GetPos: Int32;
begin
result := Fm_pos;
end;
procedure THashBuffer.Initialize;
begin
Fm_pos := 0;
System.FillChar(Fm_data[0], System.Length(Fm_data) * System.SizeOf(Byte), 0);
end;
function THashBuffer.ToString: String;
begin
result := Format('HashBuffer, Length: %d, Pos: %d, IsEmpty: %s',
[Self.Length, Self.Pos, BoolToStr(Self.IsEmpty, True)]);
end;
end.
| 21.173913 | 79 | 0.704055 |
85ab685bca13b886cef23bf3ba6aa2858f50fe3c | 6,630 | dfm | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvWinDialogs/testunit.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvWinDialogs/testunit.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/JvWinDialogs/testunit.dfm | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | object Form1: TForm1
Left = 483
Top = 232
BorderStyle = bsDialog
Caption = 'WinDialogs Demo'
ClientHeight = 202
ClientWidth = 208
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 8
Top = 8
Width = 90
Height = 25
Caption = 'Favorites'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 8
Top = 35
Width = 90
Height = 25
Caption = 'Folder'
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 8
Top = 63
Width = 90
Height = 25
Caption = 'Control Panel'
TabOrder = 2
OnClick = Button3Click
end
object Button4: TButton
Left = 8
Top = 90
Width = 90
Height = 25
Caption = 'Applet'
TabOrder = 3
OnClick = Button4Click
end
object Button5: TButton
Left = 8
Top = 117
Width = 90
Height = 25
Caption = 'Change Icon'
TabOrder = 4
OnClick = Button5Click
end
object Button6: TButton
Left = 104
Top = 8
Width = 90
Height = 25
Caption = 'About'
TabOrder = 5
OnClick = Button6Click
end
object Button7: TButton
Left = 104
Top = 35
Width = 90
Height = 25
Caption = 'Out of Memory'
TabOrder = 6
OnClick = Button7Click
end
object Button8: TButton
Left = 104
Top = 63
Width = 90
Height = 25
Caption = 'Run'
TabOrder = 7
OnClick = Button8Click
end
object Button9: TButton
Left = 104
Top = 90
Width = 90
Height = 25
Caption = 'Format Drive'
TabOrder = 8
OnClick = Button9Click
end
object Button10: TButton
Left = 104
Top = 118
Width = 90
Height = 25
Caption = 'Computer'
TabOrder = 9
OnClick = Button10Click
end
object Button11: TButton
Left = 8
Top = 145
Width = 90
Height = 25
Caption = 'Properties'
TabOrder = 10
OnClick = Button11Click
end
object Button13: TButton
Left = 8
Top = 172
Width = 90
Height = 25
Caption = 'New Shortcut'
TabOrder = 11
OnClick = Button13Click
end
object Button14: TButton
Left = 104
Top = 145
Width = 90
Height = 25
Caption = 'Add Hardware'
TabOrder = 12
OnClick = Button14Click
end
object OrganizeFavoritesDialog: TJvOrganizeFavoritesDialog
Left = 16
Top = 12
end
object BrowseFolderDialog: TJvBrowseForFolderDialog
RootDirectory = fdRootFolder
Title = 'Select Folder'
Left = 16
Top = 44
end
object AppletDialog: TJvAppletDialog
AppletName = 'C:\WINNT\system32\timedate.cpl'
Left = 16
Top = 100
end
object ChangeIconDialog: TJvChangeIconDialog
IconIndex = 0
Left = 16
Top = 140
end
object ShellAboutDialog: TJvShellAboutDialog
Caption = 'About'
OtherText = 'Other Text'
Product = 'Product Name'
Left = 168
Top = 4
end
object OutOfMemoryDialog: TJvOutOfMemoryDialog
Caption = 'Warning'
Left = 172
Top = 32
end
object RunDialog: TJvRunDialog
Caption = 'Caption'
Description = 'Description'
Icon.Data = {
0000010002002020100000000000E80200002600000010101000000000002801
00000E0300002800000020000000400000000100040000000000800200000000
0000000000000000000000000000000000000000800000800000008080008000
0000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF00
0000FF00FF00FFFF0000FFFFFF00000000000000000000000000000000000000
0000011111111111111000000000000000001111111111111111000000000000
0001111111111111111110000000000000111111111111111111110000000000
0111111111111111111111100000000011111111111111111111111100000001
1111111111111111111111111000001111111111111111111111111111000111
11111111111111111111111111100111111FF1111F1111FF111F111111100111
11F11F111F111F11F11F11111110011111F11F111F111F11F11F111111100111
11F11F111F111F11F11F11111110011111111F111F111F11F11F111111100111
11111F111F111F11F11F111111100111111FF1111F111F11F11FFF1111100111
11F111111F111F11F11F11F11110011111F111111F111F11F11F11F111100111
11F11F111F111F11F11F11F11110011111F11F111F111F11F11F11F111100111
111FF11FFFFF11FF111FFF111110011111111111111111111111111111100011
1111111111111111111111111100000111111111111111111111111110000000
1111111111111111111111110000000001111111111111111111111000000000
0011111111111111111111000000000000011111111111111111100000000000
0000111111111111111100000000000000000111111111111110000000000000
0000000000000000000000000000FFFFFFFFFF8001FFFF0000FFFE00007FFC00
003FF800001FF000000FE0000007C00000038000000180000001800000018000
0001800000018000000180000001800000018000000180000001800000018000
00018000000180000001C0000003E0000007F000000FF800001FFC00003FFE00
007FFF0000FFFF8001FFFFFFFFFF280000001000000020000000010004000000
0000C00000000000000000000000000000000000000000000000000080000080
00000080800080000000800080008080000080808000C0C0C0000000FF0000FF
000000FFFF00FF000000FF00FF00FFFF0000FFFFFF0000000000000000000000
11111111100000011111111111000011111111111110011F11F11F11F11101F1
F1F1F1F1F1110111F1F1F1F1F111011FF1F1F1F1FF1101FF11F1F1F1F1F101F1
11F1F1F1F1F101F1F1F1F1F1F1F1011F1FFF1F11FF1100111111111111100001
11111111110000001111111110000000000000000000FFFF0000F0070000E003
0000C00100008000000080000000800000008000000080000000800000008000
000080000000C0010000E0030000F0070000FFFF0000}
Left = 176
Top = 60
end
object ComputerNameDialog: TJvComputerNameDialog
Left = 180
Top = 120
end
object ObjectPropertiesDialog: TJvObjectPropertiesDialog
ObjectName = 'My Computer'
ObjectType = sdPathObject
Left = 20
Top = 152
end
object psvNewLinkDialog: TJvNewLinkDialog
DestinationFolder = 'c:\'
Left = 16
Top = 180
end
object AddHardwareDialog: TJvAddHardwareDialog
Left = 176
Top = 144
end
object JvFormatDriveDialog1: TJvFormatDriveDialog
FormatType = ftQuick
Capacity = dcDefault
Left = 176
Top = 88
end
object JvAppletDialog1: TJvAppletDialog
Left = 16
Top = 68
end
end
| 27.857143 | 71 | 0.704977 |
f1efad5ccfd1c23050701dacc9c50b49f88f1acf | 459,851 | pas | Pascal | source/ALString.pas | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 1 | 2019-08-01T04:40:10.000Z | 2019-08-01T04:40:10.000Z | source/ALString.pas | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| null | null | null | source/ALString.pas | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| null | null | null | {*************************************************************
Description: Powerfull stringreplace, Pos, Move, comparetext,
uppercase, lowercase function. Also a powerfull
FastTagReplace function To replace in string tag
like <#tagname params1="value1" params2="value2">
by custom value
**************************************************************}
unit ALString;
interface
{$H+,B-,R-}
{$IF CompilerVersion < 29} {Delphi XE8}
{$IF defined(CPUX64)} // The CPU supports the x86-64 instruction set, and is in a 64-bit environment. *New* in XE2/x64
{$DEFINE CPU64BITS} // The CPU is in a 64-bit environment, such as DCC64.EXE. *New* in XE8
{$ENDIF}
{$IF defined(CPUX86)} // The CPU supports the x86-64 instruction set, and is in a 64-bit environment. *New* in XE2/x64
{$DEFINE CPU32BITS} // The CPU is in a 32-bit environment, such as DCC32.EXE. *New* in XE8
{$ENDIF}
{$ENDIF}
{$IF Low(string) = 0}
{$DEFINE _ZEROBASEDSTRINGS_ON}
{$ENDIF}
// http://docwiki.embarcadero.com/RADStudio/en/Conditional_compilation_(Delphi)
// http://docwiki.embarcadero.com/RADStudio/en/Compiler_Versions
{$IFDEF CPUX86}
{$DEFINE X86ASM}
{$ELSE !CPUX86}
{$DEFINE PUREPASCAL}
{$DEFINE PUREPASCAL_X64ONLY}
{$ENDIF !CPUX86}
{$IF SizeOf(Extended) = 10}
{$DEFINE EXTENDEDHAS10BYTES}
{$ENDIF}
{$IFDEF ANDROID}
{$DEFINE USE_LIBICU}
{$ENDIF}
{$DEFINE LEGACY_FORMAT} // Define this to enable the old ASM code for Win32.
{$IF CompilerVersion >= 25} {Delphi XE4}
{$LEGACYIFEND ON} // http://docwiki.embarcadero.com/RADStudio/XE4/en/Legacy_IFEND_(Delphi)
{$IFEND}
uses {$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF}
System.SysUtils,
System.Classes,
{$IFNDEF NEXTGEN}
System.Contnrs,
{$ENDIF}
{$IFDEF MACOS}
Macapi.CoreFoundation,
{$ENDIF MACOS}
ALInit,
ALStringList;
resourcestring
SALInvalidFormat = 'Format ''%s'' invalid or incompatible with argument';
SALArgumentMissing = 'No argument for format ''%s''';
type
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.TFormatSettings is still the same and adjust the IFDEF'}
{$IFEND}
{$IFNDEF NEXTGEN}
pALFormatSettings = ^TALFormatSettings;
TALFormatSettings = record
public
type
TEraInfo = record
EraName: ansiString;
EraOffset: Integer;
EraStart: TDate;
EraEnd: TDate;
end;
public
// Important: Do not change the order of these declarations, they must
// match the declaration order of the corresponding globals variables exactly!
CurrencyString: AnsiString;
CurrencyFormat: Byte;
CurrencyDecimals: Byte;
DateSeparator: AnsiChar;
TimeSeparator: AnsiChar;
ListSeparator: AnsiChar;
ShortDateFormat: AnsiString;
LongDateFormat: AnsiString;
TimeAMString: AnsiString;
TimePMString: AnsiString;
ShortTimeFormat: AnsiString;
LongTimeFormat: AnsiString;
ShortMonthNames: array[1..12] of AnsiString;
LongMonthNames: array[1..12] of AnsiString;
ShortDayNames: array[1..7] of AnsiString;
LongDayNames: array[1..7] of AnsiString;
EraInfo: array of TEraInfo;
ThousandSeparator: AnsiChar;
DecimalSeparator: AnsiChar;
TwoDigitYearCenturyWindow: Word;
NegCurrFormat: Byte;
// Creates a TALFormatSettings record with current default values provided
// by the operating system.
class function Create: TALFormatSettings; overload; static; inline;
// Creates a TALFormatSettings record with values provided by the operating
// system for the specified locale. The locale is an LCID on Windows
// platforms, or a locale_t on Posix platforms.
{$IF defined(MSWINDOWS)}
class function Create(Locale: LCID): TALFormatSettings; overload; platform; static;
{$IFEND}
// Creates a TALFormatSettings record with values provided by the operating
// system for the specified locale name in the "Language-Country" format.
// Example: 'en-US' for U.S. English settings or 'en-UK' for UK English settings.
class function Create(const LocaleName: AnsiString): TALFormatSettings; overload; static;
function GetEraYearOffset(const Name: ansistring): Integer;
end;
{$ENDIF}
pALFormatSettingsU = ^TALFormatSettingsU;
TALFormatSettingsU = TFormatSettings;
{$IFNDEF NEXTGEN}
function ALGetFormatSettingsID(const aFormatSettings: TALFormatSettings): AnsiString;
{$IF defined(MSWINDOWS)}
procedure ALGetLocaleFormatSettings(Locale: LCID; var AFormatSettings: TALFormatSettings); platform;
{$IFEND}
{$ENDIF}
var
{$IFNDEF NEXTGEN}
ALDefaultFormatSettings: TALformatSettings;
{$ENDIF}
ALDefaultFormatSettingsU: TALformatSettingsU;
type
{$IFNDEF NEXTGEN}
EALException = class(Exception)
public
constructor Create(const Msg: AnsiString);
constructor CreateFmt(const Msg: ansistring; const Args: array of const);
end;
{$ENDIF}
EALExceptionU = class(Exception);
{$IFNDEF NEXTGEN}
TALStringStream = class(TStream)
private
FDataString: AnsiString;
FPosition: Integer;
protected
procedure SetSize(NewSize: Longint); override;
public
constructor Create(const AString: AnsiString);
function Read(var Buffer; Count: Longint): Longint; override;
function ReadString(Count: Longint): AnsiString;
function Seek(Offset: Longint; Origin: Word): Longint; override;
function Write(const Buffer; Count: Longint): Longint; override;
procedure WriteString(const AString: AnsiString);
property DataString: AnsiString read FDataString;
end;
{$ENDIF}
{$IFNDEF NEXTGEN}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.Masks is still the same and adjust the IFDEF'}
{$IFEND}
EALMaskException = class(Exception);
TALMask = class
private type
// WideChar Reduced to ByteChar in set expressions.
TALMaskSet = set of ansiChar;
PALMaskSet = ^TALMaskSet;
TALMaskStates = (msLiteral, msAny, msSet, msMBCSLiteral);
TALMaskState = record
SkipTo: Boolean;
case State: TALMaskStates of
msLiteral: (Literal: ansiChar);
msAny: ();
msSet: (
Negate: Boolean;
CharSet: PALMaskSet);
msMBCSLiteral: (LeadByte, TrailByte: ansiChar);
end;
private
FMaskStates: array of TALMaskState;
protected
function InitMaskStates(const Mask: ansistring): Integer;
procedure DoneMaskStates;
function MatchesMaskStates(const Filename: ansistring): Boolean;
public
constructor Create(const MaskValue: ansistring);
destructor Destroy; override;
function Matches(const Filename: ansistring): Boolean;
end;
function ALMatchesMask(const Filename, Mask: AnsiString): Boolean;
{$ENDIF}
type
TALPerlRegExOptions = set of (
preCaseLess, // /i -> Case insensitive
preMultiLine, // /m -> ^ and $ also match before/after a newline, not just at the beginning and the end of the string
preSingleLine, // /s -> Dot matches any character, including \n (newline). Otherwise, it matches anything except \n
preExtended, // /x -> Allow regex to contain extra whitespace, newlines and Perl-style comments, all of which will be filtered out
preAnchored, // /A -> Successful match can only occur at the start of the subject or right after the previous match
preUnGreedy, // Repeat operators (+, *, ?) are not greedy by default (i.e. they try to match the minimum number of characters instead of the maximum)
preNoAutoCapture // (group) is a non-capturing group; only named groups capture
);
// TALPerlRegEx is not supported anymore after Tokyo, you can use instead
// TPerlRegEx (unicode). TALPerlRegEx is hard to maintain and the win in
// performance (mostly to avoid to do a conversion from ansiString to Unicode)
// seam to be low (I didn't do any test, but i suppose)
{$IF (not defined(NEXTGEN)) and (CompilerVersion <= 32)}{Delphi Tokyo}
type
TALPerlRegExState = set of (
preNotBOL, // Not Beginning Of Line: ^ does not match at the start of Subject
preNotEOL, // Not End Of Line: $ does not match at the end of Subject
preNotEmpty // Empty matches not allowed
);
const
// Maximum number of subexpressions (backreferences)
// Subexpressions are created by placing round brackets in the regex, and are referenced by \1, \2, ...
// In Perl, they are available as $1, $2, ... after the regex matched; with TALPerlRegEx, use the Subexpressions property
// You can also insert \1, \2, ... in the replacement string; \0 is the complete matched expression
cALPerlRegExMAXSUBEXPRESSIONS = 99;
// All implicit string casts have been verified to be correct
{ $WARN IMPLICIT_STRING_CAST OFF}
type
TALPerlRegExReplaceEvent = procedure(Sender: TObject; var ReplaceWith: AnsiString) of object;
type
TALPerlRegEx = class
private // *** Property storage, getters and setters
FCompiled, FStudied: Boolean;
FOptions: TALPerlRegExOptions;
FState: TALPerlRegExState;
FRegEx: AnsiString;
FReplacement: AnsiString;
FSubject: AnsiString;
FStart, FStop: Integer;
FOnMatch: TNotifyEvent;
FOnReplace: TALPerlRegExReplaceEvent;
function GetMatchedText: AnsiString;
function GetMatchedLength: Integer;
function GetMatchedOffset: Integer;
procedure SetOptions(Value: TALPerlRegExOptions);
procedure SetRegEx(const Value: AnsiString);
function GetGroupCount: Integer;
function GetGroups(Index: Integer): AnsiString;
function GetGroupLengths(Index: Integer): Integer;
function GetGroupOffsets(Index: Integer): Integer;
procedure SetSubject(const Value: AnsiString);
procedure SetStart(const Value: Integer);
procedure SetStop(const Value: Integer);
function GetFoundMatch: Boolean;
private // *** Variables used by PCRE
Offsets: array[0..(cALPerlRegExMAXSUBEXPRESSIONS+1)*3] of Integer;
OffsetCount: Integer;
FPCREOptions: Integer;
FPattern: Pointer;
FHints: Pointer;
FCharTable: Pointer;
FSubjectPChar: PAnsiChar;
FHasStoredGroups: Boolean;
FStoredGroups: array of AnsiString;
function GetSubjectLeft: AnsiString;
function GetSubjectRight: AnsiString;
protected
procedure CleanUp;
// Dispose off whatever we created, so we can start over. Called automatically when needed, so it is not made public
procedure ClearStoredGroups;
public
constructor Create;
// Come to life
destructor Destroy; override;
// Clean up after ourselves
class function EscapeRegExChars(const S: AnsiString): AnsiString;
// Escapes regex characters in S so that the regex engine can be used to match S as plain text
function Compile(const RaiseException: boolean = True): boolean;
// Compile the regex. Called automatically by Match
procedure Study;
// Study the regex. Studying takes time, but will make the execution of the regex a lot faster.
// Call study if you will be using the same regex many times
function Match: Boolean; overload;
// Attempt to match the regex, starting the attempt from the beginning of Subject
function Match(const aSubject: ansiString; aGroups: TalStrings): Boolean; overload;
// Thread Safe version of Match
function MatchAgain: Boolean;
// Attempt to match the regex to the remainder of Subject after the previous match (as indicated by Start)
function Replace: AnsiString;
// Replace matched expression in Subject with ComputeReplacement. Returns the actual replacement text from ComputeReplacement
function ReplaceAll: Boolean;
// Repeat MatchAgain and Replace until you drop. Returns True if anything was replaced at all.
function ComputeReplacement: AnsiString;
// Returns Replacement with backreferences filled in
procedure StoreGroups;
// Stores duplicates of Groups[] so they and ComputeReplacement will still return the proper strings
// even if FSubject is changed or cleared
function NamedGroup(const Name: AnsiString): Integer;
// Returns the index of the named group Name
procedure Split(Strings: TALStrings; Limit: Integer);
// Split Subject along regex matches. Capturing groups are ignored.
procedure SplitCapture(Strings: TALStrings; Limit: Integer); overload;
procedure SplitCapture(Strings: TALStrings; Limit: Integer; Offset : Integer); overload;
// Split Subject along regex matches. Capturing groups are added to Strings as well.
property Compiled: Boolean read FCompiled;
// True if the RegEx has already been compiled.
property FoundMatch: Boolean read GetFoundMatch;
// Returns True when Matched* and Group* indicate a match
property Studied: Boolean read FStudied;
// True if the RegEx has already been studied
property MatchedText: AnsiString read GetMatchedText;
// The matched text
property MatchedLength: Integer read GetMatchedLength;
// Length of the matched text
property MatchedOffset: Integer read GetMatchedOffset;
// Character offset in the Subject string at which MatchedText starts
property Start: Integer read FStart write SetStart;
// Starting position in Subject from which MatchAgain begins
property Stop: Integer read FStop write SetStop;
// Last character in Subject that Match and MatchAgain search through
property State: TALPerlRegExState read FState write FState;
// State of Subject
property GroupCount: Integer read GetGroupCount;
// Number of matched capturing groups
property Groups[Index: Integer]: AnsiString read GetGroups;
// Text matched by capturing groups
property GroupLengths[Index: Integer]: Integer read GetGroupLengths;
// Lengths of the text matched by capturing groups
property GroupOffsets[Index: Integer]: Integer read GetGroupOffsets;
// Character offsets in Subject at which the capturing group matches start
property Subject: AnsiString read FSubject write SetSubject;
// The string on which Match() will try to match RegEx
property SubjectLeft: AnsiString read GetSubjectLeft;
// Part of the subject to the left of the match
property SubjectRight: AnsiString read GetSubjectRight;
// Part of the subject to the right of the match
public
property Options: TALPerlRegExOptions read FOptions write SetOptions;
// Options
property RegEx: AnsiString read FRegEx write SetRegEx;
// The regular expression to be matched
property Replacement: AnsiString read FReplacement write FReplacement;
// Text to replace matched expression with. \number and $number backreferences will be substituted with Groups
// TALPerlRegEx supports the "JGsoft" replacement text flavor as explained at http://www.regular-expressions.info/refreplace.html
property OnMatch: TNotifyEvent read FOnMatch write FOnMatch;
// Triggered by Match and MatchAgain after a successful match
property OnReplace: TALPerlRegExReplaceEvent read FOnReplace write FOnReplace;
// Triggered by Replace and ReplaceAll just before the replacement is done, allowing you to determine the new AnsiString
end;
{
You can add TALPerlRegEx instances to a TALPerlRegExList to match them all together on the same subject,
as if they were one regex regex1|regex2|regex3|...
TALPerlRegExList does not own the TALPerlRegEx components, just like a TList
If a TALPerlRegEx has been added to a TALPerlRegExList, it should not be used in any other situation
until it is removed from the list
}
type
TALPerlRegExList = class
private
FList: TList;
FSubject: AnsiString;
FMatchedRegEx: TALPerlRegEx;
FStart, FStop: Integer;
function GetRegEx(Index: Integer): TALPerlRegEx;
procedure SetRegEx(Index: Integer; Value: TALPerlRegEx);
procedure SetSubject(const Value: AnsiString);
procedure SetStart(const Value: Integer);
procedure SetStop(const Value: Integer);
function GetCount: Integer;
protected
procedure UpdateRegEx(ARegEx: TALPerlRegEx);
public
constructor Create;
destructor Destroy; override;
public
function Add(ARegEx: TALPerlRegEx): Integer;
procedure Clear;
procedure Delete(Index: Integer);
function IndexOf(ARegEx: TALPerlRegEx): Integer;
procedure Insert(Index: Integer; ARegEx: TALPerlRegEx);
public
function Match: Boolean;
function MatchAgain: Boolean;
property RegEx[Index: Integer]: TALPerlRegEx read GetRegEx write SetRegEx;
property Count: Integer read GetCount;
property Subject: AnsiString read FSubject write SetSubject;
property Start: Integer read FStart write SetStart;
property Stop: Integer read FStop write SetStop;
property MatchedRegEx: TALPerlRegEx read FMatchedRegEx;
end;
ERegularExpressionError = class(Exception);
{$IFEND}
var ALMove: procedure (const Source; var Dest; Count: NativeInt);
function ALIfThen(AValue: Boolean; const ATrue: Integer; const AFalse: Integer): Integer; overload; inline;
function ALIfThen(AValue: Boolean; const ATrue: Int64; const AFalse: Int64): Int64; overload; inline;
function ALIfThen(AValue: Boolean; const ATrue: UInt64; const AFalse: UInt64): UInt64; overload; inline;
function ALIfThen(AValue: Boolean; const ATrue: Single; const AFalse: Single): Single; overload; inline;
function ALIfThen(AValue: Boolean; const ATrue: Double; const AFalse: Double): Double; overload; inline;
function ALIfThen(AValue: Boolean; const ATrue: Extended; const AFalse: Extended): Extended; overload; inline;
{$IFNDEF NEXTGEN}
function ALGUIDToByteString(const Guid: TGUID): Ansistring;
function ALNewGUIDByteString: Ansistring;
function ALGUIDToString(const Guid: TGUID; const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): Ansistring;
Function ALNewGUIDString(const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): AnsiString;
function ALIfThen(AValue: Boolean; const ATrue: AnsiString; AFalse: AnsiString = ''): AnsiString; overload; inline;
function ALFormat(const Format: AnsiString; const Args: array of const): AnsiString; overload;
procedure ALFormat(const Format: AnsiString; const Args: array of const; var Result: ansiString); overload;
function ALFormat(const Format: AnsiString; const Args: array of const; const AFormatSettings: TALFormatSettings): AnsiString; overload;
procedure ALFormat(const Format: AnsiString; const Args: array of const; const AFormatSettings: TALFormatSettings; var Result: ansiString); overload;
function ALTryStrToBool(const S: Ansistring; out Value: Boolean): Boolean;
Function AlStrToBool(Value:AnsiString):Boolean;
function ALBoolToStr(B: Boolean; const trueStr: ansistring='1'; const falseStr: ansistring='0'): Ansistring; overload;
procedure ALBoolToStr(var s: ansiString; B: Boolean; const trueStr: ansistring='1'; const falseStr: ansistring='0'); overload;
function ALDateToStr(const DateTime: TDateTime; const AFormatSettings: TALFormatSettings): AnsiString;
function ALTimeToStr(const DateTime: TDateTime; const AFormatSettings: TALFormatSettings): AnsiString;
function ALDateTimeToStr(const DateTime: TDateTime; const AFormatSettings: TALFormatSettings): AnsiString; overload;
procedure ALDateTimeToStr(const DateTime: TDateTime; var s: ansiString; const AFormatSettings: TALFormatSettings); overload;
function ALFormatDateTime(const Format: AnsiString; DateTime: TDateTime; const AFormatSettings: TALFormatSettings): AnsiString;
function ALTryStrToDate(const S: AnsiString; out Value: TDateTime; const AFormatSettings: TALFormatSettings): Boolean;
function ALStrToDate(const S: AnsiString; const AFormatSettings: TALFormatSettings): TDateTime;
function ALTryStrToTime(const S: AnsiString; out Value: TDateTime; const AFormatSettings: TALFormatSettings): Boolean;
function ALStrToTime(const S: AnsiString; const AFormatSettings: TALFormatSettings): TDateTime;
function ALTryStrToDateTime(const S: AnsiString; out Value: TDateTime; const AFormatSettings: TALFormatSettings): Boolean;
function ALStrToDateTime(const S: AnsiString; const AFormatSettings: TALFormatSettings): TDateTime;
function ALTryStrToInt(const S: AnsiString; out Value: Integer): Boolean;
function ALStrToInt(const S: AnsiString): Integer;
function ALStrToIntDef(const S: AnsiString; Default: Integer): Integer;
function ALTryStrToUInt(const S: AnsiString; out Value: Cardinal): Boolean;
function ALStrToUInt(const S: AnsiString): Cardinal;
function ALStrToUIntDef(const S: Ansistring; Default: Cardinal): Cardinal;
function ALTryStrToInt64(const S: AnsiString; out Value: Int64): Boolean;
function ALStrToInt64(const S: AnsiString): Int64;
function ALStrToInt64Def(const S: AnsiString; const Default: Int64): Int64;
function ALIntToStr(Value: Integer): AnsiString; overload;
procedure ALIntToStr(Value: Integer; var s: ansiString); overload;
function ALIntToStr(Value: Int64): AnsiString; overload;
procedure ALIntToStr(Value: Int64; var s: ansiString); overload;
function ALStrToUInt64(const S: ansistring): UInt64;
function ALStrToUInt64Def(const S: ansistring; const Default: UInt64): UInt64;
function ALTryStrToUInt64(const S: ansistring; out Value: UInt64): Boolean;
function ALUIntToStr(Value: Cardinal): AnsiString; overload;
function ALUIntToStr(Value: UInt64): AnsiString; overload;
function ALIntToHex(Value: Integer; Digits: Integer): AnsiString; overload;
function ALIntToHex(Value: Int64; Digits: Integer): AnsiString; overload;
function ALIntToHex(Value: UInt64; Digits: Integer): AnsiString; overload;
Function ALTryBinToHex(const aBin: AnsiString; out Value: AnsiString): boolean; overload;
Function ALBinToHex(const aBin: AnsiString): AnsiString; overload;
Function ALTryBinToHex(const aBin; aBinSize : Cardinal; out Value: AnsiString): boolean; overload;
Function ALBinToHex(const aBin; aBinSize : Cardinal): AnsiString; overload;
Function ALTryHexToBin(const aHex: AnsiString; out Value: AnsiString): boolean;
Function ALHexToBin(const aHex: AnsiString): AnsiString;
function ALIntToBit(value: Integer; digits: integer): ansistring;
function AlBitToInt(Value: ansiString): Integer;
function AlInt2BaseN(NumIn: UInt64; const charset: array of ansiChar): ansistring;
function AlBaseN2Int(const Str: ansiString; const charset: array of ansiChar): UInt64;
function ALBase64EncodeString(const P: PansiChar; const ln: Integer): AnsiString; overload;
function ALBase64EncodeString(const S: AnsiString): AnsiString; overload;
function ALBase64DecodeString(const P: PansiChar; const ln: Integer): AnsiString; overload;
function ALBase64DecodeString(const S: AnsiString): AnsiString; overload;
function ALBase64EncodeStringMIME(const S: AnsiString): AnsiString;
function ALBase64DecodeStringMIME(const S: AnsiString): AnsiString;
function ALIsDecimal(const S: AnsiString; const RejectPlusMinusSign: boolean = False): boolean;
Function ALIsInt64 (const S: AnsiString): Boolean;
Function ALIsInteger (const S: AnsiString): Boolean;
Function ALIsSmallInt (const S: AnsiString): Boolean;
Function ALIsFloat (const S: AnsiString; const AFormatSettings: TALFormatSettings): Boolean;
function ALFloatToStr(Value: Extended; const AFormatSettings: TALFormatSettings): AnsiString; overload;
procedure ALFloatToStr(Value: Extended; var S: ansiString; const AFormatSettings: TALFormatSettings); overload;
function ALFloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer; const AFormatSettings: TALFormatSettings): AnsiString;
function ALCurrToStr(Value: Currency; const AFormatSettings: TALFormatSettings): AnsiString;
function ALFormatFloat(const Format: AnsiString; Value: Extended; const AFormatSettings: TALFormatSettings): AnsiString;
function ALFormatCurr(const Format: AnsiString; Value: Currency; const AFormatSettings: TALFormatSettings): AnsiString;
function ALStrToFloat(const S: AnsiString; const AFormatSettings: TALFormatSettings): Extended;
function ALStrToFloatDef(const S: AnsiString; const Default: Extended; const AFormatSettings: TALFormatSettings): Extended;
function ALTryStrToFloat(const S: AnsiString; out Value: Extended; const AFormatSettings: TALFormatSettings): Boolean; overload;
function ALTryStrToFloat(const S: AnsiString; out Value: Double; const AFormatSettings: TALFormatSettings): Boolean; overload;
function ALTryStrToFloat(const S: AnsiString; out Value: Single; const AFormatSettings: TALFormatSettings): Boolean; overload;
function ALStrToCurr(const S: AnsiString; const AFormatSettings: TALFormatSettings): Currency;
function ALStrToCurrDef(const S: AnsiString; const Default: Currency; const AFormatSettings: TALFormatSettings): Currency;
function ALTryStrToCurr(const S: AnsiString; out Value: Currency; const AFormatSettings: TALFormatSettings): Boolean;
function ALPos(const SubStr, Str: AnsiString; Offset: Integer = 1): Integer; inline;
var ALPosEx: function(const SubStr, S: AnsiString; Offset: Integer = 1): Integer;
function ALPosExIgnoreCase(const SubStr, S: Ansistring; Offset: Integer = 1): Integer;
var AlUpperCase: function(const S: AnsiString): AnsiString;
var AlLowerCase: function(const S: AnsiString): AnsiString;
function AlUpCase(const Ch: AnsiChar): AnsiChar;
function AlLoCase(const Ch: AnsiChar): AnsiChar;
var ALCompareStr: function(const S1, S2: AnsiString): Integer;
var ALSameStr: function(const S1, S2: AnsiString): Boolean;
var ALCompareText: function(const S1, S2: AnsiString): Integer;
var ALSameText: function(const S1, S2: AnsiString): Boolean;
var ALMatchText: function(const AText: AnsiString; const AValues: array of AnsiString): Boolean;
var ALMatchStr: function(const AText: AnsiString; const AValues: array of AnsiString): Boolean;
function ALTrim(const S: AnsiString): AnsiString;
function ALTrimLeft(const S: AnsiString): AnsiString;
function ALTrimRight(const S: AnsiString): AnsiString;
function ALPadLeft(const S: AnsiString; Const Width: Integer): AnsiString;
function ALPadRight(const S: AnsiString; Const Width: Integer): AnsiString;
function ALQuotedStr(const S: AnsiString; const Quote: AnsiChar = ''''): AnsiString;
function ALDequotedStr(const S: AnsiString; AQuote: AnsiChar): AnsiString;
function ALExtractQuotedStr(var Src: PAnsiChar; Quote: AnsiChar): AnsiString;
function ALExtractFilePath(const FileName: AnsiString): AnsiString;
function ALExtractFileDir(const FileName: AnsiString): AnsiString;
function ALExtractFileDrive(const FileName: AnsiString): AnsiString;
function ALExtractFileName(const FileName: AnsiString): AnsiString;
function ALExtractFileExt(const FileName: AnsiString): AnsiString;
function ALLastDelimiter(const Delimiters, S: AnsiString): Integer;
function ALIsPathDelimiter(const S: AnsiString; Index: Integer; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): Boolean;
function ALIncludeTrailingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
function ALExcludeTrailingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
function ALIncludeLeadingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
function ALExcludeLeadingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
procedure ALStrMove(const Source: PAnsiChar; var Dest: PAnsiChar; Count: NativeInt); inline;
function ALCopyStr(const aSourceString: AnsiString; aStart, aLength: Integer): AnsiString; overload;
procedure ALCopyStr(const aSourceString: AnsiString; var aDestString: ansiString; aStart, aLength: Integer); overload;
function ALCopyStr(const aSourceString: AnsiString;
const aStartStr: AnsiString;
const aEndStr: AnsiString;
const aOffset: integer = 1;
const aRaiseExceptionIfNotFound: Boolean = True): AnsiString; overload;
function ALStringReplace(const S, OldPattern, NewPattern: AnsiString; Flags: TReplaceFlags): AnsiString;
{$ENDIF}
Function ALNewGUIDBytes: TBytes;
function ALGUIDToStringU(const Guid: TGUID; const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): string;
Function ALNewGUIDStringU(const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): String;
function ALIfThenU(AValue: Boolean; const ATrue: String; AFalse: String = ''): String; overload; inline;
function ALFormatU(const Format: String; const Args: array of const): String; overload;
procedure ALFormatU(const Format: String; const Args: array of const; var Result: String); overload;
function ALFormatU(const Format: String; const Args: array of const; const AFormatSettings: TALFormatSettingsU): String; overload;
procedure ALFormatU(const Format: String; const Args: array of const; const AFormatSettings: TALFormatSettingsU; var Result: String); overload;
function ALTryStrToBoolU(const S: String; out Value: Boolean): Boolean;
Function AlStrToBoolU(Value:String):Boolean;
function ALBoolToStrU(B: Boolean; const trueStr: String='1'; const falseStr: String='0'): String; overload;
procedure ALBoolToStrU(var s: String; B: Boolean; const trueStr: String='1'; const falseStr: String='0'); overload;
var ALDateToStrU: function(const DateTime: TDateTime; const AFormatSettings: TALFormatSettingsU): string;
var ALTimeToStrU: function(const DateTime: TDateTime; const AFormatSettings: TALFormatSettingsU): string;
function ALDateTimeToStrU(const DateTime: TDateTime; const AFormatSettings: TALFormatSettingsU): String; overload; inline;
procedure ALDateTimeToStrU(const DateTime: TDateTime; var s: String; const AFormatSettings: TALFormatSettingsU); overload; inline;
var ALFormatDateTimeU: function(const Format: string; DateTime: TDateTime; const AFormatSettings: TALFormatSettingsU): string;
var ALTryStrToDateU: function(const S: string; out Value: TDateTime; const AFormatSettings: TALFormatSettingsU): Boolean;
var ALStrToDateU: function(const S: string; const AFormatSettings: TALFormatSettingsU): TDateTime;
var ALTryStrToTimeU: function(const S: string; out Value: TDateTime; const AFormatSettings: TALFormatSettingsU): Boolean;
var ALStrToTimeU: function(const S: string; const AFormatSettings: TALFormatSettingsU): TDateTime;
var ALTryStrToDateTimeU: function(const S: string; out Value: TDateTime; const AFormatSettings: TALFormatSettingsU): Boolean;
var ALStrToDateTimeU: function(const S: string; const AFormatSettings: TALFormatSettingsU): TDateTime;
var ALTryStrToIntU: function(const S: string; out Value: Integer): Boolean;
var ALStrToIntU: function(const S: string): Integer;
var ALStrToIntDefU: function(const S: string; Default: Integer): Integer;
var ALTryStrToInt64U: function(const S: string; out Value: Int64): Boolean;
var ALStrToInt64U: function(const S: string): Int64;
var ALStrToInt64DefU: function(const S: string; const Default: Int64): Int64;
function ALIntToStrU(Value: Integer): String; overload; inline;
procedure ALIntToStrU(Value: Integer; var s: String); overload; inline;
function ALIntToStrU(Value: Int64): String; overload; inline;
procedure ALIntToStrU(Value: Int64; var s: String); overload; inline;
{$IF CompilerVersion >= 26}{Delphi XE5}
var ALStrToUInt64U: function(const S: String): UInt64;
var ALStrToUInt64DefU: function(const S: String; const Default: UInt64): UInt64;
var ALTryStrToUInt64U: function(const S: String; out Value: UInt64): Boolean;
{$ifend}
function ALUIntToStrU(Value: Cardinal): String; overload; inline;
function ALUIntToStrU(Value: UInt64): String; overload; inline;
function ALTryBinToHexU(const aBin: Tbytes; out Value: String): boolean; overload;
Function ALBinToHexU(const aBin: Tbytes): String; overload;
Function ALTryBinToHexU(const aBin; aBinSize : Cardinal; out Value: String): boolean; overload;
Function ALBinToHexU(const aBin; aBinSize : Cardinal): String; overload;
Function ALTryHexToBinU(const aHex: String; out Value: Tbytes): boolean;
Function ALHexToBinU(const aHex: String): Tbytes;
Function ALBase64EncodeStringU(const S: String; const AEncoding: TEncoding = nil): String;
Function ALBase64DecodeStringU(const S: String; const AEncoding: TEncoding = nil): String;
Function ALBase64EncodeBytesU(const Bytes: Tbytes): String; overload;
{$IF CompilerVersion >= 31} // berlin
Function ALBase64EncodeBytesU(const Bytes: pointer; const Size: Integer): String; overload;
{$IFEND}
Function ALBase64DecodeBytesU(const S: String): Tbytes;
function ALIsDecimalU(const S: String; const RejectPlusMinusSign: boolean = False): boolean;
Function ALIsInt64U(const S: String): Boolean;
Function ALIsIntegerU(const S: String): Boolean;
Function ALIsSmallIntU(const S: String): Boolean;
Function ALIsFloatU(const S: String; const AFormatSettings: TALFormatSettingsU): Boolean;
function ALFloatToStrU(Value: Extended; const AFormatSettings: TALFormatSettingsU): String; overload; inline;
procedure ALFloatToStrU(Value: Extended; var S: String; const AFormatSettings: TALFormatSettingsU); overload; inline;
var ALCurrToStrU: function(Value: Currency; const AFormatSettings: TALFormatSettingsU): string;
var ALFormatFloatU: function(const Format: string; Value: Extended; const AFormatSettings: TALFormatSettingsU): string;
var ALFormatCurrU: function(const Format: string; Value: Currency; const AFormatSettings: TALFormatSettingsU): string;
var ALStrToFloatU: function(const S: string; const AFormatSettings: TALFormatSettingsU): Extended;
var ALStrToFloatDefU: function(const S: string; const Default: Extended; const AFormatSettings: TALFormatSettingsU): Extended;
function ALTryStrToFloatU(const S: String; out Value: Extended; const AFormatSettings: TALFormatSettingsU): Boolean; overload; inline;
function ALTryStrToFloatU(const S: String; out Value: Double; const AFormatSettings: TALFormatSettingsU): Boolean; overload; inline;
function ALTryStrToFloatU(const S: String; out Value: Single; const AFormatSettings: TALFormatSettingsU): Boolean; overload; inline;
var ALStrToCurrU: function(const S: string; const AFormatSettings: TALFormatSettingsU): Currency;
var ALStrToCurrDefU: function(const S: string; const Default: Currency; const AFormatSettings: TALFormatSettingsU): Currency;
var ALTryStrToCurrU: function(const S: string; out Value: Currency; const AFormatSettings: TALFormatSettingsU): Boolean;
var ALPosU: function(const SubStr, Str: UnicodeString; Offset: Integer = 1): Integer;
var ALPosExU: function(const SubStr, S: string; Offset: Integer = 1): Integer;
function ALPosExIgnoreCaseU(const SubStr, S: String; Offset: Integer = 1): Integer;
var AlUpperCaseU: function(const S: string): string;
var AlLowerCaseU: function(const S: string): string;
var AlUpCaseU: function(Ch: WideChar): WideChar;
function AlLoCaseU(Ch: WideChar): WideChar;
var ALCompareStrU: function(const S1, S2: string): Integer;
var ALSameStrU: function(const S1, S2: string): Boolean;
var ALCompareTextU: function(const S1, S2: string): Integer;
var ALSameTextU: function(const S1, S2: string): Boolean;
var ALTrimU: function(const S: string): string;
var ALTrimLeftU: function(const S: string): string;
var ALTrimRightU: function(const S: string): string;
function ALQuotedStrU(const S: String; const Quote: Char = ''''): String;
var ALDequotedStrU: function(const S: string; AQuote: Char): string;
function ALExtractQuotedStrU(var Src: PChar; Quote: Char): String;
var ALLastDelimiterU: function(const Delimiters, S: string): Integer;
function ALIsPathDelimiterU(const S: String; Index: Integer; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): Boolean;
function ALIncludeTrailingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
function ALExcludeTrailingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
function ALIncludeLeadingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
function ALExcludeLeadingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
procedure ALStrMoveU(const Source: PChar; var Dest: PChar; Count: NativeInt); inline;
function ALCopyStrU(const aSourceString: String; aStart, aLength: Integer): String; overload;
procedure ALCopyStrU(const aSourceString: String; var aDestString: String; aStart, aLength: Integer); overload;
function ALCopyStrU(const aSourceString: String;
const aStartStr: String;
const aEndStr: String;
const aOffset: integer = 1;
const aRaiseExceptionIfNotFound: Boolean = True): String; overload;
var ALStringReplaceU: function(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;
{$IFNDEF NEXTGEN}
type
TALTagParamsClass = class of TalStrings;
TALBasePrecompiledTag = Class(Tobject)
private
fTagString: ansiString;
protected
function GetTagParams: TALStrings; virtual; abstract;
public
property TagString: ansiString read fTagString write fTagString;
property TagParams: TALStrings read GetTagParams;
End;
TALPrecompiledTag = Class(TALBasePrecompiledTag)
private
fTagParams: TALStrings;
protected
function GetTagParams: TALStrings; override;
public
constructor Create;
destructor Destroy; override;
End;
TALHandleTagfunct = function(const TagString: AnsiString;
TagParams: TALStrings;
ExtData: pointer;
Var Handled: Boolean): AnsiString;
TALHandleTagExtendedfunct = function(const TagString: AnsiString;
TagParams: TALStrings;
ExtData: pointer;
Var Handled: Boolean;
Const SourceString: AnsiString;
Var TagPosition, TagLength: integer): AnsiString;
TALHandleTagPrecompileFunct = function(const TagString: AnsiString;
TagParams: TALStrings;
ExtData: pointer;
Const SourceString: AnsiString;
Var TagPosition, TagLength: integer): TALBasePrecompiledTag;
function ALFastTagReplacePrecompile(Const SourceString, TagStart, TagEnd: AnsiString;
PrecompileProc: TALHandleTagPrecompileFunct;
StripParamQuotes: Boolean;
ExtData: Pointer;
TagsContainer: TObjectList;
Const flags: TReplaceFlags=[]): AnsiString; // rfreplaceall is ignored here, only rfIgnoreCase is matter
function ALFastTagReplace(Const SourceString, TagStart, TagEnd: AnsiString;
ReplaceProc: TALHandleTagFunct;
ReplaceExtendedProc: TALHandleTagExtendedfunct;
StripParamQuotes: Boolean;
Flags: TReplaceFlags;
ExtData: Pointer;
TagParamsClass: TALTagParamsClass;
const TagReplaceProcResult: Boolean = False): AnsiString; overload;
function ALFastTagReplace(const SourceString, TagStart, TagEnd: AnsiString;
ReplaceProc: TALHandleTagFunct;
StripParamQuotes: Boolean;
ExtData: Pointer;
Const flags: TReplaceFlags=[rfreplaceall];
const TagReplaceProcResult: Boolean = False): AnsiString; overload;
function ALFastTagReplace(const SourceString, TagStart, TagEnd: AnsiString;
ReplaceExtendedProc: TALHandleTagExtendedfunct;
StripParamQuotes: Boolean;
ExtData: Pointer;
Const flags: TReplaceFlags=[rfreplaceall];
const TagReplaceProcResult: Boolean = False): AnsiString; overload;
function ALFastTagReplace(const SourceString, TagStart, TagEnd: AnsiString;
const ReplaceWith: AnsiString;
const Flags: TReplaceFlags=[rfreplaceall]): AnsiString; overload;
function ALExtractTagParams(Const SourceString, TagStart, TagEnd: AnsiString;
StripParamQuotes: Boolean;
TagParams: TALStrings;
IgnoreCase: Boolean): Boolean;
Procedure ALSplitTextAndTag(Const SourceString, TagStart, TagEnd: AnsiString;
SplitTextAndTagLst: TALStrings;
IgnoreCase: Boolean);
{$ENDIF}
{$IFNDEF NEXTGEN}
function ALRandomStr(const aLength: Longint; const aCharset: Array of ansiChar): AnsiString; overload;
function ALRandomStr(const aLength: Longint): AnsiString; overload;
function ALNEVExtractName(const S: AnsiString): AnsiString;
function ALNEVExtractValue(const s: AnsiString): AnsiString;
function ALGetStringFromFile(const filename: AnsiString; const ShareMode: Word = fmShareDenyWrite): AnsiString;
function ALGetStringFromFileWithoutUTF8BOM(const filename: AnsiString; const ShareMode: Word = fmShareDenyWrite): AnsiString;
procedure ALAppendStringToFile(const Str: AnsiString; const FileName: AnsiString);
procedure ALSaveStringtoFile(const Str: AnsiString; const filename: AnsiString);
{$IF defined(MSWINDOWS)}
Function ALWideNormalize(const S: Widestring;
const WordSeparator: WideChar;
const SymbolsToIgnore: array of WideChar): Widestring; overload;
Function ALWideNormalize(const S: Widestring;
const WordSeparator: WideChar = '-'): Widestring; overload;
Function ALWideRemoveDiacritic(const S: Widestring): Widestring;
Function ALWideExpandLigatures(const S: Widestring): Widestring;
Function ALWideUpperCaseNoDiacritic(const S: Widestring): Widestring;
Function ALWideLowerCaseNoDiacritic(const S: Widestring): Widestring;
Function ALUTF8RemoveDiacritic(const S: AnsiString): AnsiString;
Function ALUTF8ExpandLigatures(const S: AnsiString): AnsiString;
Function ALUTF8UpperCaseNoDiacritic(const S: AnsiString): AnsiString;
Function ALUTF8LowerCaseNoDiacritic(const S: AnsiString): AnsiString;
Function ALUTF8Normalize(const S: AnsiString;
const WordSeparator: ansiChar;
const SymbolsToIgnore: array of AnsiChar): AnsiString; overload;
Function ALUTF8Normalize(const S: AnsiString;
const WordSeparator: ansiChar = '-'): AnsiString; overload;
function AlUTF8Check(const S: AnsiString): Boolean;
{$IFEND}
function ALUTF8UpperCase(const s: AnsiString): AnsiString;
function ALUTF8LowerCase(const s: AnsiString): AnsiString;
function AlUTF8removeBOM(const S: AnsiString): AnsiString;
function AlUTF8DetectBOM(const P: PAnsiChar; const Size: Integer): Boolean;
function ALUTF8CharSize(Lead: AnsiChar): Integer;
function ALUTF8CharCount(const S: AnsiString): Integer;
Function ALUTF8ByteTrunc(const s:AnsiString; const Count: Integer): AnsiString;
Function ALUTF8CharTrunc(const s:AnsiString; const Count: Integer): AnsiString;
Function ALUTF8UpperFirstChar(const s:AnsiString): AnsiString;
Function ALUTF8TitleCase(const s:AnsiString): AnsiString;
Function ALUTF8SentenceCase(const s:AnsiString): AnsiString;
{$IF defined(MSWINDOWS)}
Function ALStringToWideString(const S: RawByteString; const aCodePage: Word): WideString;
function AlWideStringToString(const WS: WideString; const aCodePage: Word): AnsiString;
Function ALGetCodePageFromLCID(const aLCID:Integer): Word;
{$IFEND}
Function ALUTF8Encode(const S: RawByteString; const aCodePage: Word): AnsiString;
Function ALUTF8decode(const S: UTF8String; const aCodePage: Word): AnsiString;
Function ALGetCodePageFromCharSetName(Acharset:AnsiString): Word;
Function ALUTF8ISO91995CyrillicToLatin(const aCyrillicText: AnsiString): AnsiString;
Function ALUTF8BGNPCGN1947CyrillicToLatin(const aCyrillicText: AnsiString): AnsiString;
function ALExtractExpression(const S: AnsiString;
const OpenChar, CloseChar: AnsiChar; // ex: '(' and ')'
Const QuoteChars: Array of ansiChar; // ex: ['''', '"']
Const EscapeQuoteChar: ansiChar; // ex: '\' or #0 to ignore
var StartPos: integer;
var EndPos: integer): boolean;
function ALHTTPEncode(const AStr: AnsiString): AnsiString;
function ALHTTPDecode(const AStr: AnsiString): AnsiString;
procedure ALExtractHeaderFields(Separators,
WhiteSpace,
Quotes: TSysCharSet;
Content: PAnsiChar;
Strings: TALStrings;
HttpDecode: Boolean;
StripQuotes: Boolean = False);
procedure ALExtractHeaderFieldsWithQuoteEscaped(Separators,
WhiteSpace,
Quotes: TSysCharSet;
Content: PAnsiChar;
Strings: TALStrings;
HttpDecode: Boolean;
StripQuotes: Boolean = False);
{$ENDIF}
function ALGetBytesFromStream(const aStream : TStream): Tbytes;
function ALGetBytesFromFileU(const filename: String; const ShareMode: Word = fmShareDenyWrite): Tbytes;
function ALGetStringFromBufferU(const buf : TBytes; const ADefaultEncoding: TEncoding): String;
function ALGetStringFromStreamU(const aStream : TStream; const ADefaultEncoding: TEncoding) : String;
function ALGetStringFromFileU(const filename: String; const ADefaultEncoding: TEncoding; const ShareMode: Word = fmShareDenyWrite): String;
procedure ALSaveStringtoFileU(const Str: String; const filename: String; AEncoding: TEncoding; const WriteBOM: boolean = False);
function ALRandomStrU(const aLength: Longint; const aCharset: Array of Char): String; overload;
function ALRandomStrU(const aLength: Longint): String; overload;
function ALHTTPEncodeU(const AStr: String): String;
function ALHTTPDecodeU(const AStr: String): String;
{$WARN SYMBOL_DEPRECATED OFF}
procedure ALExtractHeaderFieldsWithQuoteEscapedU(Separators,
WhiteSpace,
Quotes: TSysCharSet;
Content: PChar;
Strings: TALStringsU;
HttpDecode: Boolean;
StripQuotes: Boolean = False);
{$WARN SYMBOL_DEPRECATED ON}
{$IFNDEF NEXTGEN}
Const cAlUTF8Bom = ansiString(#$EF) + ansiString(#$BB) + ansiString(#$BF);
cAlUTF16LittleEndianBom = ansiString(#$FF) + ansiString(#$FE);
cAlUTF16bigEndianBom = ansiString(#$FE) + ansiString(#$FF);
cAlUTF32LittleEndianBom = ansiString(#$FF) + ansiString(#$FE) + ansiString(#$00) + ansiString(#$00);
cAlUTF32BigEndianBom = ansiString(#$00) + ansiString(#$00) + ansiString(#$FE) + ansiString(#$FF);
{$ENDIF}
Procedure ALStringInitialization;
procedure ALStringFinalization;
implementation
uses System.SysConst,
System.RTLConsts,
System.StrUtils,
{$IF (not defined(NEXTGEN)) and (CompilerVersion <= 32)}{Delphi Tokyo}
System.RegularExpressionsAPI,
System.RegularExpressionsConsts,
{$IFEND}
{$IF CompilerVersion >= 31} // berlin
system.netencoding,
{$IFEND}
{$IFNDEF NEXTGEN}
System.Ansistrings,
{$ENDIF}
System.Character,
System.Math,
ALcommon;
{$IFNDEF NEXTGEN}
{*****************************************************}
constructor EALException.Create(const Msg: AnsiString);
begin
inherited create(String(Msg));
end;
{************************************************************************************}
constructor EALException.CreateFmt(const Msg: ansistring; const Args: array of const);
begin
inherited CreateFmt(String(Msg), Args);
end;
{************************************************************}
constructor TALStringStream.Create(const AString: AnsiString);
begin
inherited Create;
FDataString := AString;
end;
{*****************************************************************}
function TALStringStream.Read(var Buffer; Count: Longint): Longint;
begin
Result := Length(FDataString) - FPosition;
if Result > Count then Result := Count;
// a little modification from the original TStringStream
// because in original we will have a call to uniqueString on FDataString :(
// https://forums.embarcadero.com/thread.jspa?threadID=119103
// ALMove(PAnsiChar(@FDataString[FPosition + SizeOf(AnsiChar)])^, Buffer, Result * SizeOf(AnsiChar));
ALMove(Pbyte(FDataString)[FPosition], Buffer, Result * SizeOf(AnsiChar));
Inc(FPosition, Result);
end;
{********************************************************************}
function TALStringStream.Write(const Buffer; Count: Longint): Longint;
begin
Result := Count;
// a little modification from the original TStringStream
// because in original it's crazy we can not update part inside the datastring !!
// SetLength(FDataString, (FPosition + Result));
if FPosition + Result > length(FDataString) then SetLength(FDataString, (FPosition + Result));
ALMove(Buffer, PAnsiChar(@FDataString[FPosition + SizeOf(AnsiChar)])^, Result * SizeOf(AnsiChar));
Inc(FPosition, Result);
end;
{********************************************************************}
function TALStringStream.Seek(Offset: Longint; Origin: Word): Longint;
begin
case Origin of
soFromBeginning: FPosition := Offset;
soFromCurrent: FPosition := FPosition + Offset;
soFromEnd: FPosition := Length(FDataString) - Offset;
end;
if FPosition > Length(FDataString) then
FPosition := Length(FDataString)
else if FPosition < 0 then FPosition := 0;
Result := FPosition;
end;
{**************************************************************}
function TALStringStream.ReadString(Count: Longint): AnsiString;
var
Len: Integer;
begin
Len := Length(FDataString) - FPosition;
if Len > Count then Len := Count;
SetString(Result, PAnsiChar(@FDataString[FPosition + SizeOf(AnsiChar)]), Len);
Inc(FPosition, Len);
end;
{***************************************************************}
procedure TALStringStream.WriteString(const AString: AnsiString);
begin
Write(PAnsiChar(AString)^, Length(AString));
end;
{**************************************************}
procedure TALStringStream.SetSize(NewSize: Longint);
begin
SetLength(FDataString, NewSize);
if FPosition > NewSize then FPosition := NewSize;
end;
{**********************}
{$IF defined(MSWINDOWS)}
class function TALFormatSettings.Create(Locale: LCID): TALFormatSettings;
var aFormatSettings: TformatSettings;
i: integer;
begin
{$WARN SYMBOL_PLATFORM OFF}
aFormatSettings:= TformatSettings.Create(Locale);
{$WARN SYMBOL_PLATFORM ON}
with result do begin
CurrencyString := AnsiString(aFormatSettings.CurrencyString);
CurrencyFormat := aFormatSettings.CurrencyFormat;
CurrencyDecimals := aFormatSettings.CurrencyDecimals;
DateSeparator := AnsiChar(aFormatSettings.DateSeparator);
TimeSeparator := AnsiChar(aFormatSettings.TimeSeparator);
ListSeparator := AnsiChar(aFormatSettings.ListSeparator);
ShortDateFormat := AnsiString(aFormatSettings.ShortDateFormat);
LongDateFormat := AnsiString(aFormatSettings.LongDateFormat);
TimeAMString := AnsiString(aFormatSettings.TimeAMString);
TimePMString := AnsiString(aFormatSettings.TimePMString);
ShortTimeFormat := AnsiString(aFormatSettings.ShortTimeFormat);
LongTimeFormat := AnsiString(aFormatSettings.LongTimeFormat);
for I := Low(ShortMonthNames) to High(ShortMonthNames) do
ShortMonthNames[i] := AnsiString(aFormatSettings.ShortMonthNames[i]);
for I := Low(LongMonthNames) to High(LongMonthNames) do
LongMonthNames[i] := AnsiString(aFormatSettings.LongMonthNames[i]);
for I := Low(ShortDayNames) to High(ShortDayNames) do
ShortDayNames[i] := AnsiString(aFormatSettings.ShortDayNames[i]);
for I := Low(LongDayNames) to High(LongDayNames) do
LongDayNames[i] := AnsiString(aFormatSettings.LongDayNames[i]);
{$IF CompilerVersion >= 28} {Delphi XE7}
setlength(EraInfo, length(aFormatSettings.EraInfo));
for I := Low(aFormatSettings.EraInfo) to High(aFormatSettings.EraInfo) do begin
EraInfo[i].EraName := ansiString(aFormatSettings.EraInfo[i].EraName);
EraInfo[i].EraOffset := aFormatSettings.EraInfo[i].EraOffset;
EraInfo[i].EraStart := aFormatSettings.EraInfo[i].EraStart;
EraInfo[i].EraEnd := aFormatSettings.EraInfo[i].EraEnd;
end;
{$else}
setlength(EraInfo, MaxEraCount);
for I := 1 to MaxEraCount do begin
EraInfo[i-1].EraName := ansiString(EraNames[i]);
EraInfo[i-1].EraOffset := EraYearOffsets[i];
{$IFDEF POSIX}
EraInfo[i-1].EraStart := EraRanges[i].StartDate;
EraInfo[i-1].EraEnd := EraRanges[i].EndDate;
{$ENDIF POSIX}
end;
{$ifend}
ThousandSeparator := AnsiChar(aFormatSettings.ThousandSeparator);
DecimalSeparator := AnsiChar(aFormatSettings.DecimalSeparator);
TwoDigitYearCenturyWindow := aFormatSettings.TwoDigitYearCenturyWindow;
NegCurrFormat := aFormatSettings.NegCurrFormat;
end;
end;
{$IFEND}
{***************************************************************************************}
class function TALFormatSettings.Create(const LocaleName: AnsiString): TALFormatSettings;
var aFormatSettings: TformatSettings;
i: integer;
begin
aFormatSettings:= TformatSettings.Create(String(LocaleName));
with result do begin
CurrencyString := AnsiString(aFormatSettings.CurrencyString);
CurrencyFormat := aFormatSettings.CurrencyFormat;
CurrencyDecimals := aFormatSettings.CurrencyDecimals;
DateSeparator := AnsiChar(aFormatSettings.DateSeparator);
TimeSeparator := AnsiChar(aFormatSettings.TimeSeparator);
ListSeparator := AnsiChar(aFormatSettings.ListSeparator);
ShortDateFormat := AnsiString(aFormatSettings.ShortDateFormat);
LongDateFormat := AnsiString(aFormatSettings.LongDateFormat);
TimeAMString := AnsiString(aFormatSettings.TimeAMString);
TimePMString := AnsiString(aFormatSettings.TimePMString);
ShortTimeFormat := AnsiString(aFormatSettings.ShortTimeFormat);
LongTimeFormat := AnsiString(aFormatSettings.LongTimeFormat);
for I := Low(ShortMonthNames) to High(ShortMonthNames) do
ShortMonthNames[i] := AnsiString(aFormatSettings.ShortMonthNames[i]);
for I := Low(LongMonthNames) to High(LongMonthNames) do
LongMonthNames[i] := AnsiString(aFormatSettings.LongMonthNames[i]);
for I := Low(ShortDayNames) to High(ShortDayNames) do
ShortDayNames[i] := AnsiString(aFormatSettings.ShortDayNames[i]);
for I := Low(LongDayNames) to High(LongDayNames) do
LongDayNames[i] := AnsiString(aFormatSettings.LongDayNames[i]);
{$IF CompilerVersion >= 28} {Delphi XE7}
setlength(EraInfo, length(aFormatSettings.EraInfo));
for I := Low(aFormatSettings.EraInfo) to High(aFormatSettings.EraInfo) do begin
EraInfo[i].EraName := ansiString(aFormatSettings.EraInfo[i].EraName);
EraInfo[i].EraOffset := aFormatSettings.EraInfo[i].EraOffset;
EraInfo[i].EraStart := aFormatSettings.EraInfo[i].EraStart;
EraInfo[i].EraEnd := aFormatSettings.EraInfo[i].EraEnd;
end;
{$else}
setlength(EraInfo, MaxEraCount);
for I := 1 to MaxEraCount do begin
EraInfo[i-1].EraName := ansiString(EraNames[i]);
EraInfo[i-1].EraOffset := EraYearOffsets[i];
{$IFDEF POSIX}
EraInfo[i-1].EraStart := EraRanges[i].StartDate;
EraInfo[i-1].EraEnd := EraRanges[i].EndDate;
{$ENDIF POSIX}
end;
{$ifend}
ThousandSeparator := AnsiChar(aFormatSettings.ThousandSeparator);
DecimalSeparator := AnsiChar(aFormatSettings.DecimalSeparator);
TwoDigitYearCenturyWindow := aFormatSettings.TwoDigitYearCenturyWindow;
NegCurrFormat := aFormatSettings.NegCurrFormat;
end;
end;
{***************************************************************************}
function TALFormatSettings.GetEraYearOffset(const Name: ansistring): Integer;
var
I: Integer;
begin
Result := 0;
for I := Low(EraInfo) to High(EraInfo) do
begin
if EraInfo[I].EraName = '' then Break;
if ALPos(EraInfo[I].EraName, Name) > 0 then
begin
Result := EraInfo[I].EraOffset;
Exit;
end;
end;
end;
{*********************************************************}
class function TALFormatSettings.Create: TALFormatSettings;
begin
Result := TALFormatSettings.Create('');
end;
{***********************************************************************************}
function ALGetFormatSettingsID(const aFormatSettings: TALFormatSettings): AnsiString;
begin
With aFormatSettings do begin
Result := ALIntToStr(CurrencyFormat) + '#' +
ALIntToStr(CurrencyDecimals) + '#' +
DateSeparator + '#' +
TimeSeparator + '#' +
ListSeparator + '#' +
ShortDateFormat + '#' +
LongDateFormat + '#' +
ShortTimeFormat + '#' +
LongTimeFormat + '#' +
ThousandSeparator + '#' +
DecimalSeparator + '#' +
ALIntToStr(TwoDigitYearCenturyWindow) + '#' +
ALIntToStr(NegCurrFormat);
end;
end;
{**********************}
{$IF defined(MSWINDOWS)}
procedure ALGetLocaleFormatSettings(Locale: LCID; var AFormatSettings: TALFormatSettings);
begin
AFormatSettings := TALFormatSettings.Create(Locale);
end;
{$IFEND}
{**********************************************************}
function ALGUIDToByteString(const Guid: TGUID): Ansistring;
var aByteArray: TBytes;
begin
aByteArray := Guid.ToByteArray;
SetString(result, PAnsiChar(@aByteArray[0]), length(aByteArray));
end;
{****************************************}
function ALNewGUIDByteString: Ansistring;
var aGuid: TGUID;
begin
if CreateGUID(aGUID) <> S_OK then RaiseLastOSError;
result := ALGUIDToByteString(aGuid);
end;
{***********************************************************************************************************************************}
function ALGUIDToString(const Guid: TGUID; const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): Ansistring;
begin
if WithoutBracket then begin
if WithoutHyphen then begin
SetLength(Result, 32);
System.Ansistrings.StrLFmt(PAnsiChar(Result), 32,'%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end
else begin
SetLength(Result, 36);
System.Ansistrings.StrLFmt(PAnsiChar(Result), 36,'%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end;
end
else begin
if WithoutHyphen then begin
SetLength(Result, 34);
System.Ansistrings.StrLFmt(PAnsiChar(Result), 34,'{%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x}', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end
else begin
SetLength(Result, 38);
System.Ansistrings.StrLFmt(PAnsiChar(Result), 38,'{%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end;
end;
end;
{*****************************************************************************************************************}
Function ALNewGUIDString(const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): AnsiString;
Var aGUID: TGUID;
Begin
if CreateGUID(aGUID) <> S_OK then RaiseLastOSError;
Result := ALGUIDToString(aGUID, WithoutBracket, WithoutHyphen);
End;
{$ENDIF !NEXTGEN}
{*******************************}
Function ALNewGUIDBytes: TBytes;
Var aGUID: TGUID;
Begin
if CreateGUID(aGUID) <> S_OK then RaiseLastOSError;
SetLength(Result, 16);
ALMove(aGuid.D1, Result[0], 4); // D1: Cardinal;
ALMove(aGuid.D2, Result[4], 2); // D2: Word;
ALMove(aGuid.D3, Result[6], 2); // D3: Word;
ALMove(aGuid.D4[0], Result[8], 8); // D4: array[0..7] of Byte;
End;
{********************************************************************************************************************************}
function ALGUIDToStringU(const Guid: TGUID; const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): string;
begin
if WithoutBracket then begin
if WithoutHyphen then begin
SetLength(Result, 32);
StrLFmt(PChar(Result), 32,'%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end
else begin
SetLength(Result, 36);
StrLFmt(PChar(Result), 36,'%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end;
end
else begin
if WithoutHyphen then begin
SetLength(Result, 34);
StrLFmt(PChar(Result), 34,'{%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x}', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end
else begin
SetLength(Result, 38);
StrLFmt(PChar(Result), 38,'{%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}', // do not localize
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end;
end;
end;
{**************************************************************************************************************}
Function ALNewGUIDStringU(const WithoutBracket: boolean = false; const WithoutHyphen: boolean = false): String;
Var aGUID: TGUID;
Begin
if CreateGUID(aGUID) <> S_OK then RaiseLastOSError;
Result := ALGUIDToStringU(aGUID, WithoutBracket, WithoutHyphen);
End;
{$IFNDEF NEXTGEN}
//
//TALMask is taken from delphi seattle upd1
//
{***}
const
MaxCards = 30;
{***************************************************************}
function TALMask.InitMaskStates(const Mask: ansistring): Integer;
var
I: Integer;
SkipTo: Boolean;
Literal: ansiChar;
LeadByte, TrailByte: ansiChar;
P: PansiChar;
Negate: Boolean;
CharSet: TALMaskSet;
Cards: Integer;
procedure InvalidMask;
begin
raise EALMaskException.CreateResFmt(@SInvalidMask, [Mask,
P - PansiChar(Mask) + 1]);
end;
procedure Reset;
begin
SkipTo := False;
Negate := False;
CharSet := [];
end;
procedure WriteScan(MaskState: TALMaskStates);
begin
if I <= High(FMaskStates) then
begin
if SkipTo then
begin
Inc(Cards);
if Cards > MaxCards then InvalidMask;
end;
FMaskStates[I].SkipTo := SkipTo;
FMaskStates[I].State := MaskState;
case MaskState of
msLiteral: FMaskStates[I].Literal := UpCase(Literal);
msSet:
begin
FMaskStates[I].Negate := Negate;
New(FMaskStates[I].CharSet);
FMaskStates[I].CharSet^ := CharSet;
end;
msMBCSLiteral:
begin
FMaskStates[I].LeadByte := LeadByte;
FMaskStates[I].TrailByte := TrailByte;
end;
end;
end;
Inc(I);
Reset;
end;
procedure ScanSet;
var
LastChar: ansiChar;
C: ansiChar;
begin
Inc(P);
if P^ = '!' then
begin
Negate := True;
Inc(P);
end;
LastChar := #0;
while not (P^ in [#0, ']']) do
begin
// MBCS characters not supported in msSet!
//if IsLeadChar(P^) then
// Inc(P)
//else
case P^ of
'-':
if LastChar = #0 then InvalidMask
else
begin
Inc(P);
for C := LastChar to UpCase(P^) do
CharSet := CharSet + [C];
end;
else
LastChar := UpCase(P^);
CharSet := CharSet + [LastChar];
end;
Inc(P);
end;
if (P^ <> ']') or (CharSet = []) then InvalidMask;
WriteScan(msSet);
end;
begin
P := PansiChar(Mask);
I := 0;
Cards := 0;
Reset;
while P^ <> #0 do
begin
case P^ of
'*': SkipTo := True;
'?': if not SkipTo then WriteScan(msAny);
'[': ScanSet;
else
//if IsLeadChar(P^) then
//begin
// LeadByte := P^;
// Inc(P);
// TrailByte := P^;
// WriteScan(msMBCSLiteral);
//end
//else
begin
Literal := P^;
WriteScan(msLiteral);
end;
end;
Inc(P);
end;
Literal := #0;
WriteScan(msLiteral);
Result := I;
end;
{**********************************************************************}
function TALMask.MatchesMaskStates(const Filename: ansistring): Boolean;
type
TStackRec = record
sP: PansiChar;
sI: Integer;
end;
var
T: Integer;
S: array of TStackRec;
I: Integer;
P: PansiChar;
procedure Push(P: PansiChar; I: Integer);
begin
S[T].sP := P;
S[T].sI := I;
Inc(T);
end;
function Pop(var P: PansiChar; var I: Integer): Boolean;
begin
if T = 0 then
Result := False
else
begin
Dec(T);
P := S[T].sP;
I := S[T].sI;
Result := True;
end;
end;
function Matches(P: PansiChar; Start: Integer): Boolean;
var
I: Integer;
begin
Result := False;
for I := Start to High(FMaskStates) do
begin
if FMaskStates[I].SkipTo then
begin
case FMaskStates[I].State of
msLiteral:
while (P^ <> #0) and (UpCase(P^) <> FMaskStates[I].Literal) do Inc(P);
msSet:
while (P^ <> #0) and not (FMaskStates[I].Negate xor (UpCase(P^) in FMaskStates[I].CharSet^)) do Inc(P);
msMBCSLiteral:
while (P^ <> #0) do
begin
if (P^ <> FMaskStates[I].LeadByte) then Inc(P, 2)
else
begin
Inc(P);
if (P^ = FMaskStates[I].TrailByte) then Break;
Inc(P);
end;
end;
end;
if P^ <> #0 then
Push(@P[1], I);
end;
case FMaskStates[I].State of
msLiteral: if UpCase(P^) <> FMaskStates[I].Literal then Exit;
msSet: if not (FMaskStates[I].Negate xor (UpCase(P^) in FMaskStates[I].CharSet^)) then Exit;
msMBCSLiteral:
begin
if P^ <> FMaskStates[I].LeadByte then Exit;
Inc(P);
if P^ <> FMaskStates[I].TrailByte then Exit;
end;
msAny:
if P^ = #0 then
begin
Result := False;
Exit;
end;
end;
Inc(P);
end;
Result := True;
end;
begin
SetLength(S, MaxCards);
Result := True;
T := 0;
P := PansiChar(Filename);
I := Low(FMaskStates);
repeat
if Matches(P, I) then Exit;
until not Pop(P, I);
Result := False;
end;
{*******************************}
procedure TALMask.DoneMaskStates;
var
I: Integer;
begin
for I := Low(FMaskStates) to High(FMaskStates) do
if FMaskStates[I].State = msSet then Dispose(FMaskStates[I].CharSet);
end;
{****************************************************}
constructor TALMask.Create(const MaskValue: ansistring);
var
Size: Integer;
begin
inherited Create;
SetLength(FMaskStates, 1);
Size := InitMaskStates(MaskValue);
DoneMaskStates;
SetLength(FMaskStates, Size);
InitMaskStates(MaskValue);
end;
{*************************}
destructor TALMask.Destroy;
begin
DoneMaskStates;
SetLength(FMaskStates, 0);
inherited;
end;
{************************************************************}
function TALMask.Matches(const Filename: ansistring): Boolean;
begin
Result := MatchesMaskStates(Filename);
end;
{****************************************************************}
function ALMatchesMask(const Filename, Mask: ansistring): Boolean;
var
CMask: TALMask;
begin
CMask := TALMask.Create(Mask);
try
Result := CMask.Matches(Filename);
finally
CMask.Free;
end;
end;
{$ENDIF !NEXTGEN}
{$IF (not defined(NEXTGEN)) and (CompilerVersion <= 32)}{Delphi Tokyo}
{****************************************************}
function ALPerlRegExFirstCap(const S: string): string;
begin
if S = '' then
Result := ''
else
begin
Result := LowerCase(S);
Result[1] := UpperCase(S[1])[1];
end
end;
{*******************************************************}
function ALPerlRegExInitialCaps(const S: string): string;
var
I: Integer;
Up: Boolean;
begin
Result := LowerCase(S);
Up := True;
for I := 1 to Length(Result) do
begin
case Result[I] of
#0..'&', '(', '*', '+', ',', '-', '.', '?', '<', '[', '{', #$00B7:
Up := True
else
if Up and (Result[I] <> '''') then
begin
Result[1] := UpperCase(S[1])[1];
Up := False
end
end;
end;
end;
{*****************************}
procedure TALPerlRegEx.CleanUp;
begin
FCompiled := False;
FStudied := False;
pcre_dispose(FPattern, FHints, nil);
FPattern := nil;
FHints := nil;
ClearStoredGroups;
OffsetCount := 0;
end;
{***************************************}
procedure TALPerlRegEx.ClearStoredGroups;
begin
FHasStoredGroups := False;
FStoredGroups := nil;
end;
{***************************************************************************}
function TALPerlRegEx.Compile(const RaiseException: boolean = True): boolean;
var
Error: PAnsiChar;
ErrorOffset: Integer;
begin
result := False;
CleanUp;
if FRegEx = '' then begin
if RaiseException then raise ERegularExpressionError.CreateRes(@SRegExMissingExpression)
else exit;
end;
FPattern := pcre_compile(PAnsiChar(FRegEx), FPCREOptions, @Error, @ErrorOffset, FCharTable);
if FPattern = nil then begin
if RaiseException then raise ERegularExpressionError.CreateResFmt(@SRegExExpressionError, [ErrorOffset, String(Error)])
else exit;
end;
FCompiled := True;
result := True;
end;
(* Backreference overview:
Assume there are 13 backreferences:
Text TALPerlRegEx .NET Java ECMAScript
$17 $1 + "7" "$17" $1 + "7" $1 + "7"
$017 $1 + "7" "$017" $1 + "7" $1 + "7"
$12 $12 $12 $12 $12
$012 $1 + "2" $12 $12 $1 + "2"
${1}2 $1 + "2" $1 + "2" error "${1}2"
$$ "$" "$" error "$"
\$ "$" "\$" "$" "\$"
*)
{***************************************************}
function TALPerlRegEx.ComputeReplacement: AnsiString;
var
Mode: AnsiChar;
S: AnsiString;
I, J, N: Integer;
procedure ReplaceBackreference(Number: Integer);
var
Backreference: AnsiString;
begin
Delete(S, I, J-I);
if Number <= GroupCount then
begin
Backreference := Groups[Number];
if Backreference <> '' then
begin
// Ignore warnings; converting to UTF-8 does not cause data loss
case Mode of
'L', 'l': Backreference := AnsiString(LowerCase(String(Backreference)));
'U', 'u': Backreference := AnsiString(UpperCase(String(Backreference)));
'F', 'f': Backreference := AnsiString(ALPerlRegExFirstCap(String(Backreference)));
'I', 'i': Backreference := AnsiString(ALPerlRegExInitialCaps(String(Backreference)));
end;
if S <> '' then
begin
Insert(Backreference, S, I);
I := I + Length(Backreference);
end
else
begin
S := Backreference;
I := MaxInt;
end
end;
end
end;
procedure ProcessBackreference(NumberOnly, Dollar: Boolean);
var
Number, Number2: Integer;
Group: AnsiString;
begin
Number := -1;
if (J <= Length(S)) and (S[J] in ['0'..'9']) then
begin
// Get the number of the backreference
Number := Ord(S[J]) - Ord('0');
Inc(J);
if (J <= Length(S)) and (S[J] in ['0'..'9']) then
begin
// Expand it to two digits only if that would lead to a valid backreference
Number2 := Number*10 + Ord(S[J]) - Ord('0');
if Number2 <= GroupCount then
begin
Number := Number2;
Inc(J)
end;
end;
end
else if not NumberOnly then
begin
if Dollar and (J < Length(S)) and (S[J] = '{') then
begin
// Number or name in curly braces
Inc(J);
case S[J] of
'0'..'9':
begin
Number := Ord(S[J]) - Ord('0');
Inc(J);
while (J <= Length(S)) and (S[J] in ['0'..'9']) do
begin
Number := Number*10 + Ord(S[J]) - Ord('0');
Inc(J)
end;
end;
'A'..'Z', 'a'..'z', '_':
begin
Inc(J);
while (J <= Length(S)) and (S[J] in ['A'..'Z', 'a'..'z', '0'..'9', '_']) do
Inc(J);
if (J <= Length(S)) and (S[J] = '}') then
begin
Group := ALCopyStr(S, I+2, J-I-2);
Number := NamedGroup(Group);
end
end;
end;
if (J > Length(S)) or (S[J] <> '}') then
Number := -1
else
Inc(J);
end
else if Dollar and (S[J] = '_') then
begin
// $_ (whole subject)
Delete(S, I, J+1-I);
Insert(Subject, S, I);
I := I + Length(Subject);
Exit;
end
else
case S[J] of
'&':
begin
// \& or $& (whole regex match)
Number := 0;
Inc(J);
end;
'+':
begin
// \+ or $+ (highest-numbered participating group)
Number := GroupCount;
Inc(J);
end;
'`':
begin
// \` or $` (backtick; subject to the left of the match)
Delete(S, I, J+1-I);
Insert(SubjectLeft, S, I);
I := I + Offsets[0] - 1;
Exit;
end;
'''':
begin
// \' or $' (straight quote; subject to the right of the match)
Delete(S, I, J+1-I);
Insert(SubjectRight, S, I);
I := I + Length(Subject) - Offsets[1];
Exit;
end
end;
end;
if Number >= 0 then
ReplaceBackreference(Number)
else
Inc(I)
end;
begin
S := FReplacement;
I := 1;
while I < Length(S) do
begin
case S[I] of
'\':
begin
J := I + 1;
// We let I stop one character before the end, so J cannot point
// beyond the end of the AnsiString here
if J > Length(S) then
raise ERegularExpressionError.CreateResFmt(@SRegExIndexOutOfBounds, [J]);
case S[J] of
'$', '\':
begin
Delete(S, I, 1);
Inc(I);
end;
'g':
begin
if (J < Length(S)-1) and (S[J+1] = '<') and (S[J+2] in ['A'..'Z', 'a'..'z', '_']) then
begin
// Python-style named group reference \g<name>
J := J+3;
while (J <= Length(S)) and (S[J] in ['0'..'9', 'A'..'Z', 'a'..'z', '_']) do
Inc(J);
if (J <= Length(S)) and (S[J] = '>') then
begin
N := NamedGroup(ALCopyStr(S, I+3, J-I-3));
Inc(J);
Mode := #0;
if N > 0 then
ReplaceBackreference(N)
else
Delete(S, I, J-I);
end
else
I := J
end
else
I := I+2;
end;
'l', 'L', 'u', 'U', 'f', 'F', 'i', 'I':
begin
Mode := S[J];
Inc(J);
ProcessBackreference(True, False);
end;
else
Mode := #0;
ProcessBackreference(False, False);
end;
end;
'$':
begin
J := I + 1;
// We let I stop one character before the end, so J cannot point
// beyond the end of the AnsiString here
if J > Length(S) then
raise ERegularExpressionError.CreateResFmt(@SRegExIndexOutOfBounds, [J]);
if S[J] = '$' then
begin
Delete(S, J, 1);
Inc(I);
end
else
begin
Mode := #0;
ProcessBackreference(False, True);
end
end;
else
Inc(I);
end
end;
Result := S
end;
{******************************}
constructor TALPerlRegEx.Create;
begin
inherited Create;
FState := [preNotEmpty];
FCharTable := pcre_maketables;
FPCREOptions := PCRE_UTF8 or PCRE_NEWLINE_ANY;
end;
{******************************}
destructor TALPerlRegEx.Destroy;
begin
pcre_dispose(FPattern, FHints, FCharTable);
inherited Destroy;
end;
{****************************************************************************}
class function TALPerlRegEx.EscapeRegExChars(const S: AnsiString): AnsiString;
var
I: Integer;
begin
Result := S;
I := Length(Result);
while I > 0 do
begin
case Result[I] of
'.', '[', ']', '(', ')', '?', '*', '+', '{', '}', '^', '$', '|', '\', '/' {NOTE: '/' was added from the delphi original TPerlRegEx}:
Insert('\', Result, I);
#0:
begin
Result[I] := '0';
Insert('\', Result, I);
end;
end;
Dec(I);
end;
end;
{*******************************************}
function TALPerlRegEx.GetFoundMatch: Boolean;
begin
Result := OffsetCount > 0;
end;
{***********************************************}
function TALPerlRegEx.GetMatchedText: AnsiString;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
Result := GetGroups(0);
end;
{**********************************************}
function TALPerlRegEx.GetMatchedLength: Integer;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
Result := GetGroupLengths(0)
end;
{**********************************************}
function TALPerlRegEx.GetMatchedOffset: Integer;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
Result := GetGroupOffsets(0)
end;
{*******************************************}
function TALPerlRegEx.GetGroupCount: Integer;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
Result := OffsetCount-1
end;
{*************************************************************}
function TALPerlRegEx.GetGroupLengths(Index: Integer): Integer;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
if (Index >= 0) and (Index <= GroupCount) then
Result := Offsets[Index*2+1]-Offsets[Index*2]
else
raise ERegularExpressionError.CreateResFmt(@SRegExIndexOutOfBounds, [Index]);
end;
{*************************************************************}
function TALPerlRegEx.GetGroupOffsets(Index: Integer): Integer;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
if (Index >= 0) and (Index <= GroupCount) then
Result := Offsets[Index*2]
else
raise ERegularExpressionError.CreateResFmt(@SRegExIndexOutOfBounds, [Index]);
end;
{**********************************************************}
function TALPerlRegEx.GetGroups(Index: Integer): AnsiString;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
if Index > GroupCount then
Result := ''
else if FHasStoredGroups then
Result := FStoredGroups[Index]
else
Result := ALCopyStr(FSubject, Offsets[Index*2], Offsets[Index*2+1]-Offsets[Index*2]);
end;
{***********************************************}
function TALPerlRegEx.GetSubjectLeft: AnsiString;
begin
Result := ALCopyStr(Subject, 1, Offsets[0]-1);
end;
{************************************************}
function TALPerlRegEx.GetSubjectRight: AnsiString;
begin
Result := ALCopyStr(Subject, Offsets[1], MaxInt);
end;
{***********************************}
function TALPerlRegEx.Match: Boolean;
var
I, Opts: Integer;
begin
ClearStoredGroups;
if not Compiled then
Compile;
if preNotBOL in State then
Opts := PCRE_NOTBOL
else
Opts := 0;
if preNotEOL in State then
Opts := Opts or PCRE_NOTEOL;
if preNotEmpty in State then
Opts := Opts or PCRE_NOTEMPTY;
OffsetCount := pcre_exec(FPattern, FHints, FSubjectPChar, FStop, 0, Opts, @Offsets[0], High(Offsets));
Result := OffsetCount > 0;
// Convert offsets into AnsiString indices
if Result then
begin
for I := 0 to OffsetCount*2-1 do
Inc(Offsets[I]);
FStart := Offsets[1];
if Offsets[0] = Offsets[1] then
Inc(FStart); // Make sure we don't get stuck at the same position
if Assigned(OnMatch) then
OnMatch(Self)
end;
end;
{************************************************************************************}
function TALPerlRegEx.Match(const aSubject: ansiString; aGroups: TalStrings): Boolean;
var aOpts: Integer;
aSubjectPChar: PAnsiChar;
aStop: Integer;
aOffsetCount: Integer;
aOffsets: array[0..(cALPerlRegExMAXSUBEXPRESSIONS+1)*3] of Integer;
i: integer;
begin
aSubjectPChar := PAnsiChar(aSubject);
aStop := Length(aSubject);
if not Compiled then raise ERegularExpressionError.Create('You must compile first to call the thread safe version of Match');
if preNotBOL in State then aOpts := PCRE_NOTBOL
else aOpts := 0;
if preNotEOL in State then aOpts := aOpts or PCRE_NOTEOL;
if preNotEmpty in State then aOpts := aOpts or PCRE_NOTEMPTY;
aOffsetCount := pcre_exec(FPattern, FHints, aSubjectPChar, aStop, 0, aOpts, @aOffsets[0], High(aOffsets));
Result := aOffsetCount > 0;
aGroups.Clear;
if Result then begin
for I := 0 to aOffsetCount*2-1 do Inc(aOffsets[I]);
for I := 0 to aOffsetCount-1 do aGroups.Add(ALCopyStr(aSubject, aOffsets[I*2], aOffsets[I*2+1]-aOffsets[I*2]))
end;
end;
{****************************************}
function TALPerlRegEx.MatchAgain: Boolean;
var
I, Opts: Integer;
begin
ClearStoredGroups;
if not Compiled then
Compile;
if preNotBOL in State then
Opts := PCRE_NOTBOL
else
Opts := 0;
if preNotEOL in State then
Opts := Opts or PCRE_NOTEOL;
if preNotEmpty in State then
Opts := Opts or PCRE_NOTEMPTY;
if FStart-1 > FStop then
OffsetCount := -1
else
OffsetCount := pcre_exec(FPattern, FHints, FSubjectPChar, FStop, FStart-1, Opts, @Offsets[0], High(Offsets));
Result := OffsetCount > 0;
// Convert offsets into AnsiString indices
if Result then
begin
for I := 0 to OffsetCount*2-1 do
Inc(Offsets[I]);
FStart := Offsets[1];
if Offsets[0] = Offsets[1] then
Inc(FStart); // Make sure we don't get stuck at the same position
if Assigned(OnMatch) then
OnMatch(Self)
end;
end;
{****************************************************************}
function TALPerlRegEx.NamedGroup(const Name: AnsiString): Integer;
begin
Result := pcre_get_stringnumber(FPattern, PAnsiChar(Name));
end;
{****************************************}
function TALPerlRegEx.Replace: AnsiString;
begin
if not FoundMatch then
raise ERegularExpressionError.CreateRes(@SRegExMatchRequired);
// Substitute backreferences
Result := ComputeReplacement;
// Allow for just-in-time substitution determination
if Assigned(OnReplace) then
OnReplace(Self, Result);
// Perform substitution
Delete(FSubject, MatchedOffset, MatchedLength);
if Result <> '' then
Insert(Result, FSubject, MatchedOffset);
FSubjectPChar := PAnsiChar(FSubject);
// Position to continue search
FStart := FStart - MatchedLength + Length(Result);
FStop := FStop - MatchedLength + Length(Result);
// Replacement no longer matches regex, we assume
ClearStoredGroups;
OffsetCount := 0;
end;
{****************************************}
function TALPerlRegEx.ReplaceAll: Boolean;
begin
if Match then
begin
Result := True;
repeat
Replace
until not MatchAgain;
end
else
Result := False;
end;
{************************************************************}
procedure TALPerlRegEx.SetOptions(Value: TALPerlRegExOptions);
begin
if (FOptions <> Value) then
begin
FOptions := Value;
FPCREOptions := PCRE_UTF8 or PCRE_NEWLINE_ANY;
if (preCaseLess in Value) then
FPCREOptions := FPCREOptions or PCRE_CASELESS;
if (preMultiLine in Value) then
FPCREOptions := FPCREOptions or PCRE_MULTILINE;
if (preSingleLine in Value) then
FPCREOptions := FPCREOptions or PCRE_DOTALL;
if (preExtended in Value) then
FPCREOptions := FPCREOptions or PCRE_EXTENDED;
if (preAnchored in Value) then
FPCREOptions := FPCREOptions or PCRE_ANCHORED;
if (preUnGreedy in Value) then
FPCREOptions := FPCREOptions or PCRE_UNGREEDY;
if (preNoAutoCapture in Value) then
FPCREOptions := FPCREOptions or PCRE_NO_AUTO_CAPTURE;
CleanUp
end
end;
{*******************************************************}
procedure TALPerlRegEx.SetRegEx(const Value: AnsiString);
begin
if FRegEx <> Value then
begin
FRegEx := Value;
CleanUp
end
end;
{****************************************************}
procedure TALPerlRegEx.SetStart(const Value: Integer);
begin
if Value < 1 then
FStart := 1
else
FStart := Value;
// If FStart > Length(Subject), MatchAgain() will simply return False
end;
{***************************************************}
procedure TALPerlRegEx.SetStop(const Value: Integer);
begin
if Value > Length(Subject) then
FStop := Length(Subject)
else
FStop := Value;
end;
{*********************************************************}
procedure TALPerlRegEx.SetSubject(const Value: AnsiString);
begin
FSubject := Value;
FSubjectPChar := PAnsiChar(Value);
FStart := 1;
FStop := Length(Subject);
if not FHasStoredGroups then
OffsetCount := 0;
end;
{****************************************************************}
procedure TALPerlRegEx.Split(Strings: TALStrings; Limit: Integer);
var
Offset, Count: Integer;
begin
if Strings = nil then
raise ERegularExpressionError.CreateRes(@SRegExStringsRequired);
if (Limit = 1) or not Match then
Strings.Add(Subject)
else
begin
Offset := 1;
Count := 1;
repeat
Strings.Add(ALCopyStr(Subject, Offset, MatchedOffset - Offset));
Inc(Count);
Offset := MatchedOffset + MatchedLength;
until ((Limit > 1) and (Count >= Limit)) or not MatchAgain;
Strings.Add(ALCopyStr(Subject, Offset, MaxInt));
end
end;
{*******************************************************************************}
procedure TALPerlRegEx.SplitCapture(Strings: TALStrings; Limit, Offset: Integer);
var
Count: Integer;
LUseOffset: Boolean;
LOffset: Integer;
begin
if Strings = nil then
raise ERegularExpressionError.CreateRes(@SRegExStringsRequired);
if (Limit = 1) or not Match then
Strings.Add(Subject)
else
begin
LUseOffset := Offset <> 1;
if Offset <> 1 then
Dec(Limit);
LOffset := 1;
Count := 1;
repeat
if LUseOffset then
begin
if MatchedOffset >= Offset then
begin
LUseOffset := False;
Strings.Add(ALCopyStr(Subject, 1, MatchedOffset -1));
if Self.GroupCount > 0 then
Strings.Add(Self.Groups[Self.GroupCount]);
end;
end
else
begin
Strings.Add(ALCopyStr(Subject, LOffset, MatchedOffset - LOffset));
Inc(Count);
if Self.GroupCount > 0 then
Strings.Add(Self.Groups[Self.GroupCount]);
end;
LOffset := MatchedOffset + MatchedLength;
until ((Limit > 1) and (Count >= Limit)) or not MatchAgain;
Strings.Add(ALCopyStr(Subject, LOffset, MaxInt));
end
end;
{***********************************************************************}
procedure TALPerlRegEx.SplitCapture(Strings: TALStrings; Limit: Integer);
begin
SplitCapture(Strings,Limit,1);
end;
{*********************************}
procedure TALPerlRegEx.StoreGroups;
var
I: Integer;
begin
if OffsetCount > 0 then
begin
ClearStoredGroups;
SetLength(FStoredGroups, GroupCount+1);
for I := GroupCount downto 0 do
FStoredGroups[I] := Groups[I];
FHasStoredGroups := True;
end
end;
{***************************}
procedure TALPerlRegEx.Study;
var
Error: PAnsiChar;
begin
if not FCompiled then
Compile;
FHints := pcre_study(FPattern, 0, @Error);
if Error <> nil then
raise ERegularExpressionError.CreateResFmt(@SRegExStudyError, [String(Error)]);
FStudied := True
end;
{***********************************************************}
function TALPerlRegExList.Add(ARegEx: TALPerlRegEx): Integer;
begin
Result := FList.Add(ARegEx);
UpdateRegEx(ARegEx);
end;
{*******************************}
procedure TALPerlRegExList.Clear;
begin
FList.Clear;
end;
{**********************************}
constructor TALPerlRegExList.Create;
begin
inherited Create;
FList := TList.Create;
end;
{************************************************}
procedure TALPerlRegExList.Delete(Index: Integer);
begin
FList.Delete(Index);
end;
{**********************************}
destructor TALPerlRegExList.Destroy;
begin
FList.Free;
inherited
end;
{******************************************}
function TALPerlRegExList.GetCount: Integer;
begin
Result := FList.Count;
end;
{***************************************************************}
function TALPerlRegExList.GetRegEx(Index: Integer): TALPerlRegEx;
begin
Result := TALPerlRegEx(Pointer(FList[Index]));
end;
{***************************************************************}
function TALPerlRegExList.IndexOf(ARegEx: TALPerlRegEx): Integer;
begin
Result := FList.IndexOf(ARegEx);
end;
{**********************************************************************}
procedure TALPerlRegExList.Insert(Index: Integer; ARegEx: TALPerlRegEx);
begin
FList.Insert(Index, ARegEx);
UpdateRegEx(ARegEx);
end;
{***************************************}
function TALPerlRegExList.Match: Boolean;
begin
SetStart(1);
FMatchedRegEx := nil;
Result := MatchAgain;
end;
{********************************************}
function TALPerlRegExList.MatchAgain: Boolean;
var
I, MatchStart, MatchPos: Integer;
ARegEx: TALPerlRegEx;
begin
if FMatchedRegEx <> nil then
MatchStart := FMatchedRegEx.MatchedOffset + FMatchedRegEx.MatchedLength
else
MatchStart := FStart;
FMatchedRegEx := nil;
MatchPos := MaxInt;
for I := 0 to Count-1 do
begin
ARegEx := RegEx[I];
if (not ARegEx.FoundMatch) or (ARegEx.MatchedOffset < MatchStart) then
begin
ARegEx.Start := MatchStart;
ARegEx.MatchAgain;
end;
if ARegEx.FoundMatch and (ARegEx.MatchedOffset < MatchPos) then
begin
MatchPos := ARegEx.MatchedOffset;
FMatchedRegEx := ARegEx;
end;
if MatchPos = MatchStart then Break;
end;
Result := MatchPos < MaxInt;
end;
{***********************************************************************}
procedure TALPerlRegExList.SetRegEx(Index: Integer; Value: TALPerlRegEx);
begin
FList[Index] := Value;
UpdateRegEx(Value);
end;
{********************************************************}
procedure TALPerlRegExList.SetStart(const Value: Integer);
var
I: Integer;
begin
if FStart <> Value then
begin
FStart := Value;
for I := Count-1 downto 0 do
RegEx[I].Start := Value;
FMatchedRegEx := nil;
end;
end;
{*******************************************************}
procedure TALPerlRegExList.SetStop(const Value: Integer);
var
I: Integer;
begin
if FStop <> Value then
begin
FStop := Value;
for I := Count-1 downto 0 do
RegEx[I].Stop := Value;
FMatchedRegEx := nil;
end;
end;
{*************************************************************}
procedure TALPerlRegExList.SetSubject(const Value: AnsiString);
var
I: Integer;
begin
if FSubject <> Value then
begin
FSubject := Value;
for I := Count-1 downto 0 do
RegEx[I].Subject := Value;
FMatchedRegEx := nil;
end;
end;
{***********************************************************}
procedure TALPerlRegExList.UpdateRegEx(ARegEx: TALPerlRegEx);
begin
ARegEx.Subject := FSubject;
ARegEx.Start := FStart;
end;
{$IFEND}
{$IFNDEF NEXTGEN}
{***********************************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: AnsiString; AFalse: AnsiString = ''): AnsiString;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{$ENDIF !NEXTGEN}
{************************************************************************************}
function ALIfThenU(AValue: Boolean; const ATrue: String; AFalse: String = ''): String;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{***************************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: Integer; const AFalse: Integer): Integer;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{*********************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: Int64; const AFalse: Int64): Int64;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{************************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: UInt64; const AFalse: UInt64): UInt64;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{************************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: Single; const AFalse: Single): Single;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{************************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: Double; const AFalse: Double): Double;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{******************************************************************************************}
function ALIfThen(AValue: Boolean; const ATrue: Extended; const AFalse: Extended): Extended;
begin
if AValue then
Result := ATrue
else
Result := AFalse;
end;
{$IFNDEF NEXTGEN}
{***************************************************************************************}
procedure ALConvertErrorFmt(ResString: PResStringRec; const Args: array of const); local;
begin
raise EConvertError.CreateResFmt(ResString, Args);
end;
{********************************************************}
procedure ALConvertError(ResString: PResStringRec); local;
begin
raise EConvertError.CreateRes(ResString);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.FormatError is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALFormatError(ErrorCode: Integer; Format: PChar; FmtLen: Cardinal);
const
FormatErrorStrs: array[0..1] of PResStringRec = (
@SALInvalidFormat, @SALArgumentMissing);
var
Buffer: array[0..31] of Char;
begin
if FmtLen > 31 then FmtLen := 31;
if StrByteType(Format, FmtLen-1) = mbLeadByte then Dec(FmtLen);
StrMove(Buffer, Format, FmtLen);
Buffer[FmtLen] := #0;
ALConvertErrorFmt(FormatErrorStrs[ErrorCode], [PChar(@Buffer)]);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.AnsiFormatError is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALAnsiFormatError(ErrorCode: Integer; Format: PAnsiChar; FmtLen: Cardinal);
var
FormatText: string;
begin
FormatText := UTF8ToUnicodeString(Format);
ALFormatError(ErrorCode, PChar(FormatText), FmtLen);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.FormatVarToStr is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALFormatVarToStr(var S: AnsiString; const V: TVarData);
begin
if Assigned(System.VarToLStrProc) then
System.VarToLStrProc(S, V)
else
System.Error(reVarInvalidOp);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.AnsiStrings.FormatClearStr is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALFormatClearStr(var S: AnsiString);
begin
S := '';
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.GetGOT is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF X86ASM}
{$IFDEF PIC}
{ Do not remove export or the begin block. }
function ALGetGOT: Pointer;
begin
asm
MOV Result,EBX
end;
end;
{$ENDIF}
{$ENDIF X86ASM}
{***}
const
cALDCon10: Integer = 10;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.PutExponent is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF X86ASM}
procedure ALPutExponent;
// Store exponent
// In AL = Exponent character ('E' or 'e')
// AH = Positive sign character ('+' or 0)
// BL = Zero indicator
// BH = Destination buffer type: 0=Ansi, 1=Unicode
// ECX = Minimum number of digits (0..4)
// EDX = Exponent
// EDI = Destination buffer
asm //StackAlignSafe - internal method can be called unaligned
PUSH ESI
{$IFDEF PIC}
PUSH EAX
PUSH ECX
CALL ALGetGOT
MOV ESI,EAX
POP ECX
POP EAX
{$ELSE !PIC}
XOR ESI,ESI
{$ENDIF !PIC}
STOSB
CMP BH,0
JE @@a
XOR AL,AL
STOSB
@@a: OR BL,BL
JNE @@0
XOR EDX,EDX
JMP @@1
@@0: OR EDX,EDX
JGE @@1
MOV AL,'-'
NEG EDX
JMP @@2
@@1: OR AH,AH
JE @@3
MOV AL,AH
@@2: STOSB
CMP BH,0
JE @@3
XOR AL,AL
STOSB
@@3: XCHG EAX,EDX
PUSH EAX
PUSH EBX
MOV EBX,ESP
SUB EBX,8
PUSH EBX
@@4: XOR EDX,EDX
DIV [ESI].cALDCon10
ADD DL,'0'
MOV [EBX],DL
INC EBX
DEC ECX
OR EAX,EAX
JNE @@4
OR ECX,ECX
JG @@4
POP EDX
POP ECX
@@5: DEC EBX
MOV AL,[EBX]
STOSB
CMP CH,0
JE @@6
XOR AL,AL
STOSB
@@6: CMP EBX,EDX
JNE @@5
POP EAX
POP ESI
end;
{$ENDIF X86ASM}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.InternalFloatToText is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF PUREPASCAL}
function ALInternalFloatToText(
ABuffer: PByte;
ABufferIsUnicode: Boolean;
const AValue;
AValueType: TFloatValue;
AFormat: TFloatFormat;
APrecision, ADigits: Integer;
const AFormatSettings: TALFormatSettings): Integer;
const
CMinExtPrecision = 2;
{$IFDEF EXTENDEDHAS10BYTES}
CMaxExtPrecision = 18;
{$ELSE !EXTENDEDHAS10BYTES}
CMaxExtPrecision = 17;
{$ENDIF !EXTENDEDHAS10BYTES}
CCurrPrecision = 19;
CGenExpDigits = 9999;
CExpChar = 'E'; // DO NOT LOCALIZE
CMinusSign: AnsiChar = '-'; // DO NOT LOCALIZE
CPlusSign: AnsiChar = '+'; // DO NOT LOCALIZE
CZero: AnsiChar = '0'; // DO NOT LOCALIZE
CSpecial: array[0 .. 1] of ansistring = ('INF', 'NAN'); // DO NOT LOCALIZE
CCurrencyFormats: array[0 .. 3] of ansistring = ('$*@@@', '*$@@@', '$ *@@', '* $@@'); // DO NOT LOCALIZE
CNegCurrencyFormats: array[0 .. 15] of ansistring =
(
'($*)@', '-$*@@', '$-*@@', '$*-@@', '(*$)@', '-*$@@', // DO NOT LOCALIZE
'*-$@@', '*$-@@', '-* $@', '-$ *@', '* $-@', // DO NOT LOCALIZE
'$ *-@', '$ -*@', '*- $@', '($ *)', '(* $)' // DO NOT LOCALIZE
);
var
FloatRec: TFloatRec;
LDigits: Integer;
LExponent: Cardinal;
LUseENotation: Boolean;
LCurrentFormat: ansistring;
//LCurrChar: Char;
ICurrChar: integer;
LFloatRecDigit: Integer;
LNextThousand: Integer;
procedure AppendChar(const AChar: AnsiChar);
begin
//if ABufferIsUnicode then
//begin
// PChar(ABuffer)^ := Char(AChar);
// Inc(ABuffer, SizeOf(Char));
//end else
//begin
PAnsiChar(ABuffer)^ := AChar;
Inc(ABuffer, SizeOf(AnsiChar));
//end;
Inc(Result);
end;
procedure AppendString(const AStr: AnsiString);
var
{I,} L: Integer;
begin
L := Length(AStr);
if L > 0 then
begin
//if ABufferIsUnicode then
//begin
// { Unicode -- loop }
// for I := Low(AStr) to High(AStr) do
// begin
// PChar(ABuffer)^ := Char(AStr[I]);
// Inc(ABuffer, SizeOf(Char));
// end;
//end else
//begin
{ ANSI -- move directly }
ALMove(pointer(AStr)^, ABuffer^, L);
Inc(ABuffer, L * SizeOf(AnsiChar));
//end;
Inc(Result, L);
end;
end;
function GetDigit: Byte;
begin
Result := FloatRec.Digits[LFloatRecDigit];
if Result = Ord(#0) then
Result := Ord('0')
else
Inc(LFloatRecDigit);
end;
procedure FormatNumber;
var
K: Integer;
begin
if ADigits > CMaxExtPrecision then
LDigits := CMaxExtPrecision
else
LDigits := ADigits;
K := FloatRec.Exponent;
if K > 0 then
begin
{ Find the position of the next thousand separator }
LNextThousand := 0;
if AFormat <> ffFixed then
LNextThousand := ((K - 1) mod 3) + 1;
repeat
{ Append the next digit }
AppendChar(ansiChar(GetDigit));
{ Update loop counters }
Dec(K);
Dec(LNextThousand);
{ Try to append the thousands separator and reset the counter }
if (LNextThousand = 0) and (K > 0) then
begin
LNextThousand := 3;
if AFormatSettings.ThousandSeparator <> #0 then
AppendChar(AFormatSettings.ThousandSeparator);
end;
until (K = 0);
end else
AppendChar(CZero);
{ If there are ADigits left to fill }
if LDigits <> 0 then
begin
{ Put in the decimal separator if it was specified }
if AFormatSettings.DecimalSeparator <> #0 then
AppendChar(AFormatSettings.DecimalSeparator);
{ If there is negative exponent }
if K < 0 then
begin
{ Fill with zeroes until the exponent or ADigits are exhausted}
repeat
AppendChar(CZero);
Inc(K);
Dec(LDigits);
until (K = 0) or (LDigits = 0);
end;
if LDigits > 0 then
begin
{ Exponent was filled, there are still ADigits left to fill }
repeat
AppendChar(ansiChar(GetDigit));
Dec(LDigits);
until (LDigits <= 0);
end;
end;
end;
procedure FormatExponent;
var
LMinCnt, LExponent: Integer;
LExpString: ansistring;
LDigitCnt: Integer;
begin
{ Adjust digit count }
if ADigits > 4 then
LMinCnt := 0
else
LMinCnt := ADigits;
{ Get exponent }
LExponent := FloatRec.Exponent - 1;
{ Place the E character into position }
AppendChar(CExpChar);
if Byte(FloatRec.Digits[0]) <> Ord(#0) then
begin
if LExponent < 0 then
begin
LExponent := -LExponent;
AppendChar(CMinusSign);
end
else
begin
if AFormat <> ffGeneral then
AppendChar(CPlusSign);
end;
end else
begin
if AFormat <> ffGeneral then
AppendChar(CPlusSign);
LExponent := 0;
end;
LExpString := ALIntToStr(LExponent);
LDigitCnt := Length(LExpString);
while LDigitCnt < LMinCnt do
begin
AppendChar(CZero);
Inc(LDigitCnt);
end;
AppendString(LExpString);
end;
begin
LFloatRecDigit := 0;
Result := 0;
if AValueType = fvExtended then
begin
{ Check min and max precisions for an Extended }
if APrecision < CMinExtPrecision then
APrecision := CMinExtPrecision
else if APrecision > CMaxExtPrecision then
APrecision := CMaxExtPrecision;
end else
APrecision := CCurrPrecision;
{ Check the number of ADigits to use }
if AFormat in [ffGeneral, ffExponent] then
LDigits := CGenExpDigits
else
LDigits := ADigits;
{ Decode the float }
FloatToDecimal(FloatRec, AValue, AValueType, APrecision, LDigits);
{$IFDEF EXTENDEDHAS10BYTES}
LExponent := UInt16(FloatRec.Exponent) - $7FFF;
{$ELSE !EXTENDEDHAS10BYTES}
LExponent := UInt16(FloatRec.Exponent) - $7FF;
{$ENDIF !EXTENDEDHAS10BYTES}
{ Check for INF or NAN}
if LExponent < 2 then
begin
{ Append the sign to output buffer }
if FloatRec.Negative then
AppendChar(CMinusSign);
AppendString(CSpecial[LExponent]);
Exit;
end;
if (not (AFormat in [ffGeneral .. ffCurrency])) or
((FloatRec.Exponent > APrecision) and (AFormat <> ffExponent)) then
AFormat := ffGeneral;
case AFormat of
ffGeneral:
begin
{ Append the sign to output buffer }
if FloatRec.Negative then
AppendChar(CMinusSign);
LUseENotation := False;
{ Obtain digit count and whether to use the E notation }
LDigits := FloatRec.Exponent;
if (LDigits > APrecision) or (LDigits < -3) then
begin
LDigits := 1;
LUseENotation := True;
end;
if LDigits > 0 then
begin
{ Append the ADigits that precede decimal separator }
while LDigits > 0 do
begin
AppendChar(ansiChar(GetDigit));
Dec(LDigits);
end;
{ Append the decimal separator and the following digit }
if FloatRec.Digits[LFloatRecDigit] <> ord(#0) then
begin
AppendChar(AFormatSettings.DecimalSeparator);
{ Append the ADigits that come after the decimal separator }
while FloatRec.Digits[LFloatRecDigit] <> ord(#0) do
AppendChar(ansiChar(GetDigit));
end;
if LUseENotation then
FormatExponent();
end else
begin
AppendChar(CZero);
if FloatRec.Digits[0] <> ord(#0) then
begin
AppendChar(AFormatSettings.DecimalSeparator);
LDigits := -LDigits;
{ Append zeroes to fulfill the exponent }
while LDigits > 0 do
begin
AppendChar(CZero);
Dec(LDigits);
end;
{ Attach all the other ADigits now }
while FloatRec.Digits[LFloatRecDigit] <> ord(#0) do
AppendChar(ansiChar(GetDigit));
end;
end;
end;
ffExponent:
begin
{ Append the sign to output buffer }
if FloatRec.Negative then
AppendChar(CMinusSign);
{ Append the first digit and the decimal separator }
AppendChar(ansiChar(GetDigit));
AppendChar(AFormatSettings.DecimalSeparator);
{ Append ADigits based on the APrecision requirements }
Dec(APrecision);
repeat
AppendChar(ansiChar(GetDigit));
Dec(APrecision);
until (APrecision = 0);
FormatExponent();
end;
ffNumber, ffFixed:
begin
{ Append the sign to output buffer }
if FloatRec.Negative then
AppendChar(CMinusSign);
FormatNumber();
end;
ffCurrency:
begin
{ Select the appropriate currency AFormat}
if FloatRec.Negative then
begin
{ negative AFormat is used, check for bounds and select }
if AFormatSettings.NegCurrFormat > High(CNegCurrencyFormats) then
LCurrentFormat := CNegCurrencyFormats[High(CNegCurrencyFormats)]
else
LCurrentFormat := CNegCurrencyFormats[AFormatSettings.NegCurrFormat];
end else
begin
{ positive AFormat is used, check for bounds and select }
if AFormatSettings.CurrencyFormat > High(CCurrencyFormats) then
LCurrentFormat := CCurrencyFormats[High(CCurrencyFormats)]
else
LCurrentFormat := CCurrencyFormats[AFormatSettings.CurrencyFormat];
end;
{ Iterate over each charater in the AFormat string }
// for LCurrChar in LCurrentFormat do
// case LCurrChar of
for ICurrChar := Low(LCurrentFormat) to High(LCurrentFormat) do
case LCurrentFormat[ICurrChar] of
'@': break;
'$':
if AFormatSettings.CurrencyString <> '' {EmptyStr} then
AppendString(AFormatSettings.CurrencyString);
'*': FormatNumber();
else
//AppendChar(LCurrChar);
AppendChar(LCurrentFormat[ICurrChar]);
end;
end;
end;
end;
{$ENDIF PUREPASCAL}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.AnsiStrings.FloatToText is still the same and adjust the IFDEF'}
{$IFEND}
function ALFloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const AFormatSettings: TALFormatSettings): Integer;
{$IFDEF PUREPASCAL}
begin
{ Call internal helper. Specify that we're using an ANSI buffer }
Result := ALInternalFloatToText(PByte(BufferArg), False, Value, ValueType, Format, Precision, Digits, AFormatSettings);
end;
{$ELSE !PUREPASCAL}
{$IFDEF X86ASM}
var
Buffer: Pointer;
FloatRec: TFloatRec;
SaveGOT: Integer;
DecimalSep: AnsiChar;
ThousandSep: AnsiChar;
CurrencyStr: Pointer;
CurrFmt: Byte;
NegCurrFmt: Byte;
//AnsiCurrencyStr: AnsiString;
asm //StackAligned
PUSH EDI
PUSH ESI
PUSH EBX
MOV Buffer,EAX
{$IFDEF PIC}
PUSH ECX
CALL ALGetGOT
MOV SaveGOT,EAX
POP ECX
{$ELSE !PIC}
MOV SaveGOT,0
{$ENDIF !PIC}
{$IFDEF ALIGN_STACK}
SUB ESP,4
{$ENDIF ALIGN_STACK}
//PUSH ECX
//PUSH EDX
{$IFDEF PIC} // Double indirect using GOT
//MOV ECX, [EAX].DefaultSystemCodePage
//MOV ECX, [ECX]
{$ELSE !PIC}
//MOV ECX, DefaultSystemCodePage
{$ENDIF}
//LEA EAX,AnsiCurrencyStr
//MOV EDX,AFormatSettings
//MOV EDX,[EDX].TALFormatSettings.CurrencyString
//CALL System.@LStrFromUStr
//MOV EAX,AnsiCurrencyStr
//MOV CurrencyStr,EAX
//POP EDX
//POP ECX
MOV EAX,AFormatSettings
MOV EAX,[EAX].TALFormatSettings.CurrencyString
MOV CurrencyStr,EAX
MOV EAX,AFormatSettings
MOV AL,AnsiChar([EAX].TALFormatSettings.DecimalSeparator)
MOV DecimalSep,AL
MOV EAX,AFormatSettings
MOV AL,AnsiChar([EAX].TALFormatSettings.ThousandSeparator)
MOV ThousandSep,AL
MOV EAX,AFormatSettings
MOV AL,[EAX].TALFormatSettings.CurrencyFormat
MOV CurrFmt,AL
MOV EAX,AFormatSettings
MOV AL,[EAX].TALFormatSettings.NegCurrFormat
MOV NegCurrFmt,AL
MOV EAX,19
CMP CL,fvExtended
JNE @@2
MOV EAX,Precision
CMP EAX,2
JGE @@1
MOV EAX,2
@@1: CMP EAX,18
JLE @@2
MOV EAX,18
@@2: MOV Precision,EAX
PUSH EAX
MOV EAX,9999
CMP Format,ffFixed
JB @@3
MOV EAX,Digits
@@3: PUSH EAX
LEA EAX,FloatRec
CALL FloatToDecimal
MOV EDI,Buffer
MOVZX EAX,FloatRec.Exponent
SUB EAX,7FFFH
CMP EAX,2
JAE @@4
MOV ECX, EAX
CALL @@PutSign
LEA ESI,@@INFNAN[ECX+ECX*2]
ADD ESI,SaveGOT
MOV ECX,3
REP MOVSB
JMP @@7
@@4: LEA ESI,FloatRec.Digits
MOVZX EBX,Format
CMP BL,ffExponent
JE @@6
CMP BL,ffCurrency
JA @@5
MOVSX EAX,FloatRec.Exponent
CMP EAX,Precision
JLE @@6
@@5: MOV BL,ffGeneral
@@6: LEA EBX,@@FormatVector[EBX*4]
ADD EBX,SaveGOT
MOV EBX,[EBX]
ADD EBX,SaveGOT
CALL EBX
@@7: MOV EAX,EDI
SUB EAX,Buffer
{$IFDEF ALIGN_STACK}
ADD ESP, 4
{$ENDIF ALIGN_STACK}
POP EBX
POP ESI
POP EDI
JMP @@Exit
@@FormatVector:
DD @@PutFGeneral
DD @@PutFExponent
DD @@PutFFixed
DD @@PutFNumber
DD @@PutFCurrency
@@INFNAN: DB 'INFNAN'
// Get digit or '0' if at end of digit string
@@GetDigit:
LODSB
OR AL,AL
JNE @@a1
MOV AL,'0'
DEC ESI
@@a1: RET
// Store '-' if number is negative
@@PutSign:
CMP FloatRec.Negative,0
JE @@b1
MOV AL,'-'
STOSB
@@b1: RET
// Convert number using ffGeneral format
@@PutFGeneral:
CALL @@PutSign
MOVSX ECX,FloatRec.Exponent
XOR EDX,EDX
CMP ECX,Precision
JG @@c1
CMP ECX,-3
JL @@c1
OR ECX,ECX
JG @@c2
MOV AL,'0'
STOSB
CMP BYTE PTR [ESI],0
JE @@c6
MOV AL,DecimalSep
STOSB
NEG ECX
MOV AL,'0'
REP STOSB
JMP @@c3
@@c1: MOV ECX,1
INC EDX
@@c2: LODSB
OR AL,AL
JE @@c4
STOSB
LOOP @@c2
LODSB
OR AL,AL
JE @@c5
MOV AH,AL
MOV AL,DecimalSep
STOSW
@@c3: LODSB
OR AL,AL
JE @@c5
STOSB
JMP @@c3
@@c4: MOV AL,'0'
REP STOSB
@@c5: OR EDX,EDX
JE @@c6
XOR EAX,EAX
JMP @@PutFloatExpWithDigits
@@c6: RET
// Convert number using ffExponent format
@@PutFExponent:
CALL @@PutSign
CALL @@GetDigit
MOV AH,DecimalSep
STOSW
MOV ECX,Precision
DEC ECX
@@d1: CALL @@GetDigit
STOSB
LOOP @@d1
MOV AH,'+'
@@PutFloatExpWithDigits:
MOV ECX,Digits
CMP ECX,4
JBE @@PutFloatExp
XOR ECX,ECX
// Store exponent
// In AH = Positive sign character ('+' or 0)
// ECX = Minimum number of digits (0..4)
@@PutFloatExp:
MOV AL,'E'
MOV BL, FloatRec.Digits.Byte
XOR BH,BH
MOVSX EDX,FloatRec.Exponent
DEC EDX
CALL ALPutExponent {Safe to call unaligned}
RET
// Convert number using ffFixed or ffNumber format
@@PutFFixed:
@@PutFNumber:
CALL @@PutSign
// Store number in fixed point format
@@PutNumber:
MOV EDX,Digits
CMP EDX,18
JB @@f1
MOV EDX,18
@@f1: MOVSX ECX,FloatRec.Exponent
OR ECX,ECX
JG @@f2
MOV AL,'0'
STOSB
JMP @@f4
@@f2: XOR EBX,EBX
CMP Format,ffFixed
JE @@f3
MOV EAX,ECX
DEC EAX
MOV BL,3
DIV BL
MOV BL,AH
INC EBX
@@f3: CALL @@GetDigit
STOSB
DEC ECX
JE @@f4
DEC EBX
JNE @@f3
MOV AL,ThousandSep
TEST AL,AL
JZ @@f3
STOSB
MOV BL,3
JMP @@f3
@@f4: OR EDX,EDX
JE @@f7
MOV AL,DecimalSep
TEST AL,AL
JZ @@f4b
STOSB
@@f4b: JECXZ @@f6
MOV AL,'0'
@@f5: STOSB
DEC EDX
JE @@f7
INC ECX
JNE @@f5
@@f6: CALL @@GetDigit
STOSB
DEC EDX
JNE @@f6
@@f7: RET
// Convert number using ffCurrency format
@@PutFCurrency:
XOR EBX,EBX
MOV BL,CurrFmt.Byte
MOV ECX,0003H
CMP FloatRec.Negative,0
JE @@g1
MOV BL,NegCurrFmt.Byte
MOV ECX,040FH
@@g1: CMP BL,CL
JBE @@g2
MOV BL,CL
@@g2: ADD BL,CH
LEA EBX,@@MoneyFormats[EBX+EBX*4]
ADD EBX,SaveGOT
MOV ECX,5
@@g10: MOV AL,[EBX]
CMP AL,'@'
JE @@g14
PUSH ECX
PUSH EBX
CMP AL,'$'
JE @@g11
CMP AL,'*'
JE @@g12
STOSB
JMP @@g13
@@g11: CALL @@PutCurSym
JMP @@g13
@@g12: CALL @@PutNumber
@@g13: POP EBX
POP ECX
INC EBX
LOOP @@g10
@@g14: RET
// Store currency symbol string
@@PutCurSym:
PUSH ESI
MOV ESI,CurrencyStr
TEST ESI,ESI
JE @@h1
MOV ECX,[ESI-4]
REP MOVSB
@@h1: POP ESI
RET
// Currency formatting templates
@@MoneyFormats:
DB '$*@@@'
DB '*$@@@'
DB '$ *@@'
DB '* $@@'
DB '($*)@'
DB '-$*@@'
DB '$-*@@'
DB '$*-@@'
DB '(*$)@'
DB '-*$@@'
DB '*-$@@'
DB '*$-@@'
DB '-* $@'
DB '-$ *@'
DB '* $-@'
DB '$ *-@'
DB '$ -*@'
DB '*- $@'
DB '($ *)'
DB '(* $)'
@@Exit:
{$IFDEF ALIGN_STACK}
//SUB ESP, 4
{$ENDIF ALIGN_STACK}
//PUSH EAX
//PUSH EBX
//LEA EAX,AnsiCurrencyStr
//MOV EBX,SaveGOT
//CALL System.@LStrClr
//POP EBX
//POP EAX
{$IFDEF ALIGN_STACK}
//ADD ESP, 4
{$ENDIF ALIGN_STACK}
end;
{$ENDIF X86ASM}
{$ENDIF !PUREPASCAL}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.CvtInt is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF X86ASM}
procedure ALCvtInt;
{ IN:
EAX: The integer value to be converted to text
ESI: Ptr to the right-hand side of the output buffer: LEA ESI, StrBuf[16]
ECX: Base for conversion: 0 for signed decimal, 10 or 16 for unsigned
EDX: Precision: zero padded minimum field width
OUT:
ESI: Ptr to start of converted text (not start of buffer)
ECX: Length of converted text
}
asm // StackAlignSafe
OR CL,CL
JNZ @CvtLoop
@C1: OR EAX,EAX
JNS @C2
NEG EAX
CALL @C2
MOV AL,'-'
INC ECX
DEC ESI
MOV [ESI],AL
RET
@C2: MOV ECX,10
@CvtLoop:
PUSH EDX
PUSH ESI
@D1: XOR EDX,EDX
DIV ECX
DEC ESI
ADD DL,'0'
CMP DL,'0'+10
JB @D2
ADD DL,('A'-'0')-10
@D2: MOV [ESI],DL
OR EAX,EAX
JNE @D1
POP ECX
POP EDX
SUB ECX,ESI
SUB EDX,ECX
JBE @D5
ADD ECX,EDX
MOV AL,'0'
SUB ESI,EDX
JMP @z
@zloop: MOV [ESI+EDX],AL
@z: DEC EDX
JNZ @zloop
MOV [ESI],AL
@D5:
end;
{$ENDIF X86ASM}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.SysUtils.CvtInt64 is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF X86ASM}
procedure ALCvtInt64;
{ IN:
EAX: Address of the int64 value to be converted to text
ESI: Ptr to the right-hand side of the output buffer: LEA ESI, StrBuf[32]
ECX: Base for conversion: 0 for signed decimal, or 10 or 16 for unsigned
EDX: Precision: zero padded minimum field width
OUT:
ESI: Ptr to start of converted text (not start of buffer)
ECX: Byte length of converted text
}
asm //StackAlignSafe
OR CL, CL
JNZ @start // CL = 0 => signed integer conversion
MOV ECX, 10
TEST [EAX + 4], $80000000
JZ @start
PUSH [EAX + 4]
PUSH [EAX]
MOV EAX, ESP
NEG [ESP] // negate the value
ADC [ESP + 4],0
NEG [ESP + 4]
CALL @start // perform unsigned conversion
MOV [ESI-1].Byte, '-' // tack on the negative sign
DEC ESI
INC ECX
ADD ESP, 8
RET
@start: // perform unsigned conversion
PUSH ESI
SUB ESP, 4
FNSTCW [ESP+2].Word // save
FNSTCW [ESP].Word // scratch
OR [ESP].Word, $0F00 // trunc toward zero, full precision
FLDCW [ESP].Word
MOV [ESP].Word, CX
FLD1
TEST [EAX + 4], $80000000 // test for negative
JZ @ld1 // FPU doesn't understand unsigned ints
PUSH [EAX + 4] // copy value before modifying
PUSH [EAX]
AND [ESP + 4], $7FFFFFFF // clear the sign bit
PUSH $7FFFFFFF
PUSH $FFFFFFFF
FILD [ESP + 8].QWord // load value
FILD [ESP].QWord
FADD ST(0), ST(2) // Add 1. Produces unsigned $80000000 in ST(0)
FADDP ST(1), ST(0) // Add $80000000 to value to replace the sign bit
ADD ESP, 16
JMP @ld2
@ld1:
FILD [EAX].QWord // value
@ld2:
FILD [ESP].Word // base
FLD ST(1)
@loop:
DEC ESI
FPREM // accumulator mod base
FISTP [ESP].Word
FDIV ST(1), ST(0) // accumulator := acumulator / base
MOV AL, [ESP].Byte // overlap long FPU division op with int ops
ADD AL, '0'
CMP AL, '0'+10
JB @store
ADD AL, ('A'-'0')-10
@store:
MOV [ESI].Byte, AL
FLD ST(1) // copy accumulator
FCOM ST(3) // if accumulator >= 1.0 then loop
FSTSW AX
SAHF
JAE @loop
FLDCW [ESP+2].Word
ADD ESP,4
FFREE ST(3)
FFREE ST(2)
FFREE ST(1);
FFREE ST(0);
POP ECX // original ESI
SUB ECX, ESI // ECX = length of converted string
SUB EDX,ECX
JBE @done // output longer than field width = no pad
SUB ESI,EDX
MOV AL,'0'
ADD ECX,EDX
JMP @z
@zloop: MOV [ESI+EDX].Byte,AL
@z: DEC EDX
JNZ @zloop
MOV [ESI].Byte,AL
@done:
end;
{$ENDIF X86ASM}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.AnsiStrings.FormatBuf is still the same and adjust the IFDEF'}
{$IFEND}
function ALFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const AFormatSettings: TALFormatSettings): Cardinal; overload;
{$IF not defined(LEGACY_FORMAT) or defined(PUREPASCAL)}
var
BufPtr: PAnsiChar;
FormatPtr: PAnsiChar;
FormatStartPtr: PAnsiChar;
FormatEndPtr: PAnsiChar;
ArgsIndex: Integer;
ArgsLength: Integer;
BufMaxLen: Cardinal;
Overwrite: Boolean;
FormatChar: AnsiChar;
S: AnsiString;
StrBuf: array[0..64] of AnsiChar; // if currencystring contain more than 64 chars then it's raise an error :(
LeftJustification: Boolean;
Width: Integer;
Precision: Integer;
Len: Integer;
FirstNumber: Integer;
CurrentArg: TVarRec;
FloatVal: TFloatValue;
function ApplyWidth(NumChar, Negitive: Integer): Boolean;
var
I: Integer;
Max: Integer;
begin
Result := False;
if (Precision > NumChar) and (FormatChar <> 'S') then
Max := Precision
else
Max := NumChar;
if (Width <> 0) and (Width > Max + Negitive) then
begin
for I := Max + 1 + Negitive to Width do
begin
if BufMaxLen = 0 then
begin
Result := True;
Break;
end;
BufPtr^ := ' ';
Inc(BufPtr);
Dec(BufMaxLen, Sizeof(AnsiChar));
end;
end;
end;
function AddBuf(const AItem: PAnsiChar; ItemLen: Integer = -1; StringLen: Integer = -1): Boolean;
var
NumChar: Integer;
Len: Integer;
I: Integer;
Item: PAnsiChar;
Negitive: Integer;
BytesToCopy: Cardinal;
begin
Item := AItem;
if Assigned(AItem) then
if StringLen = -1 then
NumChar := System.AnsiStrings.StrLen(Item)
else
NumChar := StringLen
else
NumChar := 0;
if (ItemLen > -1) and (NumChar > ItemLen) then
NumChar := ItemLen;
Len := NumChar * Sizeof(AnsiChar);
if (Assigned(AItem)) and (Item^ = '-') and (FormatChar <> 'S') then
begin
Dec(Len, Sizeof(AnsiChar));
Dec(NumChar);
Negitive := 1;
end
else
Negitive := 0;
if not LeftJustification then
begin
Result := ApplyWidth(NumChar, Negitive);
if Result then
Exit;
end;
if Negitive = 1 then
begin
if BufMaxLen = 0 then
begin
Result := True;
Exit;
end;
Inc(Item);
BufPtr^ := '-';
Inc(BufPtr);
Dec(BufMaxLen, Sizeof(AnsiChar));
end;
if (Precision <> -1) and (Precision > NumChar) and (FormatChar <> 'S') then
for I := NumChar + 1 to Precision do
begin
if BufMaxLen = 0 then
begin
Result := True;
Exit;
end;
BufPtr^ := '0';
Inc(BufPtr);
Dec(BufMaxLen, Sizeof(AnsiChar));
end;
if Assigned(AItem) then
begin
Result := BufMaxLen < Cardinal(Len);
if Result then
BytesToCopy := BufMaxLen
else
BytesToCopy := Len;
ALMove(Item^, BufPtr^, BytesToCopy);
BufPtr := PAnsiChar(PByte(BufPtr) + BytesToCopy);
Dec(BufMaxLen, BytesToCopy);
end
else
Result := False;
if LeftJustification then
Result := ApplyWidth(NumChar, Negitive);
end;
function VariantToAnsiString(V: TVarData): AnsiString;
begin
Result := '';
if Assigned(System.VarToLStrProc) then
System.VarToLStrProc(Result, V)
else
System.Error(reVarInvalidOp);
end;
begin
if (not Assigned(@Buffer)) or (not Assigned(@Format)) then
begin
Result := 0;
Exit;
end;
ArgsIndex := -1;
ArgsLength := Length(Args);
BufPtr := PAnsiChar(@Buffer);
FormatPtr := PAnsiChar(@Format);
if BufLen < $7FFFFFFF then
BufMaxLen := BufLen * Sizeof(AnsiChar)
else
BufMaxLen := BufLen;
FormatEndPtr := FormatPtr + FmtLen;
while (FormatPtr < FormatEndPtr) do
if FormatPtr^ = '%' then
begin
Inc(FormatPtr);
if (FormatPtr >= FormatEndPtr) then
Break;
if FormatPtr^ = '%' then
begin
if BufMaxLen = 0 then
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
BufPtr^ := FormatPtr^;
Inc(FormatPtr);
Inc(BufPtr);
Dec(BufMaxLen, Sizeof(AnsiChar));
Continue;
end;
Width := 0;
// Gather Index
Inc(ArgsIndex);
if {$IF CompilerVersion >= 25}{Delphi XE4} Char(FormatPtr^).IsNumber {$ELSE} TCharacter.IsNumber(Char(FormatPtr^)) {$IFEND} then
begin
FormatStartPtr := FormatPtr;
while (FormatPtr < FormatEndPtr) and {$IF CompilerVersion >= 25}{Delphi XE4} (Char(FormatPtr^).IsNumber) {$ELSE} (TCharacter.IsNumber(Char(FormatPtr^))) {$IFEND} do
Inc(FormatPtr);
if FormatStartPtr <> FormatPtr then
begin
System.Ansistrings.StrLCopy(StrBuf, FormatStartPtr, Integer(FormatPtr - FormatStartPtr));
if not ALTryStrToInt(AnsiString(StrBuf), FirstNumber) then
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
if FormatPtr^ = ':' then
begin
Inc(FormatPtr);
ArgsIndex := FirstNumber;
end
else
Width := FirstNumber;
end;
end
else if FormatPtr^ = ':' then
begin
ArgsIndex := 0;
Inc(FormatPtr);
end;
// Gather Justification
if FormatPtr^ = '-' then
begin
LeftJustification := True;
Inc(FormatPtr);
end
else
LeftJustification := False;
// Gather Width
FormatStartPtr := FormatPtr;
if FormatPtr^ = '*' then
begin
Width := -2;
Inc(FormatPtr);
end
else if {$IF CompilerVersion >= 25}{Delphi XE4} Char(FormatPtr^).IsNumber {$ELSE} TCharacter.IsNumber(Char(FormatPtr^)) {$IFEND} then
begin
while (FormatPtr < FormatEndPtr) and {$IF CompilerVersion >= 25}{Delphi XE4} (Char(FormatPtr^).IsNumber) {$ELSE} (TCharacter.IsNumber(Char(FormatPtr^))) {$IFEND} do
Inc(FormatPtr);
if FormatStartPtr <> FormatPtr then
begin
System.Ansistrings.StrLCopy(StrBuf, FormatStartPtr, Integer(FormatPtr - FormatStartPtr));
if not ALTryStrToInt(AnsiString(StrBuf), Width) then
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end
end;
// Gather Precision
if FormatPtr^ = '.' then
begin
Inc(FormatPtr);
if (FormatPtr >= FormatEndPtr) then
Break;
if FormatPtr^ = '*' then
begin
Precision := -2;
Inc(FormatPtr);
end
else
begin
FormatStartPtr := FormatPtr;
while (FormatPtr < FormatEndPtr) and {$IF CompilerVersion >= 25}{Delphi XE4} (Char(FormatPtr^).IsNumber) {$ELSE} (TCharacter.IsNumber(Char(FormatPtr^))) {$IFEND} do
Inc(FormatPtr);
System.Ansistrings.StrLCopy(StrBuf, FormatStartPtr, Integer(FormatPtr - FormatStartPtr));
if not ALTryStrToInt(AnsiString(StrBuf), Precision) then
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end;
end
else
Precision := -1;
// Gather Conversion Character
if not {$IF CompilerVersion >= 25}{Delphi XE4} Char(FormatPtr^).IsLetter {$ELSE} TCharacter.IsLetter(Char(FormatPtr^)) {$IFEND} then
Break;
case FormatPtr^ of
'a'..'z':
FormatChar := AnsiChar(Byte(FormatPtr^) xor $20);
else
FormatChar := FormatPtr^;
end;
Inc(FormatPtr);
// Handle Args
if Width = -2 then // If * width was found
begin
if ArgsIndex >= ArgsLength then
ALAnsiFormatError(1, PAnsiChar(@Format), FmtLen);
if Args[ArgsIndex].VType = vtInteger then
begin
if ArgsIndex >= ArgsLength then
ALAnsiFormatError(1, PAnsiChar(@Format), FmtLen);
Width := Args[ArgsIndex].VInteger;
if Width < 0 then
begin
LeftJustification := not LeftJustification;
Width := -Width;
end;
Inc(ArgsIndex);
end
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end;
if Precision = -2 then
begin
if ArgsIndex >= ArgsLength then
ALAnsiFormatError(1, PAnsiChar(@Format), FmtLen);
if Args[ArgsIndex].VType = vtInteger then
begin
if ArgsIndex >= ArgsLength then
ALAnsiFormatError(1, PAnsiChar(@Format), FmtLen);
Precision := Args[ArgsIndex].VInteger;
Inc(ArgsIndex);
end
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end;
if ArgsIndex >= ArgsLength then
ALAnsiFormatError(1, PAnsiChar(@Format), FmtLen);
CurrentArg := Args[ArgsIndex];
Overwrite := False;
case CurrentArg.VType of
vtBoolean,
vtObject,
vtClass,
vtWideChar,
vtPWideChar,
vtWideString,
vtInterface: ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtInteger:
begin
if (Precision > 16) or (Precision = -1) then
Precision := 0;
case FormatChar of
'D': S := AnsiString(ALIntToStr(CurrentArg.VInteger));
'U': S := AnsiString(ALUIntToStr(Cardinal(CurrentArg.VInteger)));
'X': S := AnsiString(ALIntToHex(CurrentArg.VInteger, 0));
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end;
Overwrite := AddBuf(PAnsiChar(S));
end;
vtChar:
if FormatChar = 'S' then
begin
S := AnsiChar(CurrentArg.VChar);
Overwrite := AddBuf(PAnsiChar(S), Precision);
end
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtExtended, vtCurrency:
begin
if CurrentArg.VType = vtExtended then
FloatVal := fvExtended
else
FloatVal := fvCurrency;
Len := 0;
if (FormatChar = 'G') or (FormatChar = 'E') then
begin
if Cardinal(Precision) > 18 then
Precision := 15;
end
else if Cardinal(Precision) > 18 then
begin
Precision := 2;
if FormatChar = 'M' then
Precision := AFormatSettings.CurrencyDecimals;
end;
case FormatChar of
'G': Len := ALFloatToText(StrBuf, CurrentArg.VExtended^, FloatVal, ffGeneral, Precision, 3, AFormatSettings);
'E': Len := ALFloatToText(StrBuf, CurrentArg.VExtended^, FloatVal, ffExponent, Precision, 3, AFormatSettings);
'F': Len := ALFloatToText(StrBuf, CurrentArg.VExtended^, FloatVal, ffFixed, 18, Precision, AFormatSettings);
'N': Len := ALFloatToText(StrBuf, CurrentArg.VExtended^, FloatVal, ffNumber, 18, Precision, AFormatSettings);
'M': Len := ALFloatToText(StrBuf, CurrentArg.VExtended^, FloatVal, ffCurrency, 18, Precision, AFormatSettings);
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end;
StrBuf[Len] := #0;
Precision := 0;
Overwrite := AddBuf(StrBuf);
end;
vtString:
if FormatChar = 'S' then
Overwrite := AddBuf(PAnsiChar(AnsiString(ShortString(PShortString(CurrentArg.VAnsiString)^))), Precision)
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtUnicodeString:
if FormatChar = 'S' then
Overwrite := AddBuf(PAnsiChar(AnsiString(CurrentArg.VPWideChar)), Precision)
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtVariant:
if FormatChar = 'S' then
Overwrite := AddBuf(PAnsiChar(VariantToAnsiString(TVarData(CurrentArg.VVariant^))), Precision)
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtPointer:
if FormatChar = 'P' then
begin
S := AnsiString(ALIntToHex(IntPtr(CurrentArg.VPointer), SizeOf(Pointer)*2));
Overwrite := AddBuf(PAnsiChar(S));
end
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtPChar:
if FormatChar = 'S' then
Overwrite := AddBuf(CurrentArg.VWideString, Precision)
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtAnsiString:
if FormatChar = 'S' then
Overwrite := AddBuf(CurrentArg.VAnsiString, Precision, Length(AnsiString(CurrentArg.VAnsiString)))
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
vtInt64:
begin
if (Precision > 32) or (Precision = -1) then
Precision := 0;
case FormatChar of
'D': S := AnsiString(ALIntToStr(CurrentArg.VInt64^));
'U': S := AnsiString(ALUIntToStr(UInt64(CurrentArg.VInt64^)));
'X': S := AnsiString(ALIntToHex(CurrentArg.VInt64^, 0));
else
ALAnsiFormatError(0, PAnsiChar(@Format), FmtLen);
end;
Overwrite := AddBuf(PAnsiChar(S));
end;
end;
if Overwrite then
begin
Result := BufPtr - PAnsiChar(@Buffer);
Exit;
end;
end
else
begin
if BufMaxLen = 0 then
begin
Result := BufPtr - PAnsiChar(@Buffer);
Exit;
end;
BufPtr^ := FormatPtr^;
Inc(FormatPtr);
Inc(BufPtr);
Dec(BufMaxLen, Sizeof(AnsiChar));
end;
Result := BufPtr - PAnsiChar(@Buffer);
end;
{$ELSE LEGACY_FORMAT or !PUREPASCAL}
{$IFDEF X86ASM}
function AnsiFloatToTextEx(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const AFormatSettings: TALFormatSettings): Integer;
begin
Result := ALFloatToText(BufferArg, Value, ValueType, Format, Precision, Digits,
AFormatSettings);
end;
var
ArgIndex, Width, Prec: Integer;
BufferOrg, FormatOrg, FormatPtr: PAnsiChar;
JustFlag: Byte;
StrBuf: array[0..64] of AnsiChar; // if currencystring contain more than 64 chars then it's raise an error :(
TempAnsiStr: AnsiString;
SaveGOT: Integer;
asm
{ -> eax Buffer }
{ edx BufLen }
{ ecx Format }
PUSH EBX
PUSH ESI
PUSH EDI
MOV EDI, EAX
MOV ESI, ECX
{$IFDEF PIC}
PUSH ECX
CALL ALGetGOT
POP ECX
{$ELSE !PIC}
XOR EAX, EAX
{$ENDIF !PIC}
MOV SaveGOT, EAX
ADD ECX, FmtLen
MOV BufferOrg, EDI
XOR EAX, EAX
MOV ArgIndex, EAX
MOV TempAnsiStr, EAX
@Loop:
OR EDX, EDX
JE @Done
@NextChar:
CMP ESI, ECX
JE @Done
LODSB
CMP AL, '%'
JE @Format
@StoreChar:
STOSB
DEC EDX
JNE @NextChar
@Done:
MOV EAX, EDI
SUB EAX, BufferOrg
JMP @Exit
@Format:
CMP ESI, ECX
JE @Done
LODSB
CMP AL, '%'
JE @StoreChar
LEA EBX, [ESI-2]
MOV FormatOrg, EBX
@A0: MOV JustFlag, AL
CMP AL, '-'
JNE @A1
CMP ESI, ECX
JE @Done
LODSB
@A1: CALL @Specifier
CMP AL, ':'
JNE @A2
MOV ArgIndex, EBX
CMP ESI, ECX
JE @Done
LODSB
JMP @A0
@A2: OR EBX, EBX
JNS @A2_3
NEG EBX
CMP JustFlag, '-'
JE @A2_2
MOV JustFlag, '-'
JMP @A2_3
@A2_2: MOV JustFlag, '*'
@A2_3: MOV Width, EBX
MOV EBX, -1
CMP AL, '.'
JNE @A3
CMP ESI, ECX
JE @Done
LODSB
CALL @Specifier
@A3: MOV Prec, EBX
MOV FormatPtr, ESI
PUSH ECX
PUSH EDX
{$IFDEF ALIGN_STACK}
SUB ESP, 8
{$ENDIF}
CALL @Convert
{$IFDEF ALIGN_STACK}
ADD ESP, 8
{$ENDIF}
POP EDX
MOV EBX, Width
SUB EBX, ECX // ECX <=> number of characters output
JAE @A4 // jump -> output smaller than width
XOR EBX, EBX
@A4: CMP JustFlag, '-'
JNE @A6
SUB EDX, ECX
JAE @A5
ADD ECX, EDX
XOR EDX, EDX
@A5: REP MOVSB
@A6: XCHG EBX, ECX
SUB EDX, ECX
JAE @A7
ADD ECX, EDX
XOR EDX, EDX
@A7: MOV AL, ' '
REP STOSB
XCHG EBX, ECX
SUB EDX, ECX
JAE @A8
ADD ECX, EDX
XOR EDX, EDX
@A8: REP MOVSB
CMP TempAnsiStr, 0
JE @A9
PUSH EDX
LEA EAX, TempAnsiStr
{$IFDEF ALIGN_STACK}
SUB ESP, 8
{$ENDIF ALIGN_STACK}
CALL ALFormatClearStr
{$IFDEF ALIGN_STACK}
ADD ESP, 8
{$ENDIF ALIGN_STACK}
POP EDX
@A9: POP ECX
MOV ESI,FormatPtr
JMP @Loop
@Specifier:
XOR EBX, EBX
CMP AL, '*'
JE @B3
@B1: CMP AL, '0'
JB @B5
CMP AL, '9'
JA @B5
IMUL EBX, EBX, 10
SUB AL, '0'
MOVZX EAX, AL
ADD EBX, EAX
CMP ESI, ECX
JE @B2
LODSB
JMP @B1
@B2: POP EAX
JMP @Done
@B3: MOV EAX, ArgIndex
CMP EAX, Args.Integer[-4]
JG @B4
INC ArgIndex
MOV EBX, Args
CMP [EBX+EAX*8].Byte[4], vtInteger
MOV EBX, [EBX+EAX*8]
JE @B4
XOR EBX, EBX
@B4: CMP ESI, ECX
JE @B2
LODSB
@B5: RET
@Convert:
AND AL, 0DFH
MOV CL, AL
MOV EAX, 1
MOV EBX, ArgIndex
CMP EBX, Args.Integer[-4]
JG @ErrorExit
INC ArgIndex
MOV ESI, Args
LEA ESI, [ESI+EBX*8]
MOV EAX, [ESI].Integer[0] // TVarRec.data
MOVZX EDX, [ESI].Byte[4] // TVarRec.VType
{$IFDEF PIC}
MOV EBX, SaveGOT
ADD EBX, offset @CvtVector
MOV EBX, [EBX+EDX*4]
ADD EBX, SaveGOT
JMP EBX
{$ELSE !PIC}
JMP @CvtVector.Pointer[EDX*4]
{$ENDIF !PIC}
@CvtVector:
DD @CvtInteger // vtInteger
DD @CvtBoolean // vtBoolean
DD @CvtChar // vtChar
DD @CvtExtended // vtExtended
DD @CvtShortStr // vtString
DD @CvtPointer // vtPointer
DD @CvtPChar // vtPChar
DD @CvtObject // vtObject
DD @CvtClass // vtClass
DD @CvtWideChar // vtWideChar
DD @CvtPWideChar // vtPWideChar
DD @CvtAnsiStr // vtAnsiString
DD @CvtCurrency // vtCurrency
DD @CvtVariant // vtVariant
DD @CvtInterface // vtInterface
DD @CvtWideString // vtWideString
DD @CvtInt64 // vtInt64
DD @CvtUnicodeString // vtUnicodeString
@CvtBoolean:
@CvtObject:
@CvtClass:
@CvtWideChar:
@CvtInterface:
@CvtError:
XOR EAX,EAX
@ErrorExit:
{$IFDEF ALIGN_STACK}
SUB ESP, 12
{$ENDIF}
CALL @ClearTmpAnsiStr
{$IFDEF ALIGN_STACK}
ADD ESP, 12
{$ENDIF}
MOV EDX, FormatOrg
MOV ECX, FormatPtr
SUB ECX, EDX
MOV EBX, SaveGOT
{$IFDEF PC_MAPPED_EXCEPTIONS}
// Because of all the assembly code here, we can't call a routine
// that throws an exception if it looks like we're still on the
// stack. The static disassembler cannot give sufficient unwind
// frame info to unwind the confusion that is generated from the
// assembly code above. So before we throw the exception, we
// go to some lengths to excise ourselves from the stack chain.
// We were passed 12 bytes of parameters on the stack, and we have
// to make sure that we get rid of those, too.
{$IFDEF ALIGN_STACK}
MOV ESP, EBP // Ditch everthing to the frame
POP EBP // Ditch the rest of the frame
{$ELSE !ALIGN_STACK}
MOV ESP, EBP // Ditch everthing to the frame
MOV EBP, [ESP + 4] // Get the return addr
MOV [ESP + 16], EBP // Move the ret addr up in the stack
POP EBP // Ditch the rest of the frame
ADD ESP, 12 // Ditch the space that was taken by params
{$ENDIF !ALIGN_STACK}
JMP ALAnsiFormatError // Off to FormatErr - corrected from FormatError from original Delphi xe2 source. it's must be AnsiFormatError
{$ELSE !PC_MAPPED_EXCEPTIONS}
CALL ALAnsiFormatError // corrected from FormatError from original Delphi xe2 source. it's must be AnsiFormatError
{$ENDIF !PC_MAPPED_EXCEPTIONS}
// The above call raises an exception and does not return
@CvtInt64:
// CL <= format character
// EAX <= address of int64
// EBX <= TVarRec.VType
LEA ESI, StrBuf[32]
MOV EDX, Prec
CMP EDX, 32
JBE @I64_1 // zero padded field width > buffer => no padding
XOR EDX, EDX
@I64_1: MOV EBX, ECX
SUB CL, 'D'
JZ ALCvtInt64 // branch predict backward jump taken
MOV ECX, 16
CMP BL, 'X'
JE ALCvtInt64
MOV ECX, 10
CMP BL, 'U'
JE ALCvtInt64
JMP @CvtError
@CvtInteger:
LEA ESI, StrBuf[16]
MOV EDX, Prec
MOV EBX, ECX
CMP EDX, 16
JBE @C1 // zero padded field width > buffer => no padding
XOR EDX, EDX
@C1: SUB CL, 'D'
JZ ALCvtInt // branch predict backward jump taken
MOV ECX, 16
CMP BL, 'X'
JE ALCvtInt
MOV ECX, 10
CMP BL, 'U'
JE ALCvtInt
JMP @CvtError
@CvtChar:
CMP CL, 'S'
JNE @CvtError
MOV ECX, 1
JMP @CvtStrLen
@CvtVariant:
CMP CL, 'S'
JNE @CvtError
CMP [EAX].TVarData.VType, varNull
JBE @CvtEmptyStr
MOV EDX, EAX
LEA EAX, TempAnsiStr
CALL ALFormatVarToStr
MOV ESI, TempAnsiStr
JMP @CvtStrRef
@CvtEmptyStr:
XOR ECX,ECX
RET
@CvtShortStr:
CMP CL, 'S'
JNE @CvtError
MOV ESI, EAX
LODSB
MOVZX ECX, AL
JMP @CvtStrLen
@CvtPWideChar:
MOV ESI, OFFSET System.@LStrFromPWChar
JMP @CvtWideThing
@CvtUnicodeString:
MOV ESI, OFFSET System.@LStrFromUStr
JMP @CvtWideThing
@CvtWideString:
MOV ESI, OFFSET System.@LStrFromWStr
@CvtWideThing:
{$IFDEF PIC}
ADD ESI, SaveGOT
{$ENDIF PIC}
CMP CL, 'S'
JNE @CvtError
MOV EDX, EAX
LEA EAX, TempAnsiStr
{$IFDEF ALIGN_STACK}
SUB ESP, 4
{$ENDIF}
PUSH EBX
PUSH ECX
MOV EBX, SaveGOT
{$IFDEF PIC} // Double indirect using GOT
MOV ECX, [EBX].DefaultSystemCodePage
MOV ECX, [ECX]
{$ELSE !PIC}
//MOV ECX, DefaultSystemCodePage // >> we must use CP_UTF8 instead of DefaultSystemCodePage because if not we receive the error Need imported data reference ($G) to access DefaultSystemCodePage when we compile the dpk.
MOV ECX, CP_UTF8
{$ENDIF}
CALL ESI
POP ECX
POP EBX
{$IFDEF ALIGN_STACK}
ADD ESP, 4
{$ENDIF}
MOV ESI, TempAnsiStr
MOV EAX, ESI
JMP @CvtStrRef
@CvtAnsiStr:
CMP CL, 'S'
JNE @CvtError
MOV ESI, EAX
@CvtStrRef:
OR ESI, ESI
JE @CvtEmptyStr
MOV ECX, [ESI-4]
@CvtStrLen:
CMP ECX, Prec
JA @E1
RET
@E1: MOV ECX, Prec
RET
@CvtPChar:
CMP CL, 'S'
JNE @CvtError
MOV ESI, EAX
PUSH EDI
MOV EDI, EAX
XOR AL, AL
MOV ECX, Prec
JECXZ @F1
REPNE SCASB
JNE @F1
DEC EDI
@F1: MOV ECX, EDI
SUB ECX, ESI
POP EDI
RET
@CvtPointer:
CMP CL, 'P'
JNE @CvtError
MOV EDX, 8
MOV ECX, 16
LEA ESI, StrBuf[16]
JMP ALCvtInt
@CvtCurrency:
MOV BH, fvCurrency
JMP @CvtFloat
@CvtExtended:
MOV BH, fvExtended
@CvtFloat:
MOV ESI, EAX
MOV BL, ffGeneral
CMP CL, 'G'
JE @G2
MOV BL, ffExponent
CMP CL, 'E'
JE @G2
MOV BL, ffFixed
CMP CL, 'F'
JE @G1
MOV BL, ffNumber
CMP CL, 'N'
JE @G1
CMP CL, 'M'
JNE @CvtError
MOV BL, ffCurrency
@G1: MOV EAX, 18
MOV EDX, Prec
CMP EDX, EAX
JBE @G3
MOV EDX, 2
CMP CL, 'M'
JNE @G3
MOV EDX, AFormatSettings
MOVZX EDX, [EDX].TALFormatSettings.CurrencyDecimals
JMP @G3
@G2: MOV EAX, Prec
MOV EDX, 3
CMP EAX, 18
JBE @G3
MOV EAX, 15
@G3:
{$IFDEF ALIGN_STACK}
SUB ESP, 12
{$ENDIF ALIGN_STACK}
PUSH EBX
PUSH EAX
PUSH EDX
MOV EDX, [AFormatSettings]
PUSH EDX
LEA EAX, StrBuf
MOV EDX, ESI
MOVZX ECX, BH
MOV EBX, SaveGOT
CALL AnsiFloatToTextEx
MOV ECX, EAX
LEA ESI, StrBuf
{$IFDEF ALIGN_STACK}
ADD ESP, 12
{$ENDIF ALIGN_STACK}
RET
@ClearTmpAnsiStr:
PUSH EBX
PUSH EAX
LEA EAX, TempAnsiStr
MOV EBX, SaveGOT
{$IFDEF ALIGN_STACK}
SUB ESP, 4
{$ENDIF}
CALL System.@LStrClr
{$IFDEF ALIGN_STACK}
ADD ESP, 4
{$ENDIF}
POP EAX
POP EBX
RET
@Exit:
CALL @ClearTmpAnsiStr
POP EDI
POP ESI
POP EBX
end;
{$ENDIF X86ASM}
{$IFEND LEGACY_FORMAT or !PUREPASCAL}
{**************************************************************}
function ALFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
begin
Result := ALFormatBuf(Buffer, BufLen, Format, FmtLen, Args, ALDefaultFormatSettings);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if System.AnsiStrings.FmtStr is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALFmtStr(var Result: AnsiString; const Format: AnsiString;
const Args: array of const; const AFormatSettings: TALFormatSettings);
var
Len, BufLen: Integer;
Buffer: array[0..4095] of AnsiChar;
begin
BufLen := SizeOf(Buffer);
if Length(Format) < (sizeof(Buffer) - (sizeof(Buffer) div 4)) then
Len := ALFormatBuf(Buffer, sizeof(Buffer) - 1, Pointer(Format)^, Length(Format),
Args, AFormatSettings)
else
begin
BufLen := Length(Format);
Len := BufLen;
end;
if Len >= BufLen - 1 then
begin
while Len >= BufLen - 1 do
begin
Inc(BufLen, BufLen);
Result := ''; // prevent copying of existing data, for speed
SetLength(Result, BufLen);
Len := ALFormatBuf(Pointer(Result)^, BufLen - 1, Pointer(Format)^,
Length(Format), Args, AFormatSettings);
end;
SetLength(Result, Len);
end
else
SetString(Result, Buffer, Len);
end;
{**********************************************************************************}
function ALFormat(const Format: AnsiString; const Args: array of const): AnsiString;
begin
Result := ALFormat(Format, Args, ALDefaultFormatSettings);
end;
{***********************************************************************************************}
procedure ALFormat(const Format: AnsiString; const Args: array of const; var Result: ansiString);
begin
Result := ALFormat(Format, Args, ALDefaultFormatSettings);
end;
{****************************************************************************************************************************}
function ALFormat(const Format: AnsiString; const Args: array of const; const AFormatSettings: TALFormatSettings): AnsiString;
begin
ALFmtStr(Result, Format, Args, AFormatSettings);
end;
{*****************************************************************************************************************************************}
procedure ALFormat(const Format: AnsiString; const Args: array of const; const AFormatSettings: TALFormatSettings; var Result: ansiString);
begin
ALFmtStr(Result, Format, Args, AFormatSettings);
end;
{$ENDIF !NEXTGEN}
{***************************************************************************}
function ALFormatU(const Format: String; const Args: array of const): String;
begin
Result := System.SysUtils.Format(Format, Args, ALDefaultFormatSettingsU);
end;
{****************************************************************************************}
procedure ALFormatU(const Format: String; const Args: array of const; var Result: String);
begin
Result := System.SysUtils.Format(Format, Args, ALDefaultFormatSettingsU);
end;
{*********************************************************************************************************************}
function ALFormatU(const Format: String; const Args: array of const; const AFormatSettings: TALFormatSettingsU): String;
begin
Result := System.SysUtils.Format(Format, Args, AFormatSettings);
end;
{**********************************************************************************************************************************}
procedure ALFormatU(const Format: String; const Args: array of const; const AFormatSettings: TALFormatSettingsU; var Result: String);
begin
Result := System.SysUtils.Format(Format, Args, AFormatSettings);
end;
{$IFNDEF NEXTGEN}
{************************************************************************}
function ALTryStrToBool(const S: AnsiString; out Value: Boolean): Boolean;
var
LResult: Integer;
begin
Result := ALTryStrToInt(S, LResult);
if Result then
Value := LResult <> 0
else
begin
Result := ALSametext(S,'True');
if Result then
Value := True
else
begin
Result := ALSametext(S,'False');
if Result then
Value := False;
end;
end;
end;
{$ENDIF !NEXTGEN}
{*********************************************************************}
function ALTryStrToBoolU(const S: String; out Value: Boolean): Boolean;
var
LResult: Integer;
begin
Result := ALTryStrToIntU(S, LResult);
if Result then
Value := LResult <> 0
else
begin
Result := ALSametextU(S,'True');
if Result then
Value := True
else
begin
Result := ALSametextU(S,'False');
if Result then
Value := False;
end;
end;
end;
{$IFNDEF NEXTGEN}
{*********************************************}
Function AlStrToBool(Value:AnsiString):Boolean;
Begin
Result := False;
ALTryStrtoBool(Value,Result);
end;
{$ENDIF !NEXTGEN}
{******************************************}
Function AlStrToBoolU(Value:String):Boolean;
Begin
Result := False;
ALTryStrtoBoolU(Value,Result);
end;
{$IFNDEF NEXTGEN}
{***********************************************************************************************************}
function ALBoolToStr(B: Boolean; const trueStr: ansistring='1'; const falseStr: ansistring='0'): Ansistring;
begin
if B then result := trueStr
else result := falseStr;
end;
{******************************************************************************************************************}
procedure ALBoolToStr(var s: ansiString; B: Boolean; const trueStr: ansistring='1'; const falseStr: ansistring='0');
begin
if B then s := trueStr
else s := falseStr;
end;
{$ENDIF !NEXTGEN}
{************************************************************************************************}
function ALBoolToStrU(B: Boolean; const trueStr: String='1'; const falseStr: String='0'): String;
begin
if B then result := trueStr
else result := falseStr;
end;
{*******************************************************************************************************}
procedure ALBoolToStrU(var s: String; B: Boolean; const trueStr: String='1'; const falseStr: String='0');
begin
if B then s := trueStr
else s := falseStr;
end;
{$IFNDEF NEXTGEN}
{$IFDEF MACOS}
{**}
type
TCFString = record
Value: CFStringRef;
constructor Create(const Val: string);
function AsString(Release: Boolean = False): string;
function AsAnsiString(Release: Boolean = False): ansistring;
function AsChar(Release: Boolean = False): Char;
class operator Implicit(const Ref: CFStringRef): TCFString;
class operator Implicit(const Ref: CFMutableStringRef): TCFString;
end;
{**********************************************}
constructor TCFString.Create(const Val: string);
begin
Value := CFStringCreateWithCharacters(kCFAllocatorDefault,
PChar(Val), Length(Val));
end;
{************************************************************}
function TCFString.AsString(Release: Boolean = False): string;
var
Range: CFRange;
Tmp: TCharArray;
begin
if Value = nil then Exit('');
try
Range := CFRangeMake(0, CFStringGetLength(Value));
if Range.Length > 0 then
begin
SetLength(Tmp, Range.Length);
CFStringGetCharacters(Value, Range, MarshaledString(Tmp));
Result := string.Create(Tmp);
end
else
Result := EmptyStr;
finally
if Release then
CFRelease(Value);
end;
end;
{********************************************************************}
function TCFString.AsAnsiString(Release: Boolean = False): ansistring;
begin
result := AnsiString(AsString(Release));
end;
{********************************************************}
function TCFString.AsChar(Release: Boolean = False): Char;
begin
if Value = nil then Exit(#0);
try
if CFStringGetLength(Value) > 0 then
Result := CFStringGetCharacterAtIndex(Value, 0)
else
Result := #0;
finally
if Release then
CFRelease(Value);
end;
end;
{*******************************************************************}
class operator TCFString.Implicit(const Ref: CFStringRef): TCFString;
begin
Result.Value := Ref;
end;
{**************************************************************************}
class operator TCFString.Implicit(const Ref: CFMutableStringRef): TCFString;
begin
Result.Value := CFStringRef(Ref);
end;
{$ENDIF MACOS}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.DateTimeToString is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALDateTimeToString(var Result: AnsiString; const Format: AnsiString;
DateTime: TDateTime; const AFormatSettings: TALFormatSettings);
var
BufPos, AppendLevel: Integer;
Buffer: array[0..255] of AnsiChar;
DynBuffer: array of AnsiChar;
Sb: TArray<ansiChar>;
procedure AppendChars(P: PAnsiChar; Count: Integer);
var
N, I: Integer;
begin
N := SizeOf(Buffer) div SizeOf(AnsiChar);
N := N - BufPos;
if Count > N then
begin
I := Length(DynBuffer);
SetLength(DynBuffer, I + BufPos + Count);
if BufPos > 0 then
begin
ALMove(Buffer[0], DynBuffer[I], BufPos * SizeOf(AnsiChar));
Inc(I, BufPos);
end;
ALMove(P[0], DynBuffer[I], Count * SizeOf(AnsiChar));
BufPos := 0;
end
else if Count > 0 then
begin
ALMove(P[0], Buffer[BufPos], Count * SizeOf(AnsiChar));
Inc(BufPos, Count);
end;
end;
procedure AppendString(const S: AnsiString);
begin
AppendChars(Pointer(S), Length(S));
end;
procedure AppendNumber(Number, Digits: Integer);
const
Format: array[0..3] of AnsiChar = '%.*d';
var
NumBuf: array[0..15] of AnsiChar;
begin
AppendChars(NumBuf, ALFormatBuf(NumBuf, Length(NumBuf), Format,
Length(Format), [Digits, Number]));
end;
procedure AppendFormat(Format: PAnsiChar);
var
Starter, Token, LastToken: AnsiChar;
DateDecoded, TimeDecoded, Use12HourClock,
BetweenQuotes: Boolean;
P: PAnsiChar;
Count: Integer;
Year, Month, Day, Hour, Min, Sec, MSec, H: Word;
procedure GetCount;
var
P: PAnsiChar;
begin
P := Format;
while Format^ = Starter do Inc(Format);
Count := Format - P + 1;
end;
procedure GetDate;
begin
if not DateDecoded then
begin
DecodeDate(DateTime, Year, Month, Day);
DateDecoded := True;
end;
end;
procedure GetTime;
begin
if not TimeDecoded then
begin
DecodeTime(DateTime, Hour, Min, Sec, MSec);
TimeDecoded := True;
end;
end;
{$IFDEF MSWINDOWS}
function ConvertEraString(const Count: Integer) : AnsiString;
var
FormatStr: AnsiString;
SystemTime: TSystemTime;
Buffer: array[Byte] of AnsiChar;
P: PAnsiChar;
begin
Result := '';
SystemTime.wYear := Year;
SystemTime.wMonth := Month;
SystemTime.wDay := Day;
FormatStr := 'gg';
if GetDateFormatA(GetThreadLocale, DATE_USE_ALT_CALENDAR, @SystemTime,
PAnsiChar(FormatStr), Buffer, SizeOf(Buffer)) <> 0 then
begin
Result := Buffer;
if Count = 1 then
begin
case SysLocale.PriLangID of
LANG_JAPANESE:
Result := ALCopyStr(Result, 1, System.Ansistrings.CharToElementLen(Result, 1));
LANG_CHINESE:
if (SysLocale.SubLangID = SUBLANG_CHINESE_TRADITIONAL)
and (System.Ansistrings.ElementToCharLen(Result, Length(Result)) = 4) then
begin
P := Buffer + System.Ansistrings.CharToElementIndex(Result, 3) - 1;
SetString(Result, P, System.Ansistrings.CharToElementLen(P, 2));
end;
end;
end;
end;
end;
function ConvertYearString(const Count: Integer): AnsiString;
var
FormatStr: AnsiString;
SystemTime: TSystemTime;
Buffer: array[Byte] of AnsiChar;
begin
Result := '';
SystemTime.wYear := Year;
SystemTime.wMonth := Month;
SystemTime.wDay := Day;
if Count <= 2 then
FormatStr := 'yy' // avoid Win95 bug.
else
FormatStr := 'yyyy';
if GetDateFormatA(GetThreadLocale, DATE_USE_ALT_CALENDAR, @SystemTime,
PAnsiChar(FormatStr), Buffer, SizeOf(Buffer)) <> 0 then
begin
Result := Buffer;
if (Count = 1) and (Result[Low(AnsiString)] = '0') then
Result := ALCopyStr(Result, 2, Length(Result)-1);
end;
end;
{$ENDIF MSWINDOWS}
{$IFDEF POSIX}
{$IFNDEF MACOS}
function FindEra(Date: Integer): Byte;
var
I : Byte;
begin
Result := 0;
for I := High(AFormatSettings.EraInfo) downto Low(AFormatSettings.EraInfo) do
begin
if (AFormatSettings.EraInfo[I].EraStart <= Date) then
Exit(I);
end;
end;
{$ENDIF !MACOS}
function ConvertEraString(const Count: Integer) : AnsiString;
var
{$IFDEF MACOS}
Formatter: CFDateFormatterRef;
LDate: CFGregorianDate;
LYear, LMonth, LDay: Word;
FormatString: TCFString;
DefaultTZ: CFTimeZoneRef;
Locale: CFLocaleRef;
{$ELSE !MACOS}
I : Byte;
{$ENDIF MACOS}
begin
Result := '';
{$IFDEF MACOS}
Locale := nil;
DefaultTZ := nil;
Formatter := nil;
FormatString.Value := nil;
try
Locale := CFLocaleCopyCurrent;
DefaultTZ := CFTimeZoneCopyDefault;
Formatter := CFDateFormatterCreate(kCFAllocatorDefault, Locale,
kCFDateFormatterFullStyle, kCFDateFormatterNoStyle);
FormatString := TCFString.Create('GG');
CFDateFormatterSetFormat(Formatter, FormatString.Value);
DecodeDate(DateTime, LYear, LMonth, LDay);
LDate.year := LYear; LDate.month := ShortInt(LMonth); LDate.day := ShortInt(LDay);
LDate.hour := 0; LDate.minute := 0; LDate.second := 0;
Result := TCFString(CFDateFormatterCreateStringWithAbsoluteTime(
kCFAllocatorDefault, Formatter,
CFGregorianDateGetAbsoluteTime(LDate, DefaultTZ))
).AsAnsiString(true);
finally
if FormatString.Value <> nil then
CFRelease(FormatString.Value);
if Formatter <> nil then
CFRelease(Formatter);
if DefaultTZ <> nil then
CFRelease(DefaultTZ);
if Locale <> nil then
CFRelease(Locale);
end;
{$ELSE !MACOS}
I := FindEra(Trunc(DateTime));
if I > 0 then
Result := AFormatSettings.EraInfo[I].EraName;
{$ENDIF MACOS}
end;
function ConvertYearString(const Count: Integer) : AnsiString;
var
S : AnsiString;
function GetEraOffset: integer;
{$IFDEF MACOS}
var
StartEra, TargetDate, LengthEra: CFAbsoluteTime;
LDate: CFGregorianDate;
LYear, LMonth, LDay: Word;
Calendar, CurrentCalendar: CFCalendarRef;
TimeZone: CFTimeZoneRef;
{$ENDIF MACOS}
begin
{$IFDEF MACOS}
Result := 0;
TimeZone := nil;
CurrentCalendar := nil;
Calendar := nil;
try
DecodeDate(DateTime, LYear, LMonth, LDay);
LDate.year := LYear; LDate.month := ShortInt(LMonth); LDate.day := ShortInt(LDay);
LDate.hour := 0; LDate.minute := 0; LDate.second := 0;
TimeZone := CFTimeZoneCopyDefault;
TargetDate := CFGregorianDateGetAbsoluteTime(LDate, TimeZone);
CurrentCalendar := CFCalendarCopyCurrent;
Calendar := CFCalendarCreateWithIdentifier(kCFAllocatorDefault,
CFCalendarGetIdentifier(CurrentCalendar));
if CFCalendarGetTimeRangeOfUnit(Calendar, kCFCalendarUnitEra,
TargetDate, @StartEra, @LengthEra) then
begin
LDate := CFAbsoluteTimeGetGregorianDate(StartEra, TimeZone);
Result := LDate.Year - 1;
end;
finally
if CurrentCalendar <> nil then
CFRelease(CurrentCalendar);
if Calendar <> nil then
CFRelease(Calendar);
if TimeZone <> nil then
CFRelease(TimeZone);
end;
{$ELSE !MACOS}
Result := FindEra(Trunc(DateTime));
if Result > 0 then
Result := AFormatSettings.EraInfo[Result].EraOffset;
{$ENDIF MACOS}
end;
begin
S := ALIntToStr(Year - GetEraOffset);
while Length(S) < Count do
S := '0' + S;
if Length(S) > Count then
S := ALCopyStr(S, Length(S) - (Count - 1), Count);
Result := S;
end;
{$ENDIF POSIX}
begin
if (Format <> nil) and (AppendLevel < 2) then
begin
Inc(AppendLevel);
LastToken := ' ';
DateDecoded := False;
TimeDecoded := False;
Use12HourClock := False;
while Format^ <> #0 do
begin
Starter := Format^;
//if IsLeadChar(Starter) then
//begin
// AppendChars(Format, System.Ansistrings.StrCharLength(Format) div SizeOf(AnsiChar));
// Format := System.Ansistrings.StrNextChar(Format);
// LastToken := ' ';
// Continue;
//end;
Format := System.Ansistrings.StrNextChar(Format);
Token := Starter;
if Token in ['a'..'z'] then Dec(Token, 32);
if Token in ['A'..'Z'] then
begin
if (Token = 'M') and (LastToken = 'H') then Token := 'N';
LastToken := Token;
end;
case Token of
'Y':
begin
GetCount;
GetDate;
if Count <= 2 then
AppendNumber(Year mod 100, 2) else
AppendNumber(Year, 4);
end;
'G':
begin
GetCount;
GetDate;
AppendString(ConvertEraString(Count));
end;
'E':
begin
GetCount;
GetDate;
AppendString(ConvertYearString(Count));
end;
'M':
begin
GetCount;
GetDate;
case Count of
1, 2: AppendNumber(Month, Count);
3: AppendString(AFormatSettings.ShortMonthNames[Month]);
else
AppendString(AFormatSettings.LongMonthNames[Month]);
end;
end;
'D':
begin
GetCount;
case Count of
1, 2:
begin
GetDate;
AppendNumber(Day, Count);
end;
3: AppendString(AFormatSettings.ShortDayNames[DayOfWeek(DateTime)]);
4: AppendString(AFormatSettings.LongDayNames[DayOfWeek(DateTime)]);
5: AppendFormat(Pointer(AFormatSettings.ShortDateFormat));
else
AppendFormat(Pointer(AFormatSettings.LongDateFormat));
end;
end;
'H':
begin
GetCount;
GetTime;
BetweenQuotes := False;
P := Format;
while P^ <> #0 do
begin
//if IsLeadChar(P^) then
//begin
// P := System.Ansistrings.StrNextChar(P);
// Continue;
//end;
case P^ of
'A', 'a':
if not BetweenQuotes then
begin
if ( (System.Ansistrings.StrLIComp(P, 'AM/PM', 5) = 0)
or (System.Ansistrings.StrLIComp(P, 'A/P', 3) = 0)
or (System.Ansistrings.StrLIComp(P, 'AMPM', 4) = 0) ) then
Use12HourClock := True;
Break;
end;
'H', 'h':
Break;
'''', '"': BetweenQuotes := not BetweenQuotes;
end;
Inc(P);
end;
H := Hour;
if Use12HourClock then
if H = 0 then H := 12 else if H > 12 then Dec(H, 12);
if Count > 2 then Count := 2;
AppendNumber(H, Count);
end;
'N':
begin
GetCount;
GetTime;
if Count > 2 then Count := 2;
AppendNumber(Min, Count);
end;
'S':
begin
GetCount;
GetTime;
if Count > 2 then Count := 2;
AppendNumber(Sec, Count);
end;
'T':
begin
GetCount;
if Count = 1 then
AppendFormat(Pointer(AFormatSettings.ShortTimeFormat)) else
AppendFormat(Pointer(AFormatSettings.LongTimeFormat));
end;
'Z':
begin
GetCount;
GetTime;
if Count > 3 then Count := 3;
AppendNumber(MSec, Count);
end;
'A':
begin
GetTime;
P := Format - 1;
if System.Ansistrings.StrLIComp(P, 'AM/PM', 5) = 0 then
begin
if Hour >= 12 then Inc(P, 3);
AppendChars(P, 2);
Inc(Format, 4);
Use12HourClock := TRUE;
end else
if System.Ansistrings.StrLIComp(P, 'A/P', 3) = 0 then
begin
if Hour >= 12 then Inc(P, 2);
AppendChars(P, 1);
Inc(Format, 2);
Use12HourClock := TRUE;
end else
if System.Ansistrings.StrLIComp(P, 'AMPM', 4) = 0 then
begin
if Hour < 12 then
AppendString(AFormatSettings.TimeAMString) else
AppendString(AFormatSettings.TimePMString);
Inc(Format, 3);
Use12HourClock := TRUE;
end else
if System.Ansistrings.StrLIComp(P, 'AAAA', 4) = 0 then
begin
GetDate;
AppendString(AFormatSettings.LongDayNames[DayOfWeek(DateTime)]);
Inc(Format, 3);
end else
if System.Ansistrings.StrLIComp(P, 'AAA', 3) = 0 then
begin
GetDate;
AppendString(AFormatSettings.ShortDayNames[DayOfWeek(DateTime)]);
Inc(Format, 2);
end else
AppendChars(@Starter, 1);
end;
'C':
begin
GetCount;
AppendFormat(Pointer(AFormatSettings.ShortDateFormat));
GetTime;
if (Hour <> 0) or (Min <> 0) or (Sec <> 0) or (MSec <> 0) then
begin
AppendChars(' ', 1);
AppendFormat(Pointer(AFormatSettings.LongTimeFormat));
end;
end;
'/':
if AFormatSettings.DateSeparator <> #0 then
AppendChars(@AFormatSettings.DateSeparator, 1);
':':
if AFormatSettings.TimeSeparator <> #0 then
AppendChars(@AFormatSettings.TimeSeparator, 1);
'''', '"':
begin
P := Format;
while (Format^ <> #0) and (Format^ <> Starter) do
begin
//if IsLeadChar(Format^) then
// Format := System.Ansistrings.StrNextChar(Format)
//else
Inc(Format);
end;
AppendChars(P, Format - P);
if Format^ <> #0 then Inc(Format);
end;
else
AppendChars(@Starter, 1);
end;
end;
Dec(AppendLevel);
end;
end;
begin
BufPos := 0;
AppendLevel := 0;
if Format <> '' then AppendFormat(Pointer(Format)) else AppendFormat('C');
if Length(DynBuffer) > 0 then
begin
SetLength(Sb, Length(DynBuffer) + BufPos);
ALMove(DynBuffer[0], Sb[0], Length(DynBuffer) * SizeOf(AnsiChar));
if BufPos > 0 then
ALMove(Buffer[0], Sb[Length(DynBuffer)], BufPos * SizeOf(AnsiChar));
//Result := String.Create(Sb);
SetLength(Result, Length(Sb));
alMove(Sb[0], PansiChar(Result)^, Length(Sb));
end
else begin
//Result := AnsiString.Create(Buffer, 0, BufPos);
SetLength(Result, BufPos);
alMove(Buffer[0], PansiChar(Result)^, BufPos);
end;
end;
{*********************************************}
function ALDateToStr(const DateTime: TDateTime;
const AFormatSettings: TALFormatSettings): AnsiString;
begin
ALDateTimeToString(Result, AFormatSettings.ShortDateFormat, DateTime,
AFormatSettings);
end;
{*********************************************}
function ALTimeToStr(const DateTime: TDateTime;
const AFormatSettings: TALFormatSettings): AnsiString;
begin
ALDateTimeToString(Result, AFormatSettings.LongTimeFormat, DateTime,
AFormatSettings);
end;
{*************************************************}
function ALDateTimeToStr(const DateTime: TDateTime;
const AFormatSettings: TALFormatSettings): AnsiString;
begin
ALDateTimeToString(Result, '', DateTime, AFormatSettings);
end;
{****************************************************************************************************************}
procedure ALDateTimeToStr(const DateTime: TDateTime; var s: ansiString; const AFormatSettings: TALFormatSettings);
begin
ALDateTimeToString(s, '', DateTime, AFormatSettings);
end;
{$ENDIF !NEXTGEN}
{**************************************************}
function ALDateTimeToStrU(const DateTime: TDateTime;
const AFormatSettings: TALFormatSettingsU): String;
begin
Result := DateTimeToStr(DateTime, AFormatSettings);
end;
{*************************************************************************************************************}
procedure ALDateTimeToStrU(const DateTime: TDateTime; var s: String; const AFormatSettings: TALFormatSettingsU);
begin
s := DateTimeToStr(DateTime, AFormatSettings);
end;
{$IFNDEF NEXTGEN}
{**********************************************************************}
function ALFormatDateTime(const Format: AnsiString; DateTime: TDateTime;
const AFormatSettings: TALFormatSettings): AnsiString;
begin
ALDateTimeToString(Result, Format, DateTime, AFormatSettings);
end;
{**}
type
TALDateOrder = (doMDY, doDMY, doYMD);
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanBlanks is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALScanBlanks(const S: AnsiString; var Pos: Integer);
var
I: Integer;
begin
I := Pos;
while (I <= High(S)) and (S[I] = ' ') do Inc(I);
Pos := I;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanNumber is still the same and adjust the IFDEF'}
{$IFEND}
function ALScanNumber(const S: AnsiString; var Pos: Integer;
var Number: Word; var CharCount: Byte): Boolean;
var
I: Integer;
N: Word;
begin
Result := False;
CharCount := 0;
ALScanBlanks(S, Pos);
I := Pos;
N := 0;
while (I <= High(S)) and (S[I] in ['0'..'9']) and (N < 1000) do
begin
N := N * 10 + (Ord(S[I]) - Ord('0'));
Inc(I);
end;
if I > Pos then
begin
CharCount := I - Pos;
Pos := I;
Number := N;
Result := True;
end;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanString is still the same and adjust the IFDEF'}
{$IFEND}
function ALScanString(const S: AnsiString; var Pos: Integer;
const Symbol: AnsiString): Boolean;
begin
Result := False;
if Symbol <> '' then
begin
ALScanBlanks(S, Pos);
//if AnsiCompareText(Symbol, S.SubString(Pos - Low(string), Symbol.Length)) = 0 then
if ALCompareText(Symbol, ALCopyStr(S, Pos + alifThen(Low(ansiString)=0,1,0), Length(Symbol))) = 0 then
begin
Inc(Pos, Length(Symbol));
Result := True;
end;
end;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanChar is still the same and adjust the IFDEF'}
{$IFEND}
function ALScanChar(const S: AnsiString; var Pos: Integer; Ch: AnsiChar): Boolean;
begin
Result := False;
ALScanBlanks(S, Pos);
if (Pos <= High(S)) and (S[Pos] = Ch) then
begin
Inc(Pos);
Result := True;
end;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.GetDateOrder is still the same and adjust the IFDEF'}
{$IFEND}
function ALGetDateOrder(const DateFormat: AnsiString): TALDateOrder;
var
I: Integer;
begin
Result := doMDY;
I := low(ansiString);
while I <= High(DateFormat) do
begin
case AnsiChar(Ord(DateFormat[I]) and $DF) of
'E': Result := doYMD;
'Y': Result := doYMD;
'M': Result := doMDY;
'D': Result := doDMY;
else
Inc(I);
Continue;
end;
Exit;
end;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanToNumber is still the same and adjust the IFDEF'}
{$IFEND}
procedure ALScanToNumber(const S: AnsiString; var Pos: Integer);
begin
while (Pos <= High(S)) and not (S[Pos] in ['0'..'9']) do
begin
//if IsLeadChar(S[Pos]) then
// Pos := NextCharIndex(S, Pos)
//else
Inc(Pos);
end;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanDate is still the same and adjust the IFDEF'}
{$IFEND}
function ALScanDate(const S: AnsiString; var Pos: Integer; var Date: TDateTime;
const AFormatSettings: TALFormatSettings): Boolean; overload;
var
DateOrder: TALDateOrder;
N1, N2, N3, Y, M, D: Word;
L1, L2, L3, YearLen: Byte;
CenturyBase: Integer;
EraName : AnsiString;
EraYearOffset: Integer;
function EraToYear(Year: Integer): Integer;
begin
{$IFDEF MSWINDOWS}
if SysLocale.PriLangID = LANG_KOREAN then
begin
if Year <= 99 then
Inc(Year, (CurrentYear + Abs(EraYearOffset)) div 100 * 100);
if EraYearOffset > 0 then
EraYearOffset := -EraYearOffset;
end
else
Dec(EraYearOffset);
{$ENDIF MSWINDOWS}
Result := Year + EraYearOffset;
end;
begin
Result := False;
DateOrder := ALGetDateOrder(AFormatSettings.ShortDateFormat);
EraYearOffset := 0;
if AFormatSettings.ShortDateFormat[Low(ansistring)] = 'g' then // skip over prefix text
begin
ALScanToNumber(S, Pos);
EraName := ALTrim(ALCopyStr(S, 1, Pos-low(ansiString)));
EraYearOffset := AFormatSettings.GetEraYearOffset(EraName);
end
else
// If we are with only two digits for year, we suppose we are in the last era.
if (ALPos('e', AFormatSettings.ShortDateFormat) > 0) and
(High(AFormatSettings.EraInfo)>=0) then
EraYearOffset := AFormatSettings.EraInfo[High(AFormatSettings.EraInfo)].EraOffset;
if not (ALScanNumber(S, Pos, N1, L1) and ALScanChar(S, Pos, AFormatSettings.DateSeparator) and
ALScanNumber(S, Pos, N2, L2)) then Exit;
if ALScanChar(S, Pos, AFormatSettings.DateSeparator) then
begin
if not ALScanNumber(S, Pos, N3, L3) then Exit;
case DateOrder of
doMDY: begin Y := N3; YearLen := L3; M := N1; D := N2; end;
doDMY: begin Y := N3; YearLen := L3; M := N2; D := N1; end;
else{doYMD:} begin Y := N1; YearLen := L1; M := N2; D := N3; end;
end;
if EraYearOffset > 0 then
Y := EraToYear(Y)
else
if (YearLen <= 2) then
begin
CenturyBase := CurrentYear - AFormatSettings.TwoDigitYearCenturyWindow;
Inc(Y, CenturyBase div 100 * 100);
if (AFormatSettings.TwoDigitYearCenturyWindow > 0) and (Y < CenturyBase) then
Inc(Y, 100);
end;
end else
begin
Y := CurrentYear;
if DateOrder = doDMY then
begin
D := N1; M := N2;
end else
begin
M := N1; D := N2;
end;
end;
ALScanChar(S, Pos, AFormatSettings.DateSeparator);
ALScanBlanks(S, Pos);
if SysLocale.FarEast and (ALPos('dddd', AFormatSettings.ShortDateFormat) <> 0) then
begin // ignore trailing text
if AFormatSettings.ShortTimeFormat[Low(ansistring)] in ['0'..'9'] then // stop at time digit
ALScanToNumber(S, Pos)
else // stop at time prefix
repeat
while (Pos <= High(S)) and (S[Pos] <> ' ') do Inc(Pos);
ALScanBlanks(S, Pos);
until (Pos > high(S)) or
//(AnsiCompareText(AFormatSettings.TimeAMString, S.SubString(Pos - Low(string), AFormatSettings.TimeAMString.Length)) = 0) or
//(AnsiCompareText(AFormatSettings.TimePMString, S.SubString(Pos - Low(string), AFormatSettings.TimePMString.Length)) = 0);
(ALCompareText(AFormatSettings.TimeAMString, ALCopyStr(S, Pos + alifThen(Low(ansiString)=0,1,0), Length(AFormatSettings.TimeAMString))) = 0) or
(ALCompareText(AFormatSettings.TimePMString, ALCopyStr(S, Pos + alifThen(Low(ansiString)=0,1,0), Length(AFormatSettings.TimePMString))) = 0);
end;
Result := TryEncodeDate(Y, M, D, Date);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.ScanTime is still the same and adjust the IFDEF'}
{$IFEND}
function ALScanTime(const S: AnsiString; var Pos: Integer; var Time: TDateTime;
const AFormatSettings: TALFormatSettings): Boolean; overload;
var
BaseHour: Integer;
Hour, Min, Sec, MSec: Word;
Junk: Byte;
begin
Result := False;
BaseHour := -1;
if ALScanString(S, Pos, AFormatSettings.TimeAMString) or ALScanString(S, Pos, 'AM') then
BaseHour := 0
else if ALScanString(S, Pos, AFormatSettings.TimePMString) or ALScanString(S, Pos, 'PM') then
BaseHour := 12;
if BaseHour >= 0 then ALScanBlanks(S, Pos);
if not ALScanNumber(S, Pos, Hour, Junk) then Exit;
Min := 0;
Sec := 0;
MSec := 0;
if ALScanChar(S, Pos, AFormatSettings.TimeSeparator) then
begin
if not ALScanNumber(S, Pos, Min, Junk) then Exit;
if ALScanChar(S, Pos, AFormatSettings.TimeSeparator) then
begin
if not ALScanNumber(S, Pos, Sec, Junk) then Exit;
if ALScanChar(S, Pos, AFormatSettings.DecimalSeparator) then
if not ALScanNumber(S, Pos, MSec, Junk) then Exit;
end;
end;
if BaseHour < 0 then
if ALScanString(S, Pos, AFormatSettings.TimeAMString) or ALScanString(S, Pos, 'AM') then
BaseHour := 0
else
if ALScanString(S, Pos, AFormatSettings.TimePMString) or ALScanString(S, Pos, 'PM') then
BaseHour := 12;
if BaseHour >= 0 then
begin
if (Hour = 0) or (Hour > 12) then Exit;
if Hour = 12 then Hour := 0;
Inc(Hour, BaseHour);
end;
ALScanBlanks(S, Pos);
Result := TryEncodeTime(Hour, Min, Sec, MSec, Time);
end;
{****************************************************************}
function ALTryStrToDate(const S: AnsiString; out Value: TDateTime;
const AFormatSettings: TALFormatSettings): Boolean;
var
Pos: Integer;
begin
Pos := low(ansiString);
Result := ALScanDate(S, Pos, Value, AFormatSettings) and (Pos > High(S));
end;
{***************************************}
function ALStrToDate(const S: AnsiString;
const AFormatSettings: TALFormatSettings): TDateTime;
begin
if not ALTryStrToDate(S, Result, AFormatSettings) then
ALConvertErrorFmt(@System.SysConst.SInvalidDate, [S]);
end;
{****************************************************************}
function ALTryStrToTime(const S: AnsiString; out Value: TDateTime;
const AFormatSettings: TALFormatSettings): Boolean;
var
Pos: Integer;
begin
Pos := low(ansiString);
Result := ALScanTime(S, Pos, Value, AFormatSettings) and (Pos > High(S));
end;
{***************************************}
function ALStrToTime(const S: AnsiString;
const AFormatSettings: TALFormatSettings): TDateTime;
begin
if not ALTryStrToTime(S, Result, AFormatSettings) then
ALConvertErrorFmt(@System.SysConst.SInvalidTime, [S]);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.TryStrToDateTime is still the same and adjust the IFDEF'}
{$IFEND}
function ALTryStrToDateTime(const S: AnsiString; out Value: TDateTime;
const AFormatSettings: TALFormatSettings): Boolean;
var
Pos: Integer;
NumberPos: Integer;
BlankPos, OrigBlankPos: Integer;
LDate, LTime: TDateTime;
Stop: Boolean;
begin
Result := True;
Pos := Low(ansistring);
LTime := 0;
// jump over all the non-numeric characters before the date data
// if the format starts with era name, do not skip any character.
if AFormatSettings.ShortDateFormat[Low(ansistring)] <> 'g' then
ALScanToNumber(S, Pos);
// date data scanned; searched for the time data
if ALScanDate(S, Pos, LDate, AFormatSettings) then
begin
// search for time data; search for the first number in the time data
NumberPos := Pos;
ALScanToNumber(S, NumberPos);
// the first number of the time data was found
if NumberPos < High(S) then
begin
// search between the end of date and the start of time for AM and PM
// strings; if found, then ScanTime from this position where it is found
BlankPos := Pos - 1;
Stop := False;
while (not Stop) and (BlankPos < NumberPos) do
begin
// blank was found; scan for AM/PM strings that may follow the blank
if (BlankPos > 0) and (BlankPos < NumberPos) then
begin
Inc(BlankPos); // start after the blank
OrigBlankPos := BlankPos; // keep BlankPos because ScanString modifies it
Stop := ALScanString(S, BlankPos, AFormatSettings.TimeAMString) or
ALScanString(S, BlankPos, 'AM') or
ALScanString(S, BlankPos, AFormatSettings.TimePMString) or
ALScanString(S, BlankPos, 'PM');
// ScanString jumps over the AM/PM string; if found, then it is needed
// by ScanTime to correctly scan the time
BlankPos := OrigBlankPos;
end
// no more blanks found; end the loop
else
Stop := True;
// search of the next blank if no AM/PM string has been found
if not Stop then
begin
while (S[BlankPos] <> ' ') and (BlankPos <= High(S)) do
Inc(BlankPos);
if BlankPos > High(S) then
BlankPos := 0;
end;
end;
// loop was forcely stopped; check if AM/PM has been found
if Stop then
// AM/PM has been found; check if it is before or after the time data
if BlankPos > 0 then
if BlankPos < NumberPos then // AM/PM is before the time number
Pos := BlankPos
else
Pos := NumberPos // AM/PM is after the time number
else
Pos := NumberPos
// the blank found is after the the first number in time data
else
Pos := NumberPos;
// get the time data
Result := ALScanTime(S, Pos, LTime, AFormatSettings);
// time data scanned with no errors
if Result then
if LDate >= 0 then
Value := LDate + LTime
else
Value := LDate - LTime;
end
// no time data; return only date data
else
Value := LDate;
end
// could not scan date data; try to scan time data
else
Result := ALTryStrToTime(S, Value, AFormatSettings)
end;
{*******************************************}
function ALStrToDateTime(const S: AnsiString;
const AFormatSettings: TALFormatSettings): TDateTime;
begin
if not ALTryStrToDateTime(S, Result, AFormatSettings) then
ALConvertErrorFmt(@System.SysConst.SInvalidDateTime, [S]);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system._ValLong is still the same and adjust the IFDEF'}
{$IFEND}
// Hex : ( '$' | 'X' | 'x' | '0X' | '0x' ) [0-9A-Fa-f]*
// Dec : ( '+' | '-' )? [0-9]*
function _ALValLong(const S: ansiString; var Code: Integer): Integer;
{$IFDEF PUREPASCAL}
const
FirstIndex = Low(ansistring);
var
I: Integer;
Dig: Integer;
Sign: Boolean;
Empty: Boolean;
begin
I := FirstIndex;
Sign := False;
Result := 0;
{$IF CompilerVersion <= 31} // berlin
{$IF not (defined(CPUX64) and not defined(EXTERNALLINKER))}
Dig := 0;
{$IFEND}
{$IFEND}
Empty := True;
if S = '' then
begin
Code := 1;
Exit;
end;
while S[I] = ' ' do
Inc(I);
if S[I] = '-' then
begin
Sign := True;
Inc(I);
end
else if S[I] = '+' then
Inc(I);
// Hex
if ((S[I] = '0') and (I < High(S)) and ((S[I+1] = 'X') or (S[I+1] = 'x'))) or
(S[I] = '$') or
(S[I] = 'X') or
(S[I] = 'x') then
begin
if S[I] = '0' then
Inc(I);
Inc(I);
while True do
begin
case S[I] of
'0'..'9': Dig := Ord(S[I]) - Ord('0');
'A'..'F': Dig := Ord(S[I]) - Ord('A') + 10;
'a'..'f': Dig := Ord(S[I]) - Ord('a') + 10;
else
Break;
end;
if (Result < 0) or (Result > (High(Integer) shr 3)) then
Break;
Result := Result shl 4 + Dig;
Inc(I);
Empty := False;
end;
if Sign then
Result := - Result;
end
// Decimal
else
begin
while True do
begin
case S[I] of
'0'..'9': Dig := Ord(S[I]) - Ord('0');
else
Break;
end;
if (Result < 0) or (Result > (High(Integer) div 10)) then
Break;
Result := Result*10 + Dig;
Inc(I);
Empty := False;
end;
if Sign then
Result := - Result;
if (Result <> 0) and (Sign <> (Result < 0)) then
Dec(I);
end;
if ((S[I] <> ansiChar(#0)) or Empty) then
Code := I + 1 - FirstIndex
else
Code := 0;
end;
{$ELSE !PUREPASCAL}
asm
{ FUNCTION _ValLong( s: AnsiString; VAR code: Integer ) : Longint; }
{ ->EAX Pointer to string }
{ EDX Pointer to code result }
{ <-EAX Result }
PUSH EBX
PUSH ESI
PUSH EDI
MOV ESI,EAX
PUSH EAX { save for the error case }
TEST EAX,EAX
JE @@empty
XOR EAX,EAX
XOR EBX,EBX
MOV EDI,07FFFFFFFH / 10 { limit }
@@blankLoop:
MOV BL,[ESI]
INC ESI
CMP BL,' '
JE @@blankLoop
@@endBlanks:
MOV CH,0
CMP BL,'-'
JE @@minus
CMP BL,'+'
JE @@plus
@@checkDollar:
CMP BL,'$'
JE @@dollar
CMP BL, 'x'
JE @@dollar
CMP BL, 'X'
JE @@dollar
CMP BL, '0'
JNE @@firstDigit
MOV BL, [ESI]
INC ESI
CMP BL, 'x'
JE @@dollar
CMP BL, 'X'
JE @@dollar
TEST BL, BL
JE @@endDigits
JMP @@digLoop
@@firstDigit:
TEST BL,BL
JE @@error
@@digLoop:
SUB BL,'0'
CMP BL,9
JA @@error
CMP EAX,EDI { value > limit ? }
JA @@overFlow
LEA EAX,[EAX+EAX*4]
ADD EAX,EAX
ADD EAX,EBX { fortunately, we can't have a carry }
MOV BL,[ESI]
INC ESI
TEST BL,BL
JNE @@digLoop
@@endDigits:
DEC CH
JE @@negate
TEST EAX,EAX
JGE @@successExit
JMP @@overFlow
@@empty:
INC ESI
JMP @@error
@@negate:
NEG EAX
JLE @@successExit
JS @@successExit { to handle 2**31 correctly, where the negate overflows }
@@error:
@@overFlow:
POP EBX
SUB ESI,EBX
JMP @@exit
@@minus:
INC CH
@@plus:
MOV BL,[ESI]
INC ESI
JMP @@checkDollar
@@dollar:
MOV EDI,0FFFFFFFH
MOV BL,[ESI]
INC ESI
TEST BL,BL
JZ @@empty
@@hDigLoop:
CMP BL,'a'
JB @@upper
SUB BL,'a' - 'A'
@@upper:
SUB BL,'0'
CMP BL,9
JBE @@digOk
SUB BL,'A' - '0'
CMP BL,5
JA @@error
ADD BL,10
@@digOk:
CMP EAX,EDI
JA @@overFlow
SHL EAX,4
ADD EAX,EBX
MOV BL,[ESI]
INC ESI
TEST BL,BL
JNE @@hDigLoop
DEC CH
JNE @@successExit
NEG EAX
@@successExit:
POP ECX { saved copy of string pointer }
XOR ESI,ESI { signal no error to caller }
@@exit:
MOV [EDX],ESI
POP EDI
POP ESI
POP EBX
end;
{$ENDIF}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system._ValInt64 is still the same and adjust the IFDEF'}
{$IFEND}
function _ALValInt64(const s: AnsiString; var code: Integer): Int64;
const
FirstIndex = Low(ansistring);
var
I: Integer;
Dig: Integer;
Sign: Boolean;
Empty: Boolean;
begin
I := FirstIndex;
Sign := False;
Result := 0;
{$IF CompilerVersion <= 31} // berlin
{$IF not (defined(CPUX64) and not defined(EXTERNALLINKER))}
Dig := 0;
{$IFEND}
{$IFEND}
Empty := True;
if S = '' then
begin
Code := 1;
Exit;
end;
while S[I] = ' ' do
Inc(I);
if S[I] = '-' then
begin
Sign := True;
Inc(I);
end
else if S[I] = '+' then
Inc(I);
// Hex
if ((S[I] = '0') and (I < High(S)) and ((S[I+1] = 'X') or (S[I+1] = 'x'))) or
(S[I] = '$') or
(S[I] = 'X') or
(S[I] = 'x') then
begin
if S[I] = '0' then
Inc(I);
Inc(I);
while True do
begin
case S[I] of
'0'..'9': Dig := Ord(S[I]) - Ord('0');
'A'..'F': Dig := Ord(S[I]) - Ord('A') + 10;
'a'..'f': Dig := Ord(S[I]) - Ord('a') + 10;
else
Break;
end;
if (Result < 0) or (Result > (High(Int64) shr 3)) then
Break;
Result := Result shl 4 + Dig;
Inc(I);
Empty := False;
end;
if Sign then
Result := - Result;
end
// Decimal
else
begin
while True do
begin
case S[I] of
'0'..'9': Dig := Ord(S[I]) - Ord('0');
else
Break;
end;
if (Result < 0) or (Result > (High(Int64) div 10)) then
Break;
Result := Result*10 + Dig;
Inc(I);
Empty := False;
end;
if Sign then
Result := - Result;
if (Result <> 0) and (Sign <> (Result < 0)) then
Dec(I);
end;
if ((S[I] <> ansiChar(#0)) or Empty) then
Code := I + 1 - FirstIndex
else
Code := 0;
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system._ValUInt64 is still the same and adjust the IFDEF'}
{$IFEND}
function _ALValUInt64(const s: ansistring; var code: Integer): UInt64;
const
FirstIndex = Low(ansistring);
var
i: Integer;
dig: Integer;
sign: Boolean;
empty: Boolean;
begin
i := FirstIndex;
{$IF CompilerVersion <= 31} // berlin
// avoid E1036: Variable 'dig' might not have been initialized
{$IF not (defined(CPUX64) and not defined(EXTERNALLINKER))}
dig := 0;
{$IFEND}
{$IFEND}
Result := 0;
if s = '' then
begin
code := 1;
exit;
end;
while s[i] = ansiChar(' ') do
Inc(i);
sign := False;
if s[i] = ansiChar('-') then
begin
sign := True;
Inc(i);
end
else if s[i] = ansiChar('+') then
Inc(i);
empty := True;
if (s[i] = ansiChar('$')) or (Upcase(s[i]) = ansiChar('X'))
or ((s[i] = ansiChar('0')) and (I < High(S)) and (Upcase(s[i+1]) = ansiChar('X'))) then
begin
if s[i] = ansiChar('0') then
Inc(i);
Inc(i);
while True do
begin
case ansiChar(s[i]) of
ansiChar('0').. ansiChar('9'): dig := Ord(s[i]) - Ord('0');
ansiChar('A').. ansiChar('F'): dig := Ord(s[i]) - (Ord('A') - 10);
ansiChar('a').. ansiChar('f'): dig := Ord(s[i]) - (Ord('a') - 10);
else
break;
end;
if Result > (High(UInt64) shr 4) then
Break;
if sign and (dig <> 0) then
Break;
Result := Result shl 4 + Cardinal(dig);
Inc(i);
empty := False;
end;
end
else
begin
while True do
begin
case ansiChar(s[i]) of
ansiChar('0').. ansiChar('9'): dig := Ord(s[i]) - Ord('0');
else
break;
end;
// 18446744073709551615
if Result >= 1844674407370955161 then
begin
if (Result > 1844674407370955161) or (High(UInt64) - Result*10 < dig) then
Break
end;
if sign and (dig <> 0) then
Break;
Result := Result*10 + Cardinal(dig);
Inc(i);
empty := False;
end;
end;
if (s[i] <> ansiChar(#0)) or empty then
code := i + 1 - FirstIndex
else
code := 0;
end;
{***********************************************************************}
function ALTryStrToInt(const S: AnsiString; out Value: Integer): Boolean;
var
E: Integer;
begin
Value := _ALValLong(S, E);
Result := E = 0;
end;
{************************************************}
function ALStrToInt(const S: AnsiString): Integer;
var
E: Integer;
begin
Result := _ALValLong(S, E);
if E <> 0 then raise EConvertError.CreateResFmt(@System.SysConst.SInvalidInteger, [S]);
end;
{*********************************************************************}
function ALStrToIntDef(const S: AnsiString; Default: Integer): Integer;
var
E: Integer;
begin
Result := _ALValLong(S, E);
if E <> 0 then Result := Default;
end;
{**************************************************************************}
function ALTryStrToUInt(const S: AnsiString; out Value: Cardinal): Boolean;
var
I64: Int64;
E: Integer;
begin
I64 := _ALValInt64(S, E);
Value := I64;
Result := (E = 0) and (Cardinal.MinValue <= I64) and (I64 <= Cardinal.MaxValue);
end;
{***************************************************}
function ALStrToUInt(const S: AnsiString): Cardinal;
var
I64: Int64;
E: Integer;
begin
I64 := _ALValInt64(S, E);
if (E <> 0) or not((Cardinal.MinValue <= I64) and (I64 <= Cardinal.MaxValue)) then
raise EConvertError.CreateResFmt(@System.SysConst.SInvalidInteger, [S]);
Result := I64;
end;
{*************************************************************************}
function ALStrToUIntDef(const S: Ansistring; Default: Cardinal): Cardinal;
var
I64: Int64;
E: Integer;
begin
I64 := _ALValInt64(S, E);
if (E <> 0) or not((Cardinal.MinValue <= I64) and (I64 <= Cardinal.MaxValue)) then
Result := Default
else
Result := I64;
end;
{***********************************************************************}
function ALTryStrToInt64(const S: AnsiString; out Value: Int64): Boolean;
var
E: Integer;
begin
Value := _ALValInt64(S, E);
Result := E = 0;
end;
{************************************************}
function ALStrToInt64(const S: AnsiString): Int64;
var
E: Integer;
begin
Result := _ALValInt64(S, E);
if E <> 0 then raise EConvertError.CreateResFmt(@System.SysConst.SInvalidInteger, [S]);
end;
{*************************************************************************}
function ALStrToInt64Def(const S: AnsiString; const Default: Int64): Int64;
var
E: Integer;
begin
Result := _ALValInt64(S, E);
if E <> 0 then Result := Default;
end;
{***}
const
ALTwoDigitLookup : packed array[0..99] of array[1..2] of AnsiChar =
('00','01','02','03','04','05','06','07','08','09',
'10','11','12','13','14','15','16','17','18','19',
'20','21','22','23','24','25','26','27','28','29',
'30','31','32','33','34','35','36','37','38','39',
'40','41','42','43','44','45','46','47','48','49',
'50','51','52','53','54','55','56','57','58','59',
'60','61','62','63','64','65','66','67','68','69',
'70','71','72','73','74','75','76','77','78','79',
'80','81','82','83','84','85','86','87','88','89',
'90','91','92','93','94','95','96','97','98','99');
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils._IntToStr32 is still the same and adjust the IFDEF'}
{$IFEND}
function _ALIntToStr32(Value: Cardinal; Negative: Boolean): AnsiString;
var
I, J, K : Cardinal;
Digits : Integer;
P : PAnsiChar;
NewLen : Integer;
begin
I := Value;
if I >= 10000 then
if I >= 1000000 then
if I >= 100000000 then
Digits := 9 + Ord(I >= 1000000000)
else
Digits := 7 + Ord(I >= 10000000)
else
Digits := 5 + Ord(I >= 100000)
else
if I >= 100 then
Digits := 3 + Ord(I >= 1000)
else
Digits := 1 + Ord(I >= 10);
NewLen := Digits + Ord(Negative);
SetLength(Result, NewLen);
P := PAnsiChar(Result);
P^ := AnsiChar('-');
Inc(P, Ord(Negative));
if Digits > 2 then
repeat
J := I div 100; {Dividend div 100}
K := J * 100;
K := I - K; {Dividend mod 100}
I := J; {Next Dividend}
Dec(Digits, 2);
PWord(P + Digits)^ := Word(ALTwoDigitLookup[K]);
until Digits <= 2;
if Digits = 2 then
PWord(P+ Digits-2)^ := Word(ALTwoDigitLookup[I])
else
PAnsiChar(P)^ := AnsiChar(I or ord(AnsiChar('0')));
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils._IntToStr64 is still the same and adjust the IFDEF'}
{$IFEND}
function _ALIntToStr64(Value: UInt64; Negative: Boolean): AnsiString;
var
I64, J64, K64 : UInt64;
I32, J32, K32, L32 : Cardinal;
Digits : Byte;
P : PAnsiChar;
NewLen : Integer;
begin
{Within Integer Range - Use Faster Integer Version}
if (Negative and (Value <= High(Integer))) or
(not Negative and (Value <= High(Cardinal))) then
exit(_ALIntToStr32(Value, Negative));
I64 := Value;
if I64 >= 100000000000000 then
if I64 >= 10000000000000000 then
if I64 >= 1000000000000000000 then
if I64 >= 10000000000000000000 then
Digits := 20
else
Digits := 19
else
Digits := 17 + Ord(I64 >= 100000000000000000)
else
Digits := 15 + Ord(I64 >= 1000000000000000)
else
if I64 >= 1000000000000 then
Digits := 13 + Ord(I64 >= 10000000000000)
else
if I64 >= 10000000000 then
Digits := 11 + Ord(I64 >= 100000000000)
else
Digits := 10;
NewLen := Digits + Ord(Negative);
SetLength(Result, NewLen);
P := PAnsiChar(Result);
P^ := AnsiChar('-');
Inc(P, Ord(Negative));
if Digits = 20 then
begin
P^ := AnsiChar('1');
Inc(P);
Dec(I64, 10000000000000000000);
Dec(Digits);
end;
if Digits > 17 then
begin {18 or 19 Digits}
if Digits = 19 then
begin
P^ := AnsiChar('0');
while I64 >= 1000000000000000000 do
begin
Dec(I64, 1000000000000000000);
Inc(P^);
end;
Inc(P);
end;
P^ := AnsiChar('0');
while I64 >= 100000000000000000 do
begin
Dec(I64, 100000000000000000);
Inc(P^);
end;
Inc(P);
Digits := 17;
end;
J64 := I64 div 100000000;
K64 := I64 - (J64 * 100000000); {Remainder = 0..99999999}
I32 := K64;
J32 := I32 div 100;
K32 := J32 * 100;
K32 := I32 - K32;
PWord(P + Digits - 2)^ := Word(ALTwoDigitLookup[K32]);
I32 := J32 div 100;
L32 := I32 * 100;
L32 := J32 - L32;
PWord(P + Digits - 4)^ := Word(ALTwoDigitLookup[L32]);
J32 := I32 div 100;
K32 := J32 * 100;
K32 := I32 - K32;
PWord(P + Digits - 6)^ := Word(ALTwoDigitLookup[K32]);
PWord(P + Digits - 8)^ := Word(ALTwoDigitLookup[J32]);
Dec(Digits, 8);
I32 := J64; {Dividend now Fits within Integer - Use Faster Version}
if Digits > 2 then
repeat
J32 := I32 div 100;
K32 := J32 * 100;
K32 := I32 - K32;
I32 := J32;
Dec(Digits, 2);
PWord(P + Digits)^ := Word(ALTwoDigitLookup[K32]);
until Digits <= 2;
if Digits = 2 then
PWord(P + Digits-2)^ := Word(ALTwoDigitLookup[I32])
else
P^ := AnsiChar(I32 or ord(AnsiChar('0')));
end;
{**********************************************}
function ALIntToStr(Value: Integer): AnsiString;
begin
if Value < 0 then
Result := _ALIntToStr32(-Value, True)
else
Result := _ALIntToStr32(Value, False);
end;
{******************************************************}
procedure ALIntToStr(Value: Integer; var s: ansiString);
begin
if Value < 0 then
s := _ALIntToStr32(-Value, True)
else
s := _ALIntToStr32(Value, False);
end;
{********************************************}
function ALIntToStr(Value: Int64): AnsiString;
begin
if Value < 0 then
Result := _ALIntToStr64(-Value, True)
else
Result := _ALIntToStr64(Value, False);
end;
{****************************************************}
procedure ALIntToStr(Value: Int64; var s: ansiString);
begin
if Value < 0 then
s := _ALIntToStr64(-Value, True)
else
s := _ALIntToStr64(Value, False);
end;
{$ENDIF !NEXTGEN}
{***************************************************}
procedure ALIntToStrU(Value: Integer; var s: String);
begin
s := IntToStr(Value);
end;
{*****************************************}
function ALIntToStrU(Value: Int64): String;
begin
result := IntToStr(Value);
end;
{*************************************************}
procedure ALIntToStrU(Value: Int64; var s: String);
begin
s := IntToStr(Value);
end;
{*******************************************}
function ALIntToStrU(Value: Integer): String;
begin
result := IntToStr(Value);
end;
{$IFNDEF NEXTGEN}
{**************************************************}
function ALStrToUInt64(const S: ansistring): UInt64;
var
E: Integer;
begin
Result := _ALValUInt64(S, E);
if E <> 0 then raise EConvertError.CreateResFmt(@System.SysConst.SInvalidInteger, [S]);
end;
{****************************************************************************}
function ALStrToUInt64Def(const S: ansistring; const Default: UInt64): UInt64;
var
E: Integer;
begin
Result := _ALValUInt64(S, E);
if E <> 0 then Result := Default;
end;
{*************************************************************************}
function ALTryStrToUInt64(const S: ansistring; out Value: UInt64): Boolean;
var
E: Integer;
begin
Value := _ALValUInt64(S, E);
Result := E = 0;
end;
{************************************************}
function ALUIntToStr(Value: Cardinal): AnsiString;
begin
Result := _ALIntToStr32(Value, False);
end;
{**********************************************}
function ALUIntToStr(Value: UInt64): AnsiString;
begin
Result := _ALIntToStr64(Value, False);
end;
{$ENDIF !NEXTGEN}
{*********************************************}
function ALUIntToStrU(Value: Cardinal): String;
begin
Result := UIntToStr(Value);
end;
{*******************************************}
function ALUIntToStrU(Value: UInt64): String;
begin
Result := UIntToStr(Value);
end;
{$IFNDEF NEXTGEN}
{***}
const
ALTwoHexLookup : packed array[0..255] of array[1..2] of AnsiChar =
('00','01','02','03','04','05','06','07','08','09','0A','0B','0C','0D','0E','0F',
'10','11','12','13','14','15','16','17','18','19','1A','1B','1C','1D','1E','1F',
'20','21','22','23','24','25','26','27','28','29','2A','2B','2C','2D','2E','2F',
'30','31','32','33','34','35','36','37','38','39','3A','3B','3C','3D','3E','3F',
'40','41','42','43','44','45','46','47','48','49','4A','4B','4C','4D','4E','4F',
'50','51','52','53','54','55','56','57','58','59','5A','5B','5C','5D','5E','5F',
'60','61','62','63','64','65','66','67','68','69','6A','6B','6C','6D','6E','6F',
'70','71','72','73','74','75','76','77','78','79','7A','7B','7C','7D','7E','7F',
'80','81','82','83','84','85','86','87','88','89','8A','8B','8C','8D','8E','8F',
'90','91','92','93','94','95','96','97','98','99','9A','9B','9C','9D','9E','9F',
'A0','A1','A2','A3','A4','A5','A6','A7','A8','A9','AA','AB','AC','AD','AE','AF',
'B0','B1','B2','B3','B4','B5','B6','B7','B8','B9','BA','BB','BC','BD','BE','BF',
'C0','C1','C2','C3','C4','C5','C6','C7','C8','C9','CA','CB','CC','CD','CE','CF',
'D0','D1','D2','D3','D4','D5','D6','D7','D8','D9','DA','DB','DC','DD','DE','DF',
'E0','E1','E2','E3','E4','E5','E6','E7','E8','E9','EA','EB','EC','ED','EE','EF',
'F0','F1','F2','F3','F4','F5','F6','F7','F8','F9','FA','FB','FC','FD','FE','FF');
{***************************************************************}
function _ALIntToHex(Value: UInt64; Digits: Integer): AnsiString;
var
I32 : Integer;
I, J : UInt64;
P : Integer;
NewLen : Integer;
Sb : TArray<ansiChar>;
begin
NewLen := 1;
I := Value shr 4;
while I > 0 do
begin
Inc(NewLen);
I := I shr 4;
end;
if Digits > NewLen then
begin
SetLength(Sb, Digits);
for I32 := 0 to (Digits - NewLen) - 1 do
Sb[I32] := '0';
P := Digits - NewLen;
end
else
begin
SetLength(Sb, NewLen);
P := 0;
end;
I := Value;
while NewLen > 2 do
begin
J := I and $FF;
I := I shr 8;
Dec(NewLen, 2);
Sb[P + NewLen] := AlTwoHexLookup[J][1];
Sb[P + NewLen + 1] := AlTwoHexLookup[J][2];
end;
if NewLen = 2 then
begin
Sb[P] := AlTwoHexLookup[I][1];
Sb[P+1] := AlTwoHexLookup[I][2];
end
else
Sb[P] := AlTwoHexLookup[I][2];
//Result := String.Create(Sb);
SetLength(Result, Length(Sb));
alMove(Sb[0], PansiChar(Result)^, Length(Sb));
end;
{***************************************************************}
function ALIntToHex(Value: Integer; Digits: Integer): AnsiString;
begin
Result := _ALIntToHex(Cardinal(Value), Digits);
end;
{*************************************************************}
function ALIntToHex(Value: Int64; Digits: Integer): AnsiString;
begin
Result := _ALIntToHex(Value, digits);
end;
{**************************************************************}
function ALIntToHex(Value: UInt64; Digits: Integer): AnsiString;
begin
Result := _ALIntToHex(Value, digits);
end;
{**************************************************************************}
procedure _ALBinToHex(Buffer: PAnsiChar; Text: PAnsiChar; BufSize: Integer); overload;
const
Convert: array[0..15] of AnsiChar = AnsiString('0123456789abcdef');
var
I: Integer;
begin
for I := 0 to BufSize - 1 do
begin
Text[0] := Convert[Byte(Buffer[I]) shr 4];
Text[1] := Convert[Byte(Buffer[I]) and $F];
Inc(Text, 2);
end;
end;
{******************************************************************************}
Function ALTryBinToHex(const aBin: AnsiString; out Value: AnsiString): boolean;
begin
if aBin = '' then exit(false);
setlength(Value,length(aBin) * 2);
_ALBinToHex(PansiChar(aBin),pansiChar(Value),length(aBin));
result := true;
end;
{*******************************************************}
Function ALBinToHex(const aBin: AnsiString): AnsiString;
begin
if not ALTryBinToHex(aBin, Result) then
raise Exception.Create('Bad binary value');
end;
{***************************************************************************************}
Function ALTryBinToHex(const aBin; aBinSize : Cardinal; out Value: AnsiString): boolean;
begin
if aBinSize = 0 then exit(false);
setlength(Value, aBinSize * 2);
_ALBinToHex(@aBin,pansiChar(Value),aBinSize);
result := true;
end;
{****************************************************************}
Function ALBinToHex(const aBin; aBinSize : Cardinal): AnsiString;
begin
if not ALTryBinToHex(aBin, aBinSize, Result) then
raise Exception.Create('Bad binary value');
end;
{******************************************************************************}
Function ALTryHexToBin(const aHex: AnsiString; out Value: AnsiString): boolean;
var l: integer;
begin
l := length(aHex);
if (l = 0) or (l mod 2 <> 0) then exit(False);
setlength(Value,l div 2);
result := HexToBin(PansiChar(aHex),pansiChar(Value),length(Value)) = l div 2;
end;
{*******************************************************}
Function ALHexToBin(const aHex: AnsiString): AnsiString;
begin
if not ALTryHexToBin(aHex, Result) then
raise Exception.Create('Bad hex value');
end;
{$ENDIF !NEXTGEN}
{*********************************************************************************************************************}
procedure _ALBinToHex(const Buffer: TBytes; BufOffset: Integer; var Text: TBytes; TextOffset: Integer; Count: Integer); overload;
const
B2HConvert: array[0..15] of Byte = ($30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $61, $62, $63, $64, $65, $66);
var
I: Integer;
begin
for I := 0 to Count - 1 do
begin
Text[TextOffset + I * 2] := B2HConvert[Buffer[BufOffset + I] shr 4];
Text[TextOffset + I * 2 + 1] := B2HConvert[Buffer[BufOffset + I] and $0F];
end;
end;
{***********************************************************************}
Function ALTryBinToHexU(const aBin: TBytes; out Value: String): boolean;
var bufOut: TBytes;
begin
if length(aBin) = 0 then exit(false);
setlength(bufOut,length(aBin) * 2);
_ALBintoHex(aBin, // Buffer: TBytes
0, // BufOffset: Integer;
bufOut, // Text: TBytes;
0, // TextOffset: Integer;
length(aBin)); // Count: Integer
Value := Tencoding.UTF8.GetString(bufOut); // UTF8 is good because bufOut must contain only low ascii chars
result := true;
end;
{************************************************}
Function ALBinToHexU(const aBin: TBytes): String;
begin
if not ALTryBinToHexU(aBin, Result) then
raise Exception.Create('Bad binary value');
end;
{************************************************************************************}
Function ALTryBinToHexU(const aBin; aBinSize : Cardinal; out Value: String): boolean;
var bufOut: TBytes;
begin
if aBinSize = 0 then exit(false);
setlength(bufOut,aBinSize * 2);
_ALBintoHex(Tbytes(@aBin), // Buffer: TBytes
0, // BufOffset: Integer;
bufOut, // Text: TBytes;
0, // TextOffset: Integer;
aBinSize); // Count: Integer
Value := Tencoding.UTF8.GetString(bufOut); // UTF8 is good because bufOut must contain only low ascii chars
result := true;
end;
{*************************************************************}
Function ALBinToHexU(const aBin; aBinSize : Cardinal): String;
begin
if not ALTryBinToHexU(aBin, aBinSize, Result) then
raise Exception.Create('Bad binary value');
end;
{***********************************************************************}
Function ALTryHexToBinU(const aHex: String; out Value: TBytes): boolean;
var l: integer;
{$IF CompilerVersion < 30}{Delphi seattle}
aByteHex: Tbytes;
{$IFEND}
begin
{$IF CompilerVersion >= 30}{Delphi seattle}
l := length(aHex);
if (l = 0) or (l mod 2 <> 0) then exit(False);
setlength(Value,l div 2);
result := HexToBin(PChar(aHex), // Text
0, // TextOffset
Value, //Buffer
0, // BufOffset
length(Value)) = l div 2;
{$ELSE}
aByteHex := Tencoding.UTF8.GetBytes(aHex);
l := length(aByteHex);
if (l = 0) or (l mod 2 <> 0) then exit(False);
setlength(Value,l div 2);
result := HexToBin(aByteHex, // Text
0, // TextOffset
Value, //Buffer
0, // BufOffset
length(Value)) = l div 2;
{$IFEND}
end;
{************************************************}
Function ALHexToBinU(const aHex: String): TBytes;
begin
if not ALTryHexToBinU(aHex, Result) then
raise Exception.Create('Bad hex value');
end;
{$IFNDEF NEXTGEN}
{***************************************************************}
function ALIntToBit(value: integer; digits: integer): ansistring;
begin
result := StringOfChar (ansiChar('0'), digits) ;
while value > 0 do begin
if (value and 1) = 1 then
result[digits] := '1';
dec(digits) ;
value := value shr 1;
end;
end;
{**********************************************}
function ALBitToInt(Value: ansiString): integer;
var i: Integer;
begin
//init result
Result:=0;
//remove leading zeroes
i := 1;
while (i <= length(Value)) and (Value[i] = '0') do inc(i);
if i > length(Value) then exit;
Value := ALCopyStr(Value,I,Maxint);
//do the conversion
for i:=Length(Value) downto 1 do
if Value[i]='1' then
Result:=Result+(1 shl (Length(Value)-i));
end;
{********************************************************************************}
function AlInt2BaseN(NumIn: UInt64; const charset: array of ansiChar): ansistring;
var Remainder: UInt64;
BaseOut: integer;
begin
//ex convert 1544745455 to base26
// |
//1544745455 / 26 = 59413286, reste 19 -> T | 26 / 26 = 1, reste 0 -> A
//59413286 / 26 = 2285126, reste 10 -> K | 1 -> B
//2285126 / 26 = 87889, reste 12 -> M |
//87889 / 26 = 3380, reste 9 -> J | 26 = BA
//3380 / 26 = 130, reste 0 -> A |
//130 / 26 = 5, reste 0 -> A |
//5 -> G |
// |
//1544745455 = GAAJMKT
if length(charset) = 0 then raise Exception.Create('Charset must not be empty');
result := '';
BaseOut := length(charset);
while NumIn >= BaseOut do begin
DivMod(NumIn{Dividend}, BaseOut{Divisor}, NumIn{Result}, Remainder{Remainder});
Result := charset[Remainder] + Result;
end;
Result := charset[NumIn] + Result;
end;
{************************************************************************************}
function AlBaseN2Int(const Str: ansiString; const charset: array of ansiChar): UInt64;
var BaseIn: Byte;
Lst: TalStringList;
I,j: integer;
P: UInt64;
begin
//
//ex convert ABCD to int
//
// ABCD = (26*26*26) * 0 + (26*26) * 1 + (26) * 2 + 3 = 731
// A B C D
Lst := TalStringList.Create;
try
Lst.CaseSensitive := True;
Lst.Duplicates := DupError;
for I := Low(charset) to High(charset) do
Lst.addObject(charset[i],pointer(i));
Lst.Sorted := True;
result := 0;
P := 1;
BaseIn := length(charset);
for I := length(Str) downto 1 do begin
J := Lst.IndexOf(Str[I]);
if J < 0 then raise EALException.CreateFmt('Character (%s) not found in charset', [Str[I]]);
result := result + (Uint64(Lst.Objects[J]) * P);
P := P * BaseIn;
end;
finally
Lst.Free;
end;
end;
/////////////////////////////////
////// Base64 (ansiString) //////
/////////////////////////////////
//
// Taken from https://github.com/synopse/mORMot.git
// https://synopse.info
// http://mormot.net
//
// NOTE: the original function was different from the Unicode in the way that it's
// don't ignore Characters outside alphabet (and even don't raise any exception)
// also the purepascal implementation seam to be 2x more faster than the
// ASM implementation. So i decide to remove the ASM implementation
// and i make that Base64decode crash with invalid chars
// https://synopse.info/forum/viewtopic.php?pid=26173#p26173
//
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if https://github.com/synopse/mORMot.git SynCommons.pas was not updated from references\mORMot\SynCommons.pas and adjust the IFDEF'}
{$IFEND}
type
TBase64Enc = array[0..63] of AnsiChar;
TBase64Dec = array[AnsiChar] of shortint;
const
b64enc: TBase64Enc =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var
/// a conversion table from Base64 text into binary data
// - used by Base64ToBin/IsBase64 functions
// - contains -1 for invalid char, -2 for '=', 0..63 for b64enc[] chars
ConvertBase64ToBin: TBase64Dec;
const
sInvalidbase64String = 'Invalid base64 string';
{********************************************************************************************}
function Base64AnyDecode(const decode: TBase64Dec; sp,rp: PAnsiChar; len: NativeInt): boolean;
var c, ch: NativeInt;
begin
result := false;
while len>=4 do begin
c := decode[sp[0]];
if c<0 then
exit;
c := c shl 6;
ch := decode[sp[1]];
if ch<0 then
exit;
c := (c or ch) shl 6;
ch := decode[sp[2]];
if ch<0 then
exit;
c := (c or ch) shl 6;
ch := decode[sp[3]];
if ch<0 then
exit;
c := c or ch;
rp[2] := AnsiChar(c);
c := c shr 8;
rp[1] := AnsiChar(c);
c := c shr 8;
rp[0] := AnsiChar(c);
dec(len,4);
inc(rp,3);
inc(sp,4);
end;
if len>=2 then begin
c := decode[sp[0]];
if c<0 then
exit;
c := c shl 6;
ch := decode[sp[1]];
if ch<0 then
exit;
if len=2 then
rp[0] := AnsiChar((c or ch) shr 4) else begin
c := (c or ch) shl 6;
ch := decode[sp[2]];
if ch<0 then
exit;
c := (c or ch) shr 2;
rp[1] := AnsiChar(c);
rp[0] := AnsiChar(c shr 8);
end;
end;
result := true;
end;
{*******************************************************************}
function Base64EncodeMain(rp, sp: PAnsiChar; len: cardinal): integer;
var i: integer;
c: cardinal;
begin
result := len div 3;
for i := 1 to result do begin
c := ord(sp[0]) shl 16 + ord(sp[1]) shl 8 + ord(sp[2]);
rp[0] := b64enc[(c shr 18) and $3f];
rp[1] := b64enc[(c shr 12) and $3f];
rp[2] := b64enc[(c shr 6) and $3f];
rp[3] := b64enc[c and $3f];
inc(rp,4);
inc(sp,3);
end;
end;
{*******************************************************}
procedure Base64Decode(sp,rp: PAnsiChar; len: NativeInt);
begin
len := len shl 2; // len was the number of 4 chars chunks in sp
if (len>0) and (ConvertBase64ToBin[sp[len-2]]>=0) then
if ConvertBase64ToBin[sp[len-1]]>=0 then else
dec(len) else
dec(len,2); // adjust for Base64AnyDecode() algorithm
if not Base64AnyDecode(ConvertBase64ToBin,sp,rp,len) then
raise Exception.Create(sInvalidbase64String);
end;
{***********************************************************************}
procedure Base64EncodeTrailing(rp, sp: PAnsiChar; len: cardinal); inline;
var c: cardinal;
begin
case len of
1: begin
c := ord(sp[0]) shl 4;
rp[0] := b64enc[(c shr 6) and $3f];
rp[1] := b64enc[c and $3f];
rp[2] := '=';
rp[3] := '=';
end;
2: begin
c := ord(sp[0]) shl 10 + ord(sp[1]) shl 2;
rp[0] := b64enc[(c shr 12) and $3f];
rp[1] := b64enc[(c shr 6) and $3f];
rp[2] := b64enc[c and $3f];
rp[3] := '=';
end;
end;
end;
{*******************************************************}
procedure Base64Encode(rp, sp: PAnsiChar; len: cardinal);
var main: cardinal;
begin
main := Base64EncodeMain(rp,sp,len);
Base64EncodeTrailing(rp+main*4,sp+main*3,len-main*3);
end;
{******************************************************}
function BinToBase64Length(len: NativeUInt): NativeUInt;
begin
result := ((len+2)div 3)*4;
end;
{*******************************************************************}
function Base64ToBinLength(sp: PAnsiChar; len: NativeInt): NativeInt;
begin
result := 0;
if (len=0) then exit;
if (len and 3<>0) then raise Exception.Create(sInvalidbase64String);
if ConvertBase64ToBin[sp[len-2]]>=0 then
if ConvertBase64ToBin[sp[len-1]]>=0 then
result := 0 else
result := 1 else
result := 2;
result := (len shr 2)*3-result;
end;
{***************************************************************************}
procedure Base64ToBin(sp: PAnsiChar; len: NativeInt; var result: AnsiString);
var resultLen: NativeInt;
begin
resultLen := Base64ToBinLength(sp,len);
if resultLen=0 then
result := '' else begin
SetString(result,nil,resultLen);
Base64Decode(sp,pointer(result),len shr 2);
end;
end;
{********************************************************************************}
function ALBase64EncodeString(const P: PansiChar; const ln: Integer): AnsiString;
begin
result := '';
if ln=0 then exit;
SetLength(result,BinToBase64Length(ln));
Base64Encode(pointer(result),P,ln);
end;
{**************************************************************}
function ALBase64EncodeString(const S: AnsiString): AnsiString;
var len: integer;
begin
result := '';
len := length(s);
if len=0 then exit;
SetLength(result,BinToBase64Length(len));
Base64Encode(pointer(result),pointer(s),len);
end;
{********************************************************************************}
function ALBase64DecodeString(const P: PansiChar; const ln: Integer): AnsiString;
begin
Base64ToBin(P,ln,result);
end;
{**************************************************************}
function ALBase64DecodeString(const S: AnsiString): AnsiString;
begin
Base64ToBin(pointer(s),length(s),result);
end;
{*********************}
{$ZEROBASEDSTRINGS OFF} // << the guy who introduce zero base string in delphi is just a mix of a Monkey and a Donkey !
function ALBase64EncodeStringMIME(const S: AnsiString): AnsiString;
var Ln: integer;
CountOfCRLF: integer;
CurrentPos: integer;
TmpStr: AnsiString;
i: integer;
const maximumLineLength = 76;
begin
//https://en.wikipedia.org/wiki/Base64
//MIME does not specify a fixed length for Base64-encoded lines, but it does specify a maximum line length of
//76 characters. Additionally it specifies that any extra-alphabetic characters must be ignored by a
//compliant decoder, although most implementations use a CR/LF newline pair to delimit encoded lines.
result := ALBase64EncodeString(s);
Ln := length(result);
CountOfCRLF := (ln div maximumLineLength);
if (ln mod maximumLineLength) = 0 then dec(CountOfCRLF);
if CountOfCRLF > 0 then begin
setlength(TmpStr, ln + (CountOfCRLF * 2));
CurrentPos := 0;
for I := 0 to CountOfCRLF - 1 do begin
AlMove(pbyte(result)[CurrentPos], pbyte(TmpStr)[CurrentPos + (i * 2)], maximumLineLength); // pbyte(Result) to not jump inside uniqueString (Result is already unique thanks to previous SetLength))
currentPos := currentPos + maximumLineLength;
pbyte(TmpStr)[CurrentPos + (i * 2)] := 13;
pbyte(TmpStr)[CurrentPos + (i * 2) +1] := 10;
end;
AlMove(pbyte(result)[CurrentPos], pbyte(TmpStr)[CurrentPos + (CountOfCRLF * 2)], ln-CurrentPos);
result := TmpStr;
end;
end;
{$IF defined(_ZEROBASEDSTRINGS_ON)}
{$ZEROBASEDSTRINGS ON}
{$IFEND}
{******************************************************************}
function ALBase64DecodeStringMIME(const S: AnsiString): AnsiString;
begin
//https://en.wikipedia.org/wiki/Base64
//MIME specifies that any extra-alphabetic characters must be ignored by a
//compliant decoder, but here we just ignore the #13#10
result := ALBase64DecodeString(AlStringReplace(s, #13#10, '', [rfReplaceAll]));
end;
////////////////////////////////////
////// Base64 (UnicodeString) //////
////////////////////////////////////
{$ENDIF !NEXTGEN}
{$IF CompilerVersion >= 31} // berlin
{*}
var
_Base64Encoding: TBase64Encoding;
{****************************************}
function _GetBase64Encoding: TNetEncoding;
var LEncoding: TBase64Encoding;
begin
if _Base64Encoding = nil then begin
LEncoding := TBase64Encoding.Create(0); // this constructor to omits line breaks
if AtomicCmpExchange(Pointer(_Base64Encoding), Pointer(LEncoding), nil) <> nil then ALFreeAndNil(LEncoding)
{$IFDEF AUTOREFCOUNT}
else _Base64Encoding.__ObjAddRef;
{$ENDIF AUTOREFCOUNT}
end;
Result := _Base64Encoding;
end;
{*****************************************************************************************}
Function ALBase64EncodeStringU(const S: String; const AEncoding: TEncoding = nil): String;
var BufIn: TBytes;
begin
if assigned(AEncoding) then BufIn := AEncoding.GetBytes(S)
else BufIn := TEncoding.unicode.GetBytes(S);
result := _GetBase64Encoding.EncodeBytesToString(BufIn);
end;
{*****************************************************************************************}
Function ALBase64DecodeStringU(const S: String; const AEncoding: TEncoding = nil): String;
var BufOut: TBytes;
begin
BufOut := _GetBase64Encoding.DecodeStringToBytes(S);
if assigned(AEncoding) then result := AEncoding.GetString(BufOut)
else result := TEncoding.unicode.GetString(BufOut);
end;
{**********************************************************}
Function ALBase64EncodeBytesU(const Bytes: Tbytes): String;
begin
result := _GetBase64Encoding.EncodeBytesToString(Bytes);
end;
{********************************************************************************}
Function ALBase64EncodeBytesU(const Bytes: pointer; const Size: Integer): String;
begin
result := _GetBase64Encoding.EncodeBytesToString(Bytes, Size);
end;
{******************************************************}
Function ALBase64DecodeBytesU(const S: String): Tbytes;
begin
result := _GetBase64Encoding.DecodeStringToBytes(S);
end;
{$IFEND CompilerVersion >= 31}
{$IFNDEF NEXTGEN}
{$IF CompilerVersion <= 30} // seattle
{*****************************************************************************************}
function ALBase64EncodeStringU(const S: String; const AEncoding: TEncoding = nil): String;
begin
result := String(ALBase64EncodeString(AnsiString(S)));
end;
{*****************************************************************************************}
function ALBase64DecodeStringU(const S: String; const AEncoding: TEncoding = nil): String;
begin
result := String(ALBase64DecodeString(AnsiString(S)));
end;
{**********************************************************}
function ALBase64EncodeBytesU(const Bytes: Tbytes): String;
begin
result := String(ALBase64EncodeString(AnsiString(StringOf(Bytes))));
end;
{******************************************************}
function ALBase64DecodeBytesU(const S: String): Tbytes;
begin
result := BytesOf(String(ALBase64DecodeString(AnsiString(S))));
end;
{$IFEND}
{*********************************************************************************************}
function ALIsDecimal(const S: AnsiString; const RejectPlusMinusSign: boolean = False): boolean;
var i: integer;
begin
result := true;
if S = '' then Exit(false);
for i := low(s) to high(S) do begin
if (not RejectPlusMinusSign) and (i=low(s)) then begin
if not (S[i] in ['0'..'9','-','+']) then begin
result := false;
break;
end;
end
else if not (S[i] in ['0'..'9']) then begin
result := false;
break;
end;
end;
end;
{*************************************************}
Function ALIsInteger(const S: AnsiString): Boolean;
var i: integer;
Begin
result := ALIsDecimal(S) and ALTryStrToInt(S, i);
End;
{***********************************************}
Function ALIsInt64(const S: AnsiString): Boolean;
var i : int64;
Begin
Result := ALIsDecimal(S) and ALTryStrToInt64(S, I);
End;
{**************************************************}
Function ALIsSmallInt(const S: AnsiString): Boolean;
var i : Integer;
Begin
Result := ALIsDecimal(S) and ALTryStrToInt(S, I) and (i <= 32767) and (I >= -32768);
End;
{*******************************************************************************************}
Function ALIsFloat (const S: AnsiString; const AFormatSettings: TALFormatSettings): Boolean;
var i: integer;
aDouble: Double;
begin
if S = '' then Exit(false);
for i := low(s) to high(s) do begin
if not (S[i] in ['0'..'9','-',AFormatSettings.DecimalSeparator]) then begin
result := false;
exit;
end;
end;
result := ALTryStrToFloat(s,aDouble,AFormatSettings);
end;
{*******************************************************************************************}
function ALFloatToStr(Value: Extended; const AFormatSettings: TALFormatSettings): AnsiString;
var
Buffer: array[0..63] of AnsiChar;
begin
SetString(Result, Buffer, ALFloatToText(Buffer, Value, fvExtended,
ffGeneral, 15, 0, AFormatSettings));
end;
{***************************************************************************************************}
procedure ALFloatToStr(Value: Extended; var S: ansiString; const AFormatSettings: TALFormatSettings);
var
Buffer: array[0..63] of AnsiChar;
begin
SetString(S, Buffer, ALFloatToText(Buffer, Value, fvExtended,
ffGeneral, 15, 0, AFormatSettings));
end;
{***************************************************************************************************}
function ALFloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer; const AFormatSettings: TALFormatSettings): AnsiString;
var
Buffer: array[0..63] of AnsiChar;
begin
SetString(Result, Buffer, ALFloatToText(Buffer, Value, fvExtended,
Format, Precision, Digits, AFormatSettings));
end;
{$ENDIF !NEXTGEN}
{***************************}
{$WARN SYMBOL_DEPRECATED OFF}
function ALIsDecimalU(const S: String; const RejectPlusMinusSign: boolean = False): boolean;
var i: integer;
begin
result := true;
if S = '' then Exit(false);
for i := low(s) to high(S) do begin
if (not RejectPlusMinusSign) and (i=low(s)) then begin
if not CharInSet(S[i], ['0'..'9','-','+']) then begin
result := false;
break;
end;
end
else if not CharInSet(S[i], ['0'..'9']) then begin
result := false;
break;
end;
end;
end;
{$WARN SYMBOL_DEPRECATED ON}
{**********************************************}
Function ALIsIntegerU(const S: String): Boolean;
var i: integer;
Begin
result := ALIsDecimalU(S) and ALTryStrToIntU(S, i);
End;
{********************************************}
Function ALIsInt64U(const S: String): Boolean;
var i : int64;
Begin
Result := ALIsDecimalU(S) and ALTryStrToInt64U(S, I);
End;
{***********************************************}
Function ALIsSmallIntU(const S: String): Boolean;
var i : Integer;
Begin
Result := ALIsDecimalU(S) and ALTryStrToIntU(S, I) and (i <= 32767) and (I >= -32768);
End;
{***************************}
{$WARN SYMBOL_DEPRECATED OFF}
Function ALIsFloatU(const S: String; const AFormatSettings: TALFormatSettingsU): Boolean;
var i: integer;
aDouble: Double;
begin
if S = '' then Exit(false);
for i := low(s) to high(s) do begin
if not CharInSet(S[i], ['0'..'9','-',AFormatSettings.DecimalSeparator]) then begin
result := false;
exit;
end;
end;
result := ALTryStrToFloatU(s,aDouble,AFormatSettings);
end;
{$WARN SYMBOL_DEPRECATED ON}
{****************************************************************************************}
function ALFloatToStrU(Value: Extended; const AFormatSettings: TALFormatSettingsU): String;
begin
result := FloatToStr(Value, AFormatSettings);
end;
{************************************************************************************************}
procedure ALFloatToStrU(Value: Extended; var S: String; const AFormatSettings: TALFormatSettingsU);
begin
S := FloatToStr(Value, AFormatSettings);
end;
{$IFNDEF NEXTGEN}
{*******************************************************************************************}
function ALCurrToStr(Value: Currency; const AFormatSettings: TALFormatSettings): AnsiString;
var
Buffer: array[0..63] of AnsiChar;
begin
SetString(Result, Buffer, ALFloatToText(Buffer, Value, fvCurrency,
ffGeneral, 0, 0, AFormatSettings));
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if declaration below in system.Sysutils is still the same and adjust the IFDEF'}
{$IFEND}
const
// 8087/SSE status word masks
mIE = $0001;
mDE = $0002;
mZE = $0004;
mOE = $0008;
mUE = $0010;
mPE = $0020;
{$IFDEF CPUX86}
mC0 = $0100;
mC1 = $0200;
mC2 = $0400;
mC3 = $4000;
{$ENDIF CPUX86}
{$IFDEF CPUX86}
const
// 8087 control word
// Infinity control = 1 Affine
// Rounding Control = 0 Round to nearest or even
// Precision Control = 3 64 bits
// All interrupts masked
CWNear: Word = $133F;
{$ENDIF CPUX86}
{$IFDEF CPUX64}
const
// MXCSR control word
// Rounding Control = 0 Round to nearest or even
// All interrupts masked
MXCSRNear: UInt32 = $1F80;
{$ENDIF CPUX64}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.TestAndClearFPUExceptions is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF CPUX86}
function ALTestAndClearFPUExceptions(AExceptionMask: Word): Boolean;
asm
PUSH ECX
MOV CX, AX
FSTSW AX
TEST AX, CX
JNE @@bad
XOR EAX, EAX
INC EAX
JMP @@exit
@@bad:
XOR EAX, EAX
@@exit:
POP ECX
FCLEX
RET
end;
{$ENDIF CPUX86}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.TestAndClearSSEExceptions is still the same and adjust the IFDEF'}
{$IFEND}
{$WARN SYMBOL_PLATFORM OFF}
{$IF Defined(CPUX64) and not Defined(EXTERNALLINKER)}
function ALTestAndClearSSEExceptions(AExceptionMask: UInt32): Boolean;
var
MXCSR: UInt32;
begin
MXCSR := GetMXCSR;
Result := ((MXCSR and $003F) and AExceptionMask) = 0;
ResetMXCSR;
end;
{$IFEND CPUX64}
{$WARN SYMBOL_PLATFORM ON}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.InternalTextToExtended is still the same and adjust the IFDEF'}
{$IFEND}
//this function is not threadsafe because of Set8087CW
//!! this is amazing !!
{$WARN SYMBOL_PLATFORM OFF}
function ALInternalTextToExtended(
ABuffer: PansiChar;
var AValue: Extended;
const AFormatSettings: TALFormatSettings): Boolean;
const
{$IFDEF EXTENDEDHAS10BYTES}
CMaxExponent = 4999;
{$ELSE !EXTENDEDHAS10BYTES}
CMaxExponent = 1024;
{$ENDIF !EXTENDEDHAS10BYTES}
CExponent = 'E'; // DO NOT LOCALIZE;
CPlus = '+'; // DO NOT LOCALIZE;
CMinus = '-'; // DO NOT LOCALIZE;
var
{$IFDEF EXTERNALLINKER}
// SavedRoundMode: Int32;
// LSavedFlags: Word;
// LDummyFlags: Word;
{$ELSE !EXTERNALLINKER}
{$IFDEF CPUX86}
LSavedCtrlWord: Word;
{$ENDIF CPUX86}
{$IFDEF CPUX64}
LSavedMXCSR: UInt32;
{$ENDIF CPUX64}
{$ENDIF}
LPower: Integer;
LSign: SmallInt;
LResult: Extended;
LCurrChar: ansiChar;
procedure NextChar;
begin
LCurrChar := PansiChar(ABuffer)^;
Inc(PansiChar(ABuffer));
end;
procedure SkipWhitespace();
begin
{ Skip white spaces }
while LCurrChar = ' ' do
NextChar;
end;
function ReadSign(): SmallInt;
begin
Result := 1;
if LCurrChar = CPlus then
NextChar()
else if LCurrChar = CMinus then
begin
NextChar();
Result := -1;
end;
end;
function ReadNumber(var AOut: Extended): Integer;
begin
Result := 0;
//while LCurrChar.IsDigit do
while CharInSet(LCurrChar, ['0'..'9']) do
begin
AOut := AOut * 10;
AOut := AOut + Ord(LCurrChar) - Ord('0');
NextChar();
Inc(Result);
end;
end;
function ReadExponent: SmallInt;
var
LSign: SmallInt;
begin
LSign := ReadSign();
Result := 0;
//while LCurrChar.IsDigit do
while CharInSet(LCurrChar, ['0'..'9']) do
begin
Result := Result * 10;
Result := Result + Ord(LCurrChar) - Ord('0');
NextChar();
end;
if Result > CMaxExponent then
Result := CMaxExponent;
Result := Result * LSign;
end;
var
IntPart, FracPart: Integer;
begin
{ Prepare }
Result := False;
NextChar();
{$IFDEF EXTERNALLINKER}
// FEnvGetExceptFlag(LSavedFlags, fe_ALL_EXCEPT);
// FEnvSetExceptFlag(LSavedFlags, fe_ALL_EXCEPT);
// SavedRoundMode := FEnvGetRound;
// FEnvSetRound(fe_TONEAREST);
{$ELSE EXTERNALLINKER}
{$IFDEF CPUX86}
{ Prepare the FPU }
LSavedCtrlWord := Get8087CW();
ALTestAndClearFPUExceptions(0);
Set8087CW(CWNear);
{$ENDIF CPUX86}
{$IF Defined(CPUX64)}
{ Prepare the FPU }
LSavedMXCSR := GetMXCSR;
ALTestAndClearSSEExceptions(0);
SetMXCSR(MXCSRNear);
{$IFEND Defined(CPUX64)}
{$ENDIF EXTERNALLINKER}
{ Skip white spaces }
SkipWhitespace();
{ Exit if nothing to do }
if LCurrChar <> #0 then
begin
{ Detect the sign of the number }
LSign := ReadSign();
if LCurrChar <> #0 then
begin
{ De result }
LResult := 0;
{ Read the integer and fractionary parts }
IntPart := ReadNumber(LResult);
FracPart := 0;
if LCurrChar = AFormatSettings.DecimalSeparator then
begin
NextChar();
FracPart := ReadNumber(LResult);
LPower := -FracPart;
end else
LPower := 0;
{ Read the exponent and adjust the power }
if Char(Word(LCurrChar) and $FFDF) = CExponent then
begin
NextChar();
Inc(LPower, ReadExponent());
end;
if (IntPart = 0) and (FracPart = 0) then
exit; // Reject "E3" or ".E1" case.
{ Skip white spaces }
SkipWhitespace();
{ Continue only if the buffer is depleted }
if LCurrChar = #0 then
begin
{ Calculate the final number }
{$IFDEF EXTERNALLINKER}
try
LResult := Power10(LResult, LPower) * LSign;
AValue := LResult;
Result := True;
except
Result := False;
end;
{$ELSE !EXTERNALLINKER}
LResult := Power10(LResult, LPower) * LSign;
AValue := LResult;
{$ENDIF EXTERNALLINKER}
{$IFDEF EXTERNALLINKER}
// Result := True;
{$ELSE !EXTERNALLINKER}
{$IFDEF CPUX86}
{ Final check that everything went OK }
Result := ALTestAndClearFPUExceptions(mIE + mOE);
{$ENDIF CPUX86}
{$IFDEF CPUX64}
{ Final check that everything went OK }
Result := ALTestAndClearSSEExceptions(mIE + mOE);
{$ENDIF CPUX64}
{$ENDIF EXTERNALLINKER}
end;
end;
end;
{ Clear Math Exceptions }
{$IFDEF EXTERNALLINKER}
// FEnvSetRound(SavedRoundMode);
// FEnvSetExceptFlag(LDummyFlags, LSavedFlags);
{$ELSE EXTERNALLINKER}
{$IFDEF CPUX86}
Set8087CW(LSavedCtrlWord);
{$ENDIF CPUX86}
{$IFDEF CPUX64}
SetMXCSR(LSavedMXCSR);
{$ENDIF CPUX64}
{$ENDIF EXTERNALLINKER}
end;
{$WARN SYMBOL_PLATFORM ON}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.InternalTextToCurrency is still the same and adjust the IFDEF'}
{$IFEND}
//this function is not threadsafe because of Set8087CW
//!! this is amazing !!
function ALInternalTextToCurrency(
ABuffer: PansiChar;
var AValue: Currency;
const AFormatSettings: TALFormatSettings): Boolean;
{$IF Defined(EXTENDEDHAS10BYTES) and not Defined(Linux64)}
const
CMaxExponent = 4999;
CExponent = 'E'; // DO NOT LOCALIZE;
CPlus = '+'; // DO NOT LOCALIZE;
CMinus = '-'; // DO NOT LOCALIZE;
var
{$IFDEF EXTERNALLINKER}
{$ELSE EXTERNALLINKER}
{$IFDEF CPUX86}
{$IF defined(CPUX86) and not defined(EXTENDEDHAS10BYTES)}
LSavedCtrlWord: Word;
{$IFEND CPUX86 and !EXTENDEDHAS10BYTES}
{$ELSE}
{$MESSAGE ERROR 'Unknown platform'}
{$ENDIF CPUX86}
{$ENDIF EXTERNALLINKER}
LPower: Integer;
LSign: SmallInt;
LResult: Extended;
LCurrChar: ansiChar;
procedure NextChar;
begin
LCurrChar := ABuffer^;
Inc(ABuffer);
end;
procedure SkipWhitespace();
begin
{ Skip white spaces }
while LCurrChar = ' ' do
NextChar;
end;
function ReadSign(): SmallInt;
begin
Result := 1;
if LCurrChar = CPlus then
NextChar()
else if LCurrChar = CMinus then
begin
NextChar();
Result := -1;
end;
end;
function ReadNumber(var AOut: Extended): Integer;
begin
Result := 0;
while CharInSet(LCurrChar, ['0'..'9']) do
begin
AOut := AOut * 10;
AOut := AOut + Ord(LCurrChar) - Ord('0');
NextChar();
Inc(Result);
end;
end;
function ReadExponent: SmallInt;
var
LSign: SmallInt;
begin
LSign := ReadSign();
Result := 0;
while CharInSet(LCurrChar, ['0'..'9']) do
begin
Result := Result * 10;
Result := Result + Ord(LCurrChar) - Ord('0');
NextChar();
end;
if Result > CMaxExponent then
Result := CMaxExponent;
Result := Result * LSign;
end;
var
IntPart, FracPart: Integer;
begin
{ Prepare }
Result := False;
NextChar();
{$IFDEF EXTENDEDHAS10BYTES}
{$ELSE !EXTENDEDHAS10BYTES}
{$IFDEF CPUX86}
{ Prepare the FPU }
LSavedCtrlWord := Get8087CW();
ALTestAndClearFPUExceptions(0);
Set8087CW(CWNear);
{$ELSE}
{$MESSAGE ERROR 'Unknown platform'}
{$ENDIF CPUX86}
{$ENDIF EXTENDEDHAS10BYTES}
{ Skip white spaces }
SkipWhitespace();
{ Exit if nothing to do }
if LCurrChar <> #0 then
begin
{ Detect the sign of the number }
LSign := ReadSign();
if LCurrChar <> #0 then
begin
{ De result }
LResult := 0;
{ Read the integer and fractionary parts }
IntPart := ReadNumber(LResult);
FracPart := 0;
if LCurrChar = AFormatSettings.DecimalSeparator then
begin
NextChar();
FracPart := ReadNumber(LResult);
LPower := -FracPart;
end else
LPower := 0;
{ Read the exponent and adjust the power }
if Char(Word(LCurrChar) and $FFDF) = CExponent then
begin
NextChar();
Inc(LPower, ReadExponent());
end;
if (IntPart = 0) and (FracPart = 0) then
exit; // Reject "E3" or ".E1" case.
{ Skip white spaces }
SkipWhitespace();
{ Continue only if the buffer is depleted }
if LCurrChar = #0 then
begin
{ Calculate the final number }
LResult := Power10(LResult, LPower) * LSign;
Currency(AValue) := LResult;
{$IFDEF EXTENDEDHAS10BYTES}
Result := true;
{$ELSE !EXTENDEDHAS10BYTES}
{$IFDEF CPUX86}
{ Final check that everything went OK }
Result := ALTestAndClearFPUExceptions(mIE + mOE);
{$ELSE}
{$MESSAGE ERROR 'Unknown platform'}
{$ENDIF CPUX86}
{$ENDIF EXTENDEDHAS10BYTES}
end;
end;
end;
{ Clear Math Exceptions }
{$IFDEF EXTENDEDHAS10BYTES}
{$ELSE !EXTENDEDHAS10BYTES}
{$IFDEF CPUX86}
Set8087CW(LSavedCtrlWord);
{$ELSE}
{$MESSAGE ERROR 'Unknown platform'}
{$ENDIF CPUX86}
{$ENDIF EXTENDEDHAS10BYTES}
end;
{$ELSE !EXTENDEDHAS10BYTES}
const
CExponent = 'E'; // DO NOT LOCALIZE;
CPlus = '+'; // DO NOT LOCALIZE;
CMinus = '-'; // DO NOT LOCALIZE;
var
LPower: Integer;
LSign: SmallInt;
BufIndex: Integer;
procedure SkipWhitespace;
begin
{ Skip white spaces }
while ABuffer[BufIndex] = ' ' do
Inc(BufIndex);
end;
function ReadSign: SmallInt;
begin
Result := 1;
if ABuffer[BufIndex] = CPlus then
Inc(BufIndex)
else if ABuffer[BufIndex] = CMinus then
begin
Inc(BufIndex);
Result := -1;
end;
end;
function ReadNumberPart: ansistring;
begin
Result := '';
while ABuffer[BufIndex] in ['0'..'9'] do
begin
Result := Result + ABuffer[BufIndex];
Inc(BufIndex);
end;
// Skip remaining numbers.
while ABuffer[BufIndex] in ['0'..'9'] do
Inc(BufIndex);
end;
function ReadExponent: Integer;
var
LSign: Integer;
begin
LSign := ReadSign;
Result := 0;
while ABuffer[BufIndex] in ['0'..'9'] do
begin
Result := Result * 10;
Result := Result + Ord(ABuffer[BufIndex]) - Ord('0');
Inc(BufIndex);
end;
Result := Result * LSign;
end;
var
I: Integer;
U64: UInt64;
RoundUp: Boolean;
IntPart, FracPart: ansistring;
begin
{ Prepare }
BufIndex := 0;
Result := False;
{ Skip white spaces }
SkipWhitespace;
{ Exit if nothing to do }
if ABuffer[BufIndex] <> #0 then
begin
{ Detect the sign of the number }
LSign := ReadSign;
if ABuffer[BufIndex] <> #0 then
begin
{ Read the integer and fractionary parts }
IntPart := ReadNumberPart;
if ABuffer[BufIndex] = AFormatSettings.DecimalSeparator then
begin
Inc(BufIndex);
FracPart := ReadNumberPart;
end;
LPower := 0;
{ Read the exponent and adjust the power }
if Char(Word(ABuffer[BufIndex]) and $FFDF) = CExponent then
begin
Inc(BufIndex);
LPower := ReadExponent;
end;
if (IntPart = '') and (FracPart = '') then
Exit;
{ Skip white spaces }
SkipWhitespace();
{ Continue only if the buffer is depleted }
if ABuffer[BufIndex] = #0 then
begin
{ Calculate the final number }
LPower := LPower + 4; // Add Currency's offset digit
if LPower > 0 then
begin
if Length(FracPart) < LPower then
FracPart := FracPart + StringOfChar(AnsiChar('0'), LPower);
IntPart := IntPart + Copy(FracPart, Low(ansiString), LPower);
FracPart := Copy(FracPart, Low(ansiString) + LPower);
end
else if LPower < 0 then
begin
LPower := - LPower;
if Length(IntPart) < LPower then
IntPart := StringOfChar(AnsiChar('0'), LPower) + IntPart;
FracPart := Copy(IntPart, Low(ansiString) + (Length(IntPart) - LPower), LPower) + FracPart;
IntPart := Copy(IntPart, Low(ansiString), Length(IntPart) - LPower);
end;
if IntPart = '' then
IntPart := '0';
U64 := _ALValInt64(IntPart, I);
if I <> 0 then Exit; // error.
if U64 > UInt64(Int64.MaxValue)+1 then Exit; // overflow error
if (FracPart <> '') and (FracPart[low(FracPart)] >= '5') then
begin
RoundUp := True;
if (FracPart[low(FracPart)] = '5') then
begin
RoundUp := False;
for I := low(FracPart) + 1 to high(FracPart) do
if IntPart[I] <> '0' then
begin
RoundUp := True;
Break;
end;
// exact half -> False / not half -> True
RoundUp := RoundUp or (IntPart[length(IntPart)] in ['1','3','5','7','9']);
end;
if RoundUp then
Inc(U64); // U64 is UInt64. no overflow.
end;
if LSign < 0 then
begin
if U64 > UInt64(Int64.MaxValue)+1 then Exit;
U64 := (not U64) + 1; // nagate;
end
else
if U64 > Int64.MaxValue then Exit;
PUInt64(@AValue)^ := U64;
Result := True;
end;
end;
end;
end;
{$IFEND !EXTENDEDHAS10BYTES}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.TextToFloat is still the same and adjust the IFDEF'}
{$IFEND}
{$WARN SYMBOL_DEPRECATED OFF}
function ALTextToFloat(Buffer: PAnsiChar; var Value;
ValueType: TFloatValue; const AFormatSettings: TALFormatSettings): Boolean;
{$IFDEF PUREPASCAL}
//var
// S: string;
begin
// S := string(AnsiString(Buffer));
// Result := TextToFloat( PChar(s), Value, ValueType, AFormatSettings);
if ValueType = fvExtended then
Result := ALInternalTextToExtended(Buffer, Extended(Value), AFormatSettings)
else
Result := ALInternalTextToCurrency(Buffer, Currency(Value), AFormatSettings);
end;
{$ELSE !PUREPASCAL}
{$IFDEF X86ASM}
var
Temp: Integer;
CtrlWord: Word;
DecimalSep: AnsiChar;
SaveGOT: Integer;
asm //StackAligned
PUSH EDI
PUSH ESI
PUSH EBX
MOV ESI,EAX
MOV EDI,EDX
{$IFDEF PIC}
PUSH ECX
CALL ALGetGOT
POP EBX
MOV SaveGOT,EAX
{$ELSE !PIC}
MOV SaveGOT,0
MOV EBX,ECX
{$ENDIF !PIC}
MOV EAX,AFormatSettings
MOV AL,AnsiChar([EAX].TALFormatSettings.DecimalSeparator)
MOV DecimalSep,AL
FSTCW CtrlWord
FCLEX
{$IFDEF PIC}
MOV EAX, SaveGOT
FLDCW [EAX].CWNear
{$ELSE !PIC}
FLDCW CWNear
{$ENDIF !PIC}
FLDZ
CALL @@SkipBlanks
MOV BH, byte ptr [ESI]
CMP BH,'+'
JE @@1
CMP BH,'-'
JNE @@2
@@1: INC ESI
@@2: MOV ECX,ESI
CALL @@GetDigitStr
XOR EDX,EDX
MOV AL,[ESI]
CMP AL,DecimalSep
JNE @@3
INC ESI
CALL @@GetDigitStr
NEG EDX
@@3: CMP ECX,ESI
JE @@9
MOV AL, byte ptr [ESI]
AND AL,0DFH
CMP AL,'E'
JNE @@4
INC ESI
PUSH EDX
CALL @@GetExponent
POP EAX
ADD EDX,EAX
@@4: CALL @@SkipBlanks
CMP BYTE PTR [ESI],0
JNE @@9
MOV EAX,EDX
CMP BL,fvCurrency
JNE @@5
ADD EAX,4
@@5:
{$IFDEF ALIGN_STACK}
SUB ESP, 12
{$ENDIF ALIGN_STACK}
PUSH EBX
MOV EBX,SaveGOT
CALL FPower10
POP EBX
{$IFDEF ALIGN_STACK}
ADD ESP, 12
{$ENDIF ALIGN_STACK}
CMP BH,'-'
JNE @@6
FCHS
@@6: CMP BL,fvExtended
JE @@7
FISTP QWORD PTR [EDI]
JMP @@8
@@7: FSTP TBYTE PTR [EDI]
@@8: FSTSW AX
TEST AX,mIE+mOE
JNE @@10
MOV AL,1
JMP @@11
@@9: FSTP ST(0)
@@10: XOR EAX,EAX
@@11: FCLEX
FLDCW CtrlWord
FWAIT
JMP @@Exit
@@SkipBlanks:
@@21: LODSB
OR AL,AL
JE @@22
CMP AL,' '
JE @@21
@@22: DEC ESI
RET
// Process string of digits
// Out EDX = Digit count
@@GetDigitStr:
XOR EAX,EAX
XOR EDX,EDX
@@31: LODSB
SUB AL,'0'+10
ADD AL,10
JNC @@32
{$IFDEF PIC}
XCHG SaveGOT,EBX
FIMUL [EBX].calDCon10
XCHG SaveGOT,EBX
{$ELSE !PIC}
FIMUL calDCon10
{$ENDIF !PIC}
MOV Temp,EAX
FIADD Temp
INC EDX
JMP @@31
@@32: DEC ESI
RET
// Get exponent
// Out EDX = Exponent (-4999..4999)
@@GetExponent:
XOR EAX,EAX
XOR EDX,EDX
MOV CL, byte ptr [ESI]
CMP CL,'+'
JE @@41
CMP CL,'-'
JNE @@42
@@41: INC ESI
@@42: MOV AL, byte ptr [ESI]
SUB AL,'0'+10
ADD AL,10
JNC @@43
INC ESI
IMUL EDX,10
ADD EDX,EAX
CMP EDX,500
JB @@42
@@43: CMP CL,'-'
JNE @@44
NEG EDX
@@44: RET
@@Exit:
POP EBX
POP ESI
POP EDI
end;
{$ENDIF X86ASM}
{$ENDIF !PUREPASCAL}
{$WARN SYMBOL_DEPRECATED ON}
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.SysUtils.InternalFloatToTextFmt is still the same and adjust the IFDEF'}
{$IFEND}
{$IFDEF PUREPASCAL}
function InternalFloatToTextFmt(Buf: PByte; const Value; ValueType: TFloatValue; Format: PByte;
const AFormatSettings: TALFormatSettings; const Unicode: Boolean): Integer;
const
CMinExtPrecision = 2;
{$IFDEF EXTENDEDHAS10BYTES}
CMaxExtPrecision = 18;
{$ELSE !EXTENDEDHAS10BYTES}
CMaxExtPrecision = 17;
{$ENDIF EXTENDEDHAS10BYTES}
var
AIndex: Integer;
ThousandSep: Boolean;
Section: ansiString;
SectionIndex: Integer;
FloatValue: TFloatRec;
DecimalIndex: Integer;
FirstDigit: Integer;
LastDigit: Integer;
DigitCount: Integer;
Scientific: Boolean;
Precision: Integer;
Digits: Integer;
DecimalSep: ansiChar;
ThousandsSep: ansiChar;
FormatLength: Integer;
procedure AppendChar(const AChar: ansiChar);
begin
//if Unicode then
//begin
// PWideChar(Buf)^ := char(AChar);
// Inc(Buf, SizeOf(Char));
//end else
//begin
PByte(Buf)^ := Byte(AChar);
Inc(Buf, SizeOf(Byte));
//end;
Inc(Result);
end;
function GetLength(const ABuf: PByte): Integer;
var
//AWide: PChar;
AAnsi: PByte;
begin
Result := 0;
//if Unicode then
//begin
// AWide := PChar(ABuf);
// while AWide^ <> #0 do
// begin
// Inc(AWide);
// Inc(Result);
// end;
//end else
//begin
AAnsi := PByte(ABuf);
while AAnsi^ <> Ord(#0) do
begin
Inc(AAnsi);
Inc(Result);
end;
//end;
end;
function GetCharIndex(const ABuf: PByte; const Index: Integer): ansiChar;
begin
//if Unicode then
// Result := PWideChar(ABuf)[Index]
//else
Result := ansiChar(PByte(ABuf)[Index]);
end;
procedure AppendString(const AStr: ansiString);
var
{I,} L: Integer;
begin
L := length(AStr);
if L > 0 then
begin
//if Unicode then
//begin
// { Unicode -- loop }
// for I := Low(AStr) to High(AStr) do
// begin
// PChar(Buf)^ := Char(AStr[I]);
// Inc(Buf, SizeOf(Char));
// end;
//end else
//begin
{ ANSI -- move directly }
ALMove(pointer(AStr)^, Buf^, L);
Inc(Buf, L * SizeOf(AnsiChar));
//end;
Inc(Result, L);
end;
end;
function FindSection(AIndex: Integer): Integer;
var
Section: Integer;
C: Integer;
begin
Section := 0;
C := 0;
FormatLength := GetLength(Format);
while (Section <> AIndex) and (C < FormatLength) do
begin
case GetCharIndex(Format, C) of
';': begin
Inc(Section);
Inc(C);
end;
'"': begin
Inc(C);
while (C < FormatLength) and (GetCharIndex(Format, C) <> '"') do
Inc(C);
if C < FormatLength then
Inc(C);
end;
'''': begin
Inc(C);
while (C < FormatLength) and (GetCharIndex(Format, C) <> '''') do
Inc(C);
if C < FormatLength then
Inc(C);
end;
else
Inc(C);
end;
end;
if (Section < AIndex) or (C = FormatLength) then
Result := 0
else
Result := C;
end;
function ScanSection(APos: Integer): ansiString;
var
C: Integer;
AChar: ansiChar;
I: Integer;
begin
DecimalIndex := -1;
Scientific := false;
ThousandSep := false;
C := APos;
FirstDigit := 32767;
DigitCount := 0;
LastDigit := 0;
while (C < FormatLength) and (GetCharIndex(Format, C) <> ';') do
begin
case GetCharIndex(Format, C) of
',': begin
ThousandSep := true;
Inc(C);
end;
'.': begin
if DecimalIndex = -1 then
DecimalIndex := DigitCount;
Inc(C);
end;
'"': begin
Inc(C);
while (C < FormatLength) and (GetCharIndex(Format, C) <> '"') do
Inc(C);
if C < FormatLength then
Inc(C);
end;
'''': begin
Inc(C);
while (C < FormatLength) and (GetCharIndex(Format, C) <> '''') do
Inc(C);
if C < FormatLength then
Inc(C);
end;
'e', 'E': begin
Inc(C);
if C < FormatLength then
begin
AChar := GetCharIndex(Format, C);
if (AChar = '-') or (AChar = '+') then
begin
Scientific := true;
Inc(C);
while (C < FormatLength) and (GetCharIndex(Format, C) = '0') do
Inc(C);
end;
end;
end;
'#': begin
Inc(DigitCount);
Inc(C);
end;
'0': begin
if DigitCount < FirstDigit then
FirstDigit := DigitCount;
Inc(DigitCount);
LastDigit := DigitCount;
Inc(C);
end;
else
Inc(C);
end;
end;
if DecimalIndex = -1 then
DecimalIndex := DigitCount;
LastDigit := DecimalIndex - LastDigit;
if LastDigit > 0 then
LastDigit := 0;
FirstDigit := DecimalIndex - FirstDigit;
if FirstDigit < 0 then
FirstDigit := 0;
Result := '';
for I := APos to APos + (C - APos - 1) do
Result := Result + GetCharIndex(Format, I);
end;
function DigitsLength: Integer;
var
C: Integer;
begin
Result := 0;
C := Low(FloatValue.Digits);
while (C <= High(FloatValue.Digits)) and (FloatValue.Digits[C] <> Ord(#0)) do
begin
Inc(C);
Inc(Result);
end;
end;
procedure ApplyFormat;
var
C: Integer;
DigitDelta: Integer;
DigitPlace: Integer;
DigitsC: Integer;
DigitsLimit: Integer;
OldC: ansiChar;
Sign: ansiChar;
Zeros: Integer;
procedure WriteDigit(ADigit: ansiChar);
begin
if DigitPlace = 0 then
begin
AppendChar(DecimalSep);
AppendChar(ADigit);
Dec(DigitPlace);
end
else
begin
AppendChar(ADigit);
Dec(DigitPlace);
if ThousandSep and (DigitPlace > 1) and ((DigitPlace mod 3) = 0) then
AppendChar(ThousandsSep);
end;
end;
procedure AddDigit;
var
AChar: ansiChar;
begin
if DigitsC <= DigitsLimit then
begin
AChar := ansiChar(FloatValue.Digits[DigitsC]);
Inc(DigitsC);
WriteDigit(AChar);
end
else
begin
if DigitPlace <= LastDigit then
Dec(DigitPlace)
else
WriteDigit('0');
end;
end;
procedure PutFmtDigit;
begin
if DigitDelta < 0 then
begin
Inc(DigitDelta);
if DigitPlace <= FirstDigit then
WriteDigit('0')
else
Dec(DigitPlace);
end
else
begin
if DigitDelta = 0 then
AddDigit
else
begin // DigitDelta > 0
while DigitDelta > 0 do
begin
AddDigit;
Dec(DigitDelta);
end;
AddDigit;
end;
end;
end;
procedure PutExponent(EChar: ansiChar; Sign: ansiChar; Zeros: Integer; Exponent: Integer);
var
Exp: ansiString;
WriteSign: ansiString;
begin
AppendChar(EChar);
if (Sign = '+') and (Exponent >=0) then
WriteSign := '+'
else
if Exponent < 0 then
WriteSign := '-'
else
WriteSign := '';
Exp := alIntToStr(Abs(Exponent));
AppendString(WriteSign + StringOfChar(ansiChar('0'), Zeros - length(Exp)) + Exp);
end;
begin
if (FloatValue.Negative) and (SectionIndex = 0) then
AppendChar('-');
if Scientific then
begin
DigitPlace := DecimalIndex;
DigitDelta := 0;
end
else
begin
DigitDelta := FloatValue.Exponent - DecimalIndex;
if DigitDelta >= 0 then
DigitPlace := FloatValue.Exponent
else
DigitPlace := DecimalIndex;
end;
DigitsLimit := DigitsLength - 1;
C := low(ansiString);
DigitsC := 0;
//while C < length(Section) do
while C <= High(Section) do
begin
case Section[C] of
'0', '#': begin
PutFmtDigit;
Inc(C);
end;
'.', ',': Inc(C);
'"', '''': begin
OldC := Section[C];
Inc(C);
while (C < High(Section)) and (Section[C] <> OldC) do
begin
AppendChar(Section[C]);
Inc(C);
end;
Inc(C);
end;
'e', 'E': begin
OldC := Section[C];
Inc(C);
//if C < length(Section) then
if C <= High(Section) then
begin
Sign := Section[C];
if (Sign <> '+') and (Sign <> '-') then
AppendChar(OldC)
else
begin
Zeros := 0;
Inc(C);
//while (C < length(Section)) and (Section[C] = '0') do
while (C <= High(Section)) and (Section[C] = '0') do
begin
Inc(C);
if Zeros < 4 then Inc(Zeros);
end;
PutExponent(OldC, Sign, Zeros, FloatValue.Exponent - DecimalIndex);
end;
end
else
AppendChar(OldC);
end;
else
begin
AppendChar(Section[C]);
Inc(C);
end;
end;
end;
if Result > 0 then
begin
AppendChar(#0);
Dec(Result);
end;
end;
var
Temp: Extended;
begin
Result := 0;
DecimalSep := AFormatSettings.DecimalSeparator;
ThousandsSep := AFormatSettings.ThousandSeparator;
if ValueType = fvCurrency then
Temp := Currency(Value)
else
Temp := Extended(Value);
if Extended(Temp) > 0 then
AIndex := 0
else
if Extended(Temp) < 0 then
AIndex := 1
else
AIndex := 2;
SectionIndex := FindSection(AIndex);
Section := ScanSection(SectionIndex);
if Section = '' then
begin
SectionIndex := FindSection(0);
Section := ScanSection(SectionIndex);
end;
if Scientific then
begin
Precision := DigitCount;
Digits := 9999;
end
else begin
Precision := CMaxExtPrecision;
Digits := DigitCount - DecimalIndex;
end;
FloatToDecimal(FloatValue, Value, ValueType, Precision, Digits);
if (FormatLength = 0) or (GetCharIndex(Format, 0) = ';') or
((FloatValue.Exponent >= 18) and (not Scientific)) or
(FloatValue.Exponent = $7FF) or (FloatValue.Exponent = $800) then
{$IFNDEF NEXTGEN}
//if Unicode then
// Result := FloatToText(PWideChar(Buf), Value, ValueType, ffGeneral, 15, 0, AFormatSettings)
//else
Result := ALFloatToText(PAnsiChar(Buf), Value, ValueType, ffGeneral, 15, 0, AFormatSettings)
{$ELSE NEXTGEN}
Result := FloatToText(PWideChar(Buf), Value, ValueType, ffGeneral, 15, 0, AFormatSettings)
{$ENDIF !NEXTGEN}
else
ApplyFormat;
end;
{$ENDIF PUREPASCAL}
{*************************************************************************************}
function ALAnsiFloatToTextEx(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const AFormatSettings: TALFormatSettings): Integer;
begin
Result := ALFloatToText(BufferArg, Value, ValueType, Format, Precision, Digits,
AFormatSettings);
end;
{************************}
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if system.sysUtils.FloatToTextFmt is still the same and adjust the IFDEF'}
{$IFEND}
function ALFloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar; const AFormatSettings: TALFormatSettings): Integer;
{$IFDEF PUREPASCAL}
begin
Result := InternalFloatToTextFmt(PByte(Buf), Value, ValueType, PByte(Format), AFormatSettings, False);
end;
{$ELSE !PUREPASCAL}
{$IFDEF X86ASM}
var
Buffer: Pointer;
ThousandSep: Boolean;
DecimalSep: AnsiChar;
ThousandsSep: AnsiChar;
Scientific: Boolean;
Section: Integer;
DigitCount: Integer;
DecimalIndex: Integer;
FirstDigit: Integer;
LastDigit: Integer;
DigitPlace: Integer;
DigitDelta: Integer;
FloatRec: TFloatRec;
asm
PUSH EDI
PUSH ESI
PUSH EBX
MOV Buffer,EAX
MOV EDI,EDX
MOV EBX,ECX
MOV EAX,AFormatSettings
MOV AL,AnsiChar([EAX].TALFormatSettings.DecimalSeparator)
MOV DecimalSep,AL
MOV EAX,AFormatSettings
MOV AL,AnsiChar([EAX].TALFormatSettings.ThousandSeparator)
MOV ThousandsSep,AL
MOV ECX,2
CMP BL,fvExtended
JE @@1
MOV EAX,[EDI].Integer
OR EAX,[EDI].Integer[4]
JE @@2
MOV ECX,[EDI].Integer[4]
SHR ECX,31
JMP @@2
@@1: MOVZX EAX,[EDI].Word[8]
OR EAX,[EDI].Integer[0]
OR EAX,[EDI].Integer[4]
JE @@2
MOVZX ECX,[EDI].Word[8]
SHR ECX,15
@@2: CALL @@FindSection
JE @@5
CALL @@ScanSection
MOV EAX,DigitCount
MOV EDX,9999
CMP Scientific,0
JNE @@3
SUB EAX,DecimalIndex
MOV EDX,EAX
MOV EAX,18
@@3: PUSH EAX
PUSH EDX
LEA EAX,FloatRec
MOV EDX,EDI
MOV ECX,EBX
CALL FloatToDecimal { Stack aligned - ESP(xxxxxxx0h) on call }
MOV AX,FloatRec.Exponent
CMP AX,8000H
JE @@5
CMP AX,7FFFH
JE @@5
CMP BL,fvExtended
JNE @@6
CMP AX,18
JLE @@6
CMP Scientific,0
JNE @@6
@@5:
{$IFDEF ALIGN_STACK}
SUB ESP, 8
{$ENDIF ALIGN_STACK}
PUSH ffGeneral
PUSH 15
PUSH 0
MOV EAX,[AFormatSettings]
PUSH EAX
MOV EAX,Buffer
MOV EDX,EDI
MOV ECX,EBX
CALL ALAnsiFloatToTextEx
{$IFDEF ALIGN_STACK}
ADD ESP, 8
{$ENDIF ALIGN_STACK}
JMP @@Exit
@@6: CMP FloatRec.Digits.Byte,0
JNE @@7
MOV ECX,2
CALL @@FindSection
JE @@5
CMP ESI,Section
JE @@7
CALL @@ScanSection
@@7: CALL @@ApplyFormat
JMP @@Exit
// Find format section
// In ECX = Section index
// Out ESI = Section offset
// ZF = 1 if section is empty
@@FindSection:
MOV ESI,Format
JECXZ @@fs2
@@fs1: LODSB
CMP AL,"'"
JE @@fs4
CMP AL,'"'
JE @@fs4
OR AL,AL
JE @@fs2
CMP AL,';'
JNE @@fs1
LOOP @@fs1
MOV AL,byte ptr [ESI]
OR AL,AL
JE @@fs2
CMP AL,';'
JNE @@fs3
@@fs2: MOV ESI,Format
MOV AL,byte ptr [ESI]
OR AL,AL
JE @@fs3
CMP AL,';'
@@fs3: RET
@@fs4: MOV AH,AL
@@fs5: LODSB
CMP AL,AH
JE @@fs1
OR AL,AL
JNE @@fs5
JMP @@fs2
// Scan format section
@@ScanSection:
PUSH EBX
MOV Section,ESI
MOV EBX,32767
XOR ECX,ECX
XOR EDX,EDX
MOV DecimalIndex,-1
MOV ThousandSep,DL
MOV Scientific,DL
@@ss1: LODSB
@@ss2: CMP AL,'#'
JE @@ss10
CMP AL,'0'
JE @@ss11
CMP AL,'.'
JE @@ss13
CMP AL,','
JE @@ss14
CMP AL,"'"
JE @@ss15
CMP AL,'"'
JE @@ss15
CMP AL,'E'
JE @@ss20
CMP AL,'e'
JE @@ss20
CMP AL,';'
JE @@ss30
OR AL,AL
JNE @@ss1
JMP @@ss30
@@ss10: INC EDX
JMP @@ss1
@@ss11: CMP EDX,EBX
JGE @@ss12
MOV EBX,EDX
@@ss12: INC EDX
MOV ECX,EDX
JMP @@ss1
@@ss13: CMP DecimalIndex,-1
JNE @@ss1
MOV DecimalIndex,EDX
JMP @@ss1
@@ss14: MOV ThousandSep,1
JMP @@ss1
@@ss15: MOV AH,AL
@@ss16: LODSB
CMP AL,AH
JE @@ss1
OR AL,AL
JNE @@ss16
JMP @@ss30
@@ss20: LODSB
CMP AL,'-'
JE @@ss21
CMP AL,'+'
JNE @@ss2
@@ss21: MOV Scientific,1
@@ss22: LODSB
CMP AL,'0'
JE @@ss22
JMP @@ss2
@@ss30: MOV DigitCount,EDX
CMP DecimalIndex,-1
JNE @@ss31
MOV DecimalIndex,EDX
@@ss31: MOV EAX,DecimalIndex
SUB EAX,ECX
JLE @@ss32
XOR EAX,EAX
@@ss32: MOV LastDigit,EAX
MOV EAX,DecimalIndex
SUB EAX,EBX
JGE @@ss33
XOR EAX,EAX
@@ss33: MOV FirstDigit,EAX
POP EBX
RET
// Apply format string
@@ApplyFormat:
CMP Scientific,0
JE @@af1
MOV EAX,DecimalIndex
XOR EDX,EDX
JMP @@af3
@@af1: MOVSX EAX,FloatRec.Exponent
CMP EAX,DecimalIndex
JG @@af2
MOV EAX,DecimalIndex
@@af2: MOVSX EDX,FloatRec.Exponent
SUB EDX,DecimalIndex
@@af3: MOV DigitPlace,EAX
MOV DigitDelta,EDX
MOV ESI,Section
MOV EDI,Buffer
LEA EBX,FloatRec.Digits
CMP FloatRec.Negative,0
JE @@af10
CMP ESI,Format
JNE @@af10
MOV AL,'-'
STOSB
@@af10: LODSB
CMP AL,'#'
JE @@af20
CMP AL,'0'
JE @@af20
CMP AL,'.'
JE @@af10
CMP AL,','
JE @@af10
CMP AL,"'"
JE @@af25
CMP AL,'"'
JE @@af25
CMP AL,'E'
JE @@af30
CMP AL,'e'
JE @@af30
CMP AL,';'
JE @@af40
OR AL,AL
JE @@af40
@@af11: STOSB
JMP @@af10
@@af20: CALL @@PutFmtDigit
JMP @@af10
@@af25: MOV AH,AL
@@af26: LODSB
CMP AL,AH
JE @@af10
OR AL,AL
JE @@af40
STOSB
JMP @@af26
@@af30: MOV AH,[ESI]
CMP AH,'+'
JE @@af31
CMP AH,'-'
JNE @@af11
XOR AH,AH
@@af31: MOV ECX,-1
@@af32: INC ECX
INC ESI
CMP [ESI].Byte,'0'
JE @@af32
CMP ECX,4
JB @@af33
MOV ECX,4
@@af33: PUSH EBX
MOV BL,FloatRec.Digits.Byte
XOR BH,BH
MOVSX EDX,FloatRec.Exponent
SUB EDX,DecimalIndex
CALL ALPutExponent {Safe to call unaligned}
POP EBX
JMP @@af10
@@af40: MOV EAX,EDI
SUB EAX,Buffer
RET
// Store formatted digit
@@PutFmtDigit:
CMP DigitDelta,0
JE @@fd3
JL @@fd2
@@fd1: CALL @@fd3
DEC DigitDelta
JNE @@fd1
JMP @@fd3
@@fd2: INC DigitDelta
MOV EAX,DigitPlace
CMP EAX,FirstDigit
JLE @@fd4
JMP @@fd7
@@fd3: MOV AL,[EBX]
INC EBX
OR AL,AL
JNE @@fd5
DEC EBX
MOV EAX,DigitPlace
CMP EAX,LastDigit
JLE @@fd7
@@fd4: MOV AL,'0'
@@fd5: CMP DigitPlace,0
JNE @@fd6
MOV AH,AL
MOV AL,DecimalSep
STOSW
JMP @@fd7
@@fd6: STOSB
CMP ThousandSep,0
JE @@fd7
MOV EAX,DigitPlace
CMP EAX,1
JLE @@fd7
MOV DL,3
DIV DL
CMP AH,1
JNE @@fd7
MOV AL,ThousandsSep
TEST AL,AL
JZ @@fd7
STOSB
@@fd7: DEC DigitPlace
RET
@@exit:
POP EBX
POP ESI
POP EDI
end;
{$ENDIF X86ASM}
{$ENDIF !PUREPASCAL}
{***************************************************************}
function ALFormatFloat(const Format: AnsiString; Value: Extended;
const AFormatSettings: TALFormatSettings): AnsiString;
var
Buffer: array[0..255] of AnsiChar;
begin
if Length(Format) > Length(Buffer) - 32 then ALConvertError(@SFormatTooLong);
SetString(Result, Buffer, ALFloatToTextFmt(Buffer, Value, fvExtended,
PAnsiChar(Format), AFormatSettings));
end;
{**************************************************************}
function ALFormatCurr(const Format: AnsiString; Value: Currency;
const AFormatSettings: TALFormatSettings): AnsiString;
var
Buffer: array[0..255] of AnsiChar;
begin
if Length(Format) > Length(Buffer) - 32 then ALConvertError(@SFormatTooLong);
SetString(Result, Buffer, ALFloatToTextFmt(Buffer, Value, fvCurrency,
PAnsiChar(Format), AFormatSettings));
end;
{**********************************************************************************************}
function ALStrToFloat(const S: AnsiString; const AFormatSettings: TALFormatSettings): Extended;
begin
if not ALTextToFloat(PAnsiChar(S), Result, fvExtended, AFormatSettings) then
ALConvertErrorFmt(@SInvalidFloat, [S]);
end;
{**************************************************************************************************************************}
function ALStrToFloatDef(const S: AnsiString; const Default: Extended; const AFormatSettings: TALFormatSettings): Extended;
begin
if not ALTextToFloat(PAnsiChar(S), Result, fvExtended, AFormatSettings) then
Result := Default;
end;
{*********************************************************************************************************************}
function ALTryStrToFloat(const S: AnsiString; out Value: Extended; const AFormatSettings: TALFormatSettings): Boolean;
begin
Result := ALTextToFloat(PansiChar(S), Value, fvExtended, AFormatSettings);
end;
{*******************************************************************************************************************}
function ALTryStrToFloat(const S: AnsiString; out Value: Double; const AFormatSettings: TALFormatSettings): Boolean;
var
LValue: Extended;
begin
Result := ALTextToFloat(PAnsiChar(S), LValue, fvExtended, AFormatSettings);
if Result then
if (LValue < -MaxDouble) or (LValue > MaxDouble) then
Result := False;
if Result then
Value := LValue;
end;
{*******************************************************************************************************************}
function ALTryStrToFloat(const S: AnsiString; out Value: Single; const AFormatSettings: TALFormatSettings): Boolean;
var
LValue: Extended;
begin
Result := ALTextToFloat(PAnsiChar(S), LValue, fvExtended, AFormatSettings);
if Result then
if (LValue < -MaxSingle) or (LValue > MaxSingle) then
Result := False;
if Result then
Value := LValue;
end;
{$ENDIF !NEXTGEN}
{****************************************************************************************************************}
function ALTryStrToFloatU(const S: String; out Value: Single; const AFormatSettings: TALFormatSettingsU): Boolean;
begin
Result := TryStrToFloat(S, Value, AFormatSettings);
end;
{****************************************************************************************************************}
function ALTryStrToFloatU(const S: String; out Value: Double; const AFormatSettings: TALFormatSettingsU): Boolean;
begin
Result := TryStrToFloat(S, Value, AFormatSettings);
end;
{******************************************************************************************************************}
function ALTryStrToFloatU(const S: String; out Value: Extended; const AFormatSettings: TALFormatSettingsU): Boolean;
begin
Result := TryStrToFloat(S, Value, AFormatSettings);
end;
{$IFNDEF NEXTGEN}
{*********************************************************************************************}
function ALStrToCurr(const S: AnsiString; const AFormatSettings: TALFormatSettings): Currency;
begin
if not ALTextToFloat(PAnsiChar(S), Result, fvCurrency, AFormatSettings) then
ALConvertErrorFmt(@SInvalidFloat, [S]);
end;
{*************************************************************************************************************************}
function ALStrToCurrDef(const S: AnsiString; const Default: Currency; const AFormatSettings: TALFormatSettings): Currency;
begin
if not ALTextToFloat(PAnsiChar(S), Result, fvCurrency, AFormatSettings) then
Result := Default;
end;
{********************************************************************************************************************}
function ALTryStrToCurr(const S: AnsiString; out Value: Currency; const AFormatSettings: TALFormatSettings): Boolean;
begin
Result := ALTextToFloat(PAnsiChar(S), Value, fvCurrency, AFormatSettings);
end;
{***************************************************************************}
function ALPos(const SubStr, Str: AnsiString; Offset: Integer = 1): Integer;
begin
Result := System.Pos(SubStr, Str, Offset);
end;
var
vALPosExIgnoreCaseLookupTable: packed array[AnsiChar] of AnsiChar; {Upcase Lookup Table}
{***********************************************}
procedure ALPosExIgnoreCaseInitialiseLookupTable;
var Ch: AnsiChar;
begin
for Ch := #0 to #255 do
vALPosExIgnoreCaseLookupTable[Ch] := AlUpCase(Ch);
end;
{*****************************************************************************************}
{from John O'Harrow (john@elmcrest.demon.co.uk) - original name: StringReplace_JOH_IA32_12}
function ALPosExIgnoreCase(const SubStr, S: Ansistring; Offset: Integer = 1): Integer;
{$IFDEF PUREPASCAL}
var
I, LIterCnt, L, J: Integer;
PSubStr, PS: PAnsiChar;
C1, C2: AnsiChar;
begin
{ Calculate the number of possible iterations. Not valid if Offset < 1. }
LIterCnt := Length(S) - Offset - Length(SubStr) + 1;
{ Only continue if the number of iterations is positive or zero (there is space to check) }
if (Offset > 0) and (LIterCnt >= 0) then
begin
L := Length(SubStr);
PSubStr := PAnsiChar(SubStr);
PS := PAnsiChar(S);
Inc(PS, Offset - 1);
for I := 0 to LIterCnt do
begin
J := 0;
while (J >= 0) and (J < L) do
begin
C1 := (PS + I + J)^;
C2 := (PSubStr + J)^;
if (C1 = C2) or
((C1 in ['a' .. 'z']) and
(C1 = AnsiChar(Byte(C2) + $20))) or
((C1 in ['A' .. 'Z']) and
(C1 = AnsiChar(Byte(C2) - $20))) then
Inc(J)
else
J := -1;
end;
if J >= L then
Exit(I + Offset);
end;
end;
Result := 0;
end;
{$ELSE !PUREPASCAL}
{$IFDEF X86ASM}
asm
push ebx
push esi
push edx {@Str}
test eax, eax
jz @@NotFound {Exit if SubStr = ''}
test edx, edx
jz @@NotFound {Exit if Str = ''}
mov esi, ecx
mov ecx, [edx-4] {Length(Str)}
mov ebx, [eax-4] {Length(SubStr)}
add ecx, edx
sub ecx, ebx {Max Start Pos for Full Match}
lea edx, [edx+esi-1] {Set Start Position}
cmp edx, ecx
jg @@NotFound {StartPos > Max Start Pos}
cmp ebx, 1 {Length(SubStr)}
jle @@SingleChar {Length(SubStr) <= 1}
push edi
push ebp
lea edi, [ebx-2] {Length(SubStr) - 2}
mov esi, eax
push edi {Save Remainder to Check = Length(SubStr) - 2}
push ecx {Save Max Start Position}
lea edi, vALPosExIgnoreCaseLookupTable {Uppercase Lookup Table}
movzx ebx, [eax] {Search Character = 1st Char of SubStr}
movzx ebx, [edi+ebx] {Convert to Uppercase}
@@Loop: {Loop Comparing 2 Characters per Loop}
movzx eax, [edx] {Get Next Character}
movzx eax, [edi+eax] {Convert to Uppercase}
cmp eax, ebx
jne @@NotChar1
mov ebp, [esp+4] {Remainder to Check}
@@Char1Loop:
movzx eax, [esi+ebp]
movzx ecx, [edx+ebp]
movzx eax, [edi+eax] {Convert to Uppercase}
movzx ecx, [edi+ecx] {Convert to Uppercase}
cmp eax, ecx
jne @@NotChar1
movzx eax, [esi+ebp+1]
movzx ecx, [edx+ebp+1]
movzx eax, [edi+eax] {Convert to Uppercase}
movzx ecx, [edi+ecx] {Convert to Uppercase}
cmp eax, ecx
jne @@NotChar1
sub ebp, 2
jnc @@Char1Loop
pop ecx
pop edi
pop ebp
pop edi
jmp @@SetResult
@@NotChar1:
movzx eax, [edx+1] {Get Next Character}
movzx eax, [edi+eax] {Convert to Uppercase}
cmp bl, al
jne @@NotChar2
mov ebp, [esp+4] {Remainder to Check}
@@Char2Loop:
movzx eax, [esi+ebp]
movzx ecx, [edx+ebp+1]
movzx eax, [edi+eax] {Convert to Uppercase}
movzx ecx, [edi+ecx] {Convert to Uppercase}
cmp eax, ecx
jne @@NotChar2
movzx eax, [esi+ebp+1]
movzx ecx, [edx+ebp+2]
movzx eax, [edi+eax] {Convert to Uppercase}
movzx ecx, [edi+ecx] {Convert to Uppercase}
cmp eax, ecx
jne @@NotChar2
sub ebp, 2
jnc @@Char2Loop
pop ecx
pop edi
pop ebp
pop edi
jmp @@CheckResult {Check Match is within String Data}
@@NotChar2:
add edx, 2
cmp edx, [esp] {Compate to Max Start Position}
jle @@Loop {Loop until Start Position > Max Start Position}
pop ecx {Dump Start Position}
pop edi {Dump Remainder to Check}
pop ebp
pop edi
jmp @@NotFound
@@SingleChar:
jl @@NotFound {Needed for Zero-Length Non-NIL Strings}
lea esi, vALPosExIgnoreCaseLookupTable
movzx ebx, [eax] {Search Character = 1st Char of SubStr}
movzx ebx, [esi+ebx] {Convert to Uppercase}
@@CharLoop:
movzx eax, [edx]
movzx eax, [esi+eax] {Convert to Uppercase}
cmp eax, ebx
je @@SetResult
movzx eax, [edx+1]
movzx eax, [esi+eax] {Convert to Uppercase}
cmp eax, ebx
je @@CheckResult
add edx, 2
cmp edx, ecx
jle @@CharLoop
@@NotFound:
xor eax, eax
pop edx
pop esi
pop ebx
ret
@@CheckResult: {Check Match is within String Data}
cmp edx, ecx
jge @@NotFound
add edx, 1 {OK - Adjust Result}
@@SetResult: {Set Result Position}
pop ecx {@Str}
pop esi
pop ebx
neg ecx
lea eax, [edx+ecx+1]
end; {AnsiPosExIC}
{$ENDIF X86ASM}
{$ENDIF !PUREPASCAL}
{$ENDIF !NEXTGEN}
{*****************************************************************************************}
{from John O'Harrow (john@elmcrest.demon.co.uk) - original name: StringReplace_JOH_IA32_12}
function ALPosExIgnoreCaseU(const SubStr, S: String; Offset: Integer = 1): Integer;
var
I, LIterCnt, L, J: Integer;
PSubStr, PS: PChar;
C1, C2: Char;
begin
{ Calculate the number of possible iterations. Not valid if Offset < 1. }
LIterCnt := Length(S) - Offset - Length(SubStr) + 1;
{ Only continue if the number of iterations is positive or zero (there is space to check) }
if (Offset > 0) and (LIterCnt >= 0) then
begin
L := Length(SubStr);
PSubStr := PChar(SubStr);
PS := PChar(S);
Inc(PS, Offset - 1);
for I := 0 to LIterCnt do
begin
J := 0;
while (J >= 0) and (J < L) do
begin
C1 := (PS + I + J)^;
C2 := (PSubStr + J)^;
if (C1 = C2) or
(((C1 >= char('a')) and (C1 <= char('z'))) and
(C1 = Char(word(C2) + $20))) or
(((C1 >= char('A')) and (C1 <= char('Z'))) and
(C1 = Char(word(C2) - $20))) then
Inc(J)
else
J := -1;
end;
if J >= L then
Exit(I + Offset);
end;
end;
Result := 0;
end;
{$IFNDEF NEXTGEN}
{***********************************************}
function AlUpCase(const Ch: AnsiChar): AnsiChar;
begin
Result := Ch;
if Result in ['a'..'z'] then
Dec(Result, Ord('a')-Ord('A'));
end;
{***********************************************}
function AlLoCase(const Ch: AnsiChar): AnsiChar;
begin
Result := Ch;
if Result in ['A'..'Z'] then
Inc(Result, Ord('a')-Ord('A'));
end;
{$ENDIF !NEXTGEN}
{******************************************}
function AlLoCaseU(Ch: WideChar): WideChar;
begin
Result := Ch;
case Ch of
'A'..'Z':
Inc(Result, Ord(char('a'))-Ord(char('A')));
end;
end;
{$IFNDEF NEXTGEN}
{************************************************}
function ALTrim(const S: AnsiString): AnsiString;
var
I, L: Integer;
begin
L := Length(S);
I := 1;
if (L > 0) and (S[I] > ' ') and (S[L] > ' ') then Exit(S);
while (I <= L) and (S[I] <= ' ') do Inc(I);
if I > L then Exit('');
while S[L] <= ' ' do Dec(L);
Result := ALCopyStr(S, I, L - I + 1);
end;
{****************************************************}
function ALTrimLeft(const S: AnsiString): AnsiString;
var
I, L: Integer;
begin
L := Length(S);
I := 1;
while (I <= L) and (S[I] <= ' ') do Inc(I);
if I = 1 then Exit(S);
Result := ALCopyStr(S, I, Maxint);
end;
{*****************************************************}
function ALTrimRight(const S: AnsiString): AnsiString;
var
I: Integer;
begin
I := Length(S);
if (I > 0) and (S[I] > ' ') then Exit(S);
while (I > 0) and (S[I] <= ' ') do Dec(I);
Result := ALCopyStr(S, 1, I);
end;
{*************************************************************************}
function ALPadLeft(const S: AnsiString; Const Width: Integer): AnsiString;
begin
result := ALFormat('%'+ALIntToStr(Width)+'s', [S]);
end;
{**************************************************************************}
function ALPadRight(const S: AnsiString; Const Width: Integer): AnsiString;
begin
result := ALFormat('%-'+ALIntToStr(Width)+'s', [S]);
end;
{***********************************************************************************}
function ALQuotedStr(const S: AnsiString; const Quote: AnsiChar = ''''): AnsiString;
var
I: Integer;
begin
Result := S;
for I := Length(Result) downto 1 do
if Result[I] = Quote then Insert(Quote, Result, I);
Result := Quote + Result + Quote;
end;
{$ENDIF !NEXTGEN}
{************************************************************************}
function ALQuotedStrU(const S: String; const Quote: Char = ''''): String;
var
I: Integer;
begin
Result := S;
for I := Result.Length - 1 downto 0 do
if Result.Chars[I] = Quote then Result := Result.Insert(I, Quote);
Result := Quote + Result + Quote;
end;
{$IFNDEF NEXTGEN}
{***************************************************************************}
function ALExtractQuotedStr(var Src: PAnsiChar; Quote: AnsiChar): AnsiString;
var
P, Dest: PAnsiChar;
DropCount: Integer;
EndSuffix: Integer;
begin
Result := '';
if (Src = nil) or (Src^ <> Quote) then Exit;
Inc(Src);
DropCount := 1;
P := Src;
Src := System.Ansistrings.StrScan(Src, Quote);
while Src <> nil do // count adjacent pairs of quote chars
begin
Inc(Src);
if Src^ <> Quote then Break;
Inc(Src);
Inc(DropCount);
Src := System.Ansistrings.StrScan(Src, Quote);
end;
EndSuffix := Ord(Src = nil); // Has an ending quoatation mark?
if Src = nil then Src := System.Ansistrings.StrEnd(P);
if ((Src - P) <= 1 - EndSuffix) or ((Src - P - DropCount) = EndSuffix) then Exit;
if DropCount = 1 then
SetString(Result, P, Src - P - 1 + EndSuffix)
else
begin
SetLength(Result, Src - P - DropCount + EndSuffix);
Dest := PAnsiChar(Result);
Src := System.Ansistrings.StrScan(P, Quote);
while Src <> nil do
begin
Inc(Src);
if Src^ <> Quote then Break;
ALMove(P^, Dest^, Src - P);
Inc(Dest, Src - P);
Inc(Src);
P := Src;
Src := System.Ansistrings.StrScan(Src, Quote);
end;
if Src = nil then Src := System.Ansistrings.StrEnd(P);
ALMove(P^, Dest^, Src - P - 1 + EndSuffix);
end;
end;
{************************************************************************}
function ALDequotedStr(const S: AnsiString; AQuote: AnsiChar): AnsiString;
var
LText: PAnsiChar;
begin
LText := PAnsiChar(S);
Result := ALExtractQuotedStr(LText, AQuote);
if ((Result = '') or (LText^ = #0)) and
(Length(S) > 0) and ((S[1] <> AQuote) or (S[Length(S)] <> AQuote)) then
Result := S;
end;
{$ENDIF !NEXTGEN}
{****************************************************************}
function ALExtractQuotedStrU(var Src: PChar; Quote: Char): String;
begin
result := AnsiExtractQuotedStr(PWideChar(Src), Quote);
end;
{$IFNDEF NEXTGEN}
{******************************************************************}
function ALExtractFilePath(const FileName: AnsiString): AnsiString;
begin
Result := System.AnsiStrings.ExtractFilePath(FileName);
end;
{*****************************************************************}
function ALExtractFileDir(const FileName: AnsiString): AnsiString;
begin
Result := ExtractFileDir(FileName);
end;
{*******************************************************************}
function ALExtractFileDrive(const FileName: AnsiString): AnsiString;
begin
Result := ExtractFileDrive(FileName);
end;
{******************************************************************}
function ALExtractFileName(const FileName: AnsiString): AnsiString;
begin
Result := ExtractFileName(FileName);
end;
{*****************************************************************}
function ALExtractFileExt(const FileName: AnsiString): AnsiString;
begin
Result := System.AnsiStrings.ExtractFileExt(FileName);
end;
{******************************************************************}
function ALLastDelimiter(const Delimiters, S: AnsiString): Integer;
var
P: PAnsiChar;
begin
Result := Length(S);
P := PAnsiChar(Delimiters);
while Result > 0 do
begin
if (S[Result] <> #0) and (System.Ansistrings.StrScan(P, S[Result]) <> nil) then
Exit;
Dec(Result);
end;
end;
{******************************************************************************************************************************************************}
function ALIsPathDelimiter(const S: AnsiString; Index: Integer; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): Boolean;
begin
Result := (Index >= low(s)) and (Index <= high(S)) and (S[Index] = PathDelimiter);
end;
{******************************************************************************************************************************************************}
function ALIncludeTrailingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
begin
Result := S;
if not ALIsPathDelimiter(Result, Length(Result), PathDelimiter) then
Result := Result + PathDelimiter;
end;
{******************************************************************************************************************************************************}
function ALExcludeTrailingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
begin
Result := S;
if ALIsPathDelimiter(Result, Length(Result), PathDelimiter) then
SetLength(Result, Length(Result)-1);
end;
{*****************************************************************************************************************************************************}
function ALIncludeLeadingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
begin
if not ALIsPathDelimiter(s, 1, PathDelimiter) then Result := PathDelimiter + s
else Result := S;
end;
{*****************************************************************************************************************************************************}
function ALExcludeLeadingPathDelimiter(const S: AnsiString; const PathDelimiter: ansiString = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): AnsiString;
begin
if ALIsPathDelimiter(S, 1, PathDelimiter) then Result := ALcopyStr(S,2,maxint)
else result := S;
end;
{$ENDIF !NEXTGEN}
{***********************************************************************************************************************************************}
function ALIsPathDelimiterU(const S: String; Index: Integer; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): Boolean;
begin
Result := (Index >= low(s)) and (Index <= high(S)) and (S[low(s) + Index - 1] = PathDelimiter);
end;
{*******************************************************************************************************************************************}
function ALIncludeTrailingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
begin
Result := S;
if not ALIsPathDelimiterU(Result, Length(Result), PathDelimiter) then
Result := Result + PathDelimiter;
end;
{*******************************************************************************************************************************************}
function ALExcludeTrailingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
begin
Result := S;
if ALIsPathDelimiterU(Result, Length(Result), PathDelimiter) then
SetLength(Result, Length(Result)-1);
end;
{******************************************************************************************************************************************}
function ALIncludeLeadingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
begin
if not ALIsPathDelimiterU(s, 1, PathDelimiter) then Result := PathDelimiter + s
else Result := S;
end;
{******************************************************************************************************************************************}
function ALExcludeLeadingPathDelimiterU(const S: String; const PathDelimiter: String = {$IFDEF MSWINDOWS} '\' {$ELSE} '/' {$ENDIF}): String;
begin
if ALIsPathDelimiterU(S, 1, PathDelimiter) then Result := ALcopyStrU(S,2,maxint)
else result := S;
end;
{$IFNDEF NEXTGEN}
{*****************************************************************************************}
{from John O'Harrow (john@elmcrest.demon.co.uk) - original name: StringReplace_JOH_IA32_12}
function ALStringReplace(const S, OldPattern, NewPattern: AnsiString; Flags: TReplaceFlags): AnsiString;
type TPosEx = function(const SubStr, S: AnsiString; Offset: Integer): Integer;
const StaticBufferSize = 16;
var
SrcLen, OldLen, NewLen, Found, Count, Start, Match, Matches, BufSize,
Remainder : Integer;
PosExFunction: TPosEx;
StaticBuffer : array[0..StaticBufferSize-1] of Integer;
Buffer : PIntegerArray;
P, PSrc, PRes: PAnsiChar;
Ch : AnsiChar;
begin
SrcLen := Length(S);
OldLen := Length(OldPattern);
NewLen := Length(NewPattern);
if (OldLen = 0) or (SrcLen < OldLen) then
begin
if SrcLen = 0 then
Result := '' {Needed for Non-Nil Zero Length Strings}
else
Result := S
end
else
begin
if rfIgnoreCase in Flags then
begin
PosExFunction := ALPosExIgnoreCase;
end
else
PosExFunction := ALPosEx;
if rfReplaceAll in Flags then
begin
if (OldLen = 1) and (NewLen = 1) then
begin {Single Character Replacement}
Remainder := SrcLen;
SetLength(Result, Remainder);
P := Pointer(Result);
ALMove(Pointer(S)^, P^, Remainder);
if rfIgnoreCase in Flags then
begin
Ch := vALPosExIgnoreCaseLookupTable[OldPattern[1]];
repeat
Dec(Remainder);
if vALPosExIgnoreCaseLookupTable[P[Remainder]] = Ch then
P[Remainder] := NewPattern[1];
until Remainder = 0;
end
else
begin
repeat
Dec(Remainder);
if P[Remainder] = OldPattern[1] then
P[Remainder] := NewPattern[1];
until Remainder = 0;
end;
Exit;
end;
Found := PosExFunction(OldPattern, S, 1);
if Found <> 0 then
begin
Buffer := @StaticBuffer;
BufSize := StaticBufferSize;
Matches := 1;
Buffer[0] := Found;
repeat
Inc(Found, OldLen);
Found := PosExFunction(OldPattern, S, Found);
if Found > 0 then
begin
if Matches = BufSize then
begin {Create or Expand Dynamic Buffer}
BufSize := BufSize + (BufSize shr 1); {Grow by 50%}
if Buffer = @StaticBuffer then
begin {Create Dynamic Buffer}
GetMem(Buffer, BufSize * SizeOf(Integer));
ALMove(StaticBuffer, Buffer^, SizeOf(StaticBuffer));
end
else {Expand Dynamic Buffer}
ReallocMem(Buffer, BufSize * SizeOf(Integer));
end;
Buffer[Matches] := Found;
Inc(Matches);
end
until Found = 0;
SetLength(Result, SrcLen + (Matches * (NewLen - OldLen)));
PSrc := Pointer(S);
PRes := Pointer(Result);
Start := 1;
Match := 0;
repeat
Found := Buffer[Match];
Count := Found - Start;
Start := Found + OldLen;
if Count > 0 then
begin
ALMove(PSrc^, PRes^, Count);
Inc(PRes, Count);
end;
Inc(PSrc, Count + OldLen);
ALMove(Pointer(NewPattern)^, PRes^, NewLen);
Inc(PRes, NewLen);
Inc(Match);
until Match = Matches;
Remainder := SrcLen - Start;
if Remainder >= 0 then
ALMove(PSrc^, PRes^, Remainder + 1);
if BufSize <> StaticBufferSize then
FreeMem(Buffer); {Free Dynamic Buffer if Created}
end
else {No Matches Found}
Result := S
end {ReplaceAll}
else
begin {Replace First Occurance Only}
Found := PosExFunction(OldPattern, S, 1);
if Found <> 0 then
begin {Match Found}
SetLength(Result, SrcLen - OldLen + NewLen);
Dec(Found);
PSrc := Pointer(S);
PRes := Pointer(Result);
if NewLen = OldLen then
begin
ALMove(PSrc^, PRes^, SrcLen);
Inc(PRes, Found);
ALMove(Pointer(NewPattern)^, PRes^, NewLen);
end
else
begin
ALMove(PSrc^, PRes^, Found);
Inc(PRes, Found);
Inc(PSrc, Found + OldLen);
ALMove(Pointer(NewPattern)^, PRes^, NewLen);
Inc(PRes, NewLen);
ALMove(PSrc^, PRes^, SrcLen - Found - OldLen);
end;
end
else {No Matches Found}
Result := S
end;
end;
end;
{***********************************************************************************************}
// warning ALStrMove inverse the order of the original StrMove (to keep the same order as ALMove)
procedure ALStrMove(const Source: PAnsiChar; var Dest: PAnsiChar; Count: NativeInt);
begin
ALMove(Source^, Dest^, Count);
end;
{$ENDIF !NEXTGEN}
{***********************************************************************************************}
// warning ALStrMove inverse the order of the original StrMove (to keep the same order as ALMove)
procedure ALStrMoveU(const Source: PChar; var Dest: PChar; Count: NativeInt);
begin
ALMove(Source^, Dest^, Count * sizeOf(Char));
end;
{$IFNDEF NEXTGEN}
{****************************************************************************************}
function ALCopyStr(const aSourceString: AnsiString; aStart, aLength: Integer): AnsiString;
var aSourceStringLength: Integer;
begin
aSourceStringLength := Length(aSourceString);
If (aStart < 1) then aStart := 1;
if (aSourceStringLength=0) or
(aLength < 1) or
(aStart > aSourceStringLength) then Begin
Result := '';
Exit;
end;
if aLength > aSourceStringLength - (aStart - 1) then aLength := aSourceStringLength - (aStart-1);
SetLength(Result,aLength); // To guarantee that the string is unique, call the SetLength, SetString, or UniqueString procedures
ALMove(Pbyte(aSourceString)[aStart-1], pointer(Result)^, aLength); // pointer(Result)^ to not jump inside uniqueString (aDestString is already unique thanks to previous SetLength))
end;
{**********************************************************************************************************}
procedure ALCopyStr(const aSourceString: AnsiString; var aDestString: ansiString; aStart, aLength: Integer);
var aSourceStringLength: Integer;
begin
aSourceStringLength := Length(aSourceString);
If (aStart < 1) then aStart := 1;
if (aSourceStringLength=0) or
(aLength < 1) or
(aStart > aSourceStringLength) then Begin
aDestString := '';
Exit;
end;
if aLength > aSourceStringLength - (aStart - 1) then aLength := aSourceStringLength - (aStart-1);
SetLength(aDestString,aLength); // To guarantee that the string is unique, call the SetLength, SetString, or UniqueString procedures
ALMove(Pbyte(aSourceString)[aStart-1], pointer(aDestString)^, aLength); // pointer(aDestString)^ to not jump inside uniqueString (aDestString is already unique thanks to previous SetLength))
end;
{**************************************************}
function ALCopyStr(const aSourceString: AnsiString;
const aStartStr: AnsiString;
const aEndStr: AnsiString;
const aOffset: integer = 1;
const aRaiseExceptionIfNotFound: Boolean = True): AnsiString;
var P1, P2: integer;
begin
P1 := AlPosExIgnoreCase(aStartStr, aSourceString, aOffset);
if P1 <= 0 then begin
if aRaiseExceptionIfNotFound then Raise EALException.Createfmt('Can not find%s the text %s in %s', [ALIfThen(aOffset > 1, AlFormat(' after offset %d', [aOffset])), aStartStr, aSourceString])
else begin
result := '';
exit;
end;
end;
Inc(P1, Length(aStartStr));
P2 := AlPosExIgnoreCase(aEndStr, aSourceString, P1);
if P2 <= 0 then begin
if aRaiseExceptionIfNotFound then Raise EALException.Createfmt('Can not find%s the text %s in %s', [ALIfThen(aOffset > 1, AlFormat(' after offset %d', [aOffset])), aEndStr, aSourceString])
else begin
result := '';
exit;
end;
end;
result := ALCopyStr(aSourceString, P1, P2 - P1);
end;
{$ENDIF !NEXTGEN}
{*********************************************************************************}
function ALCopyStrU(const aSourceString: String; aStart, aLength: Integer): String;
var aSourceStringLength: Integer;
begin
aSourceStringLength := Length(aSourceString);
If (aStart < 1) then aStart := 1;
if (aSourceStringLength=0) or
(aLength < 1) or
(aStart > aSourceStringLength) then Begin
Result := '';
Exit;
end;
if aLength > aSourceStringLength - (aStart - 1) then aLength := aSourceStringLength - (aStart-1);
SetLength(Result,aLength); // To guarantee that the string is unique, call the SetLength, SetString, or UniqueString procedures
ALMove(PChar(aSourceString)[aStart-1], pointer(Result)^, aLength*SizeOf(Char)); // pointer(Result)^ to not jump inside uniqueString (aDestString is already unique thanks to previous SetLength))
end;
{***************************************************************************************************}
procedure ALCopyStrU(const aSourceString: String; var aDestString: String; aStart, aLength: Integer);
var aSourceStringLength: Integer;
begin
aSourceStringLength := Length(aSourceString);
If (aStart < 1) then aStart := 1;
if (aSourceStringLength=0) or
(aLength < 1) or
(aStart > aSourceStringLength) then Begin
aDestString := '';
Exit;
end;
if aLength > aSourceStringLength - (aStart - 1) then aLength := aSourceStringLength - (aStart-1);
SetLength(aDestString,aLength); // To guarantee that the string is unique, call the SetLength, SetString, or UniqueString procedures
ALMove(PChar(aSourceString)[aStart-1], pointer(aDestString)^, aLength*SizeOf(Char)); // pointer(aDestString)^ to not jump inside uniqueString (aDestString is already unique thanks to previous SetLength))
end;
{***********************************************}
function ALCopyStrU(const aSourceString: String;
const aStartStr: String;
const aEndStr: String;
const aOffset: integer = 1;
const aRaiseExceptionIfNotFound: Boolean = True): String;
var P1, P2: integer;
begin
P1 := AlPosExIgnoreCaseU(aStartStr, aSourceString, aOffset);
if P1 <= 0 then begin
if aRaiseExceptionIfNotFound then Raise EALExceptionU.Createfmt('Can not find%s the text %s in %s', [ALIfThenU(aOffset > 1, AlFormatU(' after offset %d', [aOffset])), aStartStr, aSourceString])
else begin
result := '';
exit;
end;
end;
Inc(P1, Length(aStartStr));
P2 := AlPosExIgnoreCaseU(aEndStr, aSourceString, P1);
if P2 <= 0 then begin
if aRaiseExceptionIfNotFound then Raise EALExceptionU.Createfmt('Can not find%s the text %s in %s', [ALIfThenU(aOffset > 1, AlFormatU(' after offset %d', [aOffset])), aEndStr, aSourceString])
else begin
result := '';
exit;
end;
end;
result := ALCopyStrU(aSourceString, P1, P2 - P1);
end;
{$IFNDEF NEXTGEN}
{*******************************************************************************************}
function ALRandomStr(const aLength: Longint; const aCharset: Array of ansiChar): AnsiString;
var X: Longint;
P: Pansichar;
begin
if aLength <= 0 then exit('');
SetLength(Result, aLength);
P := pansiChar(Result);
for X:=1 to aLength do begin
P^ := aCharset[Random(length(aCharset))];
inc(P);
end;
end;
{*******************************************************}
function ALRandomStr(const aLength: Longint): AnsiString;
begin
Result := ALRandomStr(aLength,['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']);
end;
{$ENDIF !NEXTGEN}
{************************************************************************************}
function ALRandomStrU(const aLength: Longint; const aCharset: Array of Char): String;
var X: Longint;
P: Pchar;
begin
if aLength <= 0 then exit('');
SetLength(Result, aLength);
P := pchar(Result);
for X:=1 to aLength do begin
P^ := aCharset[Random(length(aCharset))];
inc(P);
end;
end;
{****************************************************}
function ALRandomStrU(const aLength: Longint): String;
begin
Result := ALRandomStrU(aLength,['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']);
end;
{$IFNDEF NEXTGEN}
{*********************************************************}
function ALNEVExtractName(const S: AnsiString): AnsiString;
var P: Integer;
begin
Result := S;
P := alPos('=', Result);
if P <> 0 then SetLength(Result, P-1)
else SetLength(Result, 0);
end;
{**********************************************************}
function ALNEVExtractValue(const s: AnsiString): AnsiString;
begin
Result := AlCopyStr(s, Length(ALNEVExtractName(s)) + 2, MaxInt)
end;
{***********************************}
constructor TALPrecompiledTag.Create;
begin
fTagString := '';
fTagParams := TALStringList.Create;
TALStringList(fTagParams).Duplicates := dupIgnore;
end;
{***********************************}
destructor TALPrecompiledTag.Destroy;
begin
fTagParams.Free;
inherited;
end;
{**************************************************}
function TALPrecompiledTag.GetTagParams: TALStrings;
begin
result := fTagParams;
end;
{***********************************************************************************}
function ALFastTagReplacePrecompile(Const SourceString, TagStart, TagEnd: AnsiString;
PrecompileProc: TALHandleTagPrecompileFunct;
StripParamQuotes: Boolean; // useless if PrecompileProc is provided
ExtData: Pointer;
TagsContainer: TObjectList; // just a container where all the PrecompiledTag will be store. must free all the PrecompiledTag at the end of the application
Const flags: TReplaceFlags=[]): AnsiString; // rfreplaceall is ignored here, only rfIgnoreCase is matter
var ReplaceString: AnsiString;
TagEndFirstChar, TagEndFirstCharLower, TagEndFirstCharUpper: AnsiChar;
TokenStr, ParamStr: AnsiString;
ParamList: TALStringList;
TagStartLength: integer;
TagEndLength: integer;
SourceStringLength: Integer;
InDoubleQuote: Boolean;
InsingleQuote: Boolean;
SourceCurrentPos: integer;
ResultCurrentPos: integer;
ResultCurrentLength: integer;
PrecompiledTag: TALBasePrecompiledTag;
IgnoreCase: Boolean;
PosExFunct: Function(const SubStr, S: AnsiString; Offset: Integer = 1): Integer;
T1,T2: Integer;
i: integer;
Const ResultBuffSize: integer = 16384;
{------------------------------------}
Function _ExtractTokenStr: AnsiString;
var x: Integer;
Begin
X := 1;
while (x <= length(ReplaceString)) and
(not (ReplaceString[x] in [' ', #9, #13, #10])) do inc(x);
if x > length(ReplaceString) then Result := ReplaceString
else Result := AlcopyStr(ReplaceString,1,x-1);
end;
{-----------------------------------------------------------------}
Function _ExtractParamsStr(const TokenStr: ansiString): AnsiString;
Begin
Result := ALTrim(AlcopyStr(ReplaceString,length(TokenStr) + 1, MaxInt));
end;
{-----------------------------------------------------------------------------------}
procedure _MoveStr2Result(const aSourceString: AnsiString; aStart, aLength: Integer);
var aSourceStringLength: Integer;
begin
aSourceStringLength := Length(aSourceString);
If (aStart < 1) then aStart := 1;
if (aSourceStringLength=0) or
(aLength < 1) or
(aStart > aSourceStringLength) then Exit;
if aLength > aSourceStringLength - (aStart - 1) then aLength := aSourceStringLength - (aStart-1);
If aLength + ResultCurrentPos - 1 > ResultCurrentLength then begin
ResultCurrentLength := ResultCurrentLength + aLength + ResultBuffSize;
SetLength(Result, ResultCurrentLength);
end;
AlMove(pbyte(aSourceString)[aStart-1], pbyte(Result)[ResultCurrentPos-1], aLength);
ResultCurrentPos := ResultCurrentPos + aLength;
end;
{---------------------------------------------------------}
function _ObjAddressToStr(Const Obj: Tobject): AnsiString;
begin
result := ALIntToHex(NativeInt(Obj), sizeof(pointer) * 2);
end;
begin
if (SourceString = '') or (TagStart = '') or (TagEnd = '') then begin
Result := SourceString;
Exit;
end;
IgnoreCase := rfIgnoreCase in flags;
If IgnoreCase then PosExFunct := ALPosExIgnoreCase
Else PosExFunct := ALPosEx;
SourceCurrentPos := 1;
T1 := PosExFunct(TagStart,SourceString,SourceCurrentPos);
if T1 <= 0 then begin
result := SourceString;
exit;
end;
SourceStringLength := length(SourceString);
ResultCurrentLength := SourceStringLength;
SetLength(Result,ResultCurrentLength);
ResultCurrentPos := 1;
TagStartLength := Length(TagStart);
TagEndLength := Length(TagEnd);
TagEndFirstChar := TagEnd[1];
TagEndFirstCharLower := ALLoCase(TagEnd[1]);
TagEndFirstCharUpper := ALUpCase(TagEnd[1]);
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (SourceString[T2] <> TagEndFirstCharLower) and (SourceString[T2] <> TagEndFirstCharUpper)) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
((TagEndLength > 1) and (PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1))) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
While (T1 > 0) and (T2 > T1) do begin
ReplaceString := AlCopyStr(SourceString,T1 + TagStartLength,T2 - T1 - TagStartLength);
T2 := T2 + TagEndLength;
If assigned(PrecompileProc) then begin
TokenStr := _ExtractTokenStr;
ParamStr := _ExtractParamsStr(TokenStr);
ParamList := TALStringList.Create;
try
ParamList.Duplicates := dupIgnore;
ALExtractHeaderFieldsWithQuoteEscaped([' ', #9, #13, #10],
[' ', #9, #13, #10],
['"', ''''],
PAnsiChar(ParamStr),
ParamList,
False,
StripParamQuotes);
T2 := T2 - T1;
PrecompiledTag := PrecompileProc(TokenStr, ParamList, ExtData, SourceString, T1, T2);
T2 := T2 + T1;
if assigned(PrecompiledTag) then begin
TagsContainer.Add(PrecompiledTag);
ReplaceString := TagStart + #2{start of text} + _ObjAddressToStr(PrecompiledTag) + #3{end of text} + TagEnd;
end
else ReplaceString := '';
finally
ParamList.Free;
end;
end
else begin
PrecompiledTag := TALPrecompiledTag.Create;
try
PrecompiledTag.TagString := _ExtractTokenStr;
ParamStr := _ExtractParamsStr(PrecompiledTag.TagString);
ALExtractHeaderFieldsWithQuoteEscaped([' ', #9, #13, #10],
[' ', #9, #13, #10],
['"', ''''],
PAnsiChar(ParamStr),
PrecompiledTag.TagParams,
False,
StripParamQuotes);
TagsContainer.Add(PrecompiledTag);
ReplaceString := TagStart + #2{start of text} + _ObjAddressToStr(PrecompiledTag) + #3{end of text} + TagEnd;
except
PrecompiledTag.Free;
raise;
end;
for I := 0 to PrecompiledTag.TagParams.Count - 1 do
PrecompiledTag.TagParams[i] := ALFastTagReplacePrecompile(PrecompiledTag.TagParams[i], //Const SourceString,
TagStart,
TagEnd,
PrecompileProc,
StripParamQuotes,
ExtData,
TagsContainer,
flags);
PrecompiledTag.TagString := ALFastTagReplacePrecompile(PrecompiledTag.TagString, //Const SourceString,
TagStart,
TagEnd,
PrecompileProc,
StripParamQuotes,
ExtData,
TagsContainer,
flags);
end;
_MoveStr2Result(SourceString,SourceCurrentPos,T1 - SourceCurrentPos);
_MoveStr2Result(ReplaceString,1,length(ReplaceString));
SourceCurrentPos := T2;
T1 := PosExFunct(TagStart,SourceString,SourceCurrentPos);
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (SourceString[T2] <> TagEndFirstCharLower) and (SourceString[T2] <> TagEndFirstCharUpper)) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
((TagEndLength > 1) and (PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1))) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
end;
_MoveStr2Result(SourceString,SourceCurrentPos,maxint);
SetLength(Result,ResultCurrentPos-1);
end;
{*************************************************************************}
function ALFastTagReplace(Const SourceString, TagStart, TagEnd: AnsiString;
ReplaceProc: TALHandleTagFunct;
ReplaceExtendedProc: TALHandleTagExtendedfunct;
StripParamQuotes: Boolean;
Flags: TReplaceFlags;
ExtData: Pointer;
TagParamsClass: TALTagParamsClass;
const TagReplaceProcResult: Boolean = False): AnsiString; overload;
var ReplaceString: AnsiString;
TagEndFirstChar, TagEndFirstCharLower, TagEndFirstCharUpper: AnsiChar;
TokenStr, ParamStr: AnsiString;
ParamList: TAlStrings;
TagStartLength: integer;
TagEndLength: integer;
SourceStringLength: Integer;
InDoubleQuote: Boolean;
InsingleQuote: Boolean;
TagHandled: Boolean;
SourceCurrentPos: integer;
ResultCurrentPos: integer;
ResultCurrentLength: integer;
PrecompiledTag: TALBasePrecompiledTag;
InPrecompiledTag: Boolean;
IgnoreCase: Boolean;
pSize: integer;
PosExFunct: Function(const SubStr, S: AnsiString; Offset: Integer = 1): Integer;
T1,T2: Integer;
Const ResultBuffSize: integer = 16384;
{------------------------------------}
Function _ExtractTokenStr: AnsiString;
var x: Integer;
Begin
X := 1;
while (x <= length(ReplaceString)) and
(not (ReplaceString[x] in [' ', #9, #13, #10])) do inc(x);
if x > length(ReplaceString) then Result := ReplaceString
else Result := AlcopyStr(ReplaceString,1,x-1);
end;
{-------------------------------------}
Function _ExtractParamsStr: AnsiString;
Begin
Result := ALTrim(AlcopyStr(ReplaceString,length(TokenStr) + 1, MaxInt));
end;
{-----------------------------------------------------------------------------------}
procedure _MoveStr2Result(const aSourceString: AnsiString; aStart, aLength: Integer);
var aSourceStringLength: Integer;
begin
aSourceStringLength := Length(aSourceString);
If (aStart < 1) then aStart := 1;
if (aSourceStringLength=0) or
(aLength < 1) or
(aStart > aSourceStringLength) then Exit;
if aLength > aSourceStringLength - (aStart - 1) then aLength := aSourceStringLength - (aStart-1);
If aLength + ResultCurrentPos - 1 > ResultCurrentLength then begin
ResultCurrentLength := ResultCurrentLength + aLength + ResultBuffSize;
SetLength(Result, ResultCurrentLength);
end;
AlMove(pbyte(aSourceString)[aStart-1], pbyte(Result)[ResultCurrentPos-1], aLength);
ResultCurrentPos := ResultCurrentPos + aLength;
end;
{-----------------------------------------------------------------------------------}
function _HexToInt(const aSourceString: ansistring; Start, Length: Integer): integer;
begin
Result := 0;
for Start := start to start + length - 1 do
case aSourceString[Start] of
'0'..'9': Result := Result * 16 + Ord(aSourceString[Start]) - Ord('0');
'A'..'F': Result := Result * 16 + Ord(aSourceString[Start]) - Ord('A') + 10;
end;
end;
begin
if (SourceString = '') or (TagStart = '') or (TagEnd = '') then begin
Result := SourceString;
Exit;
end;
IgnoreCase := rfIgnoreCase in flags;
If IgnoreCase then PosExFunct := ALPosExIgnoreCase
Else PosExFunct := ALPosEx;
SourceCurrentPos := 1;
T1 := PosExFunct(TagStart,SourceString,SourceCurrentPos);
if T1 <= 0 then begin
result := SourceString;
exit;
end;
SourceStringLength := length(SourceString);
ResultCurrentLength := SourceStringLength;
SetLength(Result,ResultCurrentLength);
ResultCurrentPos := 1;
TagStartLength := Length(TagStart);
TagEndLength := Length(TagEnd);
TagEndFirstChar := TagEnd[1];
TagEndFirstCharLower := ALLoCase(TagEnd[1]);
TagEndFirstCharUpper := ALUpCase(TagEnd[1]);
pSize := sizeOf(pointer) * 2;
InPrecompiledTag := False; // to remove warning
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
//we are in precompiled tag
if (SourceString[T2] = #2) and
((T2 + pSize + 1 + TagEndLength) <= SourceStringLength) and
(SourceString[T2 + pSize + 1] = #3) and
((IgnoreCase and ((SourceString[T2 + pSize + 2] = TagEndFirstCharLower) or (SourceString[T2 + pSize + 2] = TagEndFirstCharUpper))) or
((not IgnoreCase) and (SourceString[T2 + pSize + 2] = TagEndFirstChar))) and
((TagEndLength <= 1) or (PosExFunct(TagEnd,AlCopyStr(SourceString,T2 + pSize + 2,TagEndLength),1) = 1)) then begin
InPrecompiledTag := True;
T2 := T2 + pSize + 1 + TagEndLength;
end
//else not precompiled tag
else begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (SourceString[T2] <> TagEndFirstCharLower) and (SourceString[T2] <> TagEndFirstCharUpper)) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
((TagEndLength > 1) and (PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1))) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
end;
While (T1 > 0) and (T2 > T1) do begin
//we are in precompiled tag
if InPrecompiledTag then begin
PrecompiledTag := Pointer(_HexToInt(SourceString, T1 + TagStartLength+1, pSize));
T2 := T2 + TagEndLength;
if assigned(ReplaceExtendedProc) then begin
T2 := T2 - T1;
ReplaceString := ReplaceExtendedProc(PrecompiledTag.TagString, PrecompiledTag.TagParams, ExtData, TagHandled, SourceString, T1, T2);
T2 := T2 + T1;
end
else ReplaceString := ReplaceProc(PrecompiledTag.TagString, PrecompiledTag.TagParams, ExtData, TagHandled);
end
//else not precompiled tag
else begin
ReplaceString := AlCopyStr(SourceString,T1 + TagStartLength,T2 - T1 - TagStartLength);
T2 := T2 + TagEndLength;
TagHandled := True;
TokenStr := _ExtractTokenStr;
ParamStr := _ExtractParamsStr;
ParamList := TagParamsClass.Create;
try
ALExtractHeaderFieldsWithQuoteEscaped([' ', #9, #13, #10],
[' ', #9, #13, #10],
['"', ''''],
PAnsiChar(ParamStr),
ParamList,
False,
StripParamQuotes);
if assigned(ReplaceExtendedProc) then begin
T2 := T2 - T1;
ReplaceString := ReplaceExtendedProc(TokenStr, ParamList, ExtData, TagHandled, SourceString, T1, T2);
T2 := T2 + T1;
end
else ReplaceString := ReplaceProc(TokenStr, ParamList, ExtData, TagHandled);
finally
ParamList.Free;
end;
end;
if (TagHandled) and
(TagReplaceProcResult) and
(rfreplaceAll in flags) then ReplaceString := ALFastTagReplace(ReplaceString,
TagStart,
TagEnd,
ReplaceProc,
ReplaceExtendedProc,
StripParamQuotes,
Flags,
ExtData,
TagParamsClass,
TagReplaceProcResult);
If tagHandled then begin
_MoveStr2Result(SourceString,SourceCurrentPos,T1 - SourceCurrentPos);
_MoveStr2Result(ReplaceString,1,length(ReplaceString))
end
else _MoveStr2Result(SourceString,SourceCurrentPos,T2 - SourceCurrentPos);
SourceCurrentPos := T2;
If TagHandled and (not (rfreplaceAll in flags)) then Break;
InPrecompiledTag := False;
T1 := PosExFunct(TagStart,SourceString,SourceCurrentPos);
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
//we are in precompiled tag
if (SourceString[T2] = #2) and
((T2 + pSize + 1 + TagEndLength) <= SourceStringLength) and
(SourceString[T2 + pSize + 1] = #3) and
((IgnoreCase and ((SourceString[T2 + pSize + 2] = TagEndFirstCharLower) or (SourceString[T2 + pSize + 2] = TagEndFirstCharUpper))) or
((not IgnoreCase) and (SourceString[T2 + pSize + 2] = TagEndFirstChar))) and
((TagEndLength <= 1) or (PosExFunct(TagEnd,AlCopyStr(SourceString,T2 + pSize + 2,TagEndLength),1) = 1)) then begin
InPrecompiledTag := True;
T2 := T2 + pSize + 1 + TagEndLength;
end
//else not precompiled tag
else begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (SourceString[T2] <> TagEndFirstCharLower) and (SourceString[T2] <> TagEndFirstCharUpper)) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
((TagEndLength > 1) and (PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1))) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
end;
end;
_MoveStr2Result(SourceString,SourceCurrentPos,maxint);
SetLength(Result,ResultCurrentPos-1);
end;
{*************************************************************************}
function ALFastTagReplace(const SourceString, TagStart, TagEnd: AnsiString;
ReplaceProc: TALHandleTagFunct;
StripParamQuotes: Boolean;
ExtData: Pointer;
Const flags: TReplaceFlags=[rfreplaceall];
const TagReplaceProcResult: Boolean = False): AnsiString;
Begin
result := ALFastTagReplace(SourceString,
TagStart,
TagEnd,
ReplaceProc,
nil,
StripParamQuotes,
flags,
extdata,
TALStringList,
TagReplaceProcResult);
end;
{*************************************************************************}
function ALFastTagReplace(const SourceString, TagStart, TagEnd: AnsiString;
ReplaceExtendedProc: TALHandleTagExtendedfunct;
StripParamQuotes: Boolean;
ExtData: Pointer;
Const flags: TReplaceFlags=[rfreplaceall];
const TagReplaceProcResult: Boolean = False): AnsiString;
Begin
result := ALFastTagReplace(SourceString,
TagStart,
TagEnd,
nil,
ReplaceExtendedProc,
StripParamQuotes,
flags,
extdata,
TALStringList,
TagReplaceProcResult);
end;
{************************************************************}
function ALFastTagReplaceWithFunc(const TagString: AnsiString;
TagParams: TALStrings;
ExtData: pointer;
Var Handled: Boolean): AnsiString;
begin
Handled := true;
result := AnsiString(ExtData);
end;
{*************************************************************************}
function ALFastTagReplace(const SourceString, TagStart, TagEnd: AnsiString;
const ReplaceWith: AnsiString;
const Flags: TReplaceFlags=[rfreplaceall]): AnsiString;
Begin
Result := ALFastTagReplace(SourceString,
TagStart,
TagEnd,
ALFastTagReplaceWithFunc,
nil,
True,
flags,
PAnsiChar(ReplaceWith),
TalStringList,
false);
end;
{**************************************************}
//the problem with this function is that if you have
//<#mytagwww params="xxx"> and
//<#mytag params="xxx">
//then the ALExtractTagParams(str, '<#mytag', '>' ... ) will not work like we expect
//because it's will extract the params of the <#mytagwww
function ALExtractTagParams(Const SourceString, TagStart, TagEnd: AnsiString;
StripParamQuotes: Boolean;
TagParams: TALStrings;
IgnoreCase: Boolean): Boolean;
var ReplaceString: AnsiString;
TagEndFirstChar, TagEndFirstCharLower, TagEndFirstCharUpper: AnsiChar;
TokenStr, ParamStr: AnsiString;
TagStartLength: integer;
TagEndLength: integer;
SourceStringLength: Integer;
InDoubleQuote: Boolean;
InsingleQuote: Boolean;
PosExFunct: Function(const SubStr, S: AnsiString; Offset: Integer = 1): Integer;
T1,T2: Integer;
{------------------------------------}
Function _ExtractTokenStr: AnsiString;
var x: Integer;
Begin
X := 1;
while (x <= length(ReplaceString)) and
(not (ReplaceString[x] in [' ', #9, #13, #10])) do inc(x);
if x > length(ReplaceString) then Result := ReplaceString
else Result := AlcopyStr(ReplaceString,1,x-1);
end;
{-------------------------------------}
Function _ExtractParamsStr: AnsiString;
Begin
Result := ALTrim( AlcopyStr(ReplaceString,length(TokenStr) + 1, MaxInt) );
end;
begin
Result := False;
if (SourceString = '') or (TagStart = '') or (TagEnd = '') then Exit;
If IgnoreCase then PosExFunct := ALPosExIgnoreCase
Else PosExFunct := ALPosEx;
SourceStringLength := length(SourceString);
TagStartLength := Length(TagStart);
TagEndLength := Length(TagEnd);
TagEndFirstChar := TagEnd[1];
TagEndFirstCharLower := ALLowerCase(TagEnd[1])[1];
TagEndFirstCharUpper := ALUpperCase(TagEnd[1])[1];
T1 := PosExFunct(TagStart,SourceString,1);
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (not (SourceString[T2] in [TagEndFirstCharLower, TagEndFirstCharUpper]))) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
(PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1)) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
If (T1 > 0) and (T2 > T1) Then begin
ReplaceString := AlCopyStr(SourceString,T1 + TagStartLength,T2 - T1 - TagStartLength);
TokenStr := _ExtractTokenStr;
ParamStr := _ExtractParamsStr;
ALExtractHeaderFieldsWithQuoteEscaped([' ', #9, #13, #10],
[' ', #9, #13, #10],
['"', ''''],
PAnsiChar(ParamStr),
TagParams,
False,
StripParamQuotes);
Result := True
end;
end;
{********************}
// split the text like
// blablabla<#tag param="xxx">whouwhouwhou
// in a list of
// blablabla
// <#tag param="xxx">
// whouwhouwhou
Procedure ALSplitTextAndTag(Const SourceString, TagStart, TagEnd: AnsiString;
SplitTextAndTagLst: TALStrings;
IgnoreCase: Boolean);
var TagEndFirstChar, TagEndFirstCharLower, TagEndFirstCharUpper: AnsiChar;
TagStartLength: integer;
TagEndLength: integer;
SourceStringLength: Integer;
SourceCurrentPos: integer;
InDoubleQuote: Boolean;
InsingleQuote: Boolean;
PosExFunct: Function(const SubStr, S: AnsiString; Offset: Integer = 1): Integer;
T1,T2: Integer;
begin
if (SourceString = '') or (TagStart = '') or (TagEnd = '') then begin
if SourceString <> '' then SplitTextAndTagLst.Add(SourceString);
Exit;
end;
If IgnoreCase then PosExFunct := ALPosExIgnoreCase
Else PosExFunct := ALPosEx;
SourceStringLength := length(SourceString);
TagStartLength := Length(TagStart);
TagEndLength := Length(TagEnd);
TagEndFirstChar := TagEnd[1];
TagEndFirstCharLower := ALLowerCase(TagEnd[1])[1];
TagEndFirstCharUpper := ALUpperCase(TagEnd[1])[1];
SourceCurrentPos := 1;
T1 := PosExFunct(TagStart,SourceString,SourceCurrentPos);
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (not (SourceString[T2] in [TagEndFirstCharLower, TagEndFirstCharUpper]))) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
(PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1)) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
While (T1 > 0) and (T2 > T1) do begin
SplitTextAndTagLst.AddObject(AlcopyStr(SourceString,SourceCurrentPos,T1 - SourceCurrentPos), pointer(0));
SplitTextAndTagLst.AddObject(AlCopyStr(SourceString,T1,T2 - T1 + TagEndLength), pointer(1));
SourceCurrentPos := T2 + TagEndLength;
T1 := PosExFunct(TagStart,SourceString,SourceCurrentPos);
T2 := T1 + TagStartLength;
If (T1 > 0) and (T2 <= SourceStringLength) then begin
InDoubleQuote := False;
InsingleQuote := False;
While (T2 <= SourceStringLength) and
(InDoubleQuote or
InSingleQuote or
(IgnoreCase and (not (SourceString[T2] in [TagEndFirstCharLower, TagEndFirstCharUpper]))) or
((not IgnoreCase) and (SourceString[T2] <> TagEndFirstChar)) or
(PosExFunct(TagEnd,AlCopyStr(SourceString,T2,TagEndLength),1) <> 1)) do begin
If SourceString[T2] = '"' then InDoubleQuote := (not InDoubleQuote) and (not InSingleQuote)
else If SourceString[T2] = '''' then InSingleQuote := (not InSingleQuote) and (not InDoubleQuote);
inc(T2);
end;
if (T2 > SourceStringLength) then T2 := 0;
end;
end;
SplitTextAndTagLst.AddObject(AlcopyStr(SourceString,SourceCurrentPos,maxint), pointer(0));
end;
{*************************************************************************************************************}
function ALGetStringFromFile(const filename: AnsiString; const ShareMode: Word = fmShareDenyWrite): AnsiString;
Var AFileStream: TfileStream;
begin
AFileStream := TFileStream.Create(String(filename),fmOpenRead or ShareMode);
try
If AFileStream.size > 0 then begin
SetLength(Result, AFileStream.size);
AfileStream.ReadBuffer(pointer(Result)^,AfileStream.Size)
end
else Result := '';
finally
AfileStream.Free;
end;
end;
{***************************************************************************************************************************}
function ALGetStringFromFileWithoutUTF8BOM(const filename: AnsiString; const ShareMode: Word = fmShareDenyWrite): AnsiString;
Var AFileStream: TfileStream;
aBOMStr: AnsiString;
aSize: Integer;
begin
AFileStream := TFileStream.Create(String(filename),fmOpenRead or ShareMode);
try
aSize := AFileStream.size;
If ASize > 0 then begin
If Asize >= 3 then begin
SetLength(aBOMStr,3);
AfileStream.ReadBuffer(pointer(aBOMStr)^,3);
If AlUTF8DetectBOM(PAnsiChar(aBOMStr), 3) then aSize := aSize - 3
else AfileStream.Position := 0;
end;
If aSize > 0 then begin
SetLength(Result, aSize);
AfileStream.ReadBuffer(pointer(Result)^,ASize)
end
else Result := '';
end
else Result := '';
finally
AfileStream.Free;
end;
end;
{********************************************************************************}
procedure ALAppendStringToFile(const Str: AnsiString; const FileName: AnsiString);
var aFileStream: TFileStream;
begin
if FileExists(String(FileName)) then aFileStream := TFileStream.Create(String(FileName), fmOpenReadWrite)
else aFileStream := TFileStream.Create(String(FileName), fmCreate);
try
aFileStream.Position := aFileStream.Size;
aFileStream.WriteBuffer(Pointer(Str)^, Length(Str));
finally
aFileStream.Free;
end;
end;
{******************************************************************************}
procedure ALSaveStringtoFile(const Str: AnsiString; const filename: AnsiString);
Var AFileStream: TFileStream;
begin
AFileStream := TFileStream.Create(String(filename), fmCreate);
try
AFileStream.WriteBuffer(Pointer(Str)^, Length(Str));
finally
AFileStream.Free;
end;
end;
{$ENDIF}
{**************************************************************}
function ALGetBytesFromStream(const aStream : TStream): Tbytes;
var l: Integer;
begin
l:=aStream.Size-aStream.Position;
SetLength(result, l);
aStream.ReadBuffer(result[0], l);
end;
{******************************************************************************************************}
function ALGetBytesFromFileU(const filename: String; const ShareMode: Word = fmShareDenyWrite): Tbytes;
Var AFileStream: TfileStream;
begin
AFileStream := TFileStream.Create(filename,fmOpenRead or ShareMode);
try
Result := ALGetBytesFromStream(AFileStream);
finally
ALFreeAndNil(AfileStream);
end;
end;
{**********************************************************************************************}
function ALGetStringFromBufferU(const buf : TBytes; const ADefaultEncoding: TEncoding): String;
var encoding : TEncoding;
n : Integer;
begin
encoding:=nil;
n:=TEncoding.GetBufferEncoding(buf, encoding, ADefaultEncoding);
Result:=encoding.GetString(buf, n, Length(buf)-n);
end;
{***************************************************************************************************}
function ALGetStringFromStreamU(const aStream : TStream; const ADefaultEncoding: TEncoding): String;
var buf: Tbytes;
begin
Buf := ALGetBytesFromStream(aStream);
Result:=ALGetStringFromBufferU(buf, ADefaultEncoding);
end;
{******************************************************************************************************************************************}
function ALGetStringFromFileU(const filename: String; const ADefaultEncoding: TEncoding; const ShareMode: Word = fmShareDenyWrite): String;
Var AFileStream: TfileStream;
begin
AFileStream := TFileStream.Create(filename,fmOpenRead or ShareMode);
try
Result := ALGetStringFromStreamU(AFileStream, ADefaultEncoding);
finally
ALFreeAndNil(AfileStream);
end;
end;
{******************************************************************************************************************************}
procedure ALSaveStringtoFileU(const Str: String; const filename: String; AEncoding: TEncoding; const WriteBOM: boolean = False);
var afileStream: TfileStream;
Buffer, Preamble: TBytes;
begin
aFileStream := TfileStream.Create(filename,fmCreate);
Try
Buffer := aEncoding.GetBytes(Str);
if WriteBOM then begin
Preamble := aEncoding.GetPreamble;
if Length(Preamble) > 0 then
afileStream.WriteBuffer(Preamble, Length(Preamble));
end;
afileStream.WriteBuffer(Buffer, Length(Buffer));
finally
ALFreeAndNil(aFileStream);
end;
end;
{$IFNDEF NEXTGEN}
{**********************}
{$IF defined(MSWINDOWS)}
// Normalize a Widestring
// ie: l''été sur l''europe => l-ete-sur-l-europe
Function ALWideNormalize(const S: Widestring;
const WordSeparator: WideChar;
const SymbolsToIgnore: array of WideChar): Widestring;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
{source: http://issues.apache.org/jira/browse/LUCENE-1343}
Procedure _foldNonDiacriticChar(Var aStr: WideString);
Var i, j : integer;
Begin
for I := 1 to length(aStr) do begin
j := ord(aStr[i]);
case j of
$0181: aStr[i] := widechar($0042); // Ɓ -> B | LATIN CAPITAL LETTER B WITH HOOK -> LATIN CAPITAL LETTER B
$0182: aStr[i] := widechar($0042); // Ƃ -> B | LATIN CAPITAL LETTER B WITH TOPBAR -> LATIN CAPITAL LETTER B
$0187: aStr[i] := widechar($0043); // Ƈ -> C | LATIN CAPITAL LETTER C WITH HOOK -> LATIN CAPITAL LETTER C
$0110: aStr[i] := widechar($0044); // Đ -> D | LATIN CAPITAL LETTER D WITH STROKE -> LATIN CAPITAL LETTER D
$018A: aStr[i] := widechar($0044); // Ɗ -> D | LATIN CAPITAL LETTER D WITH HOOK -> LATIN CAPITAL LETTER D
$018B: aStr[i] := widechar($0044); // Ƌ -> D | LATIN CAPITAL LETTER D WITH TOPBAR -> LATIN CAPITAL LETTER D
$0191: aStr[i] := widechar($0046); // Ƒ -> F | LATIN CAPITAL LETTER F WITH HOOK -> LATIN CAPITAL LETTER F
$0193: aStr[i] := widechar($0047); // Ɠ -> G | LATIN CAPITAL LETTER G WITH HOOK -> LATIN CAPITAL LETTER G
$01E4: aStr[i] := widechar($0047); // Ǥ -> G | LATIN CAPITAL LETTER G WITH STROKE -> LATIN CAPITAL LETTER G
$0126: aStr[i] := widechar($0048); // Ħ -> H | LATIN CAPITAL LETTER H WITH STROKE -> LATIN CAPITAL LETTER H
$0197: aStr[i] := widechar($0049); // Ɨ -> I | LATIN CAPITAL LETTER I WITH STROKE -> LATIN CAPITAL LETTER I
$0198: aStr[i] := widechar($004B); // Ƙ -> K | LATIN CAPITAL LETTER K WITH HOOK -> LATIN CAPITAL LETTER K
$0141: aStr[i] := widechar($004C); // Ł -> L | LATIN CAPITAL LETTER L WITH STROKE -> LATIN CAPITAL LETTER L
$019D: aStr[i] := widechar($004E); // Ɲ -> N | LATIN CAPITAL LETTER N WITH LEFT HOOK -> LATIN CAPITAL LETTER N
$0220: aStr[i] := widechar($004E); // Ƞ -> N | LATIN CAPITAL LETTER N WITH LONG RIGHT LEG -> LATIN CAPITAL LETTER N
$00D8: aStr[i] := widechar($004F); // Ø -> O | LATIN CAPITAL LETTER O WITH STROKE -> LATIN CAPITAL LETTER O
$019F: aStr[i] := widechar($004F); // Ɵ -> O | LATIN CAPITAL LETTER O WITH MIDDLE TILDE -> LATIN CAPITAL LETTER O
$01FE: aStr[i] := widechar($004F); // Ǿ -> O | LATIN CAPITAL LETTER O WITH STROKE AND ACUTE -> LATIN CAPITAL LETTER O
$01A4: aStr[i] := widechar($0050); // Ƥ -> P | LATIN CAPITAL LETTER P WITH HOOK -> LATIN CAPITAL LETTER P
$0166: aStr[i] := widechar($0054); // Ŧ -> T | LATIN CAPITAL LETTER T WITH STROKE -> LATIN CAPITAL LETTER T
$01AC: aStr[i] := widechar($0054); // Ƭ -> T | LATIN CAPITAL LETTER T WITH HOOK -> LATIN CAPITAL LETTER T
$01AE: aStr[i] := widechar($0054); // Ʈ -> T | LATIN CAPITAL LETTER T WITH RETROFLEX HOOK -> LATIN CAPITAL LETTER T
$01B2: aStr[i] := widechar($0056); // Ʋ -> V | LATIN CAPITAL LETTER V WITH HOOK -> LATIN CAPITAL LETTER V
$01B3: aStr[i] := widechar($0059); // Ƴ -> Y | LATIN CAPITAL LETTER Y WITH HOOK -> LATIN CAPITAL LETTER Y
$01B5: aStr[i] := widechar($005A); // Ƶ -> Z | LATIN CAPITAL LETTER Z WITH STROKE -> LATIN CAPITAL LETTER Z
$0224: aStr[i] := widechar($005A); // Ȥ -> Z | LATIN CAPITAL LETTER Z WITH HOOK -> LATIN CAPITAL LETTER Z
$0180: aStr[i] := widechar($0062); // ƀ -> b | LATIN SMALL LETTER B WITH STROKE -> LATIN SMALL LETTER B
$0183: aStr[i] := widechar($0062); // ƃ -> b | LATIN SMALL LETTER B WITH TOPBAR -> LATIN SMALL LETTER B
$0253: aStr[i] := widechar($0062); // ɓ -> b | LATIN SMALL LETTER B WITH HOOK -> LATIN SMALL LETTER B
$0188: aStr[i] := widechar($0063); // ƈ -> c | LATIN SMALL LETTER C WITH HOOK -> LATIN SMALL LETTER C
$0255: aStr[i] := widechar($0063); // ɕ -> c | LATIN SMALL LETTER C WITH CURL -> LATIN SMALL LETTER C
$0111: aStr[i] := widechar($0064); // đ -> d | LATIN SMALL LETTER D WITH STROKE -> LATIN SMALL LETTER D
$018C: aStr[i] := widechar($0064); // ƌ -> d | LATIN SMALL LETTER D WITH TOPBAR -> LATIN SMALL LETTER D
$0221: aStr[i] := widechar($0064); // ȡ -> d | LATIN SMALL LETTER D WITH CURL -> LATIN SMALL LETTER D
$0256: aStr[i] := widechar($0064); // ɖ -> d | LATIN SMALL LETTER D WITH TAIL -> LATIN SMALL LETTER D
$0257: aStr[i] := widechar($0064); // ɗ -> d | LATIN SMALL LETTER D WITH HOOK -> LATIN SMALL LETTER D
$0192: aStr[i] := widechar($0066); // ƒ -> f | LATIN SMALL LETTER F WITH HOOK -> LATIN SMALL LETTER F
$01E5: aStr[i] := widechar($0067); // ǥ -> g | LATIN SMALL LETTER G WITH STROKE -> LATIN SMALL LETTER G
$0260: aStr[i] := widechar($0067); // ɠ -> g | LATIN SMALL LETTER G WITH HOOK -> LATIN SMALL LETTER G
$0127: aStr[i] := widechar($0068); // ħ -> h | LATIN SMALL LETTER H WITH STROKE -> LATIN SMALL LETTER H
$0266: aStr[i] := widechar($0068); // ɦ -> h | LATIN SMALL LETTER H WITH HOOK -> LATIN SMALL LETTER H
$0268: aStr[i] := widechar($0069); // ɨ -> i | LATIN SMALL LETTER I WITH STROKE -> LATIN SMALL LETTER I
$029D: aStr[i] := widechar($006A); // ʝ -> j | LATIN SMALL LETTER J WITH CROSSED-TAIL -> LATIN SMALL LETTER J
$0199: aStr[i] := widechar($006B); // ƙ -> k | LATIN SMALL LETTER K WITH HOOK -> LATIN SMALL LETTER K
$0142: aStr[i] := widechar($006C); // ł -> l | LATIN SMALL LETTER L WITH STROKE -> LATIN SMALL LETTER L
$019A: aStr[i] := widechar($006C); // ƚ -> l | LATIN SMALL LETTER L WITH BAR -> LATIN SMALL LETTER L
$0234: aStr[i] := widechar($006C); // ȴ -> l | LATIN SMALL LETTER L WITH CURL -> LATIN SMALL LETTER L
$026B: aStr[i] := widechar($006C); // ɫ -> l | LATIN SMALL LETTER L WITH MIDDLE TILDE -> LATIN SMALL LETTER L
$026C: aStr[i] := widechar($006C); // ɬ -> l | LATIN SMALL LETTER L WITH BELT -> LATIN SMALL LETTER L
$026D: aStr[i] := widechar($006C); // ɭ -> l | LATIN SMALL LETTER L WITH RETROFLEX HOOK -> LATIN SMALL LETTER L
$0271: aStr[i] := widechar($006D); // ɱ -> m | LATIN SMALL LETTER M WITH HOOK -> LATIN SMALL LETTER M
$019E: aStr[i] := widechar($006E); // ƞ -> n | LATIN SMALL LETTER N WITH LONG RIGHT LEG -> LATIN SMALL LETTER N
$0235: aStr[i] := widechar($006E); // ȵ -> n | LATIN SMALL LETTER N WITH CURL -> LATIN SMALL LETTER N
$0272: aStr[i] := widechar($006E); // ɲ -> n | LATIN SMALL LETTER N WITH LEFT HOOK -> LATIN SMALL LETTER N
$0273: aStr[i] := widechar($006E); // ɳ -> n | LATIN SMALL LETTER N WITH RETROFLEX HOOK -> LATIN SMALL LETTER N
$00F8: aStr[i] := widechar($006F); // ø -> o | LATIN SMALL LETTER O WITH STROKE -> LATIN SMALL LETTER O
$01FF: aStr[i] := widechar($006F); // ǿ -> o | LATIN SMALL LETTER O WITH STROKE AND ACUTE -> LATIN SMALL LETTER O
$01A5: aStr[i] := widechar($0070); // ƥ -> p | LATIN SMALL LETTER P WITH HOOK -> LATIN SMALL LETTER P
$02A0: aStr[i] := widechar($0071); // ʠ -> q | LATIN SMALL LETTER Q WITH HOOK -> LATIN SMALL LETTER Q
$027C: aStr[i] := widechar($0072); // ɼ -> r | LATIN SMALL LETTER R WITH LONG LEG -> LATIN SMALL LETTER R
$027D: aStr[i] := widechar($0072); // ɽ -> r | LATIN SMALL LETTER R WITH TAIL -> LATIN SMALL LETTER R
$0282: aStr[i] := widechar($0073); // ʂ -> s | LATIN SMALL LETTER S WITH HOOK -> LATIN SMALL LETTER S
$0167: aStr[i] := widechar($0074); // ŧ -> t | LATIN SMALL LETTER T WITH STROKE -> LATIN SMALL LETTER T
$01AB: aStr[i] := widechar($0074); // ƫ -> t | LATIN SMALL LETTER T WITH PALATAL HOOK -> LATIN SMALL LETTER T
$01AD: aStr[i] := widechar($0074); // ƭ -> t | LATIN SMALL LETTER T WITH HOOK -> LATIN SMALL LETTER T
$0236: aStr[i] := widechar($0074); // ȶ -> t | LATIN SMALL LETTER T WITH CURL -> LATIN SMALL LETTER T
$0288: aStr[i] := widechar($0074); // ʈ -> t | LATIN SMALL LETTER T WITH RETROFLEX HOOK -> LATIN SMALL LETTER T
$028B: aStr[i] := widechar($0076); // ʋ -> v | LATIN SMALL LETTER V WITH HOOK -> LATIN SMALL LETTER V
$01B4: aStr[i] := widechar($0079); // ƴ -> y | LATIN SMALL LETTER Y WITH HOOK -> LATIN SMALL LETTER Y
$01B6: aStr[i] := widechar($007A); // ƶ -> z | LATIN SMALL LETTER Z WITH STROKE -> LATIN SMALL LETTER Z
$0225: aStr[i] := widechar($007A); // ȥ -> z | LATIN SMALL LETTER Z WITH HOOK -> LATIN SMALL LETTER Z
$0290: aStr[i] := widechar($007A); // ʐ -> z | LATIN SMALL LETTER Z WITH RETROFLEX HOOK -> LATIN SMALL LETTER Z
$0291: aStr[i] := widechar($007A); // ʑ -> z | LATIN SMALL LETTER Z WITH CURL -> LATIN SMALL LETTER Z
$025A: aStr[i] := widechar($0259); // ɚ -> ə | LATIN SMALL LETTER SCHWA WITH HOOK -> LATIN SMALL LETTER SCHWA
$0286: aStr[i] := widechar($0283); // ʆ -> ʃ | LATIN SMALL LETTER ESH WITH CURL -> LATIN SMALL LETTER ESH
$01BA: aStr[i] := widechar($0292); // ƺ -> ʒ | LATIN SMALL LETTER EZH WITH TAIL -> LATIN SMALL LETTER EZH
$0293: aStr[i] := widechar($0292); // ʓ -> ʒ | LATIN SMALL LETTER EZH WITH CURL -> LATIN SMALL LETTER EZH
$0490: aStr[i] := widechar($0413); // Ґ -> Г | CYRILLIC CAPITAL LETTER GHE WITH UPTURN -> CYRILLIC CAPITAL LETTER GHE
$0492: aStr[i] := widechar($0413); // Ғ -> Г | CYRILLIC CAPITAL LETTER GHE WITH STROKE -> CYRILLIC CAPITAL LETTER GHE
$0494: aStr[i] := widechar($0413); // Ҕ -> Г | CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK -> CYRILLIC CAPITAL LETTER GHE
$0496: aStr[i] := widechar($0416); // Җ -> Ж | CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER -> CYRILLIC CAPITAL LETTER ZHE
$0498: aStr[i] := widechar($0417); // Ҙ -> З | CYRILLIC CAPITAL LETTER ZE WITH DESCENDER -> CYRILLIC CAPITAL LETTER ZE
$048A: aStr[i] := widechar($0419); // Ҋ -> Й | CYRILLIC CAPITAL LETTER SHORT I WITH TAIL -> CYRILLIC CAPITAL LETTER SHORT I
$049A: aStr[i] := widechar($041A); // Қ -> К | CYRILLIC CAPITAL LETTER KA WITH DESCENDER -> CYRILLIC CAPITAL LETTER KA
$049C: aStr[i] := widechar($041A); // Ҝ -> К | CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE -> CYRILLIC CAPITAL LETTER KA
$049E: aStr[i] := widechar($041A); // Ҟ -> К | CYRILLIC CAPITAL LETTER KA WITH STROKE -> CYRILLIC CAPITAL LETTER KA
$04C3: aStr[i] := widechar($041A); // Ӄ -> К | CYRILLIC CAPITAL LETTER KA WITH HOOK -> CYRILLIC CAPITAL LETTER KA
$04C5: aStr[i] := widechar($041B); // Ӆ -> Л | CYRILLIC CAPITAL LETTER EL WITH TAIL -> CYRILLIC CAPITAL LETTER EL
$04CD: aStr[i] := widechar($041C); // Ӎ -> М | CYRILLIC CAPITAL LETTER EM WITH TAIL -> CYRILLIC CAPITAL LETTER EM
$04A2: aStr[i] := widechar($041D); // Ң -> Н | CYRILLIC CAPITAL LETTER EN WITH DESCENDER -> CYRILLIC CAPITAL LETTER EN
$04C7: aStr[i] := widechar($041D); // Ӈ -> Н | CYRILLIC CAPITAL LETTER EN WITH HOOK -> CYRILLIC CAPITAL LETTER EN
$04C9: aStr[i] := widechar($041D); // Ӊ -> Н | CYRILLIC CAPITAL LETTER EN WITH TAIL -> CYRILLIC CAPITAL LETTER EN
$04A6: aStr[i] := widechar($041F); // Ҧ -> П | CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK -> CYRILLIC CAPITAL LETTER PE
$048E: aStr[i] := widechar($0420); // Ҏ -> Р | CYRILLIC CAPITAL LETTER ER WITH TICK -> CYRILLIC CAPITAL LETTER ER
$04AA: aStr[i] := widechar($0421); // Ҫ -> С | CYRILLIC CAPITAL LETTER ES WITH DESCENDER -> CYRILLIC CAPITAL LETTER ES
$04AC: aStr[i] := widechar($0422); // Ҭ -> Т | CYRILLIC CAPITAL LETTER TE WITH DESCENDER -> CYRILLIC CAPITAL LETTER TE
$04B2: aStr[i] := widechar($0425); // Ҳ -> Х | CYRILLIC CAPITAL LETTER HA WITH DESCENDER -> CYRILLIC CAPITAL LETTER HA
$04B3: aStr[i] := widechar($0425); // ҳ -> Х | CYRILLIC SMALL LETTER HA WITH DESCENDER -> CYRILLIC CAPITAL LETTER HA
$0491: aStr[i] := widechar($0433); // ґ -> г | CYRILLIC SMALL LETTER GHE WITH UPTURN -> CYRILLIC SMALL LETTER GHE
$0493: aStr[i] := widechar($0433); // ғ -> г | CYRILLIC SMALL LETTER GHE WITH STROKE -> CYRILLIC SMALL LETTER GHE
$0495: aStr[i] := widechar($0433); // ҕ -> г | CYRILLIC SMALL LETTER GHE WITH MIDDLE HOOK -> CYRILLIC SMALL LETTER GHE
$0497: aStr[i] := widechar($0436); // җ -> ж | CYRILLIC SMALL LETTER ZHE WITH DESCENDER -> CYRILLIC SMALL LETTER ZHE
$0499: aStr[i] := widechar($0437); // ҙ -> з | CYRILLIC SMALL LETTER ZE WITH DESCENDER -> CYRILLIC SMALL LETTER ZE
$048B: aStr[i] := widechar($0439); // ҋ -> й | CYRILLIC SMALL LETTER SHORT I WITH TAIL -> CYRILLIC SMALL LETTER SHORT I
$049B: aStr[i] := widechar($043A); // қ -> к | CYRILLIC SMALL LETTER KA WITH DESCENDER -> CYRILLIC SMALL LETTER KA
$049D: aStr[i] := widechar($043A); // ҝ -> к | CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE -> CYRILLIC SMALL LETTER KA
$049F: aStr[i] := widechar($043A); // ҟ -> к | CYRILLIC SMALL LETTER KA WITH STROKE -> CYRILLIC SMALL LETTER KA
$04C4: aStr[i] := widechar($043A); // ӄ -> к | CYRILLIC SMALL LETTER KA WITH HOOK -> CYRILLIC SMALL LETTER KA
$04C6: aStr[i] := widechar($043B); // ӆ -> л | CYRILLIC SMALL LETTER EL WITH TAIL -> CYRILLIC SMALL LETTER EL
$04CE: aStr[i] := widechar($043C); // ӎ -> м | CYRILLIC SMALL LETTER EM WITH TAIL -> CYRILLIC SMALL LETTER EM
$04A3: aStr[i] := widechar($043D); // ң -> н | CYRILLIC SMALL LETTER EN WITH DESCENDER -> CYRILLIC SMALL LETTER EN
$04C8: aStr[i] := widechar($043D); // ӈ -> н | CYRILLIC SMALL LETTER EN WITH HOOK -> CYRILLIC SMALL LETTER EN
$04CA: aStr[i] := widechar($043D); // ӊ -> н | CYRILLIC SMALL LETTER EN WITH TAIL -> CYRILLIC SMALL LETTER EN
$04A7: aStr[i] := widechar($043F); // ҧ -> п | CYRILLIC SMALL LETTER PE WITH MIDDLE HOOK -> CYRILLIC SMALL LETTER PE
$048F: aStr[i] := widechar($0440); // ҏ -> р | CYRILLIC SMALL LETTER ER WITH TICK -> CYRILLIC SMALL LETTER ER
$04AB: aStr[i] := widechar($0441); // ҫ -> с | CYRILLIC SMALL LETTER ES WITH DESCENDER -> CYRILLIC SMALL LETTER ES
$04AD: aStr[i] := widechar($0442); // ҭ -> т | CYRILLIC SMALL LETTER TE WITH DESCENDER -> CYRILLIC SMALL LETTER TE
$04B9: aStr[i] := widechar($0447); // ҹ -> ч | CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE -> CYRILLIC SMALL LETTER CHE
$047C: aStr[i] := widechar($0460); // Ѽ -> Ѡ | CYRILLIC CAPITAL LETTER OMEGA WITH TITLO -> CYRILLIC CAPITAL LETTER OMEGA
$047D: aStr[i] := widechar($0461); // ѽ -> ѡ | CYRILLIC SMALL LETTER OMEGA WITH TITLO -> CYRILLIC SMALL LETTER OMEGA
$04B0: aStr[i] := widechar($04AE); // Ұ -> Ү | CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE -> CYRILLIC CAPITAL LETTER STRAIGHT U
$04B1: aStr[i] := widechar($04AF); // ұ -> ү | CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE -> CYRILLIC SMALL LETTER STRAIGHT U
$04B6: aStr[i] := widechar($04BC); // Ҷ -> Ҽ | CYRILLIC CAPITAL LETTER CHE WITH DESCENDER -> CYRILLIC CAPITAL LETTER ABKHASIAN CHE
$04B7: aStr[i] := widechar($04BC); // ҷ -> Ҽ | CYRILLIC SMALL LETTER CHE WITH DESCENDER -> CYRILLIC CAPITAL LETTER ABKHASIAN CHE
$04B8: aStr[i] := widechar($04BC); // Ҹ -> Ҽ | CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE -> CYRILLIC CAPITAL LETTER ABKHASIAN CHE
$04BE: aStr[i] := widechar($04BC); // Ҿ -> Ҽ | CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER -> CYRILLIC CAPITAL LETTER ABKHASIANCHE
$04BF: aStr[i] := widechar($04BC); // ҿ -> Ҽ | CYRILLIC SMALL LETTER ABKHASIAN CHE WITH DESCENDER -> CYRILLIC CAPITAL LETTER ABKHASIAN CHE
$04CB: aStr[i] := widechar($04BC); // Ӌ -> Ҽ | CYRILLIC CAPITAL LETTER KHAKASSIAN CHE -> CYRILLIC CAPITAL LETTER ABKHASIAN CHE
$04CC: aStr[i] := widechar($04BC); // ӌ -> Ҽ | CYRILLIC SMALL LETTER KHAKASSIAN CHE -> CYRILLIC CAPITAL LETTER ABKHASIAN CHE
end;
end;
End;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
function _IsIgnoredSymbol(aSymbol: WideChar): boolean;
var i: integer;
begin
result := False;
for I := Low(SymbolsToIgnore) to High(SymbolsToIgnore) do
if SymbolsToIgnore[i] = aSymbol then begin
result := true;
exit;
end;
end;
Var i,j: integer;
TmpWideStr: WideString;
Begin
TmpWideStr := ALWideExpandLigatures(ALWideRemoveDiacritic(Widelowercase(s)));
SetLength(Result,length(TmpWideStr));
j := 0;
For i := 1 to length(TmpWideStr) do begin
if IsCharAlphaNumericW(TmpWideStr[i]) or
_IsIgnoredSymbol(TmpWideStr[i]) then begin
inc(j);
result[j] := TmpWideStr[i];
end
else if ((j >= 1) and
(result[j] <> WordSeparator)) then begin
inc(j);
result[j] := WordSeparator;
end;
end;
While (J > 0) and (result[j] = WordSeparator) do dec(j);
setlength(result,j);
_foldNonDiacriticChar(result);
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// Normalize a Widestring
// ie: l''été sur l''europe => l-ete-sur-l-europe
Function ALWideNormalize(const S: Widestring; const WordSeparator: WideChar = '-'): Widestring;
Begin
result := ALWideNormalize(S, WordSeparator, []);
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
{remove accented character}
Function ALWideRemoveDiacritic(const S: Widestring): Widestring;
{----------------------------------------------------------------}
Function internalGetCompositeCharSize(aChar: WideString): integer;
Begin
//max(1,xxx) in case FoldString return on error mean result = 0
//this can really happen ?
Result := Max(1, FoldStringW(MAP_COMPOSITE, PwideChar(aChar), length(aChar), nil, 0));
end;
var LenS, LenTmpWideStr: Integer;
i,J: integer;
TmpWideStr: WideString;
begin
result := '';
If s = '' then exit;
LenS := length(S);
LenTmpWideStr := FoldStringW(MAP_COMPOSITE, PwideChar(S), LenS, nil, 0);
if LenTmpWideStr <= 0 then Exit;
setlength(TmpWideStr,LenTmpWideStr);
FoldStringW(MAP_COMPOSITE, PwideChar(S), LenS, PwideChar(TmpWideStr), LenTmpWideStr);
i := 1;
J := 1;
SetLength(result,lenS);
while J <= lenS do begin
Result[j] := TmpWideStr[i];
if S[j] <> TmpWideStr[i] then inc(i,internalGetCompositeCharSize(S[j])) //some Diacritic can have a length of 3 in composite (ie: U+1E69)
else inc(i);
inc(j);
end;
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// Expand all ligature characters so that they are represented by
// their two-character equivalent. For example, the ligature 'æ' expands to
// the two characters 'a' and 'e'.}
Function ALWideExpandLigatures(const S: Widestring): Widestring;
Const aMAP_EXPAND_LIGATURES = $2000;
var LenS, LenResult: Integer;
begin
result := '';
If s = '' then exit;
LenS := length(S);
LenResult := FoldStringW(aMAP_EXPAND_LIGATURES, PwideChar(S), LenS, nil, 0);
setlength(Result,LenResult);
FoldStringW(aMAP_EXPAND_LIGATURES, PwideChar(S), LenS, PwideChar(Result), LenResult);
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
Function ALWideUpperCaseNoDiacritic(const S: Widestring): Widestring;
begin
Result := ALWideRemoveDiacritic(WideUppercase(s));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
Function ALWideLowerCaseNoDiacritic(const S: Widestring): Widestring;
begin
Result := ALWideRemoveDiacritic(Widelowercase(s));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// without any Diacritic.
Function ALUTF8RemoveDiacritic(const S: AnsiString): AnsiString;
begin
Result := utf8Encode(ALWideRemoveDiacritic(UTF8ToWideString(S)));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// without any Ligatures.
Function ALUTF8ExpandLigatures(const S: AnsiString): AnsiString;
begin
Result := utf8Encode(ALWideExpandLigatures(UTF8ToWideString(S)));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// in UpperCase without any Diacritic.
Function ALUTF8UpperCaseNoDiacritic(const S: AnsiString): AnsiString;
begin
Result := utf8Encode(ALWideUpperCaseNoDiacritic(UTF8ToWideString(S)));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// in LowerCase without any Diacritic.
Function ALUTF8LowerCaseNoDiacritic(const S: AnsiString): AnsiString;
begin
Result := utf8Encode(ALWideLowerCaseNoDiacritic(UTF8ToWideString(S)));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// "normalized":
// ie: l''été sur l''europe => l-ete-sur-l-europe
Function ALUTF8Normalize(const S: AnsiString;
const WordSeparator: ansiChar;
const SymbolsToIgnore: array of AnsiChar): AnsiString;
var aWideSymbolsToIgnore: Array of WideChar;
i: integer;
begin
setlength(aWideSymbolsToIgnore, length(SymbolsToIgnore));
for I := Low(SymbolsToIgnore) to High(SymbolsToIgnore) do
aWideSymbolsToIgnore[i] := WideChar(SymbolsToIgnore[i]);
Result := utf8Encode(ALWideNormalize(UTF8ToWideString(S), WideChar(WordSeparator)));
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// "normalized":
// ie: l''été sur l''europe => l-ete-sur-l-europe
Function ALUTF8Normalize(const S: AnsiString;
const WordSeparator: ansiChar = '-'): AnsiString;
begin
Result := utf8Encode(ALWideNormalize(UTF8ToWideString(S), WideChar(WordSeparator), []));
end;
{$IFEND}
{*********************************************************}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// in LowerCase. this function use CharLowerBuffW
// The only problem I know that makes Unicode uppercase/lowercase conversion
// locale-dependent is the case of dotless i (ı, $0131) and dotted I (İ, $0130).
// In most languages the upper of i ($69) is I ($49), but in turkish locale i ($69)
// maps to İ ($0130). Similarly in turkish the lower of I ($49) is ı ($0131).
// CharUpperBuff/CharLowerBuffW always maps lowercase I ("i") to uppercase I,
// even when the current language is Turkish or Azeri
function ALUTF8UpperCase(const s: AnsiString): AnsiString;
begin
result := utf8encode(WideUppercase(UTF8ToWideString(s)));
end;
{*********************************************************}
// S is a AnsiString that contains UTF-8 encoded characters
// The result of the function is the corresponding UTF-8 encoded string
// in LowerCase. this function use CharLowerBuffW
// The only problem I know that makes Unicode uppercase/lowercase conversion
// locale-dependent is the case of dotless i (ı, $0131) and dotted I (İ, $0130).
// In most languages the upper of i ($69) is I ($49), but in turkish locale i ($69)
// maps to İ ($0130). Similarly in turkish the lower of I ($49) is ı ($0131).
// CharUpperBuff/CharLowerBuffW always maps lowercase I ("i") to uppercase I,
// even when the current language is Turkish or Azeri
function ALUTF8LowerCase(const s: AnsiString): AnsiString;
begin
result := utf8encode(WideLowerCase(UTF8ToWideString(s)));
end;
{**********************}
{$IF defined(MSWINDOWS)}
function AlUTF8Check(const S: AnsiString): Boolean;
begin
if S = '' then exit(true);
Result := MultiByteToWideChar(CP_UTF8, //UINT CodePage)
8{8=MB_ERR_INVALID_CHARS that is not defined in d2007}, // DWORD dwFlags
PAnsiChar(S), // LPCSTR lpMultiByteStr,
length(S), // int cbMultiByte
nil, // LPWSTR lpWideCharStr
0) > 0; // int cchWideChar
end;
{$IFEND}
{*************************************************************************}
function AlUTF8DetectBOM(const P: PansiChar; const Size: Integer): Boolean;
var Q: PansiChar;
begin
Result := False;
if Assigned(P) and (Size >= 3) and (P^ = #$EF) then begin
Q := P;
Inc(Q);
if Q^ = #$BB then begin
Inc(Q);
if Q^ = #$BF then Result := True;
end;
end;
end;
{********************************************************}
function AlUTF8removeBOM(const S: AnsiString): AnsiString;
begin
if AlUTF8DetectBOM(PAnsiChar(S), length(S)) then result := AlCopyStr(S,length(cAlUTF8BOM) + 1,Maxint)
else Result := S;
end;
{*******************************************************}
// determine the number of bytes that follow a lead UTF-8
// character (including the lead byte). UTF8CharLength
// always returns 1, if the given character is not a valid
// UTF-8 lead byte.
function ALUTF8CharSize(Lead: AnsiChar): Integer;
begin
case Lead of
#$00..#$7F: Result := 1; //
#$C2..#$DF: Result := 2; // 110x xxxx C0 - DF
#$E0..#$EF: Result := 3; // 1110 xxxx E0 - EF
#$F0..#$F7: Result := 4; // 1111 0xxx F0 - F7 // outside traditional UNICODE
#$F8..#$FB: Result := 5; // 1111 10xx F8 - FB // outside UTF-16
#$FC..#$FD: Result := 6; // 1111 110x FC - FD // outside UTF-16
else
Result := 1; // Illegal leading character.
end;
end;
{*****************************************}
// return how many char (not byte) are in S
function ALUTF8CharCount(const S: AnsiString): Integer;
var P, L : Integer;
begin
Result := 0;
L := length(s);
P := 1;
While P <= L do begin
Inc(P, ALUTF8CharSize(S[P]));
Inc(Result);
end;
end;
{**************************************}
// Trunc a AnsiString to max count bytes
Function ALUTF8ByteTrunc(const s:AnsiString; const Count: Integer): AnsiString;
var L, P, C: Integer;
begin
L := Length(S);
If (L = 0) or (Count >= L) then Begin
Result := S;
Exit;
end;
P := 1;
While P <= Count do begin
C := ALUTF8CharSize(S[P]);
if P + C - 1 > Count then break;
inc(P,C);
end;
Result := ALCopyStr(S,1,P-1);
end;
{*****************************************}
// Trunc a AnsiString to count unicode char
Function ALUTF8CharTrunc(const s:AnsiString; const Count: Integer): AnsiString;
var L, P, C: Integer;
begin
L := Length(S);
If (L = 0) or (Count >= L) then Begin
Result := S;
Exit;
end;
P := 1;
c := 0;
While P <= L do begin
Inc(P, ALUTF8CharSize(S[P]));
Inc(c);
if c >= count then break;
end;
Result := ALCopyStr(S,1,P-1);
end;
{*****************************}
{Uppercase only the First char}
Function ALUTF8UpperFirstChar(const s:AnsiString): AnsiString;
var tmpWideStr: WideString;
begin
TmpWideStr := UTF8ToWideString(S);
result := utf8encode(WideUpperCase(copy(TmpWideStr,1,1)) + copy(TmpWideStr,2,MaxInt));
end;
{*********************************************}
//the first letter of each word is capitalized,
//the rest are lower case
Function ALUTF8TitleCase(const s:AnsiString): AnsiString;
var tmpWideStr: WideString;
i: integer;
begin
TmpWideStr := UTF8ToWideString(S);
if length(TmpWideStr) = 0 then begin
result := '';
exit;
end;
TmpWideStr := WideUpperCase(copy(TmpWideStr,1,1)) + WidelowerCase(copy(TmpWideStr,2,MaxInt));
for i:= 2 to length(TmpWideStr) do
if ((TmpWideStr[i-1] = WideChar('&')) or
(TmpWideStr[i-1] = WideChar(' ')) or
(TmpWideStr[i-1] = WideChar('-')) or
(TmpWideStr[i-1] = WideChar('''')))
and
(
(i = length(TmpWideStr)) or
(
((TmpWideStr[i+1] <> ' ') or (TmpWideStr[i-1] = '&')) and // Agenge L&G Prestige - Maison à Vendre - A Prendre Ou a Laisser
(TmpWideStr[i+1] <> '''') // Avenue de l'Elysée
)
)
then TmpWideStr[i] := WideUpperCase(TmpWideStr[i])[1];
result := utf8encode(TmpWideStr);
end;
{****************************************************************}
// first letter of the sentence capitalized, all others lower case
Function ALUTF8SentenceCase(const s:AnsiString): AnsiString;
begin
Result := AlUtf8LowerCase(S);
Result := ALUTF8UpperFirstChar(Result);
end;
{***************************************************************}
Function ALGetCodePageFromCharSetName(Acharset:AnsiString): Word;
{$IF CompilerVersion >= 23} {Delphi XE2}
Var aEncoding: Tencoding;
begin
Try
if Acharset = '' then begin
result := 0; // Default ansi code page
exit;
end;
aEncoding := Tencoding.GetEncoding(String(Acharset));
Try
Result := aEncoding.CodePage;
Finally
aEncoding.Free;
end;
Except
Result := 0; // Default ansi code page
end;
end;
{$ELSE}
begin
Acharset := ALTrim(AlLowerCase(ACharset));
if acharset='utf-8' then result := 65001 // unicode (utf-8)
else if acharset='iso-8859-1' then result := 28591 // western european (iso)
else if acharset='iso-8859-2' then result := 28592 // central european (iso)
else if acharset='iso-8859-3' then result := 28593 // latin 3 (iso)
else if acharset='iso-8859-4' then result := 28594 // baltic (iso)
else if acharset='iso-8859-5' then result := 28595 // cyrillic (iso)
else if acharset='iso-8859-6' then result := 28596 // arabic (iso)
else if acharset='iso-8859-7' then result := 28597 // greek (iso)
else if acharset='iso-8859-8' then result := 28598 // hebrew (iso-visual)
else if acharset='iso-8859-9' then result := 28599 // turkish (iso)
else if acharset='iso-8859-13' then result := 28603 // estonian (iso)
else if acharset='iso-8859-15' then result := 28605 // latin 9 (iso)
else if acharset='ibm037' then result := 37 // ibm ebcdic (us-canada)
else if acharset='ibm437' then result := 437 // oem united states
else if acharset='ibm500' then result := 500 // ibm ebcdic (international)
else if acharset='asmo-708' then result := 708 // arabic (asmo 708)
else if acharset='dos-720' then result := 720 // arabic (dos)
else if acharset='ibm737' then result := 737 // greek (dos)
else if acharset='ibm775' then result := 775 // baltic (dos)
else if acharset='ibm850' then result := 850 // western european (dos)
else if acharset='ibm852' then result := 852 // central european (dos)
else if acharset='ibm855' then result := 855 // oem cyrillic
else if acharset='ibm857' then result := 857 // turkish (dos)
else if acharset='ibm00858' then result := 858 // oem multilingual latin i
else if acharset='ibm860' then result := 860 // portuguese (dos)
else if acharset='ibm861' then result := 861 // icelandic (dos)
else if acharset='dos-862' then result := 862 // hebrew (dos)
else if acharset='ibm863' then result := 863 // french canadian (dos)
else if acharset='ibm864' then result := 864 // arabic (864)
else if acharset='ibm865' then result := 865 // nordic (dos)
else if acharset='cp866' then result := 866 // cyrillic (dos)
else if acharset='ibm869' then result := 869 // greek, modern (dos)
else if acharset='ibm870' then result := 870 // ibm ebcdic (multilingual latin-2)
else if acharset='windows-874' then result := 874 // thai (windows)
else if acharset='cp875' then result := 875 // ibm ebcdic (greek modern)
else if acharset='shift_jis' then result := 932 // japanese (shift-jis)
else if acharset='gb2312' then result := 936 // chinese simplified (gb2312)
else if acharset='ks_c_5601-1987' then result := 949 // korean
else if acharset='big5' then result := 950 // chinese traditional (big5)
else if acharset='ibm1026' then result := 1026 // ibm ebcdic (turkish latin-5)
else if acharset='ibm01047' then result := 1047 // ibm latin-1
else if acharset='ibm01140' then result := 1140 // ibm ebcdic (us-canada-euro)
else if acharset='ibm01141' then result := 1141 // ibm ebcdic (germany-euro)
else if acharset='ibm01142' then result := 1142 // ibm ebcdic (denmark-norway-euro)
else if acharset='ibm01143' then result := 1143 // ibm ebcdic (finland-sweden-euro)
else if acharset='ibm01144' then result := 1144 // ibm ebcdic (italy-euro)
else if acharset='ibm01145' then result := 1145 // ibm ebcdic (spain-euro)
else if acharset='ibm01146' then result := 1146 // ibm ebcdic (uk-euro)
else if acharset='ibm01147' then result := 1147 // ibm ebcdic (france-euro)
else if acharset='ibm01148' then result := 1148 // ibm ebcdic (international-euro)
else if acharset='ibm01149' then result := 1149 // ibm ebcdic (icelandic-euro)
else if acharset='utf-16' then result := 1200 // unicode
else if acharset='unicodefffe' then result := 1201 // unicode (big-endian)
else if acharset='windows-1250' then result := 1250 // central european (windows)
else if acharset='windows-1251' then result := 1251 // cyrillic (windows)
else if acharset='windows-1252' then result := 1252 // western european (windows)
else if acharset='windows-1253' then result := 1253 // greek (windows)
else if acharset='windows-1254' then result := 1254 // turkish (windows)
else if acharset='windows-1255' then result := 1255 // hebrew (windows)
else if acharset='windows-1256' then result := 1256 // arabic (windows)
else if acharset='windows-1257' then result := 1257 // baltic (windows)
else if acharset='windows-1258' then result := 1258 // vietnamese (windows)
else if acharset='johab' then result := 1361 // korean (johab)
else if acharset='macintosh' then result := 10000 // western european (mac)
else if acharset='x-mac-japanese' then result := 10001 // japanese (mac)
else if acharset='x-mac-chinesetrad' then result := 10002 // chinese traditional (mac)
else if acharset='x-mac-korean' then result := 10003 // korean (mac)
else if acharset='x-mac-arabic' then result := 10004 // arabic (mac)
else if acharset='x-mac-hebrew' then result := 10005 // hebrew (mac)
else if acharset='x-mac-greek' then result := 10006 // greek (mac)
else if acharset='x-mac-cyrillic' then result := 10007 // cyrillic (mac)
else if acharset='x-mac-chinesesimp' then result := 10008 // chinese simplified (mac)
else if acharset='x-mac-romanian' then result := 10010 // romanian (mac)
else if acharset='x-mac-ukrainian' then result := 10017 // ukrainian (mac)
else if acharset='x-mac-thai' then result := 10021 // thai (mac)
else if acharset='x-mac-ce' then result := 10029 // central european (mac)
else if acharset='x-mac-icelandic' then result := 10079 // icelandic (mac)
else if acharset='x-mac-turkish' then result := 10081 // turkish (mac)
else if acharset='x-mac-croatian' then result := 10082 // croatian (mac)
else if acharset='x-chinese-cns' then result := 20000 // chinese traditional (cns)
else if acharset='x-cp20001' then result := 20001 // tca taiwan
else if acharset='x-chinese-eten' then result := 20002 // chinese traditional (eten)
else if acharset='x-cp20003' then result := 20003 // ibm5550 taiwan
else if acharset='x-cp20004' then result := 20004 // teletext taiwan
else if acharset='x-cp20005' then result := 20005 // wang taiwan
else if acharset='x-ia5' then result := 20105 // western european (ia5)
else if acharset='x-ia5-german' then result := 20106 // german (ia5)
else if acharset='x-ia5-swedish' then result := 20107 // swedish (ia5)
else if acharset='x-ia5-norwegian' then result := 20108 // norwegian (ia5)
else if acharset='us-ascii' then result := 20127 // us-ascii
else if acharset='x-cp20261' then result := 20261 // t.61
else if acharset='x-cp20269' then result := 20269 // iso-6937
else if acharset='ibm273' then result := 20273 // ibm ebcdic (germany)
else if acharset='ibm277' then result := 20277 // ibm ebcdic (denmark-norway)
else if acharset='ibm278' then result := 20278 // ibm ebcdic (finland-sweden)
else if acharset='ibm280' then result := 20280 // ibm ebcdic (italy)
else if acharset='ibm284' then result := 20284 // ibm ebcdic (spain)
else if acharset='ibm285' then result := 20285 // ibm ebcdic (uk)
else if acharset='ibm290' then result := 20290 // ibm ebcdic (japanese katakana)
else if acharset='ibm297' then result := 20297 // ibm ebcdic (france)
else if acharset='ibm420' then result := 20420 // ibm ebcdic (arabic)
else if acharset='ibm423' then result := 20423 // ibm ebcdic (greek)
else if acharset='ibm424' then result := 20424 // ibm ebcdic (hebrew)
else if acharset='x-ebcdic-koreanextended' then result := 20833 // ibm ebcdic (korean extended)
else if acharset='ibm-thai' then result := 20838 // ibm ebcdic (thai)
else if acharset='koi8-r' then result := 20866 // cyrillic (koi8-r)
else if acharset='ibm871' then result := 20871 // ibm ebcdic (icelandic)
else if acharset='ibm880' then result := 20880 // ibm ebcdic (cyrillic russian)
else if acharset='ibm905' then result := 20905 // ibm ebcdic (turkish)
else if acharset='ibm00924' then result := 20924 // ibm latin-1
else if acharset='euc-jp' then result := 20932 // japanese (jis 0208-1990 and 0212-1990)
else if acharset='x-cp20936' then result := 20936 // chinese simplified (gb2312-80)
else if acharset='x-cp20949' then result := 20949 // korean wansung
else if acharset='cp1025' then result := 21025 // ibm ebcdic (cyrillic serbian-bulgarian)
else if acharset='koi8-u' then result := 21866 // cyrillic (koi8-u)
else if acharset='x-europa' then result := 29001 // europa
else if acharset='iso-8859-8-i' then result := 38598 // hebrew (iso-logical)
else if acharset='iso-2022-jp' then result := 50220 // japanese (jis)
else if acharset='csiso2022jp' then result := 50221 // japanese (jis-allow 1 byte kana)
else if acharset='iso-2022-jp' then result := 50222 // japanese (jis-allow 1 byte kana - so/si)
else if acharset='iso-2022-kr' then result := 50225 // korean (iso)
else if acharset='x-cp50227' then result := 50227 // chinese simplified (iso-2022)
else if acharset='euc-jp' then result := 51932 // japanese (euc)
else if acharset='euc-cn' then result := 51936 // chinese simplified (euc)
else if acharset='euc-kr' then result := 51949 // korean (euc)
else if acharset='hz-gb-2312' then result := 52936 // chinese simplified (hz)
else if acharset='gb18030' then result := 54936 // chinese simplified (gb18030)
else if acharset='x-iscii-de' then result := 57002 // iscii devanagari
else if acharset='x-iscii-be' then result := 57003 // iscii bengali
else if acharset='x-iscii-ta' then result := 57004 // iscii tamil
else if acharset='x-iscii-te' then result := 57005 // iscii telugu
else if acharset='x-iscii-as' then result := 57006 // iscii assamese
else if acharset='x-iscii-or' then result := 57007 // iscii oriya
else if acharset='x-iscii-ka' then result := 57008 // iscii kannada
else if acharset='x-iscii-ma' then result := 57009 // iscii malayalam
else if acharset='x-iscii-gu' then result := 57010 // iscii gujarati
else if acharset='x-iscii-pa' then result := 57011 // iscii punjabi
else if acharset='utf-7' then result := 65000 // unicode (utf-7)
else if acharset='utf-32' then result := 65005 // unicode (utf-32)
else if acharset='utf-32be' then result := 65006 // unicode (utf-32 big-endian)
else Result := 0; //Default ansi code page
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
Function ALGetCodePageFromLCID(const aLCID:Integer): Word;
var
Buffer: array [0..6] of AnsiChar;
begin
GetLocaleInfoA(ALcid, LOCALE_IDEFAULTANSICODEPAGE, Buffer, Length(Buffer));
Result:= ALStrToIntDef(Buffer, 0);
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
Function ALStringToWideString(const S: RawByteString; const aCodePage: Word): WideString;
var InputLength,
OutputLength: Integer;
begin
InputLength := Length(S);
if InputLength = 0 then begin
result := '';
exit;
end;
OutputLength := MultiByteToWideChar(aCodePage, // UINT CodePage,
0, // DWORD dwFlags
PAnsiChar(S), // LPCSTR lpMultiByteStr
InputLength, // int cbMultiByte
nil, // LPWSTR lpWideCharStr
0); // int cchWideChar
if OutputLength = 0 then raiseLastOsError;
SetLength(Result, OutputLength);
if MultiByteToWideChar(aCodePage,
0,
PAnsiChar(S),
InputLength,
PWideChar(Result),
OutputLength) = 0 then raiseLastOsError;
end;
{$IFEND}
{**********************}
{$IF defined(MSWINDOWS)}
function AlWideStringToString(const WS: WideString; const aCodePage: Word): AnsiString;
var InputLength,
OutputLength: Integer;
begin
InputLength := Length(WS);
if InputLength = 0 then begin
result := '';
exit;
end;
OutputLength := WideCharToMultiByte(aCodePage, // UINT CodePage
0, // DWORD dwFlags,
PWideChar(WS), // LPCWSTR lpWideCharStr,
InputLength, // int cchWideChar
nil, // LPSTR lpMultiByteStr,
0, // int cbMultiByte
nil, // LPCSTR lpDefaultChar (Pointer to the character to use if a character cannot be represented in the specified code page)
nil); // LPBOOL lpUsedDefaultChar (Pointer to a flag that indicates if the function has used a default character in the conversion)
if OutputLength = 0 then raiseLastOsError;
SetLength(Result, OutputLength);
if WideCharToMultiByte(aCodePage,
0,
PWideChar(WS),
InputLength,
PAnsiChar(Result),
OutputLength,
nil,
nil) = 0 then raiseLastOsError;
end;
{$IFEND}
{*******************************************************************************}
Function ALUTF8Encode(const S: RawByteString; const aCodePage: Word): AnsiString;
var TmpS: RawByteString;
begin
//Result := UTF8Encode(ALStringToWideString(S, aCodePage));
//it's look like the code below is a little (15%) more faster then
//the previous implementation, and it's compatible with OSX
TmpS := S;
SetCodePage(TmpS, aCodePage, False);
result := UTF8Encode(String(TmpS));
end;
{****************************************************************************}
Function ALUTF8decode(const S: UTF8String; const aCodePage: Word): AnsiString;
begin
//Result := ALWideStringToString(UTF8ToWideString(S), aCodePage);
//it's look like the code below is a little (15%) more faster then
//the previous implementation, and it's compatible with OSX
result := ansiString(S);
SetCodePage(RawByteString(Result), aCodePage, true);
end;
{*******************************************************************************************
ISO 9:1995 is the current transliteration standard from ISO. It is based on its predecessor
ISO/R 9:1968, which it deprecates; for Russian they only differ in the treatment of five
modern letters. It is the first language-independent, univocal system of one character
for one character equivalents (by the use of diacritics), which faithfully represents
the original and allows for reverse transliteration for Cyrillic text in any contemporary language.}
Function ALUTF8ISO91995CyrillicToLatin(const aCyrillicText: AnsiString): AnsiString;
Var aCyrillicWideStr: WideString;
aLatinWideStr: WideString;
aLatinWideStrCurrentPos: Integer;
{-----------------------------------------------------------------}
Procedure InternalAddCharsToResult(aArrayOfChar: Array of Integer);
var i: integer;
begin
for i := low(aArrayOfChar) to high(aArrayOfChar) do begin
inc(aLatinWideStrCurrentPos);
aLatinWideStr[aLatinWideStrCurrentPos] := WideChar(aArrayOfChar[i]);
end;
end;
Var I, j: Integer;
Begin
Result := '';
aCyrillicWideStr := UTF8ToWideString(aCyrillicText);
setlength(ALatinWideStr,length(aCyrillicWideStr) * 2); //to Be on the safe way
aLatinWideStrCurrentPos := 0;
for i := 1 to length(aCyrillicWideStr) do begin
j := ord(aCyrillicWideStr[i]);
case j of
$0410 {А} : InternalAddCharsToResult([$0041]); {A}
$0430 {а} : InternalAddCharsToResult([$0061]); {a}
$04D0 {Ӑ} : InternalAddCharsToResult([$0102]); {Ă}
$04D1 {ӑ} : InternalAddCharsToResult([$0103]); {ă}
$04D2 {Ӓ} : InternalAddCharsToResult([$00C4]); {Ä}
$04D3 {ӓ} : InternalAddCharsToResult([$00E4]); {ä}
$04D8 {Ә} : InternalAddCharsToResult([$0041,$030B]); {A̋}
$04D9 {ә} : InternalAddCharsToResult([$0061,$030B]); {a̋}
$0411 {Б} : InternalAddCharsToResult([$0042]); {B}
$0431 {б} : InternalAddCharsToResult([$0062]); {b}
$0412 {В} : InternalAddCharsToResult([$0056]); {V}
$0432 {в} : InternalAddCharsToResult([$0076]); {v}
$0413 {Г} : InternalAddCharsToResult([$0047]); {G}
$0433 {г} : InternalAddCharsToResult([$0067]); {g}
$0490 {Ґ} : InternalAddCharsToResult([$0047,$0300]); {G̀}
$0491 {ґ} : InternalAddCharsToResult([$0067,$0300]); {g̀}
$0494 {Ҕ} : InternalAddCharsToResult([$011E]); {Ğ}
$0495 {ҕ} : InternalAddCharsToResult([$011F]); {ğ}
$0492 {Ғ} : InternalAddCharsToResult([$0120]); {Ġ}
$0493 {ғ} : InternalAddCharsToResult([$0121]); {ġ}
$0414 {Д} : InternalAddCharsToResult([$0044]); {D}
$0434 {д} : InternalAddCharsToResult([$0064]); {d}
$0402 {Ђ} : InternalAddCharsToResult([$0110]); {Đ}
$0452 {ђ} : InternalAddCharsToResult([$0111]); {đ}
$0403 {Ѓ} : InternalAddCharsToResult([$01F4]); {Ǵ}
$0453 {ѓ} : InternalAddCharsToResult([$01F5]); {ǵ}
$0415 {Е} : InternalAddCharsToResult([$0045]); {E}
$0435 {е} : InternalAddCharsToResult([$0065]); {e}
$0401 {Ё} : InternalAddCharsToResult([$00CB]); {Ë}
$0451 {ё} : InternalAddCharsToResult([$00EB]); {ë}
$04D6 {Ӗ} : InternalAddCharsToResult([$0114]); {Ĕ}
$04D7 {ӗ} : InternalAddCharsToResult([$0115]); {ĕ}
$0404 {Є} : InternalAddCharsToResult([$00CA]); {Ê}
$0454 {є} : InternalAddCharsToResult([$00EA]); {ê}
$04BC {Ҽ} : InternalAddCharsToResult([$0043,$0306]); {C̆}
$04BD {ҽ} : InternalAddCharsToResult([$0063,$0306]); {c̆}
$04BE {Ҿ} : InternalAddCharsToResult([$00C7,$0306]); {Ç̆}
$04BF {ҿ} : InternalAddCharsToResult([$00E7,$0306]); {ç̆}
$0416 {Ж} : InternalAddCharsToResult([$017D]); {Ž}
$0436 {ж} : InternalAddCharsToResult([$017E]); {ž}
$04C1 {Ӂ} : InternalAddCharsToResult([$005A,$0306]); {Z̆}
$04C2 {ӂ} : InternalAddCharsToResult([$007A,$0306]); {z̆}
$04DC {Ӝ} : InternalAddCharsToResult([$005A,$0304]); {Z̄}
$04DD {ӝ} : InternalAddCharsToResult([$007A,$0304]); {z̄}
$0496 {Җ} : InternalAddCharsToResult([$017D,$0326]); {Ž̦}
$0497 {җ} : InternalAddCharsToResult([$017E,$0327]); {ž̧}
$0417 {З} : InternalAddCharsToResult([$005A]); {Z}
$0437 {з} : InternalAddCharsToResult([$007A]); {z}
$04DE {Ӟ} : InternalAddCharsToResult([$005A,$0308]); {Z̈}
$04DF {ӟ} : InternalAddCharsToResult([$007A,$0308]); {z̈}
$0405 {Ѕ} : InternalAddCharsToResult([$1E90]); {Ẑ}
$0455 {ѕ} : InternalAddCharsToResult([$1E91]); {ẑ}
$04E0 {Ӡ} : InternalAddCharsToResult([$0179]); {Ź}
$04E1 {ӡ} : InternalAddCharsToResult([$017A]); {ź}
$0418 {И} : InternalAddCharsToResult([$0049]); {I}
$0438 {и} : InternalAddCharsToResult([$0069]); {i}
$04E4 {Ӥ} : InternalAddCharsToResult([$00CE]); {Î}
$04E5 {ӥ} : InternalAddCharsToResult([$00EE]); {î}
$0406 {І} : InternalAddCharsToResult([$00CC]); {Ì}
$0456 {і} : InternalAddCharsToResult([$00EC]); {ì}
$0407 {Ї} : InternalAddCharsToResult([$00CF]); {Ï}
$0457 {ї} : InternalAddCharsToResult([$00EF]); {ï}
$0419 {Й} : InternalAddCharsToResult([$004A]); {J}
$0439 {й} : InternalAddCharsToResult([$006A]); {j}
$0408 {Ј} : InternalAddCharsToResult([$004A,$030C]); {J̌}
$0458 {ј} : InternalAddCharsToResult([$01F0]); {ǰ}
$041A {К} : InternalAddCharsToResult([$004B]); {K}
$043A {к} : InternalAddCharsToResult([$006B]); {k}
$049A {Қ} : InternalAddCharsToResult([$0136]); {Ķ}
$049B {қ} : InternalAddCharsToResult([$0137]); {ķ}
$049E {Ҟ} : InternalAddCharsToResult([$004B,$0304]); {K̄}
$049F {ҟ} : InternalAddCharsToResult([$006B,$0304]); {k̄}
$041B {Л} : InternalAddCharsToResult([$004C]); {L}
$043B {л} : InternalAddCharsToResult([$006C]); {l}
$0409 {Љ} : InternalAddCharsToResult([$004C,$0302]); {L̂}
$0459 {љ} : InternalAddCharsToResult([$006C,$0302]); {l̂}
$041C {М} : InternalAddCharsToResult([$004D]); {M}
$043C {м} : InternalAddCharsToResult([$006D]); {m}
$041D {Н} : InternalAddCharsToResult([$004E]); {N}
$043D {н} : InternalAddCharsToResult([$006E]); {n}
$040A {Њ} : InternalAddCharsToResult([$004E,$0302]); {N̂}
$045A {њ} : InternalAddCharsToResult([$006E,$0302]); {n̂}
$04A4 {Ҥ} : InternalAddCharsToResult([$1E44]); {Ṅ}
$04A5 {ҥ} : InternalAddCharsToResult([$1E45]); {ṅ}
$04A2 {Ң} : InternalAddCharsToResult([$1E46]); {Ṇ}
$04A3 {ң} : InternalAddCharsToResult([$1E47]); {ṇ}
$041E {О} : InternalAddCharsToResult([$004F]); {O}
$043E {о} : InternalAddCharsToResult([$006F]); {o}
$04E6 {Ӧ} : InternalAddCharsToResult([$00D6]); {Ö}
$04E7 {ӧ} : InternalAddCharsToResult([$00F6]); {ö}
$04E8 {Ө} : InternalAddCharsToResult([$00D4]); {Ô}
$04E9 {ө} : InternalAddCharsToResult([$00F4]); {ô}
$041F {П} : InternalAddCharsToResult([$0050]); {P}
$043F {п} : InternalAddCharsToResult([$0070]); {p}
$04A6 {Ҧ} : InternalAddCharsToResult([$1E54]); {Ṕ}
$04A7 {ҧ} : InternalAddCharsToResult([$1E55]); {ṕ}
$0420 {Р} : InternalAddCharsToResult([$0052]); {R}
$0440 {р} : InternalAddCharsToResult([$0072]); {r}
$0421 {С} : InternalAddCharsToResult([$0053]); {S}
$0441 {с} : InternalAddCharsToResult([$0073]); {s}
$04AA {Ҫ} : InternalAddCharsToResult([$00C7]); {Ç}
$04AB {ҫ} : InternalAddCharsToResult([$00E7]); {ç}
$0422 {Т} : InternalAddCharsToResult([$0054]); {T}
$0442 {т} : InternalAddCharsToResult([$0074]); {t}
$04AC {Ҭ} : InternalAddCharsToResult([$0162]); {Ţ}
$04AD {ҭ} : InternalAddCharsToResult([$0163]); {ţ}
$040B {Ћ} : InternalAddCharsToResult([$0106]); {Ć}
$045B {ћ} : InternalAddCharsToResult([$0170]); {Ű}
$040C {Ќ} : InternalAddCharsToResult([$1E30]); {Ḱ}
$045C {ќ} : InternalAddCharsToResult([$1E31]); {ḱ}
$0423 {У} : InternalAddCharsToResult([$0055]); {U}
$0443 {у} : InternalAddCharsToResult([$0075]); {u}
$EE19 {} : InternalAddCharsToResult([$00DA]); {Ú}
$EE99 {} : InternalAddCharsToResult([$00FA]); {ú}
$040E {Ў} : InternalAddCharsToResult([$016C]); {Ŭ}
$045E {ў} : InternalAddCharsToResult([$016D]); {ŭ}
$04F0 {Ӱ} : InternalAddCharsToResult([$00DC]); {Ü}
$04F1 {ӱ} : InternalAddCharsToResult([$00FC]); {ü}
$04F2 {Ӳ} : InternalAddCharsToResult([$0170]); {Ű}
$04F3 {ӳ} : InternalAddCharsToResult([$0171]); {ű}
$04AE {Ү} : InternalAddCharsToResult([$00D9]); {Ù}
$04AF {ү} : InternalAddCharsToResult([$00F9]); {ù}
$0424 {Ф} : InternalAddCharsToResult([$0046]); {F}
$0444 {ф} : InternalAddCharsToResult([$0066]); {f}
$0425 {Х} : InternalAddCharsToResult([$0048]); {H}
$0445 {х} : InternalAddCharsToResult([$0068]); {h}
$04B2 {Ҳ} : InternalAddCharsToResult([$1E28]); {Ḩ}
$04B3 {ҳ} : InternalAddCharsToResult([$1E29]); {ḩ}
$04BA {Һ} : InternalAddCharsToResult([$1E24]); {Ḥ}
$04BB {һ} : InternalAddCharsToResult([$1E25]); {ḥ}
$0426 {Ц} : InternalAddCharsToResult([$0043]); {C}
$0446 {ц} : InternalAddCharsToResult([$0063]); {c}
$04B4 {Ҵ} : InternalAddCharsToResult([$0043,$0304]); {C̄}
$04B5 {ҵ} : InternalAddCharsToResult([$0063,$0304]); {c̄}
$0427 {Ч} : InternalAddCharsToResult([$010C]); {Č}
$0447 {ч} : InternalAddCharsToResult([$010D]); {č}
$04F4 {Ӵ} : InternalAddCharsToResult([$0043,$0308]); {C̈}
$04F5 {ӵ} : InternalAddCharsToResult([$0063,$0308]); {c̈}
$04CB {Ӌ} : InternalAddCharsToResult([$00C7]); {Ç}
$04CC {ӌ} : InternalAddCharsToResult([$00E7]); {ç}
$040F {Џ} : InternalAddCharsToResult([$0044,$0302]); {D̂}
$045F {џ} : InternalAddCharsToResult([$0064,$0302]); {d̂}
$0428 {Ш} : InternalAddCharsToResult([$0160]); {Š}
$0448 {ш} : InternalAddCharsToResult([$0161]); {š}
$0429 {Щ} : InternalAddCharsToResult([$015C]); {Ŝ}
$0449 {щ} : InternalAddCharsToResult([$015D]); {ŝ}
$042A {Ъ} : InternalAddCharsToResult([$02BA]); {ʺ}
{The capital hard sign is very seldom in use. It may be capital, if everything is written in upper case -
therefore when transliteration is used reverse we can say that $02BA = $042A if everything is written in upper case}
$044A {ъ} : InternalAddCharsToResult([$02BA]); {ʺ}
$02BC {ʼ} : InternalAddCharsToResult([$2019]); {’}
$042B {Ы} : InternalAddCharsToResult([$0059]); {Y}
$044B {ы} : InternalAddCharsToResult([$0079]); {y}
$04F8 {Ӹ} : InternalAddCharsToResult([$0178]); {Ÿ}
$04F9 {ӹ} : InternalAddCharsToResult([$00FF]); {ÿ}
$042C {Ь} : InternalAddCharsToResult([$02B9]); {ʹ}
{The capital hard sign is very seldom in use. It may be capital, if everything is written in upper case -
therefore when transliteration is used reverse we can say that $042C = $02B9 if everything is written in upper case}
$044C {ь} : InternalAddCharsToResult([$02B9]); {ʹ}
$042D {Э} : InternalAddCharsToResult([$00C8]); {È}
$044D {э} : InternalAddCharsToResult([$00E8]); {è}
$042E {Ю} : InternalAddCharsToResult([$00DB]); {Û}
$044E {ю} : InternalAddCharsToResult([$00FB]); {û}
$042F {Я} : InternalAddCharsToResult([$00C2]); {Â}
$044F {я} : InternalAddCharsToResult([$00E2]); {â}
$048C {Ҍ} : InternalAddCharsToResult([$011A]); {Ě}
$048D {ҍ} : InternalAddCharsToResult([$011B]); {ě}
$046A {Ѫ} : InternalAddCharsToResult([$01CD]); {Ǎ}
$046B {ѫ} : InternalAddCharsToResult([$01CE]); {ǎ}
$0472 {Ѳ} : InternalAddCharsToResult([$0046,$0300]); {F̀}
$0473 {ѳ} : InternalAddCharsToResult([$0066,$0300]); {f̀}
$0474 {Ѵ} : InternalAddCharsToResult([$1EF2]); {Ỳ}
$0475 {ѵ} : InternalAddCharsToResult([$1EF3]); {ỳ}
$04A8 {Ҩ} : InternalAddCharsToResult([$00D2]); {Ò}
$04A9 {ҩ} : InternalAddCharsToResult([$00F2]); {ò}
$04C0 {Ӏ} : InternalAddCharsToResult([$2021]); {‡}
else InternalAddCharsToResult([j]);
end;
end;
SetLength(aLatinWideStr,aLatinWideStrCurrentPos);
Result := UTF8Encode(aLatinWideStr);
End;
{*******************************************************************************
The BGN/PCGN system is relatively intuitive for anglophones to read and pronounce.
In many publications a simplified form of the system is used to render English versions
of Russian names, typically converting ë to yo, simplifying -iy and -yy endings to
-y, and omitting apostrophes for ъ and ь. It can be rendered using only the basic
letters and punctuation found on English-language keyboards: no diacritics or unusual
letters are required, although the Interpunct character (·) can optionally be used to
avoid some ambiguity.
This particular standard is part of the BGN/PCGN romanization system which was developed
by the United States Board on Geographic Names and by the Permanent Committee on
Geographical Names for British Official Use. The portion of the system pertaining to
the Russian language was adopted by BGN in 1944, and by PCGN in 1947}
Function ALUTF8BGNPCGN1947CyrillicToLatin(const aCyrillicText: AnsiString): AnsiString;
Var aCyrillicWideStr: WideString;
aLatinWideStr: WideString;
aLatinWideStrCurrentPos: Integer;
{-----------------------------------------------------------------}
Procedure InternalAddCharsToResult(aArrayOfChar: Array of Integer);
var i: integer;
begin
for i := low(aArrayOfChar) to high(aArrayOfChar) do begin
inc(aLatinWideStrCurrentPos);
aLatinWideStr[aLatinWideStrCurrentPos] := WideChar(aArrayOfChar[i]);
end;
end;
{-------------------------------------------------------------------------------------}
function InternalCheckInRange(aChar: integer; aArrayOfChar: Array of Integer): boolean;
var i: integer;
begin
Result := False;
for i := low(aArrayOfChar) to high(aArrayOfChar) do
if aChar = aArrayOfChar[i] then begin
result := true;
exit;
end;
end;
Var I, j: Integer;
Begin
Result := '';
aCyrillicWideStr := UTF8ToWideString(aCyrillicText);
setlength(ALatinWideStr,length(aCyrillicWideStr) * 2); //to Be on the safe way
aLatinWideStrCurrentPos := 0;
for i := 1 to length(aCyrillicWideStr) do begin
j := ord(aCyrillicWideStr[i]);
case j of
$0410 {А} : InternalAddCharsToResult([$0041]); {A}
$0430 {а} : InternalAddCharsToResult([$0061]); {a}
$0411 {Б} : InternalAddCharsToResult([$0042]); {B}
$0431 {б} : InternalAddCharsToResult([$0062]); {b}
$0412 {В} : InternalAddCharsToResult([$0056]); {V}
$0432 {в} : InternalAddCharsToResult([$0076]); {v}
$0413 {Г} : InternalAddCharsToResult([$0047]); {G}
$0433 {г} : InternalAddCharsToResult([$0067]); {g}
$0414 {Д} : InternalAddCharsToResult([$0044]); {D}
$0434 {д} : InternalAddCharsToResult([$0064]); {d}
$0415 {Е} : begin
{The character e should be romanized ye initially, after the vowel characters a, e, ё, и, о, у, ы, э, ю, and я,
and after й, ъ, and ь. In all other instances, it should be romanized e.}
if (i > 1) and InternalCheckInRange(ord(aCyrillicWideStr[i-1]),[$0410 {А}, $0430 {а},
$0415 {Е}, $0435 {е},
$0401 {Ё}, $0451 {ё},
$0418 {И}, $0438 {и},
$041E {О}, $043E {о},
$0423 {У}, $0443 {у},
$042B {Ы}, $044B {ы},
$042D {Э}, $044D {э},
$042E {Ю}, $044E {ю},
$042F {Я}, $044F {я},
$0419 {Й}, $0439 {й},
$042A {Ъ}, $044A {ъ},
$042C {Ь}, $044C {ь}]) then InternalAddCharsToResult([$0059, $0065]) {Ye}
else InternalAddCharsToResult([$0045]); {E}
end;
$0435 {е} : begin
{The character e should be romanized ye initially, after the vowel characters a, e, ё, и, о, у, ы, э, ю, and я,
and after й, ъ, and ь. In all other instances, it should be romanized e.}
if (i > 1) and InternalCheckInRange(ord(aCyrillicWideStr[i-1]),[$0410 {А}, $0430 {а},
$0415 {Е}, $0435 {е},
$0401 {Ё}, $0451 {ё},
$0418 {И}, $0438 {и},
$041E {О}, $043E {о},
$0423 {У}, $0443 {у},
$042B {Ы}, $044B {ы},
$042D {Э}, $044D {э},
$042E {Ю}, $044E {ю},
$042F {Я}, $044F {я},
$0419 {Й}, $0439 {й},
$042A {Ъ}, $044A {ъ},
$042C {Ь}, $044C {ь}]) then InternalAddCharsToResult([$0079, $0065]) {ye}
else InternalAddCharsToResult([$0065]); {e}
end;
$0401 {Ё} : begin
{The character ё is not considered a separate character of the Russian alphabet and the dieresis is generally not shown.
When the dieresis is shown, the character should be romanized yë initially, after the vowel characters a, e, ё, и, о, у, ы, э, ю, and я,
and after й, ъ, and ь. In all other instances, it should be romanized ё. When the dieresis is not shown, the character may still be
romanized in the preceding manner or, alternatively, in accordance with note 1.}
if (i > 1) and InternalCheckInRange(ord(aCyrillicWideStr[i-1]),[$0410 {А}, $0430 {а},
$0415 {Е}, $0435 {е},
$0401 {Ё}, $0451 {ё},
$0418 {И}, $0438 {и},
$041E {О}, $043E {о},
$0423 {У}, $0443 {у},
$042B {Ы}, $044B {ы},
$042D {Э}, $044D {э},
$042E {Ю}, $044E {ю},
$042F {Я}, $044F {я},
$0419 {Й}, $0439 {й},
$042A {Ъ}, $044A {ъ},
$042C {Ь}, $044C {ь}]) then InternalAddCharsToResult([$0059, $00EB]) {Yë}
else InternalAddCharsToResult([$00CB]); {Ë}
end;
$0451 {ё} : begin
{The character ё is not considered a separate character of the Russian alphabet and the dieresis is generally not shown.
When the dieresis is shown, the character should be romanized yë initially, after the vowel characters a, e, ё, и, о, у, ы, э, ю, and я,
and after й, ъ, and ь. In all other instances, it should be romanized ё. When the dieresis is not shown, the character may still be
romanized in the preceding manner or, alternatively, in accordance with note 1.}
if (i > 1) and InternalCheckInRange(ord(aCyrillicWideStr[i-1]),[$0410 {А}, $0430 {а},
$0415 {Е}, $0435 {е},
$0401 {Ё}, $0451 {ё},
$0418 {И}, $0438 {и},
$041E {О}, $043E {о},
$0423 {У}, $0443 {у},
$042B {Ы}, $044B {ы},
$042D {Э}, $044D {э},
$042E {Ю}, $044E {ю},
$042F {Я}, $044F {я},
$0419 {Й}, $0439 {й},
$042A {Ъ}, $044A {ъ},
$042C {Ь}, $044C {ь}]) then InternalAddCharsToResult([$0079, $00EB]) {yë}
else InternalAddCharsToResult([$00EB]); {ë}
end;
$0416 {Ж} : InternalAddCharsToResult([$005A,$0068]); {Zh}
$0436 {ж} : InternalAddCharsToResult([$007A,$0068]); {zh}
$0417 {З} : InternalAddCharsToResult([$005A]); {Z}
$0437 {з} : InternalAddCharsToResult([$007A]); {z}
$0418 {И} : InternalAddCharsToResult([$0049]); {I}
$0438 {и} : InternalAddCharsToResult([$0069]); {i}
$0419 {Й} : InternalAddCharsToResult([$0059]); {Y}
$0439 {й} : InternalAddCharsToResult([$0079]); {y}
$041A {К} : InternalAddCharsToResult([$004B]); {K}
$043A {к} : InternalAddCharsToResult([$006B]); {k}
$041B {Л} : InternalAddCharsToResult([$004C]); {L}
$043B {л} : InternalAddCharsToResult([$006C]); {l}
$041C {М} : InternalAddCharsToResult([$004D]); {M}
$043C {м} : InternalAddCharsToResult([$006D]); {m}
$041D {Н} : InternalAddCharsToResult([$004E]); {N}
$043D {н} : InternalAddCharsToResult([$006E]); {n}
$041E {О} : InternalAddCharsToResult([$004F]); {O}
$043E {о} : InternalAddCharsToResult([$006F]); {o}
$041F {П} : InternalAddCharsToResult([$0050]); {P}
$043F {п} : InternalAddCharsToResult([$0070]); {p}
$0420 {Р} : InternalAddCharsToResult([$0052]); {R}
$0440 {р} : InternalAddCharsToResult([$0072]); {r}
$0421 {С} : InternalAddCharsToResult([$0053]); {S}
$0441 {с} : InternalAddCharsToResult([$0073]); {s}
$0422 {Т} : InternalAddCharsToResult([$0054]); {T}
$0442 {т} : InternalAddCharsToResult([$0074]); {t}
$0423 {У} : InternalAddCharsToResult([$0055]); {U}
$0443 {у} : InternalAddCharsToResult([$0075]); {u}
$0424 {Ф} : InternalAddCharsToResult([$0046]); {F}
$0444 {ф} : InternalAddCharsToResult([$0066]); {f}
$0425 {Х} : InternalAddCharsToResult([$004B, $0068]); {Kh}
$0445 {х} : InternalAddCharsToResult([$006B, $0068]); {kh}
$0426 {Ц} : InternalAddCharsToResult([$0054, $0073]); {Ts}
$0446 {ц} : InternalAddCharsToResult([$0074, $0073]); {ts}
$0427 {Ч} : InternalAddCharsToResult([$0043, $0068]); {Ch}
$0447 {ч} : InternalAddCharsToResult([$0063, $0068]); {ch}
$0428 {Ш} : InternalAddCharsToResult([$0053, $0068]); {Sh}
$0448 {ш} : InternalAddCharsToResult([$0073, $0068]); {sh}
$0429 {Щ} : InternalAddCharsToResult([$0053, $0068, $0063, $0068]); {Shch}
$0449 {щ} : InternalAddCharsToResult([$0073, $0068, $0063, $0068]); {shch}
$042A {Ъ} : InternalAddCharsToResult([$0022]); {"}
$044A {ъ} : InternalAddCharsToResult([$0022]); {"}
$042B {Ы} : InternalAddCharsToResult([$0059]); {Y}
$044B {ы} : InternalAddCharsToResult([$0079]); {y}
$042C {Ь} : InternalAddCharsToResult([$0027]); {'}
$044C {ь} : InternalAddCharsToResult([$0027]); {'}
$042D {Э} : InternalAddCharsToResult([$0045]); {E}
$044D {э} : InternalAddCharsToResult([$0065]); {e}
$042E {Ю} : InternalAddCharsToResult([$0059, $0075]); {Yu}
$044E {ю} : InternalAddCharsToResult([$0079, $0075]); {yu}
$042F {Я} : InternalAddCharsToResult([$0059, $0061]); {Ya}
$044F {я} : InternalAddCharsToResult([$0079, $0061]); {ya}
else InternalAddCharsToResult([j]);
end;
end;
SetLength(aLatinWideStr,aLatinWideStrCurrentPos);
Result := UTF8Encode(aLatinWideStr);
End;
{***********************************************}
function ALExtractExpression(const S: AnsiString;
const OpenChar, CloseChar: AnsiChar; // ex: '(' and ')'
Const QuoteChars: Array of ansiChar; // ex: ['''', '"']
Const EscapeQuoteChar: ansiChar; // ex: '\' or #0 to ignore
var StartPos: integer;
var EndPos: integer): boolean;
{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
function _IsQuote(aChar: ansiChar): Boolean;
var i: integer;
begin
result := False;
for I := Low(QuoteChars) to High(QuoteChars) do
if aChar = QuoteChars[i] then begin
result := true;
break;
end;
if (result) and
(EscapeQuoteChar <> #0) and
(S[EndPos - 1] = EscapeQuoteChar) then result := False;
end;
var aCurInQuote: boolean;
aCurQuoteChar: AnsiChar;
aOpenCount: integer;
begin
result := false;
if StartPos <= 0 then StartPos := 1;
while (StartPos <= length(S)) and
(s[StartPos] <> OpenChar) do inc(StartPos);
if StartPos > length(S) then exit;
aOpenCount := 1;
aCurInQuote := False;
aCurQuoteChar := #0;
EndPos := StartPos + 1;
while (EndPos <= length(S)) and
(aOpenCount > 0) do begin
if _IsQuote(s[EndPos]) then begin
if aCurInQuote then begin
if (s[EndPos] = aCurQuoteChar) then aCurInQuote := False
end
else begin
aCurInQuote := True;
aCurQuoteChar := s[EndPos];
end;
end
else if not aCurInQuote then begin
if s[EndPos] = OpenChar then inc(aOpenCount)
else if s[EndPos] = CloseChar then dec(aOpenCount);
end;
if aOpenCount <> 0 then inc(EndPos);
end;
result := EndPos <= length(S);
end;
{*********************************************************}
function ALHTTPEncode(const AStr: AnsiString): AnsiString;
// The NoConversion set contains characters as specificed in RFC 1738 and
// should not be modified unless the standard changes.
const
NoConversion = ['A'..'Z','a'..'z','*','@','.','_','-',
'0'..'9','$','!','''','(',')'];
var
Sp, Rp: PAnsiChar;
begin
SetLength(Result, Length(AStr) * 3);
Sp := PAnsiChar(AStr);
Rp := PAnsiChar(Result);
while Sp^ <> #0 do
begin
if Sp^ in NoConversion then
Rp^ := Sp^
else
if Sp^ = ' ' then
Rp^ := '+'
else
begin
System.AnsiStrings.FormatBuf(Rp^, 3, AnsiString('%%%.2x'), 6, [Ord(Sp^)]);
Inc(Rp,2);
end;
Inc(Rp);
Inc(Sp);
end;
SetLength(Result, Rp - PAnsiChar(Result));
end;
{************************************************************}
//the difference between this function and the delphi function
//HttpApp.HttpDecode is that this function will not raise any
//error (EConvertError) when the url will contain % that
//are not encoded
function ALHTTPDecode(const AStr: AnsiString): AnsiString;
var Sp, Rp, Cp, Tp: PAnsiChar;
int: integer;
S: AnsiString;
begin
SetLength(Result, Length(AStr));
Sp := PAnsiChar(AStr);
Rp := PAnsiChar(Result);
while Sp^ <> #0 do begin
case Sp^ of
'+': Rp^ := ' ';
'%': begin
Tp := Sp;
Inc(Sp);
//escaped % (%%)
if Sp^ = '%' then Rp^ := '%'
// %<hex> encoded character
else begin
Cp := Sp;
Inc(Sp);
if (Cp^ <> #0) and (Sp^ <> #0) then begin
S := AnsiChar('$') + AnsiChar(Cp^) + AnsiChar(Sp^);
if ALTryStrToInt(s,int) then Rp^ := ansiChar(int)
else begin
Rp^ := '%';
Sp := Tp;
end;
end
else begin
Rp^ := '%';
Sp := Tp;
end;
end;
end;
else Rp^ := Sp^;
end;
Inc(Rp);
Inc(Sp);
end;
SetLength(Result, Rp - PAnsiChar(Result));
end;
{********************************************************}
{Parses a multi-valued string into its constituent fields.
ExtractHeaderFields is a general utility to parse multi-valued HTTP header strings into separate substrings.
* Separators is a set of characters that are used to separate individual values within the multi-valued string.
* WhiteSpace is a set of characters that are to be ignored when parsing the string.
* Content is the multi-valued string to be parsed.
* Strings is the TStrings object that receives the individual values that are parsed from Content.
* StripQuotes determines whether the surrounding quotes are removed from the resulting items. When StripQuotes is true, surrounding quotes are removed
before substrings are added to Strings.
Note: Characters contained in Separators or WhiteSpace are treated as part of a value substring if the substring is surrounded by single or double quote
marks. HTTP escape characters are converted using the ALHTTPDecode function.}
procedure ALExtractHeaderFields(Separators,
WhiteSpace,
Quotes: TSysCharSet;
Content: PAnsiChar;
Strings: TALStrings;
HttpDecode: Boolean;
StripQuotes: Boolean = False);
var Head, Tail: PAnsiChar;
EOS, InQuote: Boolean;
QuoteChar: AnsiChar;
ExtractedField: AnsiString;
SeparatorsWithQuotesAndNulChar: TSysCharSet;
QuotesWithNulChar: TSysCharSet;
{-------------------------------------------------------}
//as i don't want to add the parameter namevalueseparator
//to the function, we will stripquote only if the string end
//with the quote or start with the quote
//ex: "name"="value" => name=value
//ex: "name"=value => name=value
//ex: name="value" => name=value
function DoStripQuotes(const S: AnsiString): AnsiString;
var I: Integer;
StripQuoteChar: AnsiChar;
canStripQuotesOnLeftSide: boolean;
begin
Result := S;
if StripQuotes then begin
canStripQuotesOnLeftSide := True;
if (length(result) > 0) and (result[length(result)] in quotes) then begin
StripQuoteChar := result[length(result)];
Delete(Result, length(result), 1);
i := Length(Result);
while i > 0 do begin
if (Result[I] = StripQuoteChar) then begin
Delete(Result, I, 1);
canStripQuotesOnLeftSide := i > 1;
break;
end;
dec(i);
end;
end;
if (canStripQuotesOnLeftSide) and (length(result) > 0) and (result[1] in quotes) then begin
StripQuoteChar := result[1];
Delete(Result, 1, 1);
i := 1;
while i <= Length(Result) do begin
if (Result[I] = StripQuoteChar) then begin
Delete(Result, I, 1);
break;
end;
inc(i);
end;
end;
end;
end;
Begin
if (Content = nil) or (Content^ = #0) then Exit;
SeparatorsWithQuotesAndNulChar := Separators + Quotes + [#0];
QuotesWithNulChar := Quotes + [#0];
Tail := Content;
QuoteChar := #0;
repeat
while Tail^ in WhiteSpace do Inc(Tail);
Head := Tail;
InQuote := False;
while True do begin
while (InQuote and not (Tail^ in QuotesWithNulChar)) or not (Tail^ in SeparatorsWithQuotesAndNulChar) do Inc(Tail);
if Tail^ in Quotes then begin
if (QuoteChar <> #0) and (QuoteChar = Tail^) then QuoteChar := #0
else If QuoteChar = #0 then QuoteChar := Tail^;
InQuote := QuoteChar <> #0;
Inc(Tail);
end
else Break;
end;
EOS := Tail^ = #0;
if Head^ <> #0 then begin
SetString(ExtractedField, Head, Tail-Head);
if HttpDecode then Strings.Add(ALHTTPDecode(DoStripQuotes(ExtractedField)))
else Strings.Add(DoStripQuotes(ExtractedField));
end;
Inc(Tail);
until EOS;
end;
{**************************************************************************************}
{same as ALExtractHeaderFields except the it take care or escaped quote (like '' or "")}
procedure ALExtractHeaderFieldsWithQuoteEscaped(Separators,
WhiteSpace,
Quotes: TSysCharSet;
Content: PAnsiChar;
Strings: TALStrings;
HttpDecode: Boolean;
StripQuotes: Boolean = False);
var Head, Tail, NextTail: PAnsiChar;
EOS, InQuote: Boolean;
QuoteChar: AnsiChar;
ExtractedField: AnsiString;
SeparatorsWithQuotesAndNulChar: TSysCharSet;
QuotesWithNulChar: TSysCharSet;
{-------------------------------------------------------}
//as i don't want to add the parameter namevalueseparator
//to the function, we will stripquote only if the string end
//with the quote or start with the quote
//ex: "name"="value" => name=value
//ex: "name"=value => name=value
//ex: name="value" => name=value
function DoStripQuotes(const S: AnsiString): AnsiString;
var I: Integer;
StripQuoteChar: AnsiChar;
canStripQuotesOnLeftSide: boolean;
begin
Result := S;
if StripQuotes then begin
canStripQuotesOnLeftSide := True;
if (length(result) > 0) and (result[length(result)] in quotes) then begin
StripQuoteChar := result[length(result)];
Delete(Result, length(result), 1);
i := Length(Result);
while i > 0 do begin
if (Result[I] = StripQuoteChar) then begin
Delete(Result, I, 1);
if (i > 1) and (Result[I-1] = StripQuoteChar) then dec(i)
else begin
canStripQuotesOnLeftSide := i > 1;
break;
end;
end;
dec(i);
end;
end;
if (canStripQuotesOnLeftSide) and (length(result) > 0) and (result[1] in quotes) then begin
StripQuoteChar := result[1];
Delete(Result, 1, 1);
i := 1;
while i <= Length(Result) do begin
if (Result[I] = StripQuoteChar) then begin
Delete(Result, I, 1);
if (i < Length(Result)) and (Result[I+1] = StripQuoteChar) then inc(i)
else break;
end;
inc(i);
end;
end;
end;
end;
Begin
if (Content = nil) or (Content^ = #0) then Exit;
SeparatorsWithQuotesAndNulChar := Separators + Quotes + [#0];
QuotesWithNulChar := Quotes + [#0];
Tail := Content;
QuoteChar := #0;
repeat
while Tail^ in WhiteSpace do Inc(Tail);
Head := Tail;
InQuote := False;
while True do begin
while (InQuote and not (Tail^ in QuotesWithNulChar)) or not (Tail^ in SeparatorsWithQuotesAndNulChar) do Inc(Tail);
if Tail^ in Quotes then begin
if (QuoteChar <> #0) and (QuoteChar = Tail^) then begin
NextTail := Tail + 1;
if NextTail^ = Tail^ then inc(tail)
else QuoteChar := #0;
end
else If QuoteChar = #0 then QuoteChar := Tail^;
InQuote := QuoteChar <> #0;
Inc(Tail);
end
else Break;
end;
EOS := Tail^ = #0;
if Head^ <> #0 then begin
SetString(ExtractedField, Head, Tail-Head);
if HttpDecode then Strings.Add(ALHTTPDecode(DoStripQuotes(ExtractedField)))
else Strings.Add(DoStripQuotes(ExtractedField));
end;
Inc(Tail);
until EOS;
end;
{$ENDIF}
{**************************************************}
function ALHTTPEncodeU(const AStr: String): String;
// The NoConversion set contains characters as specificed in RFC 1738 and
// should not be modified unless the standard changes.
const
NoConversion = [Ord('A')..Ord('Z'),Ord('a')..Ord('z'),Ord('*'),Ord('@'),Ord('.'),Ord('_'),Ord('-'),
Ord('0')..Ord('9'),Ord('$'),Ord('!'),Ord(''''),Ord('('),Ord(')')];
var
Sb: Tbytes;
Rp: PChar;
ln: integer;
i: integer;
begin
Sb := Tencoding.UTF8.GetBytes(aStr);
ln := length(Sb);
SetLength(Result, ln * 3);
Rp := PChar(Result);
i := 0;
while i <= ln - 1 do
begin
if Sb[i] in NoConversion then
Rp^ := Char(Sb[i])
else
if Sb[i] = Ord(' ') then
Rp^ := '+'
else
begin
FormatBuf(Rp, 3, String('%%%.2x'), 6, [Sb[i]]);
Inc(Rp,2);
end;
Inc(Rp);
Inc(i);
end;
SetLength(Result, Rp - PChar(Result));
end;
{************************************************************}
//the difference between this function and the delphi function
//HttpApp.HttpDecode is that this function will not raise any
//error (EConvertError) when the url will contain % that
//are not encoded
function ALHTTPDecodeU(const AStr: String): String;
var Rb: Tbytes;
Sp, Cp, Tp: PChar;
int: integer;
S: String;
i: integer;
begin
SetLength(Rb, Length(AStr));
Sp := PChar(AStr);
i := 0;
while Sp^ <> #0 do begin
case Sp^ of
'+': Rb[i] := ord(' ');
'%': begin
Tp := Sp;
Inc(Sp);
//escaped % (%%)
if Sp^ = '%' then Rb[i] := ord('%')
// %<hex> encoded character
else begin
Cp := Sp;
Inc(Sp);
if (Cp^ <> #0) and (Sp^ <> #0) then begin
S := Char('$') + Char(Cp^) + Char(Sp^);
if ALTryStrToIntU(s,int) then Rb[i] := int
else begin
Rb[i] := ord('%');
Sp := Tp;
end;
end
else begin
Rb[i] := ord('%');
Sp := Tp;
end;
end;
end;
else Rb[i] := ord(Sp^);
end;
Inc(i);
Inc(Sp);
end;
result := Tencoding.Utf8.GetString(Rb, 0{ByteIndex}, i{ByteCount});
end;
{**************************************************************************************}
{same as ALExtractHeaderFields except the it take care or escaped quote (like '' or "")}
{$ZEROBASEDSTRINGS OFF} // << the guy who introduce zero base string in delphi is just a mix of a Monkey and a Donkey !
{$WARN SYMBOL_DEPRECATED OFF}
procedure ALExtractHeaderFieldsWithQuoteEscapedU(Separators,
WhiteSpace,
Quotes: TSysCharSet;
Content: PChar;
Strings: TALStringsU;
HttpDecode: Boolean;
StripQuotes: Boolean = False);
var Head, Tail, NextTail: PChar;
EOS, InQuote: Boolean;
QuoteChar: Char;
ExtractedField: String;
SeparatorsWithQuotesAndNulChar: TSysCharSet;
QuotesWithNulChar: TSysCharSet;
{-------------------------------------------------------}
//as i don't want to add the parameter namevalueseparator
//to the function, we will stripquote only if the string end
//with the quote or start with the quote
//ex: "name"="value" => name=value
//ex: "name"=value => name=value
//ex: name="value" => name=value
function DoStripQuotes(const S: String): String;
var I: Integer;
StripQuoteChar: Char;
canStripQuotesOnLeftSide: boolean;
begin
Result := S;
if StripQuotes then begin
canStripQuotesOnLeftSide := True;
if (length(result) > 0) and charInSet(result[length(result)], quotes) then begin
StripQuoteChar := result[length(result)];
Delete(Result, length(result), 1);
i := Length(Result);
while i > 0 do begin
if (Result[I] = StripQuoteChar) then begin
Delete(Result, I, 1);
if (i > 1) and (Result[I-1] = StripQuoteChar) then dec(i)
else begin
canStripQuotesOnLeftSide := i > 1;
break;
end;
end;
dec(i);
end;
end;
if (canStripQuotesOnLeftSide) and (length(result) > 0) and charInSet(result[1], quotes) then begin
StripQuoteChar := result[1];
Delete(Result, 1, 1);
i := 1;
while i <= Length(Result) do begin
if (Result[I] = StripQuoteChar) then begin
Delete(Result, I, 1);
if (i < Length(Result)) and (Result[I+1] = StripQuoteChar) then inc(i)
else break;
end;
inc(i);
end;
end;
end;
end;
Begin
if (Content = nil) or (Content^ = #0) then Exit;
SeparatorsWithQuotesAndNulChar := Separators + Quotes + [#0];
QuotesWithNulChar := Quotes + [#0];
Tail := Content;
QuoteChar := #0;
repeat
while charInSet(Tail^, WhiteSpace) do Inc(Tail);
Head := Tail;
InQuote := False;
while True do begin
while (InQuote and not charInSet(Tail^, QuotesWithNulChar)) or not charInSet(Tail^, SeparatorsWithQuotesAndNulChar) do Inc(Tail);
if charInSet(Tail^, Quotes) then begin
if (QuoteChar <> #0) and (QuoteChar = Tail^) then begin
NextTail := Tail + 1;
if NextTail^ = Tail^ then inc(tail)
else QuoteChar := #0;
end
else If QuoteChar = #0 then QuoteChar := Tail^;
InQuote := QuoteChar <> #0;
Inc(Tail);
end
else Break;
end;
EOS := Tail^ = #0;
if Head^ <> #0 then begin
SetString(ExtractedField, Head, Tail-Head);
if HttpDecode then Strings.Add(ALHTTPDecodeU(DoStripQuotes(ExtractedField)))
else Strings.Add(DoStripQuotes(ExtractedField));
end;
Inc(Tail);
until EOS;
end;
{$WARN SYMBOL_DEPRECATED ON}
{$IF defined(_ZEROBASEDSTRINGS_ON)}
{$ZEROBASEDSTRINGS ON}
{$IFEND}
{*******************************}
Procedure ALStringInitialization;
{$IFNDEF NEXTGEN}
var i: integer;
{$ENDIF}
begin
{$IFNDEF NEXTGEN}
//
// Taken from https://github.com/synopse/mORMot.git
// https://synopse.info
// http://mormot.net
//
{$IF CompilerVersion > 33} // rio
{$MESSAGE WARN 'Check if https://github.com/synopse/mORMot.git SynCommons.pas was not updated from references\mORMot\SynCommons.pas and adjust the IFDEF'}
{$IFEND}
Fillchar(ConvertBase64ToBin,256,255); // invalid value set to -1
for i := 0 to high(b64enc) do
ConvertBase64ToBin[b64enc[i]] := i;
ConvertBase64ToBin['='] := -2; // special value for '='
{$ENDIF}
{$IF CompilerVersion >= 31} // berlin
_Base64Encoding := nil;
{$IFEND}
//https://stackoverflow.com/questions/50590627/tformatsettings-createen-us-returns-different-settings-on-different-platform
{$IFNDEF NEXTGEN}
ALPosExIgnoreCaseInitialiseLookupTable;
ALDefaultFormatSettings := TALFormatSettings.Create('en-US'); // 1033 {en-US}
ALDefaultFormatSettings.CurrencyString := '$';
ALDefaultFormatSettings.CurrencyFormat := 0;
ALDefaultFormatSettings.CurrencyDecimals := 2;
ALDefaultFormatSettings.DateSeparator := '/';
ALDefaultFormatSettings.TimeSeparator := ':';
ALDefaultFormatSettings.ListSeparator := ';';
ALDefaultFormatSettings.ShortDateFormat := 'M/d/yyyy';
ALDefaultFormatSettings.LongDateFormat := 'dddd, MMMM d, yyyy';
ALDefaultFormatSettings.TimeAMString := 'AM';
ALDefaultFormatSettings.TimePMString := 'PM';
ALDefaultFormatSettings.ShortTimeFormat := 'h:mm AMPM';
ALDefaultFormatSettings.LongTimeFormat := 'h:mm:ss AMPM';
ALDefaultFormatSettings.ShortMonthNames[1] := 'Jan';
ALDefaultFormatSettings.LongMonthNames [1] := 'January';
ALDefaultFormatSettings.ShortMonthNames[2] := 'Feb';
ALDefaultFormatSettings.LongMonthNames [2] := 'February';
ALDefaultFormatSettings.ShortMonthNames[3] := 'Mar';
ALDefaultFormatSettings.LongMonthNames [3] := 'March';
ALDefaultFormatSettings.ShortMonthNames[4] := 'Apr';
ALDefaultFormatSettings.LongMonthNames [4] := 'April';
ALDefaultFormatSettings.ShortMonthNames[5] := 'May';
ALDefaultFormatSettings.LongMonthNames [5] := 'May';
ALDefaultFormatSettings.ShortMonthNames[6] := 'Jun';
ALDefaultFormatSettings.LongMonthNames [6] := 'June';
ALDefaultFormatSettings.ShortMonthNames[7] := 'Jul';
ALDefaultFormatSettings.LongMonthNames [7] := 'July';
ALDefaultFormatSettings.ShortMonthNames[8] := 'Aug';
ALDefaultFormatSettings.LongMonthNames [8] := 'August';
ALDefaultFormatSettings.ShortMonthNames[9] := 'Sep';
ALDefaultFormatSettings.LongMonthNames [9] := 'September';
ALDefaultFormatSettings.ShortMonthNames[10] := 'Oct';
ALDefaultFormatSettings.LongMonthNames [10] := 'October';
ALDefaultFormatSettings.ShortMonthNames[11] := 'Nov';
ALDefaultFormatSettings.LongMonthNames [11] := 'November';
ALDefaultFormatSettings.ShortMonthNames[12] := 'Dec';
ALDefaultFormatSettings.LongMonthNames [12] := 'December';
ALDefaultFormatSettings.ShortDayNames[1] := 'Sun';
ALDefaultFormatSettings.LongDayNames [1] := 'Sunday';
ALDefaultFormatSettings.ShortDayNames[2] := 'Mon';
ALDefaultFormatSettings.LongDayNames [2] := 'Monday';
ALDefaultFormatSettings.ShortDayNames[3] := 'Tue';
ALDefaultFormatSettings.LongDayNames [3] := 'Tuesday';
ALDefaultFormatSettings.ShortDayNames[4] := 'Wed';
ALDefaultFormatSettings.LongDayNames [4] := 'Wednesday';
ALDefaultFormatSettings.ShortDayNames[5] := 'Thu';
ALDefaultFormatSettings.LongDayNames [5] := 'Thursday';
ALDefaultFormatSettings.ShortDayNames[6] := 'Fri';
ALDefaultFormatSettings.LongDayNames [6] := 'Friday';
ALDefaultFormatSettings.ShortDayNames[7] := 'Sat';
ALDefaultFormatSettings.LongDayNames [7] := 'Saturday';
ALDefaultFormatSettings.ThousandSeparator := ',';
ALDefaultFormatSettings.DecimalSeparator := '.';
ALDefaultFormatSettings.TwoDigitYearCenturyWindow := 50;
ALDefaultFormatSettings.NegCurrFormat := 0;
{$ENDIF}
ALDefaultFormatSettingsU := TALFormatSettingsU.Create('en-US'); // 1033 {en-US}
ALDefaultFormatSettingsU.CurrencyString := '$';
ALDefaultFormatSettingsU.CurrencyFormat := 0;
ALDefaultFormatSettingsU.CurrencyDecimals := 2;
ALDefaultFormatSettingsU.DateSeparator := '/';
ALDefaultFormatSettingsU.TimeSeparator := ':';
ALDefaultFormatSettingsU.ListSeparator := ';';
ALDefaultFormatSettingsU.ShortDateFormat := 'M/d/yyyy';
ALDefaultFormatSettingsU.LongDateFormat := 'dddd, MMMM d, yyyy';
ALDefaultFormatSettingsU.TimeAMString := 'AM';
ALDefaultFormatSettingsU.TimePMString := 'PM';
ALDefaultFormatSettingsU.ShortTimeFormat := 'h:mm AMPM';
ALDefaultFormatSettingsU.LongTimeFormat := 'h:mm:ss AMPM';
ALDefaultFormatSettingsU.ShortMonthNames[1] := 'Jan';
ALDefaultFormatSettingsU.LongMonthNames [1] := 'January';
ALDefaultFormatSettingsU.ShortMonthNames[2] := 'Feb';
ALDefaultFormatSettingsU.LongMonthNames [2] := 'February';
ALDefaultFormatSettingsU.ShortMonthNames[3] := 'Mar';
ALDefaultFormatSettingsU.LongMonthNames [3] := 'March';
ALDefaultFormatSettingsU.ShortMonthNames[4] := 'Apr';
ALDefaultFormatSettingsU.LongMonthNames [4] := 'April';
ALDefaultFormatSettingsU.ShortMonthNames[5] := 'May';
ALDefaultFormatSettingsU.LongMonthNames [5] := 'May';
ALDefaultFormatSettingsU.ShortMonthNames[6] := 'Jun';
ALDefaultFormatSettingsU.LongMonthNames [6] := 'June';
ALDefaultFormatSettingsU.ShortMonthNames[7] := 'Jul';
ALDefaultFormatSettingsU.LongMonthNames [7] := 'July';
ALDefaultFormatSettingsU.ShortMonthNames[8] := 'Aug';
ALDefaultFormatSettingsU.LongMonthNames [8] := 'August';
ALDefaultFormatSettingsU.ShortMonthNames[9] := 'Sep';
ALDefaultFormatSettingsU.LongMonthNames [9] := 'September';
ALDefaultFormatSettingsU.ShortMonthNames[10] := 'Oct';
ALDefaultFormatSettingsU.LongMonthNames [10] := 'October';
ALDefaultFormatSettingsU.ShortMonthNames[11] := 'Nov';
ALDefaultFormatSettingsU.LongMonthNames [11] := 'November';
ALDefaultFormatSettingsU.ShortMonthNames[12] := 'Dec';
ALDefaultFormatSettingsU.LongMonthNames [12] := 'December';
ALDefaultFormatSettingsU.ShortDayNames[1] := 'Sun';
ALDefaultFormatSettingsU.LongDayNames [1] := 'Sunday';
ALDefaultFormatSettingsU.ShortDayNames[2] := 'Mon';
ALDefaultFormatSettingsU.LongDayNames [2] := 'Monday';
ALDefaultFormatSettingsU.ShortDayNames[3] := 'Tue';
ALDefaultFormatSettingsU.LongDayNames [3] := 'Tuesday';
ALDefaultFormatSettingsU.ShortDayNames[4] := 'Wed';
ALDefaultFormatSettingsU.LongDayNames [4] := 'Wednesday';
ALDefaultFormatSettingsU.ShortDayNames[5] := 'Thu';
ALDefaultFormatSettingsU.LongDayNames [5] := 'Thursday';
ALDefaultFormatSettingsU.ShortDayNames[6] := 'Fri';
ALDefaultFormatSettingsU.LongDayNames [6] := 'Friday';
ALDefaultFormatSettingsU.ShortDayNames[7] := 'Sat';
ALDefaultFormatSettingsU.LongDayNames [7] := 'Saturday';
ALDefaultFormatSettingsU.ThousandSeparator := ',';
ALDefaultFormatSettingsU.DecimalSeparator := '.';
ALDefaultFormatSettingsU.TwoDigitYearCenturyWindow := 50;
ALDefaultFormatSettingsU.NegCurrFormat := 0;
ALMove := system.Move;
{$IFNDEF NEXTGEN}
ALPosEx := System.AnsiStrings.PosEx;
AlUpperCase := system.AnsiStrings.UpperCase;
AlLowerCase := system.AnsiStrings.LowerCase;
ALCompareStr := system.AnsiStrings.CompareStr;
ALSameStr := system.AnsiStrings.SameStr;
ALCompareText := system.AnsiStrings.CompareText;
ALSameText := system.AnsiStrings.SameText;
ALMatchText := System.AnsiStrings.MatchText;
ALMatchStr := System.AnsiStrings.MatchStr;
{$ENDIF}
ALDateToStrU := system.sysutils.DateToStr;
ALTimeToStrU := system.sysutils.TimeToStr;
ALFormatDateTimeU := system.sysutils.FormatDateTime;
ALTryStrToDateU := system.sysutils.TryStrToDate;
ALStrToDateU := system.sysutils.StrToDate;
ALTryStrToTimeU := system.sysutils.TryStrToTime;
ALStrToTimeU := system.sysutils.StrToTime;
ALTryStrToDateTimeU := system.sysutils.TryStrToDateTime;
ALStrToDateTimeU := system.sysutils.StrToDateTime;
ALTryStrToIntU := system.sysutils.TryStrToInt;
ALStrToIntU := system.sysutils.StrToInt;
ALStrToIntDefU := system.sysutils.StrToIntDef;
ALTryStrToInt64U := system.sysutils.TryStrToInt64;
ALStrToInt64U := system.sysutils.StrToInt64;
ALStrToInt64DefU := system.sysutils.StrToInt64Def;
{$IF CompilerVersion >= 26}{Delphi XE5}
ALStrToUInt64U := system.sysutils.StrToUInt64;
ALStrToUInt64DefU := system.sysutils.StrToUInt64Def;
ALTryStrToUInt64U := system.sysutils.TryStrToUInt64;
{$ifend}
ALCurrToStrU := system.sysutils.CurrToStr;
ALFormatFloatU := system.sysutils.FormatFloat;
ALFormatCurrU := system.sysutils.FormatCurr;
ALStrToFloatU := system.sysutils.StrToFloat;
ALStrToFloatDefU := system.sysutils.StrToFloatDef;
ALStrToCurrU := system.sysutils.StrToCurr;
ALStrToCurrDefU := system.sysutils.StrToCurrDef;
ALTryStrToCurrU := system.sysutils.TryStrToCurr;
ALPosU := system.Pos;
ALPosExU := system.StrUtils.PosEx;
AlUpperCaseU := system.sysutils.UpperCase;
AlLowerCaseU := system.sysutils.LowerCase;
AlUpCaseU := system.UpCase;
ALCompareStrU := system.sysutils.CompareStr;
ALSameStrU := system.sysutils.SameStr;
ALCompareTextU := system.sysutils.CompareText;
ALSameTextU := system.sysutils.SameText;
ALTrimU := system.sysutils.Trim;
ALTrimLeftU := system.sysutils.TrimLeft;
ALTrimRightU := system.sysutils.TrimRight;
ALDequotedStrU := system.sysutils.AnsiDequotedStr;
ALLastDelimiterU := system.sysutils.LastDelimiter;
ALStringReplaceU := system.sysutils.StringReplace;
end;
{*****************************}
Procedure ALStringFinalization;
begin
{$IF CompilerVersion >= 31} // berlin
AlFreeAndNil(_Base64Encoding);
{$IFEND}
end;
end.
| 35.487807 | 231 | 0.555423 |
f18e908e1e25b69a65c6eb200507344ad12a0275 | 329 | pas | Pascal | kvadrat.pas | upbyte/pascal | f3098ac653334fb7d80944283e38afb547a4e2d0 | [
"MIT"
]
| null | null | null | kvadrat.pas | upbyte/pascal | f3098ac653334fb7d80944283e38afb547a4e2d0 | [
"MIT"
]
| null | null | null | kvadrat.pas | upbyte/pascal | f3098ac653334fb7d80944283e38afb547a4e2d0 | [
"MIT"
]
| null | null | null | Program Kvadrat;
var a,b,c,x1,x2,d:real;
BEGIN
write('Vvedite a,b,c: ');
readln(a,b,c);
d:=(b*b)-(4*a*c);
if D<0 then writeln('NET reshenii');
if D=0 then begin
x1:=-b/(2*a);
writeln('x= ',x1:0:2);
end;
if D>0 then begin
x1:=(-b+sqrt(d))/(2*a);
x2:=(-b-sqrt(d))/(2*a);
writeln('x1= ',x1:0:2,'; x2= ',x2:0:2);
end;
readln;
END.
| 17.315789 | 39 | 0.568389 |
f1053f85754ef0ec16414415d043139039caf37f | 6,525 | pas | Pascal | Scripts/Delphiscript Scripts/PCB/PCB Outputs/GetObjectClasses.pas | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | Scripts/Delphiscript Scripts/PCB/PCB Outputs/GetObjectClasses.pas | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | Scripts/Delphiscript Scripts/PCB/PCB Outputs/GetObjectClasses.pas | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | {......................................................................................................}
{ }
{ }
{......................................................................................................}
{......................................................................................................}
Var
Board : IPCB_Board;
{......................................................................................................}
{......................................................................................................}
Function MbrKindToStr(AMbrKind : TClassMemberKind) : String;
Begin
Result := '';
Case AMbrKind Of
0 : Result := 'Net';
1 : Result := 'Component';
2 : Result := 'FromTo';
3 : Result := 'Pad';
4 : Result := 'Layer';
// 5 : Result := 'DesignChannel';
End;
End;
{......................................................................................................}
{......................................................................................................}
Procedure GenerateReport(Var ARpt : TStringList; AObjectClass : IPCB_ObjectClass);
Var
S : TPCBString;
I : Integer;
Begin
// need to know how many members in this class...
S := 'Class Name: ' + AObjectClass.Name + ' Class Member Kind: ' + MbrKindToStr(AObjectClass.MemberKind);
ARpt.Add(S);
ARpt.Add('');
If Not AObjectClass.SuperClass Then
Begin
// not a super class, so get member names
I := 0;
While AObjectClass.MemberName[I] <> '' Do
Begin
ARpt.Add(AObjectClass.MemberName[I]);
Inc(I);
End;
End
Else
Begin
// is a super class!
Case AObjectClass.MemberKind Of
eClassMemberKind_Net : ARpt.Add('All Nets');
eClassMemberKind_Component : ARpt.Add('All Components');
eClassMemberKind_FromTo : ARpt.Add('All FromTos');
eClassMemberKind_Pad : ARpt.Add('All Pads');
eClassMemberKind_Layer : ARpt.Add('All Layers');
End;
End;
End;
{......................................................................................................}
{......................................................................................................}
Procedure GenerateSelectedClassesReport(Dummy : Integer = 0);
Var
ClassRpt : TStringList;
I : Integer;
FileName : String;
Document : IServerDocument;
Begin
If Form_GetClass.Classes.Items.Count < 1 Then Exit;
ClassRpt := TStringList.Create;
For i := 0 To Form_GetClass.Classes.Items.Count - 1 Do
If Form_GetClass.Classes.Selected[i] Then
GenerateReport(ClassRpt, Form_GetClass.Classes.Items.Objects[i]);
// Display the object class and its members report
FileName := ChangeFileExt(Board.FileName,'.REP');
ClassRpt.SaveToFile(Filename);
ClassRpt.Free;
Document := Client.OpenDocument('Text', FileName);
If Document <> Nil Then
Client.ShowDocument(Document);
End;
{......................................................................................................}
{......................................................................................................}
Function ChooseClasses(Dummy : Integer = 0) : Boolean;
Begin
Result := Form_GetClass.showmodal = mrOK;
End;
{......................................................................................................}
{......................................................................................................}
Procedure FillClassList(Dummy : Integer = 0);
Var
ClassType : TClassMemberKind;
Iterator : IPCB_BoardIterator;
c : IPCB_ObjectClass;
Begin
Case Form_GetClass.cb_ClassMemberKind.ItemIndex Of
0 : ClassType := eClassMemberKind_Net;
1 : ClassType := eClassMemberKind_Component;
2 : ClassType := eClassMemberKind_FromTo;
3 : ClassType := eClassMemberKind_Pad;
4 : ClassType := eClassMemberKind_Layer;
// 5 : ClassType := eClassMemberKind_DesignChannel;
End;
Iterator := Board.BoardIterator_Create;
Iterator.SetState_FilterAll;
Iterator.AddFilter_ObjectSet(MkSet(eClassObject));
c := Iterator.FirstPCBObject;
Form_GetClass.Classes.Clear;
While c <> Nil Do
Begin
If c.MemberKind = ClassType Then
Form_GetClass.Classes.Items.AddObject(c.Name, C);
c := Iterator.NextPCBObject;
End;
Board.BoardIterator_Destroy(Iterator);
End;
{......................................................................................................}
{......................................................................................................}
Procedure SearchAndGenerateClassesReport;
Begin
Pcbserver.PreProcess;
Try
Board := PCBServer.GetCurrentPCBBoard;
If Not Assigned(Board) Then
Begin
ShowMessage('The current Document is not a PCB Document.');
Exit;
End;
FillClassList;
If ChooseClasses Then
GenerateSelectedClassesReport;
Finally
Pcbserver.PostProcess;
End;
End;
{......................................................................................................}
{......................................................................................................}
procedure Tform_GetClass.cb_ClassMemberKindChange(Sender: TObject);
begin
FillClassList;
end;
{......................................................................................................}
{......................................................................................................}
procedure Tform_GetClass.ClassesDblClick(Sender: TObject);
begin
ModalResult := mrOK;
end;
{......................................................................................................}
{......................................................................................................}
procedure Tform_GetClass.bCancelClick(Sender: TObject);
begin
Close;
end;
{......................................................................................................}
{......................................................................................................}
| 37.936047 | 110 | 0.388966 |
83e1862871accbd63e75d3ee2f6b1bcd6b78b64f | 23,531 | pas | Pascal | library/fhir4/fhir4_graphdefinition.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | library/fhir4/fhir4_graphdefinition.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | library/fhir4/fhir4_graphdefinition.pas | danka74/fhirserver | 1fc53b6fba67a54be6bee39159d3db28d42eb8e2 | [
"BSD-3-Clause"
]
| null | null | null | unit fhir4_graphdefinition;
{
Copyright (c) 2011+, HL7 and Health Intersections Pty Ltd (http://www.healthintersections.com.au)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
{$I fhir.inc}
interface
uses
SysUtils,
fsl_base, fsl_utilities,
fsl_graphql, fsl_http,
fhir_objects, fhir_graphdefinition, fhir_pathengine, fhir_factory,
fhir_graphql,
fhir4_resources, fhir4_types, fhir4_pathengine, fhir4_pathnode, fhir4_context, fhir4_utilities;
type
TFHIRGraphDefinitionParser4 = class (TFHIRGraphDefinitionParser)
private
FLexer : TFHIRPathLexer;
procedure readHeader(gd : TFhirGraphDefinition);
function readResourceType : TFhirResourceTypesEnum;
function readProfile : String;
function readSearchLink : TFhirGraphDefinitionLink;
function readCompartmentRule(use : TFhirGraphCompartmentUseEnum) : TFhirGraphDefinitionLinkTargetCompartment;
function readPathLink : TFhirGraphDefinitionLink;
procedure readLinkList(list : TFhirGraphDefinitionLinkList);
function readDefinition : TFhirGraphDefinition;
procedure writeCompartment(b : TStringBuilder; cr : TFhirGraphDefinitionLinkTargetCompartment);
procedure writePathItem(b : TStringBuilder; item : TFhirGraphDefinitionLink; indent : integer);
procedure writeSearchItem(b : TStringBuilder; item : TFhirGraphDefinitionLink; indent : integer);
procedure writeLinklist(b : TStringBuilder; list : TFhirGraphDefinitionLinkList; indent : integer);
procedure writeHeader(b : TStringBuilder; definition : TFhirGraphDefinition);
procedure writeDefinition(b : TStringBuilder; definition : TFhirGraphDefinition);
public
destructor Destroy; override;
function parseV(source : String) : TFhirResourceV; override;
function asString(definition : TFhirResourceV; header : boolean) : String; override;
end;
TFHIRGraphDefinitionEngine4 = class (TFHIRGraphDefinitionEngine)
private
FContext : TFHIRWorkerContextWithFactory;
FPathEngine : TFHIRPathEngine;
FOnFollowReference : TFHIRGraphQLEngineDereferenceEvent;
FOnListResources : TFHIRGraphQLEngineListResourcesEvent;
FOnLookup : TFHIRGraphQLEngineLookupEvent;
FBundle: TFHIRBundle;
FStart: TFHIRResource;
FDefinition: TFhirGraphDefinition;
FDepthLimit: integer;
FBaseUrl: String;
FValidating: boolean;
FAppinfo: TFslObject;
procedure SetBundle(const Value: TFHIRBundle);
procedure SetDefinition(const Value: TFhirGraphDefinition);
procedure SetStart(const Value: TFHIRResource);
function check(test : boolean; msg : String) : boolean;
function isInBundle(resource : TFHIRResource) : boolean;
procedure addToBundle(resource : TFHIRResource);
procedure processLink(focusPath : String; focus : TFHIRResource; link : TFhirGraphDefinitionLink; depth : integer);
procedure processLinkPath(focusPath: String; focus: TFHIRResource; link: TFhirGraphDefinitionLink; depth: integer);
procedure processLinkTarget(focusPath: String; focus: TFHIRResource; link: TFhirGraphDefinitionLink; depth: integer);
procedure parseParams(params : TFslList<TGraphQLArgument>; value : String; res : TFHIRResource);
procedure SetAppInfo(const Value: TFslObject);
public
constructor Create(context : TFHIRWorkerContextWithFactory); virtual;
destructor Destroy; override;
property appInfo : TFslObject read FAppinfo write SetAppInfo;
property baseURL : String read FBaseUrl write FBaseURL;
property definition : TFhirGraphDefinition read FDefinition write SetDefinition;
property start : TFHIRResource read FStart write SetStart;
property bundle : TFHIRBundle read FBundle write SetBundle;
property depthLimit : integer read FDepthLimit write FDepthLimit; // 0 = no limit
property validating : boolean read FValidating write FValidating;
property OnFollowReference : TFHIRGraphQLEngineDereferenceEvent read FOnFollowReference write FOnFollowReference;
property OnListResources : TFHIRGraphQLEngineListResourcesEvent read FOnListResources write FOnListResources;
property OnLookup : TFHIRGraphQLEngineLookupEvent read FOnLookup write FOnLookup;
property PathEngine : TFHIRPathEngine read FPathEngine;
procedure execute;
end;
implementation
{ TFHIRGraphDefinitionParser }
destructor TFHIRGraphDefinitionParser4.Destroy;
begin
FLexer.Free;
inherited;
end;
function TFHIRGraphDefinitionParser4.parseV(source: String): TFhirResourceV;
begin
FLexer := TFHIRPathLexer4.Create(fpV2, source);
result := readDefinition;
end;
function TFHIRGraphDefinitionParser4.readCompartmentRule(use: TFhirGraphCompartmentUseEnum): TFhirGraphDefinitionLinkTargetCompartment;
var
i : integer;
expr: TFHIRPathExpressionNode;
fpp : TFHIRPathParser;
begin
result := TFhirGraphDefinitionLinkTargetCompartment.Create;
try
result.use := use;
i := StringArrayIndexOfSensitive(CODES_TFhirGraphCompartmentRuleEnum, FLexer.current);
if i < 1 then
raise FLexer.error('Unexpected token "'+FLexer.current+'" expecting a compartment rule');
result.rule := TFhirGraphCompartmentRuleEnum(i);
FLexer.next;
i := StringArrayIndexOfSensitive(CODES_TFhirCompartmentTypeEnum, FLexer.current);
if i < 1 then
raise FLexer.error('Unexpected token "'+FLexer.current+'" expecting a compartment type');
result.code := TFhirCompartmentTypeEnum(i);
FLexer.next;
if FLexer.takeToken('=') then
begin
fpp := TFHIRPathParser.Create;
try
expr := fpp.parse(FLexer);
try
result.expression := expr.ToString;
finally
expr.free;
end;
finally
fpp.Free;
end;
end;
result.link;
finally
result.Free;
end;
end;
function TFHIRGraphDefinitionParser4.readDefinition: TFhirGraphDefinition;
begin
result := TFhirGraphDefinition.Create;
try
if FLexer.takeToken('graph') then
readHeader(result);
result.start := readResourceType;
result.profile := readProfile;
readLinkList(result.link_List);
if (not FLexer.done) then
raise FLexer.error('Unexpected content');
result.Link;
finally
result.Free;
end;
end;
procedure TFHIRGraphDefinitionParser4.readHeader(gd: TFhirGraphDefinition);
begin
raise EFHIRTodo.create('TFHIRGraphDefinitionParser4.readHeader');
end;
procedure TFHIRGraphDefinitionParser4.readLinkList(list: TFhirGraphDefinitionLinkList);
var
first : boolean;
begin
if FLexer.takeToken('{') then
begin
first := true;
while first or FLexer.takeToken(',') do
begin
first := false;
if (FLexer.takeToken('search')) then
list.Add(readSearchLink)
else
list.Add(readPathLink);
end;
FLexer.token('}');
end;
end;
function TFHIRGraphDefinitionParser4.readPathLink: TFhirGraphDefinitionLink;
var
fpp : TFHIRPathParser;
first : boolean;
tgt : TFhirGraphDefinitionLinkTarget;
expr : TFHIRPathExpressionNode;
begin
result := TFhirGraphDefinitionLink.Create;
try
fpp := TFHIRPathParser.Create;
try
expr := fpp.parse(FLexer);
try
result.path := expr.ToString;
finally
expr.free;
end;
finally
fpp.Free;
end;
if (FLexer.takeToken('cardinality')) then
begin
result.min := FLexer.take;
FLexer.token('.');
FLexer.token('.');
result.max := FLexer.take;
end;
if FLexer.isConstant then
result.description := FLexer.readConstant('description');
first := true;
FLexer.token(':');
repeat
if first then
first := false
else
FLexer.takeToken(';');
tgt := result.targetList.Append;
tgt.type_ := readResourceType;
tgt.profile := readProfile;
while FLexer.takeToken('where') do
tgt.compartmentList.Add(readCompartmentRule(GraphCompartmentUseCondition));
while FLexer.takeToken('require') do
tgt.compartmentList.Add(readCompartmentRule(GraphCompartmentUseRequirement));
readLinkList(tgt.link_List);
until not FLexer.hasToken(';');
result.Link;
finally
result.Free;
end;
end;
function TFHIRGraphDefinitionParser4.readProfile: String;
begin
if FLexer.takeToken('(') then
result := FLexer.readTo(')', false)
else
result := '';
end;
function TFHIRGraphDefinitionParser4.readResourceType: TFhirResourceTypesEnum;
var
i : integer;
begin
i := StringArrayIndexOfSensitive(CODES_TFhirResourceTypesEnum, FLexer.current);
if i < 1 then
raise FLexer.error('Unexpected token "'+FLexer.current+'" expecting a resource type');
FLexer.next;
result := TFhirResourceTypesEnum(i);
end;
function TFHIRGraphDefinitionParser4.readSearchLink: TFhirGraphDefinitionLink;
var
tgt : TFhirGraphDefinitionLinkTarget;
begin
result := TFhirGraphDefinitionLink.Create;
try
tgt := result.targetList.Append;
tgt.type_ := readResourceType;
FLexer.token('?');
tgt.params := FLexer.readToWS;
while FLexer.takeToken('where') do
tgt.compartmentList.Add(readCompartmentRule(GraphCompartmentUseCondition));
if (FLexer.takeToken('cardinality')) then
begin
result.min := FLexer.take;
FLexer.token('.');
FLexer.token('.');
result.max := FLexer.take;
end;
if FLexer.isConstant then
result.description := FLexer.readConstant('description');
while FLexer.takeToken('require') do
tgt.compartmentList.Add(readCompartmentRule(GraphCompartmentUseRequirement));
readLinkList(tgt.link_List);
result.link;
finally
result.Free;
end;
end;
function TFHIRGraphDefinitionParser4.asString(definition: TFhirResourceV; header: boolean): String;
var
t : TFhirGraphDefinition;
b : TStringBuilder;
begin
t := definition as TFhirGraphDefinition;
b := TStringBuilder.Create;
try
if header then
writeHeader(b, t);
writeDefinition(b, t);
result := b.ToString;
finally
b.Free;
end;
end;
procedure TFHIRGraphDefinitionParser4.writeCompartment(b: TStringBuilder; cr: TFhirGraphDefinitionLinkTargetCompartment);
begin
if cr.use = GraphCompartmentUseCondition then
b.Append('where ')
else
b.Append('require ');
b.Append(CODES_TFhirGraphCompartmentRuleEnum[cr.rule]);
b.Append(' ');
b.Append(CODES_TFhirCompartmentTypeEnum[cr.code]);
if cr.rule = GraphCompartmentRuleCustom then
begin
b.Append(' = ');
b.Append(cr.expression)
end;
end;
procedure TFHIRGraphDefinitionParser4.writeDefinition(b: TStringBuilder; definition: TFhirGraphDefinition);
begin
b.Append(CODES_TFhirResourceTypesEnum[definition.start]);
if definition.profile <> '' then
begin
b.Append('(');
b.Append(definition.profile);
b.Append(')');
end;
writeLinklist(b, definition.link_List, 2);
end;
procedure TFHIRGraphDefinitionParser4.writeHeader(b: TStringBuilder; definition: TFhirGraphDefinition);
begin
end;
procedure TFHIRGraphDefinitionParser4.writeLinklist(b: TStringBuilder; list: TFhirGraphDefinitionLinkList; indent : integer);
var
i : integer;
begin
if list.Count > 0 then
begin
b.Append(' {');
for i := 0 to list.Count - 1 do
begin
b.Append(#13#10);
b.Append(StringPadLeft('', ' ', indent));
if list[i].path <> '' then
writePathItem(b, list[i], indent)
else
writeSearchItem(b, list[i], indent);
if i < list.Count - 1 then
b.Append(',')
end;
b.Append(#13#10);
b.Append(StringPadLeft('', ' ', indent-2));
b.Append('}');
end;
end;
procedure TFHIRGraphDefinitionParser4.writePathItem(b: TStringBuilder; item: TFhirGraphDefinitionLink; indent: integer);
var
i : integer;
cr : TFhirGraphDefinitionLinkTargetCompartment;
begin
b.Append(item.path);
if (item.min <> '') or (item.max <> '') then
begin
b.Append(' cardinality ');
if item.min <> '' then
b.Append(item.min)
else
b.Append('0');
b.Append('..');
if item.max <> '' then
b.Append(item.max)
else
b.Append('*');
end;
if item.description <> '' then
begin
b.Append(' ''');
b.Append(jsonEscape(item.description, true));
b.Append('''');
end;
b.Append(' : ');
for i := 0 to item.targetList.Count - 1 do
begin
if (item.targetList.count > 1) then
begin
b.Append(#13#10);
b.Append(StringPadLeft('', ' ', indent+2));
end;
b.Append(CODES_TFhirResourceTypesEnum[item.targetList[i].type_]);
if item.targetList[i].profile <> '' then
begin
b.Append('(');
b.Append(item.targetList[i].profile);
b.Append(')');
end;
for cr in item.targetList[i].compartmentList do
if (cr.use = GraphCompartmentUseCondition) then
writeCompartment(b, cr);
for cr in item.targetList[i].compartmentList do
if (cr.use = GraphCompartmentUseRequirement) then
writeCompartment(b, cr);
if (item.targetList.count = 1) then
writeLinklist(b, item.targetList[i].link_List, indent+2)
else
writeLinklist(b, item.targetList[i].link_List, indent+4);
if i < item.targetList.Count - 1 then
b.Append(';')
end;
end;
procedure TFHIRGraphDefinitionParser4.writeSearchItem(b: TStringBuilder; item: TFhirGraphDefinitionLink; indent: integer);
begin
b.Append('search ');
b.Append(CODES_TFhirResourceTypesEnum[item.targetList[0].type_]);
b.Append('?');
b.Append(item.targetList[0].params);
if (item.min <> '') or (item.max <> '') then
begin
b.Append(' cardinality ');
if item.min <> '' then
b.Append(item.min)
else
b.Append('0');
b.Append('..');
if item.max <> '' then
b.Append(item.max)
else
b.Append('*');
end;
if item.description <> '' then
begin
b.Append(' ''');
b.Append(jsonEscape(item.description, true));
b.Append('''');
end;
writeLinklist(b, item.targetList[0].link_List, indent+2);
end;
{ TFHIRGraphDefinitionEngine4 }
constructor TFHIRGraphDefinitionEngine4.Create(context : TFHIRWorkerContextWithFactory);
begin
inherited Create;
FContext := context;
FPathEngine := TFHIRPathEngine.Create((context as TFHIRWorkerContext).link, nil);
end;
destructor TFHIRGraphDefinitionEngine4.Destroy;
begin
FAppinfo.Free;
FBundle.Free;
FDefinition.Free;
FStart.Free;
FPathEngine.Free;
FContext.Free;
inherited;
end;
procedure TFHIRGraphDefinitionEngine4.SetAppInfo(const Value: TFslObject);
begin
FAppinfo.Free;
FAppinfo := Value;
end;
procedure TFHIRGraphDefinitionEngine4.SetBundle(const Value: TFHIRBundle);
begin
FBundle.Free;
FBundle := Value;
end;
procedure TFHIRGraphDefinitionEngine4.SetDefinition(const Value: TFhirGraphDefinition);
begin
FDefinition.Free;
FDefinition := Value;
end;
procedure TFHIRGraphDefinitionEngine4.SetStart(const Value: TFHIRResource);
begin
FStart.Free;
FStart := Value;
end;
procedure TFHIRGraphDefinitionEngine4.execute;
var
l : TFhirGraphDefinitionLink;
begin
check(assigned(OnFollowReference), 'Reference Resolution services not available');
check(assigned(FOnListResources), 'Resource search services not available');
check(Start <> nil, 'A focus resource is needed');
check(Bundle <> nil, 'An output bundle is needed');
check(definition <> nil, 'a definition is needed');
check(FBaseUrl <> '', 'a baseURL is needed');
FDefinition.checkNoModifiers('FHIR.Server.GraphDefinition.execute', 'definition');
check(Start.fhirType = CODES_TFhirResourceTypesEnum[definition.start], 'Definition requires that Start is '+CODES_TFhirResourceTypesEnum[definition.start]+', but found '+Start.fhirType);
if not isInBundle(start) then
addToBundle(start);
for l in definition.link_List do
processLink(Start.fhirType, FStart, l, 1);
end;
function TFHIRGraphDefinitionEngine4.isInBundle(resource: TFHIRResource): boolean;
var
be : TFhirBundleEntry;
begin
result := false;
for be in FBundle.entryList do
if (be.resource <> nil) and (be.resource.fhirType = resource.fhirType) and (be.resource.id = resource.id) then
exit(true);
end;
procedure TFHIRGraphDefinitionEngine4.addToBundle(resource: TFHIRResource);
var
be : TFhirBundleEntry;
begin
be := FBundle.entryList.Append;
be.fullUrl := URLPath([FBaseUrl, resource.fhirType, resource.id]);
be.resource := resource.Link;
end;
function TFHIRGraphDefinitionEngine4.check(test: boolean; msg: String): boolean;
begin
if not test then
raise EFHIRException.Create(msg);
result := test;
end;
procedure TFHIRGraphDefinitionEngine4.parseParams(params: TFslList<TGraphQLArgument>; value: String; res: TFHIRResource);
var
p : THTTPParameters;
i, j : integer;
n, v : String;
refed : boolean;
begin
refed := false;
p := THTTPParameters.create(value, false);
try
for i := 0 to p.Count -1 do
begin
n := p.Name[i];
for j := 0 to p.getValueCount(i) - 1 do
begin
p.retrieveNumberedItem(i,j, v);
if (v = '{ref}') then
begin
refed := true;
v := res.fhirType+'/'+res.id;
end;
params.Add(TGraphQLArgument.Create(n, TGraphQLStringValue.Create(v)));
end;
end;
finally
p.Free;
end;
check(refed, 'no use of {ref} found');
end;
procedure TFHIRGraphDefinitionEngine4.processLink(focusPath : String; focus: TFHIRResource; link: TFhirGraphDefinitionLink; depth: integer);
begin
if link.path <> '' then
processLinkPath(focusPath, focus, link, depth)
else
processLinkTarget(focusPath, focus, link, depth);
end;
procedure TFHIRGraphDefinitionEngine4.processLinkPath(focusPath : String; focus: TFHIRResource; link: TFhirGraphDefinitionLink; depth: integer);
var
path : String;
node : TFHIRPathExpressionNode;
matches : TFHIRSelectionList;
sel : TFHIRSelection;
tl : TFhirGraphDefinitionLinkTarget;
res : TFhirResourceV;
tgtCtxt : TFHIRResourceV;
l : TFhirGraphDefinitionLink;
begin
check(link.path <> '', 'Path is needed at '+path);
check(link.sliceName = '', 'SliceName is not yet supported at '+path);
path := focusPath+' -> '+link.path;
if link.pathElement.Tag <> nil then
node := link.pathElement.Tag.Link as TFHIRPathExpressionNode
else
node := FPathEngine.parse(link.path);
try
matches := FPathEngine.evaluate(nil, focus, focus, node);
try
check(not validating or (matches.Count >= StrToIntDef(link.min, 0)), 'Link at path '+path+' requires at least '+link.min+' matches, but only found '+inttostr(matches.Count));
check(not validating or (matches.Count <= StrToIntDef(link.max, MAXINT)), 'Link at path '+path+' requires at most '+link.max+' matches, but found '+inttostr(matches.Count));
for sel in matches do
begin
check(sel.value.fhirType = 'Reference', 'Selected node from an expression must be a Reference'); // todo: should a URL be ok?
OnFollowReference(appInfo, focus, sel.value as TFhirReference, tgtCtxt, res);
if (res <> nil) then
begin
try
check(tgtCtxt <> focus, 'how to handle contained resources is not yet resolved'); // todo
for tl in link.targetList do
begin
if CODES_TFhirResourceTypesEnum[tl.type_] = res.fhirType then
begin
if not isInBundle(res as TFhirResource) then
begin
addToBundle(res as TFhirResource);
for l in definition.link_List do
processLink(Start.fhirType, res as TFhirResource, l, depth+1);
end;
end;
end;
finally
tgtCtxt.Free;
res.Free;
end;
end;
end;
finally
matches.Free;
end;
finally
node.Free;
end;
end;
procedure TFHIRGraphDefinitionEngine4.processLinkTarget(focusPath : String; focus: TFHIRResource; link: TFhirGraphDefinitionLink; depth: integer);
var
path : String;
list : TFslList<TFHIRResourceV>;
params : TFslList<TGraphQLArgument>;
res : TFhirResourceV;
l : TFhirGraphDefinitionLink;
begin
check(link.targetList.Count = 1, 'If there is no path, there must be one and only one target at '+focusPath);
check(link.targetList[0].type_ <> ResourceTypesNull, 'If there is no path, there must be type on the target at '+focusPath);
check(link.targetList[0].params.Contains('{ref}'), 'If there is no path, the target must have parameters that include a parameter using {ref} at '+focusPath);
path := focusPath+' -> '+CODES_TFhirResourceTypesEnum[link.targetList[0].type_]+'?'+link.targetList[0].params;
list := TFslList<TFHIRResourceV>.create;
try
params := TFslList<TGraphQLArgument>.create;
try
parseParams(params, link.targetList[0].params, focus);
FOnListResources(appInfo, CODES_TFhirResourceTypesEnum[link.targetList[0].type_], params, list);
finally
params.free;
end;
check(not validating or (list.Count >= StrToIntDef(link.min, 0)), 'Link at path '+path+' requires at least '+link.min+' matches, but only found '+inttostr(list.Count));
check(not validating or (list.Count <= StrToIntDef(link.max, MAXINT)), 'Link at path '+path+' requires at most '+link.max+' matches, but found '+inttostr(list.Count));
for res in list do
begin
if not isInBundle(res as TFhirResource) then
begin
addToBundle(res as TFhirResource);
for l in definition.link_List do
processLink(Start.fhirType, FStart, l, depth+1);
end;
end;
finally
list.Free;
end;
end;
end.
| 33.519943 | 189 | 0.692278 |
Subsets and Splits
HTML Code Excluding Scripts
The query retrieves a limited set of HTML content entries that are longer than 8 characters and do not contain script tags, offering only basic filtering with minimal analytical value.