[ActiveLock-Development] CVS: alugen/app ALUGEN.vbp,1.1,1.2 frmMain.frm,1.1,1.2 products.ini,1.1,1.2
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-09-22 02:53:54
|
Update of /cvsroot/activelock/alugen/app In directory sc8-pr-cvs1:/tmp/cvs-serv10097 Modified Files: ALUGEN.vbp frmMain.frm products.ini frmMain.frx Log Message: Finished first pass of implementation. ALUGEN is now able to create product codes and liberation keys. Index: ALUGEN.vbp =================================================================== RCS file: /cvsroot/activelock/alugen/app/ALUGEN.vbp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ALUGEN.vbp 24 Aug 2003 18:10:22 -0000 1.1 +++ ALUGEN.vbp 22 Sep 2003 02:53:49 -0000 1.2 @@ -1,6 +1,7 @@ Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#stdole2.tlb#OLE Automation +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\System32\stdole2.tlb#OLE Automation Reference=*\G{D073A961-5725-46E8-B51F-B76EB02685B5}#1.0#0#..\lib\alugen.dll#ActiveLock Universal Generator Library +Reference=*\G{C3B56087-6690-42ED-8914-633AA166AB41}#1.0#0#..\..\activelock\src\ActiveLock2.dll#ActiveLock2 Object={5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0; MSFLXGRD.OCX Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX Form=frmMain.frm @@ -17,8 +18,8 @@ CompatibleMode="1" MajorVer=2 MinorVer=0 -RevisionVer=1 -AutoIncrementVer=1 +RevisionVer=2 +AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="The ActiveLock Software Group" VersionLegalCopyright="Copyright © 2003" Index: frmMain.frm =================================================================== RCS file: /cvsroot/activelock/alugen/app/frmMain.frm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- frmMain.frm 24 Aug 2003 18:10:22 -0000 1.1 +++ frmMain.frm 22 Sep 2003 02:53:49 -0000 1.2 @@ -43,8 +43,11 @@ TabPicture(1) = "frmMain.frx":0CE6 Tab(1).ControlEnabled= 0 'False Tab(1).Control(0)= "cmbProds" + Tab(1).Control(0).Enabled= 0 'False Tab(1).Control(1)= "frmKeyGen" + Tab(1).Control(1).Enabled= 0 'False Tab(1).Control(2)= "Label8" + Tab(1).Control(2).Enabled= 0 'False Tab(1).ControlCount= 3 Begin VB.CommandButton cmdRemove Caption = "&Remove" @@ -69,35 +72,36 @@ TabIndex = 13 Top = 1080 Width = 8175 - Begin VB.TextBox txtDays - BackColor = &H8000000F& + Begin VB.ComboBox cmbLicClass Height = 315 + ItemData = "frmMain.frx":0D02 Left = 1320 - Locked = -1 'True - TabIndex = 19 - Text = "30" - Top = 285 - Width = 1215 + List = "frmMain.frx":0D12 + Style = 2 'Dropdown List + TabIndex = 17 + Top = 585 + Width = 5655 End Begin VB.ComboBox cmbLicType Height = 315 - ItemData = "frmMain.frx":0D02 + ItemData = "frmMain.frx":0D95 Left = 1320 - List = "frmMain.frx":0D0F + List = "frmMain.frx":0DA2 Style = 2 'Dropdown List TabIndex = 18 Top = 0 Width = 5655 End - Begin VB.ComboBox cmbLicClass + Begin VB.TextBox txtDays + Alignment = 1 'Right Justify + BackColor = &H8000000F& Height = 315 - ItemData = "frmMain.frx":0D35 Left = 1320 - List = "frmMain.frx":0D45 - Style = 2 'Dropdown List - TabIndex = 17 - Top = 585 - Width = 5655 + Locked = -1 'True + TabIndex = 19 + Text = "30" + Top = 285 + Width = 1215 End Begin VB.TextBox txtReqCodeIn Height = 315 @@ -169,7 +173,7 @@ Height = 255 Left = 2640 TabIndex = 20 - Top = 285 + Top = 315 Width = 1335 End End @@ -337,14 +341,14 @@ ' ALUGEN Executable Main Form ' ' @author th...@us... -' @version 2.0.0 +' @version 2.0.2 ' @date 20030815 ' '* /////////////////////////////////////////////////////////////////////// ' / MODULE TO DO LIST / ' /////////////////////////////////////////////////////////////////////// ' -' @todo Form_Activate() - load products from INI file +' @todo TODO1 ' ' @@ -353,7 +357,9 @@ ' /////////////////////////////////////////////////////////////////////// ' @history ' <pre> -' 08.15.03 - th2tran - Created +' 08.15.03 - th2tran - Created +' 09.21.03 - th2tran - Finished first pass of implementation. +' ALUGEN is now able to create product codes and liberation keys. ' ' </pre> @@ -361,7 +367,9 @@ ' / MODULE CODE BEGINS BELOW THIS LINE / ' /////////////////////////////////////////////////////////////////////// Option Explicit -Private GeneratorInstance As ALUGenLib.IALUGenerator +Private GeneratorInstance As ALUGENLib.IALUGenerator +Private fDisableNotifications As Boolean +Private ActiveLock As ActiveLock2.IActiveLock Private Sub gridProds_CellDataChanged(Row As Long, Col As Long, OldValue As Variant, NewValue As Variant) Dim nRow As Integer @@ -377,6 +385,53 @@ Debug.Print "gridProds_CellDataChanged" End Sub +Private Sub cmbLicClass_Click() + If cmbLicClass = "Class 1 - Lock To MAC" Then + ActiveLock.LockType = lockMAC + ElseIf cmbLicClass = "Class 2 - Lock To Windows Serial" Then + ActiveLock.LockType = lockWindows + ElseIf cmbLicClass = "Class 3 - Lock To Computer Name" Then + ActiveLock.LockType = lockComp + ElseIf cmbLicClass = "Class 4 - Lock To Hard Drive Serial" Then + ActiveLock.LockType = lockHD + End If +End Sub + +Private Sub cmbLicType_Click() + With ActiveLock + If cmbLicType = "Periodic" Then + .LicenseType = allicPeriodic + ElseIf cmbLicType = "Permanent" Then + .LicenseType = allicPermanent + ElseIf cmbLicType = "Time Locked" Then + .LicenseType = allicTimeLocked + Else + .LicenseType = allicNone + End If + ' enable the days edit box + If cmbLicType = "Periodic" Or cmbLicType = "Time Locked" Then + txtDays.Locked = False + txtDays.BackColor = &H80000005 + Else + txtDays.Locked = True + txtDays.BackColor = &H80000011 + End If + If cmbLicType = "Time Locked" Then + lblExpiry = "Expires on date:" + txtDays = Format$(Now() + 30, "YYYY/MM/DD") + lblDays = "YYYY/MM/DD" + Else + lblExpiry = "Expires after:" + txtDays = "30" + lblDays = "Day(s)" + End If + End With +End Sub + +Private Sub cmbProds_Click() + ' TODO +End Sub + Private Sub cmdAdd_Click() AddRow txtName, txtVer, txtCode1, txtCode2 cmdAdd.Enabled = False ' disallow repeated clicking of Add button @@ -386,8 +441,10 @@ Private Sub cmdCodeGen_Click() Screen.MousePointer = vbHourglass + fDisableNotifications = True txtCode1 = "" txtCode2 = "" + fDisableNotifications = False Enabled = False DoEvents On Error GoTo Done @@ -442,11 +499,15 @@ Dim strName$, strVer$ strName = Trim$(arrProdVer(0)) strVer = Trim$(arrProdVer(1)) + With ActiveLock + .SoftwareName = strName + .SoftwareVersion = strVer + End With Dim strExpire$ strExpire = GetExpirationDate() Dim strLibKey As String - strLibKey = GeneratorInstance.GenKey(strName, strVer, txtReqCodeIn, 0, strExpire) + strLibKey = GeneratorInstance.GenKey(ActiveLock, txtReqCodeIn, strExpire) txtLibKey = strLibKey End Sub @@ -472,13 +533,13 @@ SelStart = .RowSel SelEnd = .Row End If - Dim i% - For i = SelEnd To SelStart Step -1 - strName = .TextMatrix(i, 0) + Dim I% + For I = SelEnd To SelStart Step -1 + strName = .TextMatrix(I, 0) If txtName = strName Then fEnableAdd = True End If - RemoveRow i + RemoveRow I Next .RowSel = .Row ' negate current selections End With @@ -495,13 +556,16 @@ End Sub Private Sub Form_Activate() - Set GeneratorInstance = ALUGenLib.GeneratorInstance() - GeneratorInstance.StoragePath = App.Path & "\products.ini" - '@todo Populate Product List on Product Code Generator tab and Key Gen tab with product info from products.ini txtName.SetFocus End Sub Private Sub Form_Load() + ' Initialize AL + Set ActiveLock = ActiveLock2.NewInstance() + ' Initialize Generator + Set GeneratorInstance = ALUGENLib.GeneratorInstance() + GeneratorInstance.StoragePath = App.Path & "\products.ini" + ' Initialize GUI InitUI End Sub @@ -520,15 +584,20 @@ gridProds.BackColorSel = &H8000000D ' navy blue gridProds.ForeColorSel = &H80000005 ' white End If - + fDisableNotifications = True txtName = gridProds.TextMatrix(gridProds.Row, 0) txtVer = gridProds.TextMatrix(gridProds.Row, 1) txtCode1 = gridProds.TextMatrix(gridProds.Row, 2) txtCode2 = gridProds.TextMatrix(gridProds.Row, 3) cmdRemove.Enabled = True + fDisableNotifications = False End Sub -Private Sub AddRow(Name As String, Ver As String, Code1 As String, Code2 As String) +'' +' Add a Product Row to the GUI. +' If fUpdateStore is True, then product info is also saved to the store. +' +Private Sub AddRow(Name As String, Ver As String, Code1 As String, Code2 As String, Optional fUpdateStore As Boolean = True) ' Update the view With gridProds .Rows = .Rows + 1 @@ -542,9 +611,11 @@ ' .SetFocus ' show selected row End With ' Call ALUGENLib.IALUGenerator to add product - Dim ProdInfo As ALUGenLib.ProductInfo - Set ProdInfo = ALUGenLib.CreateProductInfo(Name, Ver, Code1, Code2) - Call GeneratorInstance.SaveProduct(ProdInfo) + Dim ProdInfo As ALUGENLib.ProductInfo + Set ProdInfo = ALUGENLib.CreateProductInfo(Name, Ver, Code1, Code2) + If fUpdateStore Then + Call GeneratorInstance.SaveProduct(ProdInfo) + End If cmbProds.AddItem Name & " - " & Ver cmdRemove.Enabled = True End Sub @@ -572,7 +643,7 @@ .TextMatrix(Row, 3) = Code2 End With ' update the store file - GeneratorInstance.SaveProduct ALUGenLib.CreateProductInfo(strName, strVer, Code1, Code2) + GeneratorInstance.SaveProduct ALUGENLib.CreateProductInfo(strName, strVer, Code1, Code2) End Sub Private Sub gridProds_RowColChange() @@ -587,7 +658,9 @@ If txtReqCodeIn = "" Then cmdKeyGen.Enabled = False Else - cmdKeyGen.Enabled = True + If cmbProds <> "" Then + cmdKeyGen.Enabled = True + End If End If End Sub @@ -599,6 +672,7 @@ Private Sub txtCode1_Change() UpdateAddButtonStatus + If fDisableNotifications Then Exit Sub With gridProds If .Rows = 1 Then Exit Sub ' update current row @@ -607,6 +681,7 @@ End Sub Private Sub txtCode2_Change() + If fDisableNotifications Then Exit Sub With gridProds If .Rows = 1 Then Exit Sub ' update current row @@ -638,10 +713,10 @@ ' Private Function CheckDuplicate(Name As String, Ver As String) As Boolean CheckDuplicate = False - Dim i% - For i = 0 To gridProds.Rows - 1 - If gridProds.TextMatrix(i, 0) = Name Then - If gridProds.TextMatrix(i, 1) = Ver Then + Dim I% + For I = 0 To gridProds.Rows - 1 + If gridProds.TextMatrix(I, 0) = Name Then + If gridProds.TextMatrix(I, 1) = Ver Then CheckDuplicate = True Exit Function End If @@ -653,6 +728,9 @@ ' Initialize the GUI with the proper grid headings and alignments ' Private Sub InitUI() + ' Init Default license class + cmbLicType = "Time Locked" + cmbLicClass = "Class 1 - Lock To MAC" With gridProds .Clear .Rows = 1 @@ -662,5 +740,31 @@ .ColAlignment(2) = flexAlignLeftCenter .ColAlignment(3) = flexAlignLeftCenter End With + ' Populate Product List on Product Code Generator tab + ' and Key Gen tab with product info from products.ini + Dim arrProdInfos() As ProductInfo + arrProdInfos = GeneratorInstance.RetrieveProducts() + If IsArrayEmpty(arrProdInfos) Then Exit Sub + + Dim I% + For I = LBound(arrProdInfos) To UBound(arrProdInfos) + PopulateUI arrProdInfos(I) + Next gridProds_Click +End Sub +Private Function IsArrayEmpty(arrVar As Variant) As Boolean + IsArrayEmpty = True + On Error GoTo ErrHandler + Dim lb As Long + lb = UBound(arrVar, 1) ' this will raise an error if the array is empty + IsArrayEmpty = False ' If we managed to get to here, then it's not empty + Exit Function +ErrHandler: + ' return false +End Function + +Private Sub PopulateUI(ProdInfo As ALUGENLib.ProductInfo) + With ProdInfo + AddRow .Name, .Version, .Code1, .Code2, False + End With End Sub Index: products.ini =================================================================== RCS file: /cvsroot/activelock/alugen/app/products.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- products.ini 24 Aug 2003 18:10:22 -0000 1.1 +++ products.ini 22 Sep 2003 02:53:49 -0000 1.2 @@ -1,8 +1,5 @@ [TestApp 1.0] +Name=TestApp Version=1.0 -Code1=AAAAB3NzaC1yc2EAAAABJQAAAIByliy2wJR4Rx10Vpm8OinIqKRSnn3naIBKeVvju69tSV+AF4KEHlU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7d6bSToB5TtTVAZoS198yfTqimLJd3E4OWxPtkbri681kNzd4iZESYj+QUGyCYxRbL0HyW/NznVplWqoN2jXAAAAQQDQHxsUhcRLmxm0wOZAlRqmzwaLaqoC6zvAj+nLuYCFFolb7+EjOvEbpuDN0UC3Jh/od4wiOutK3lhir/mxMTnn +Code1=AAAAB3NzaC1yc2EAAAABJQAAAIBmyH+sZ9eXI33MbVFWR85fsHLXndX2WaNokSaqxYltluQx2sX4T81r7jazTFxcczllwuMEauhL1rTqXCma0uA6xAQGajRorXeLcrW5OHIut7+HprXy9MTUp0SwsVFJJjDaRmodPaCBTUPD006lG7LNN5/jO/Cj8dNf6lVHy+VnIQ== +Code2=AAAAgGE6M5U/omxf190NdnQ2Fj7XV+C35hKMJPQ2RyvrSqXvmZbxitYh+atJHvyiLdrpiVJsPoejZh45zbsY6RXqEl/k1Hm1bT1IggEgHCb7oSnNoiiRLT+b9Y+ffKbbURevs2bbLIcG/yfEuamRlHYj1jIwF0OFEsO7XfP4M8hruZ8JAAAAQLiaDLpPqlhoNTlTMps3k8/Cbl3gJqICKzZIITO268ZRo0FK+5r+9QTupf+ZOXR2LbIincI/Wg+3cYOMsb992g8AAABAjolbxDa/YC4h1ZyJShPjviXJ0+8bXW6clS+klcD7MRo/UJ+aNNWkEfc+rtalnpwEENJkf0z+n7FLk5kokzWbzwAAAEBohtMIkBT9z5BB/HhS2LhJJUqaD5F1fHtIZRZxQExTYvNdFG8sT0ApP/BY8fCfT7JavHwWDSM/inUvOFRGRVMG Index: frmMain.frx =================================================================== RCS file: /cvsroot/activelock/alugen/app/frmMain.frx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvskWQCUh and /tmp/cvsIBMgBp differ |