Subversion Repositories oidplus

Compare Revisions

No changes between revisions

Regard whitespace Rev 232 → Rev 233

/trunk_win311/Db/AAWFHRIE.TXT
0,0 → 1,14
This OID can be used by anyone, without any permission, for the purpose of documenting examples of object identifiers (in the same way as "example.com" is defined in IETF RFC 2606 as an example for web sites).
 
 
 
 
 
 
 
 
 
 
 
 
 
/trunk_win311/Db/AIZOOOOD.TXT
0,0 → 1,7
This OID is for International Standards and ISO Member Bodies.
 
Operation of this OID is in accordance with <a href="http://itu.int/ITU-T/X.660">Rec. ITU-T X.660 | ISO/IEC 9834-1</a> "Procedures for the operation of object identifier registration authorities: General procedures and top arcs of the international object identifier tree".
 
All decisions related to child OIDs, other than the assignment of additional secondary identifiers to top-level OID <code>1</code> (see Rec. ITU-T X.660 (2004) | ISO/IEC 9834-1:2004, clause A.5), will be recorded as amendments to Rec. ITU-T X.660 | ISO/IEC 9834-1 (such changes to the common text will be regarded as editorial by ITU-T).
 
From Rec. ITU-T X.660 (2004) | ISO/IEC 9834-1:2004, "the top-level arcs are restricted to three arcs numbered 0 to 2; and the arcs beneath root arcs <code>0</code> and <code>1</code> are restricted to forty arcs numbered <code>0</code> to <code>39</code>." This enables optimized encodings to be used in which the values of the top two arcs for all arcs under top-level arcs <code>0</code> and <code>1</code> encode in a single octet in an object identifier encoding (see the Rec. ITU-T X.690 series | ISO/IEC 8825 multi-part Standard).
/trunk_win311/Db/JLCMBVBH.TXT
0,0 → 1,11
Subsequent OIDs identify ITU-T Recommendations (not jointly published with ISO/IEC) and ITU members.
 
This arc is also called <code>ccitt(0)</code> to recall that CCITT used to be an organization independent from ITU-T.
 
Identifier <strong><code>itu-r</code></strong> was added by ITU-T Study Group 17 in March 2004 (and was ratified by ISO/IEC JTC 1/SC 6 in Sep 2005). It can only be used as a 'NameAndNumberForm' (that is, followed by number <code>5</code> between parentheses) for OIDs that commence with <code>{itu-r(0) <a href="http://oid-info.com/get/0.5">r-recommendation(5)</a>}</code> (see <a href="http://itu.int/rec/T-REC-X.680/en">Rec. ITU-T X.680 | ISO/IEC 9834-1</a>, clause A.5, for more details on this specific case). Consequently Unicode label "<code>ITU-R</code>" can only be used for "<a href="http://oid-info.com/faq.htm#iri">OID-IRIs</a>" that designate OIDs under the <code>{itu-r(0) <a href="http://oid-info.com/get/0.5">r-recommendation(5)</a>}</code> arc.
 
Operation is in accordance with <a href="http://itu.int/rec/T-REC-X.660/en">Rec. ITU-T X.660 | ISO/IEC 9834-1</a> and is under the guidance of <a href="http://itu.int/ITU-T/studygroups/com17/index.asp">ITU-T Study Group 17</a>.
 
All decisions related to subsequent arcs, other than the assignment of additional secondary identifiers to top-level arc <code>0</code> (see Rec. ITU-T X.660 | ISO/IEC 9834-1, clause A.5), will be recorded ad amendments to Rec. ITU-T X.660 | ISO/IEC 9834-1 (such changes to the joint ITU-T | ISO/IEC text will be regarded as editorial by ISO).
 
From Rec. ITU-T X.660 | ISO/IEC 9834-1, "the top-level arcs are restricted to three arcs numbered <code>0</code> to <code>2</code>; and the arcs beneath root arcs <code>0</code> and <code>1</code> are restricted to forty arcs numbered <code>0</code> to <code>39</code>. This enables optimized encodings to be used in which the values of the top two arcs for all arcs under top-level arcs <code>0</code> and <code>1</code> encode in a single octet in an object identifier encoding (see the Rec. ITU-T X.690 series | ISO/IEC 8825 multi-part Standard).
/trunk_win311/Db/JLFJDTLL.TXT
0,0 → 1,5
This OID was allocated by <a href="http://itu.int/ITU-T/X.660">Rec. ITU-T X.660</a> | ISO/IEC 9834-1.
 
This OID is jointly administered by ISO and ITU-T according to <a href="http://itu.int/ITU-T/X.662">Rec. ITU-T X.662</a> | ISO/IEC 9834-3 "<em>Procedures for the Operation of OSI Registration Authorities: Registration of Object Identifier Arcs for Joint ISO and ITU-T Work</em>". As a consequence, all requests for registration must be jointly approved by ITU-T Study Group 17 and ISO/IEC JTC 1/SC 6. Child OIDs are recorded in the <a href="http://itu.int/go/X660">Register of arcs beneath the root arc with primary integer value 2</a>.
 
New child OIDs will be allocated a number greater than 47, except if there is a good rationale that a compact binary encoding is needed, in which case a number less or equal to 47 can be allocated so that the OID encodes with a single octet.
/trunk_win311/Db/OID.ini
0,0 → 1,154
; 16384
; 8192
 
[OID:]
delegates=3
delegate1=OID:0
delegate2=OID:1
delegate3=OID:2
 
[OID:0]
createdate=05.04.2020
ra=
description=International Telecommunication Union - Telecommunication standardization sector (ITU-T)
draft=0
information=JLCMBVBH.TXT
asn1id=itu-t,ccitt,itu-r
updatedate=04.04.2020
delegates=0
 
[OID:2]
createdate=04.04.2020
ra=
delegates=1
delegate1=OID:2.999
description=Areas of joint work between ISO/IEC (International Organization for Standardization/International Electrotechnical Commission) and ITU-T (International Telecommunication Union - Telecommunication standardization sector), and other international work
draft=0
information=JLFJDTLL.TXT
asn1id=joint-iso-itu-t,joint-iso-ccitt
updatedate=04.04.2020
 
[OID:2.999]
createdate=04.04.2020
ra=
description=Example
draft=0
information=AAWFHRIE.TXT
asn1id=example
updatedate=04.04.2020
delegates=1
delegate1=
 
[OID:1]
description=International Organization for Standardization (ISO)
draft=0
information=AIZOOOOD.TXT
asn1id=iso
updatedate=04.04.2020
createdate=04.04.2020
ra=
delegates=1
delegate1=OID:1.3
 
[OID:1.3]
createdate=04.04.2020
ra=
description=Organization identification schemes registered according to ISO/IEC 6523-2
asn1id=identified-organization
updatedate=04.04.2020
delegates=1
delegate1=OID:1.3.6
 
[OID:1.3.6]
createdate=04.04.2020
ra=
description=Department of Defense (DoD)
asn1id=dod
updatedate=04.04.2020
delegates=1
delegate1=OID:1.3.6.1
 
[OID:1.3.6.1]
createdate=04.04.2020
ra=
delegates=1
delegate1=OID:1.3.6.1.4
description=Internet
asn1id=internet
updatedate=04.04.2020
 
[OID:1.3.6.1.4]
createdate=04.04.2020
ra=
delegates=1
delegate1=OID:1.3.6.1.4.1
description=Private
asn1id=private
updatedate=04.04.2020
 
[OID:1.3.6.1.4.1]
createdate=04.04.2020
ra=
description=Private Enterprise Numbers (PEN)
asn1id=enterprise
updatedate=04.04.2020
delegates=1
delegate1=OID:1.3.6.1.4.1.37476
 
[OID:1.3.6.1.4.1.37476]
createdate=04.04.2020
ra=RA:VIATHINKSOFT
description=ViaThinkSoft
updatedate=04.04.2020
delegates=1
delegate1=OID:1.3.6.1.4.1.37476.1
 
[OID:1.3.6.1.4.1.37476.1]
createdate=04.04.2020
ra=RA:VIATHINKSOFT
description=Members
asn1id=members
updatedate=04.04.2020
delegates=5
delegate1=OID:1.3.6.1.4.1.37476.1.1
delegate2=OID:1.3.6.1.4.1.37476.1.2
delegate3=OID:1.3.6.1.4.1.37476.1.3
delegate4=OID:1.3.6.1.4.1.37476.1.4
delegate5=OID:1.3.6.1.4.1.37476.1.5
 
[OID:1.3.6.1.4.1.37476.1.1]
createdate=04.04.2020
ra=RA:VTS-NEGOESCU
description=Victor-Philipp Negoescu
asn1id=victor,vnegoescu
updatedate=04.04.2020
 
[OID:1.3.6.1.4.1.37476.1.2]
createdate=04.04.2020
ra=RA:VTS-MARSCHALL
description=Daniel Marschall
asn1id=daniel-marschall,dmarschall
updatedate=04.04.2020
 
[OID:1.3.6.1.4.1.37476.1.3]
createdate=04.04.2020
ra=
delegates=0
description=Michael Düpjohann
asn1id=mduepjohann
updatedate=4.5.2020
 
[OID:1.3.6.1.4.1.37476.1.4]
createdate=04.04.2020
ra=RA:VTS-BRETZKE
description=Thomas Bretzke
asn1id=thommy,tbretzke
updatedate=04.04.2020
 
[OID:1.3.6.1.4.1.37476.1.5]
createdate=05.04.2020
ra=RA:VIATHINKSOFT
description=test
updatedate=05.04.2020
asn1id=test
 
/trunk_win311/Db/RA.ini
0,0 → 1,48
[RA:]
count=13
ra1=
ra2=
ra3=
ra4=
ra5=RA:VIATHINKSOFT
ra6=RA:VTS-MARSCHALL
ra7=RA:VTS-NEGOESCU
ra8=
ra9=
ra10=RA:VTS-BRETZKE
ra11=
ra12=
ra13=
 
[RA:OLIVIER]
name=Olivier
updatedate=04.04.2020
 
[RA:MARSCHALL]
name=Daniel Marschall
updatedate=04.04.2020
 
[RA:VIATHINKSOFT]
createdate=04.04.2020
name=ViaThinkSoft
updatedate=04.04.2020
 
[RA:VTS-MARSCHALL]
createdate=04.04.2020
name=Daniel Marschall
updatedate=04.04.2020
 
[RA:VTS-NEGOESCU]
createdate=04.04.2020
name=Victor-Philipp Negoescu
updatedate=04.04.2020
 
[RA:VTS-BRETZKE]
createdate=04.04.2020
name=Thomas Bretzke
updatedate=04.04.2020
 
[RA:VTS-THOMMY]
name=Thomas Bretzke
updatedate=04.04.2020
 
/trunk_win311/DelTmp.bat
0,0 → 1,4
@echo off
del *.~*
del *.dcu
 
/trunk_win311/Main.dfm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk_win311/Main.pas
0,0 → 1,1004
unit Main;
 
{ This source code is only compatible with Delphi 1.0 ! }
 
interface
 
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IniFiles, Grids, Outline, ExtCtrls;
 
type
TForm1 = class(TForm)
Outline1: TOutline;
Notebook1: TNotebook;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label15: TLabel;
Edit3: TEdit;
Memo1: TMemo;
Edit4: TEdit;
CheckBox1: TCheckBox;
ComboBox1: TComboBox;
Edit5: TEdit;
Edit6: TEdit;
ListBox1: TListBox;
Edit7: TEdit;
Button1: TButton;
Button3: TButton;
Button2: TButton;
Button4: TButton;
Edit1: TEdit;
Button6: TButton;
Label2: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Button8: TButton;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Button9: TButton;
Edit14: TEdit;
Label13: TLabel;
Button5: TButton;
Edit2: TEdit;
Label14: TLabel;
Edit8: TEdit;
Button7: TButton;
procedure Outline1Change(Sender: TObject; Node: integer);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure CheckBox1Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Edit8KeyPress(Sender: TObject; var Key: Char);
procedure Edit11Change(Sender: TObject);
procedure ListBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit7KeyPress(Sender: TObject; var Key: Char);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Outline1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Outline1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
procedure ShowOID(oid: string; ini: TIniFile; nod: integer);
procedure ShowRA(ini: TIniFile; nod: integer);
function DBPath: string;
function GetAsn1Ids(onlyfirst: boolean): string;
procedure SaveChangesIfRequired;
procedure ShowError(msg: string);
end;
 
var
Form1: TForm1;
 
implementation
 
{$R *.DFM}
 
uses
SortStr;
 
const
TITLE_OID = 'Object Identifiers';
TITLE_RA = 'Registration Authorities';
 
procedure Split(Delimiter: string; Str: string; ListOfStrings: TStrings) ;
var
p: integer;
begin
ListOfStrings.Clear;
p := Pos(Delimiter, Str);
while p > 0 do
begin
ListOfStrings.Add(Copy(Str, 1, p-1));
Delete(Str, 1, p);
p := Pos(Delimiter, Str);
end;
if Str <> '' then ListOfStrings.Add(Str);
end;
 
procedure ExpandNodeAndParents(nod: TOutlineNode);
begin
if nod.Parent <> nil then ExpandNodeAndParents(nod.Parent);
nod.Expand;
end;
 
{ Source: Delphi 4 }
function Trim(const S: string): string;
var
I, L: Integer;
begin
L := Length(S);
I := 1;
while (I <= L) and (S[I] <= ' ') do Inc(I);
if I > L then Result := '' else
begin
while S[L] <= ' ' do Dec(L);
Result := Copy(S, I, L - I + 1);
end;
end;
 
type
TWorkItem = class(TObject)
public
sectionName: string;
ini: TIniFile;
nod: integer;
end;
 
procedure TForm1.ShowOID(oid: string; ini: TIniFile; nod: integer);
var
i: integer;
sectionName: string;
asn1ids: string;
l: TList;
sl: TStringList;
workItem: TWorkItem;
label
continuework,
ende;
begin
l := TList.Create;
sl := TStringList.Create;
 
workItem := TWorkItem.Create;
workItem.sectionName := oid;
workItem.ini := ini;
workItem.nod := nod;
l.Add(workItem);
 
continuework:
 
if l.Count = 0 then goto ende;
workItem := l.Items[l.Count-1];
oid := workItem.sectionName;
ini := workItem.ini;
nod := workItem.nod;
workItem.Free;
l.Delete(l.Count-1);
 
if oid = 'OID:' then
begin
nod := Outline1.AddChild(nod, TITLE_OID);
end
else
begin
asn1ids := ini.ReadString(oid, 'asn1id', '');
if ini.ReadBool(oid, 'draft', false) then
nod := Outline1.AddChild(nod, Trim(oid+' '+Copy(asn1ids,1,Pos(',',asn1ids+',')-1))+' [DRAFT]')
else
nod := Outline1.AddChild(nod, Trim(oid+' '+Copy(asn1ids,1,Pos(',',asn1ids+',')-1)));
end;
sl.Clear;
for i := ini.ReadInteger(oid, 'delegates', 0) downto 1 do
begin
sectionName := ini.ReadString(oid, 'delegate'+IntToStr(i), '');
if sectionName = '' then continue;
sl.Add(sectionName);
end;
SortSL(sl);
for i := sl.Count-1 downto 0 do
begin
sectionName := sl.Strings[i];
 
workItem := TWorkItem.Create;
workItem.sectionName := sectionName;
workItem.ini := ini;
workItem.nod := nod;
l.Add(workItem);
end;
if (oid = 'OID:') or (sl.Count < 125) then
ExpandNodeAndParents(Outline1.Items[nod]);
 
goto continuework;
 
ende:
 
sl.Free;
l.Free;
end;
 
procedure TForm1.ShowRA(ini: TIniFile; nod: integer);
var
i: integer;
sectionName, personname: string;
sl: TStringList;
begin
nod := Outline1.AddChild(nod, TITLE_RA);
sl := TStringList.Create;
for i := 1 to ini.ReadInteger('RA:', 'count', 0) do
begin
sectionName := ini.ReadString('RA:', 'ra'+IntToStr(i), '');
if sectionName = '' then continue;
personname := ini.ReadString(sectionName, 'name', '');
sl.Add(Trim(sectionName + ' ' + personname));
end;
SortSL(sl);
for i := 0 to sl.Count-1 do
begin
sectionName := sl.Strings[i];
Outline1.AddChild(nod, sectionName);
ComboBox1.Items.Add(Copy(sectionName,1,Pos(' ',sectionName+' ')-1));
end;
sl.Free;
ExpandNodeAndParents(Outline1.Items[nod]);
end;
 
procedure TForm1.Outline1Change(Sender: TObject; Node: integer);
var
ini: TIniFile;
txtFile: string;
begin
SaveChangesIfRequired;
 
if Copy(Outline1.Items[Outline1.SelectedItem].Text, 1, 4) = 'OID:' then
begin
Notebook1.PageIndex := 0;
ini := TIniFile.Create(DBPath+'OID.INI');
try
Edit4.Text := Copy(Outline1.Items[Outline1.SelectedItem].Text, 1,
Pos(' ',Outline1.Items[Outline1.SelectedItem].Text+' ')-1);
ListBox1.Items.Clear;
Split(',', ini.ReadString(Edit4.Text, 'asn1id', ''), ListBox1.Items);
Edit3.Text := ini.ReadString(Edit4.Text, 'description', '');
CheckBox1.Checked := ini.ReadBool(Edit4.Text, 'draft', false);
txtFile := DBPath+ini.ReadString(Edit4.Text, 'information', '');
if FileExists(txtFile) then
Memo1.Lines.LoadFromFile(txtFile)
else
Memo1.Lines.Clear;
Memo1.Modified := false;
ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(ini.ReadString(Edit4.Text, 'ra', ''));
Edit5.Text := ini.ReadString(Edit4.Text, 'createdate', '');
Edit6.Text := ini.ReadString(Edit4.Text, 'updatedate', '');
Edit7.Text := '';
finally
ini.Free;
end;
Edit1.Text := '';
end;
if Copy(Outline1.Items[Outline1.SelectedItem].Text, 1, 3) = 'RA:' then
begin
Notebook1.PageIndex := 1;
ini := TIniFile.Create(DBPath+'RA.INI');
try
Edit9.Text := Copy(Outline1.Items[Outline1.SelectedItem].Text, 1,
Pos(' ',Outline1.Items[Outline1.SelectedItem].Text+' ')-1);
Edit10.Text := ini.ReadString(Edit9.Text, 'createdate', '');
Edit11.Text := ini.ReadString(Edit9.Text, 'name', '');
Edit12.Text := ini.ReadString(Edit9.Text, 'email', '');
Edit13.Text := ini.ReadString(Edit9.Text, 'phone', '');
Edit14.Text := ini.ReadString(Edit9.Text, 'updatedate', '');
finally
ini.Free;
end;
end;
if Outline1.Items[Outline1.SelectedItem].Text = TITLE_OID then
begin
Notebook1.PageIndex := 2;
Edit2.Text := '';
end;
if Outline1.Items[Outline1.SelectedItem].Text = TITLE_RA then
begin
Notebook1.PageIndex := 3;
Edit8.Text := '';
end;
end;
 
procedure TForm1.FormShow(Sender: TObject);
var
nod, raroot: integer;
ini: TIniFile;
begin
ComboBox1.Clear;
Outline1.Clear;
nod := 0;
 
ini := TIniFile.Create(DBPath+'OID.INI');
try
ShowOID('OID:', ini, nod);
finally
ini.Free;
end;
 
ini := TIniFile.Create(DBPath+'RA.INI');
try
ShowRa(ini, nod);
finally
ini.Free;
end;
 
Outline1Click(Outline1);
end;
 
function Asn1IdValid(asn1id: string): boolean;
var
i: integer;
begin
if asn1id = '' then
begin
result := false;
exit;
end;
 
if not (asn1id[1] in ['a'..'z']) then
begin
result := false;
exit;
end;
 
for i := 2 to Length(asn1id) do
begin
if not (asn1id[1] in ['a'..'z', 'A'..'Z', '0'..'9', '-']) then
begin
result := false;
exit;
end;
end;
 
result := true;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
var
asn1id: string;
i: integer;
begin
asn1id := Edit7.Text;
if asn1id = '' then exit;
for i := 0 to ListBox1.Items.Count-1 do
begin
if ListBox1.Items.Strings[i] = asn1id then ShowError('Item already exists');
end;
if not Asn1IdValid(asn1id) then ShowError('Invalid alphanumeric identifier');
ListBox1.Items.Add(asn1id);
Outline1.Items[Outline1.SelectedItem].Text := Trim(Edit4.Text + ' ' + GetAsn1Ids(true));
Edit7.Text := '';
end;
 
procedure TForm1.Button3Click(Sender: TObject);
begin
if (ListBox1.Items.Count > 0) and ListBox1.Selected[ListBox1.ItemIndex] then
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
Outline1.Items[Outline1.SelectedItem].Text := Trim(Edit4.Text + ' ' + GetAsn1Ids(true));
end;
 
function IsPositiveNumber(str: string): boolean;
var
i: integer;
begin
if (str = '') then
begin
result := false;
exit;
end;
 
result := true;
for i := 1 to Length(str) do
begin
if not (str[i] in ['0'..'9']) then
begin
result := false;
exit;
end;
end;
 
if (str[1] = '0') and (str <> '0') then
begin
result := false;
exit;
end;
end;
 
procedure TForm1.Button4Click(Sender: TObject);
var
ini: TIniFile;
i, di: integer;
oid, parent_oid, new_value: string;
nod: integer;
candidate: string;
begin
if Notebook1.PageIndex = 0 then new_value := Edit1.Text;
if Notebook1.PageIndex = 2 then new_value := Edit2.Text;
 
new_value := Trim(new_value);
if new_value = '' then exit;
 
if not IsPositiveNumber(new_value) then ShowError('Not a valid number');
 
if Notebook1.PageIndex = 0 then
begin
oid := Edit4.Text + '.' + new_value;
parent_oid := Edit4.Text;
end
else
begin
oid := 'OID:' + new_value;
parent_oid := 'OID:';
end;
 
if Outline1.Items[Outline1.SelectedItem].HasItems then
for i := Outline1.Items[Outline1.SelectedItem].GetFirstChild to Outline1.Items[Outline1.SelectedItem].GetLastChild do
begin
candidate := Copy(Trim(Outline1.Lines[i-1]), 1, Pos(' ',Trim(Outline1.Lines[i-1])+' ')-1);
if oid = candidate then ShowError('Item already exists');
end;
 
if (parent_oid = 'OID:') and (StrToInt(new_value) > 2) then ShowError('Number must not exceed 2');
if (parent_oid = 'OID:0') and (StrToInt(new_value) > 39) then ShowError('Number must not exceed 39');
if (parent_oid = 'OID:1') and (StrToInt(new_value) > 39) then ShowError('Number must not exceed 39');
 
ini := TIniFile.Create(DBPath+'OID.INI');
try
nod := Outline1.AddChild(Outline1.SelectedItem, oid);
ComboBox1.Text := ini.ReadString(parent_oid, 'ra', '');
 
di := ini.ReadInteger(parent_oid, 'delegates', 0);
ini.WriteInteger(parent_oid, 'delegates', di+1);
ini.WriteString(parent_oid, 'delegate'+IntToStr(di+1), oid);
 
ini.WriteString(oid, 'createdate', DateToStr(date));
ini.WriteString(oid, 'ra', ComboBox1.Text);
 
if Notebook1.PageIndex = 0 then Edit1.Text := '';
if Notebook1.PageIndex = 2 then Edit2.Text := '';
 
Outline1.SelectedItem := nod;
 
{ ini.UpdateFile; }
finally
ini.Free;
end;
 
ShowMessage('Created: ' + oid);
end;
 
procedure TForm1.Button7Click(Sender: TObject);
var
ini: TIniFile;
di: integer;
nod: integer;
sectionName, new_value, candidate: string;
i: integer;
begin
ini := TIniFile.Create(DBPath+'RA.INI');
try
new_value := Edit8.Text;
new_value := Trim(new_value);
if new_value = '' then exit;
 
sectionName := 'RA:'+new_value;
 
if Outline1.Items[Outline1.SelectedItem].HasItems then
for i := Outline1.Items[Outline1.SelectedItem].GetFirstChild to Outline1.Items[Outline1.SelectedItem].GetLastChild do
begin
candidate := Trim(Outline1.Lines[i-1]);
if sectionName = candidate then ShowError('Item already exists');
end;
 
di := ini.ReadInteger('RA:', 'count', 0);
ini.WriteInteger('RA:', 'count', di+1);
ini.WriteString('RA:', 'ra'+IntToStr(di+1), sectionName);
 
nod := Outline1.AddChild(Outline1.SelectedItem, sectionName);
 
ini.WriteString(sectionName, 'createdate', DateToStr(date));
 
Edit8.Text := '';
 
Outline1.SelectedItem := nod;
 
ini.WriteString(sectionName, 'createdate', DateToStr(date));
 
{ ini.UpdateFile; }
finally
ini.Free;
end;
 
ComboBox1.Items.Add(sectionName);
 
ShowMessage('Created: ' + sectionName);
end;
 
procedure IniReadSections(ini: TIniFile; Strings: TStrings);
const
BufSize = 16384;
var
Buffer, P: PChar;
FFileName: string;
begin
GetMem(Buffer, BufSize);
try
Strings.BeginUpdate;
try
Strings.Clear;
FFileName := ini.FileName;
if GetPrivateProfileString(nil, nil, nil, Buffer, BufSize,
@FFileName[1]) <> 0 then
begin
P := Buffer;
while P^ <> #0 do
begin
Strings.Add(StrPas(P));
Inc(P, StrLen(P) + 1);
end;
end;
finally
Strings.EndUpdate;
end;
finally
FreeMem(Buffer, BufSize);
end;
end;
 
procedure TForm1.Button6Click(Sender: TObject);
var
ini: TIniFile;
nod: TOutlineNode;
parent_oid, this_oid: string;
i: integer;
sl: TStringList;
begin
if MessageDlg('Are you sure?', mtConfirmation, mbYesNoCancel, 0) <> mrYes then exit;
 
ini := TIniFile.Create(DBPath+'OID.INI');
try
this_oid := Edit4.Text;
 
if Outline1.Items[Outline1.SelectedItem].Parent.Text = TITLE_OID then
parent_oid := 'OID:'
else
parent_oid := Copy(Outline1.Items[Outline1.SelectedItem].Parent.Text, 1,
Pos(' ', Outline1.Items[Outline1.SelectedItem].Parent.Text+' ')-1);
 
nod := Outline1.Items[Outline1.SelectedItem];
Outline1.SelectedItem := nod.Parent.Index;
Outline1.Delete(nod.Index);
 
ini.EraseSection(this_oid);
 
sl := TStringList.Create;
IniReadSections(ini, sl);
for i := 0 to sl.Count-1 do
begin
if Copy(sl.Strings[i], 1, Length(this_oid)+1) = this_oid+'.' then
begin
ini.EraseSection(sl.Strings[i]);
end;
end;
sl.Free;
 
for i := 1 to ini.ReadInteger(parent_oid, 'delegates', 0) do
begin
if ini.ReadString(parent_oid, 'delegate'+IntToStr(i), '') = this_oid then
begin
ini.WriteString(parent_oid, 'delegate'+IntToStr(i), '');
end;
end;
 
{ ini.UpdateFile; }
finally
ini.Free;
end;
end;
 
procedure TForm1.Button8Click(Sender: TObject);
var
ini: TIniFile;
nod: TOutlineNode;
parent_ra, this_ra: string;
i: integer;
begin
if MessageDlg('Are you sure?', mtConfirmation, mbYesNoCancel, 0) <> mrYes then exit;
 
ini := TIniFile.Create(DBPath+'RA.INI');
try
this_ra := Copy(Outline1.Items[Outline1.SelectedItem].Text, 1, Pos(' ',Outline1.Items[Outline1.SelectedItem].Text+' ')-1);
if Outline1.Items[Outline1.SelectedItem].Parent.Text = TITLE_RA then
parent_ra := 'RA:'
else
parent_ra := Copy(Outline1.Items[Outline1.SelectedItem].Parent.Text, 1,
Pos(' ', Outline1.Items[Outline1.SelectedItem].Parent.Text+' ')-1);
 
nod := Outline1.Items[Outline1.SelectedItem];
Outline1.SelectedItem := nod.Parent.Index;
Outline1.Delete(nod.Index);
 
ini.EraseSection(this_ra);
 
for i := 1 to ini.ReadInteger(parent_ra, 'count', 0) do
begin
if ini.ReadString(parent_ra, 'ra'+IntToStr(i), '') = this_ra then
begin
ini.WriteString(parent_ra, 'ra'+IntToStr(i), '');
end;
end;
 
ComboBox1.Items.Delete(ComboBox1.Items.IndexOf(this_ra));
 
{ ini.UpdateFile; }
finally
ini.Free;
end;
end;
 
function RandomStr(len: integer): string;
var
i: integer;
begin
result := '';
for i := 1 to len do
begin
result := result + Chr(ord('A') + Random(26));
end;
end;
 
procedure TForm1.Button2Click(Sender: TObject);
var
ini: TIniFile;
txtFile, asn1s: string;
modified: boolean;
begin
{ Attention: Do not rely on Outline1.Items[Outline1.SelectedItem].Text, because Button2.Click
will be called in Outline1OnChange()! }
 
ini := TIniFile.Create(DBPath+'OID.INI');
try
modified := false;
 
if ini.ReadString(Edit4.Text, 'ra', '') <> ComboBox1.Text then
begin
modified := true;
ini.WriteString(Edit4.Text, 'ra', ComboBox1.Text);
end;
 
if ini.ReadString(Edit4.Text, 'description', '') <> Edit3.Text then
begin
modified := true;
ini.WriteString(Edit4.Text, 'description', Edit3.Text);
end;
 
if ini.ReadBool(Edit4.Text, 'draft', false) <> CheckBox1.Checked then
begin
modified := true;
ini.WriteBool(Edit4.Text, 'draft', CheckBox1.Checked);
end;
 
if Memo1.Modified then
begin
modified := true;
if Trim(Memo1.Text) = '' then
begin
txtFile := ini.ReadString(Edit4.Text, 'information', '');
if FileExists(DBPath+txtFile) then
begin
DeleteFile(DBPath+txtFile);
end;
if txtFile <> '' then
begin
ini.WriteString(Edit4.Text, 'information', '')
end;
end
else
begin
txtFile := ini.ReadString(Edit4.Text, 'information', '');
if txtFile = '' then
begin
repeat
txtFile := RandomStr(8) + '.TXT';
until not FileExists(DBPath+txtFile);
ini.WriteString(Edit4.Text, 'information', txtFile);
end;
 
Memo1.Lines.SaveToFile(DBPath+txtFile);
Memo1.Modified := false;
end;
end;
 
asn1s := GetAsn1Ids(false);
if ini.ReadString(Edit4.Text, 'asn1id', '') <> asn1s then
begin
modified := true;
ini.WriteString(Edit4.Text, 'asn1id', asn1s);
end;
 
if modified then
begin
ini.WriteString(Edit4.Text, 'updatedate', DateToStr(Date));
{ ini.Updatefile; }
end;
finally
ini.Free;
end;
end;
 
function TForm1.GetAsn1Ids(onlyfirst: boolean): string;
var
i: integer;
begin
result := '';
for i := 0 to ListBox1.Items.Count-1 do
begin
if result = '' then
result := ListBox1.Items.Strings[i]
else if not onlyfirst then
result := result + ',' + ListBox1.Items.Strings[i];
end;
end;
 
function DirectoryExists(const Directory: string; FollowLink: Boolean): Boolean; { Source: Delphi 10.3.3 }
{
var
Code: Cardinal;
Handle: THandle;
LastError: Cardinal;
const
faSymLink = $00000400; // Available on POSIX and Vista and above
INVALID_FILE_ATTRIBUTES = DWORD($FFFFFFFF);
begin
Result := False;
Code := GetFileAttributes(PChar(Directory));
 
if Code <> INVALID_FILE_ATTRIBUTES then
begin
if faSymLink and Code = 0 then
Result := faDirectory and Code <> 0
else
begin
if FollowLink then
begin
Handle := CreateFile(PChar(Directory), GENERIC_READ, FILE_SHARE_READ, nil,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if Handle <> INVALID_HANDLE_VALUE then
begin
CloseHandle(Handle);
Result := faDirectory and Code <> 0;
end;
end
else if faDirectory and Code <> 0 then
Result := True
else
begin
Handle := CreateFile(PChar(Directory), GENERIC_READ, FILE_SHARE_READ, nil,
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if Handle <> INVALID_HANDLE_VALUE then
begin
CloseHandle(Handle);
Result := False;
end
else
Result := True;
end;
end;
end
else
begin
LastError := GetLastError;
Result := (LastError <> ERROR_FILE_NOT_FOUND) and
(LastError <> ERROR_PATH_NOT_FOUND) and
(LastError <> ERROR_BAD_PATHNAME) and
(LastError <> ERROR_INVALID_NAME) and
(LastError <> ERROR_BAD_NETPATH) and
(LastError <> ERROR_NOT_READY) and
(LastError <> ERROR_BAD_NET_NAME);
end;
}
begin
{ TODO }
end;
 
function IniValueExists(ini: TIniFile; const Section, Ident: string): Boolean;
var
S: TStrings;
begin
S := TStringList.Create;
try
ini.ReadSection(Section, S);
Result := S.IndexOf(Ident) > -1;
finally
S.Free;
end;
end;
 
function TForm1.DBPath: string;
var
ini: TIniFile;
begin
ini := TIniFile.Create('.\OIDPLUS.INI');
try
if not IniValueExists(ini, 'SETTINGS', 'DATA') then
begin
result := 'DB\';
ini.WriteString('SETTINGS', 'DATA', result);
{ ini.UpdateFile; }
end
else
begin
result := ini.ReadString('SETTINGS', 'DATA', 'DB\');
end;
if not DirectoryExists(result, true) then MkDir(result);
if not DirectoryExists(result, true) then
begin
ShowError('Cannot create database directory '+result);
end;
finally
ini.Free;
end;
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
Notebook1.PageIndex := 2;
Randomize;
end;
 
procedure TForm1.SaveChangesIfRequired;
begin
if Notebook1.PageIndex = 0 then Button2.Click; { Save changes }
if Notebook1.PageIndex = 1 then Button9.Click; { Save changes }
end;
 
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
SaveChangesIfRequired;
CanClose := true;
end;
 
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
Outline1.Items[Outline1.SelectedItem].Text := Trim(Edit4.Text+' '+GetAsn1Ids(true))+' [DRAFT]'
else
Outline1.Items[Outline1.SelectedItem].Text := Trim(Edit4.Text+' '+GetAsn1Ids(true));
end;
 
procedure TForm1.ShowError(msg: string);
begin
MessageDlg(msg, mtError, [mbOk], 0);
Abort;
end;
 
procedure TForm1.Button9Click(Sender: TObject);
var
ini: TIniFile;
txtFile, asn1s: string;
modified: boolean;
begin
{ Attention: Do not rely on Outline1.Items[Outline1.SelectedItem].Text, because Button9.Click
will be called in Outline1OnChange()! }
 
ini := TIniFile.Create(DBPath+'RA.INI');
try
modified := false;
if ini.ReadString(Edit9.Text, 'name', '') <> Edit11.Text then
begin
modified := true;
ini.WriteString(Edit9.Text, 'name', Edit11.Text);
end;
if ini.ReadString(Edit9.Text, 'email', '') <> Edit12.Text then
begin
modified := true;
ini.WriteString(Edit9.Text, 'email', Edit12.Text);
end;
if ini.ReadString(Edit9.Text, 'phone', '') <> Edit13.Text then
begin
modified := true;
ini.WriteString(Edit9.Text, 'phone', Edit13.Text);
end;
if modified then
begin
ini.WriteString(Edit9.Text, 'updatedate', DateToStr(Date));
{ ini.Updatefile; }
end;
finally
ini.Free;
end;
end;
 
procedure TForm1.Edit8KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Button7.Click;
Key := #0;
Exit;
end;
if Key = #8(*backspace*) then exit;
if Key in ['a'..'z'] then Key := UpCase(Key);
if not (Key in ['A'..'Z', '-']) then
begin
{ Beep; TODO }
Key := #0;
end;
end;
 
procedure TForm1.Edit11Change(Sender: TObject);
begin
Outline1.Items[Outline1.SelectedItem].Text := Trim(Edit9.Text + ' ' + Edit11.Text);
end;
 
procedure TForm1.ListBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If Key = 46(*DEL*) then
begin
Button3.Click;
Key := 0;
end;
end;
 
procedure TForm1.Edit7KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Button1.Click;
Key := #0;
end;
end;
 
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Button5.Click;
Key := #0;
end;
end;
 
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Button4.Click;
Key := #0;
end;
end;
 
procedure TForm1.Outline1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = 46(*DEL*) then
begin
if Copy(Outline1.Items[Outline1.SelectedItem].Text, 1, 4) = 'OID:' then
begin
Button6.Click;
end
else if Copy(Outline1.Items[Outline1.SelectedItem].Text, 1, 3) = 'RA:' then
begin
Button8.Click;
end
else
begin
{ Beep; TODO }
end;
 
Key := 0;
end;
end;
 
procedure TForm1.Outline1Click(Sender: TObject);
begin
Outline1Change(Sender, Outline1.SelectedItem);
end;
 
end.
/trunk_win311/OIDPLUS.INI
0,0 → 1,2
[SETTINGS]
DATA=DB\
/trunk_win311/OIDPLUS.RES
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk_win311/OIDPLUS.cfg
0,0 → 1,33
-$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-
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H-
-W-
-M
-$M16384,1048576
-K$00400000
/trunk_win311/OIDPLUS.dof
0,0 → 1,74
[Compiler]
A=1
B=0
C=0
D=1
E=0
F=0
G=1
H=1
I=1
J=1
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=0
Z=1
ShowHints=0
ShowWarnings=0
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
 
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
 
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=VCL40;VCLX40;VCLDB40;VCLDBX40;VCLSMP40;QRPT40;TEEUI40;TEEDB40;TEE40;DSS40;ibevnt40;VCLMID40;NMFAST40;INETDB40;INET40
Conditionals=
DebugSourceDirs=
UsePackages=0
 
[Parameters]
RunParams=
HostApplication=
 
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1031
CodePage=1252
 
[Version Info Keys]
FileVersion=1.0.0.0
/trunk_win311/OIDPLUS.dpr
0,0 → 1,15
program OIDPLUS;
 
uses
Forms,
SortStr in 'SortStr.pas',
Main in 'Main.pas' {Form1};
 
{$R *.RES}
 
begin
{ Application.Initialize; }
Application.Title := 'OIDPlus';
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
/trunk_win311/OIDPLUS.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk_win311/OIDPLUS.opt
0,0 → 1,34
[Compiler]
A=1
B=0
D=1
F=0
I=1
K=1
L=1
P=1
Q=0
R=0
S=1
T=0
U=1
V=1
W=0
X=1
Y=1
 
[Linker]
MapFile=0
LinkBuffer=0
DebugInfo=0
OptimizeExe=0
StackSize=16384
HeapSize=8192
 
[Directories]
OutputDir=
SearchPath=
Conditionals=
 
[Parameters]
RunParams=
/trunk_win311/SORTSTR.pas
0,0 → 1,118
unit SortStr;
 
interface
 
uses Classes;
 
procedure SortSL(sl: TStrings);
 
implementation
 
function Power(Base, Exponent: Integer): Integer;
var
i: integer;
begin
{ multiply the base to itself exponent number of times }
result := 1;
for i := 1 to Exponent do
begin
result := result * base;
end;
end;
 
{ Source: https://www.experts-exchange.com/questions/23086281/Natural-Order-String-Sort-Compare-in-Delphi.html }
function CompareStr(Str1,Str2: string):Integer;
var Num1,Num2:Double;
pStr1,pStr2:PChar;
Function IsNumber(ch:Char):Boolean;
begin
Result:=ch in ['0'..'9'];
end;
Function GetNumber(var pch:PChar):Double;
var FoundPeriod:Boolean;
Count:Integer;
begin
FoundPeriod:=False;
Result:=0;
While (pch^<>#0) and (IsNumber(pch^) or ((not FoundPeriod) and (pch^='.'))) do
begin
if pch^='.' then
begin
FoundPeriod:=True;
Count:=0;
end
else
begin
if FoundPeriod then
begin
Inc(Count);
Result:=Result+(ord(pch^)-ord('0'))*Power(10,-Count);
end
else Result:=Result*10+ord(pch^)-ord('0');
end;
Inc(pch);
end;
end;
begin
pStr1:=@Str1[1]; pStr2:=@Str2[1];
Result:=0;
While not ((pStr1^=#0) or (pStr2^=#0)) do
begin
if IsNumber(pStr1^) and IsNumber(pStr2^) then
begin
Num1:=GetNumber(pStr1); Num2:=GetNumber(pStr2);
if Num1<Num2 then Result:=-1
else if Num1>Num2 then Result:=1;
Dec(pStr1);Dec(pStr2);
end
else if pStr1^<>pStr2^ then
begin
if pStr1^<pStr2^ then Result:=-1 else Result:=1;
end;
if Result<>0 then Break;
Inc(pStr1); Inc(pStr2);
end;
Num1:=length(Str1); Num2:= length(Str2);
if (Result=0) and (Num1<>Num2) then
begin
if Num1<Num2 then Result:=-1 else Result:=1;
end;
end;
 
{ Source: https://delphi.fandom.com/wiki/Bubble_sort }
function BubbleSort( list: TStrings ): TStrings;
var
i, j: Integer;
temp: string;
begin
for i := 0 to list.Count - 1 do begin
for j := 0 to ( list.Count - 1 ) - i do begin
{ Condition to handle i=0 & j = 9. j+1 tries to access x[10] which
is not there in zero based array }
if ( j + 1 = list.Count ) then
continue;
if CompareStr(list.Strings[j], list.Strings[j+1]) > 0 then
begin
temp := list.Strings[j];
list.Strings[j] := list.Strings[j+1];
list.Strings[j+1] := temp;
end;
end;
end;
Result := list;
end;
 
procedure SortSL(sl: TStrings);
var
sl2: TStringList;
begin
if sl.Count > 1 then
begin
sl2 := TStringList.Create;
sl2.Assign(BubbleSort(sl));
sl2.Assign(sl);
sl2.Free;
end;
end;
 
end.
/trunk_win311/TODO.txt
0,0 → 1,2
 
Import/Export to OIDplus 2.0?
/trunk_win311/screenshot.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property