from
calcDateLicenseExpiry
by Martyn Dorey
An effective way to put a time bar on your distributed files, so you can protect your intellectual c
|
| calcDateLicenseExpiry(dteNumLicence,txtDir)
|
function sclrExpire = calcDateLicenseExpiry(dteNumLicence,txtDir)
%MED 8 March 2005
%This function will calculate the expiry date so you can compile & license your own models
%Rather than check a date against the system date this operation checks the
%last date files changed on the txtDir drive.
%txtDir is c:\windows by default
%For example you opening function will look like this:
%
% dteEnd = datenum('30-Jun-2005','dd-mmm-yyyy');
% sclrExpire = calcDateLicenseExpiry(dteEnd);
% if sclrExpire>0,
% txtErr= 'Licence expired please contact xxx.yyyy@address.com';
% uiwait(msgbox(txtErr));
% error(txtErr);
% end
try
if ~exist('txtDir','var'),
txtDir =['c:\windows'];
end
files = dir(txtDir);
for i = 1:length(files),
if datenum(files(i).date)> dteNumLicence,
sclrExpire =1;
return
end
end
sclrExpire = 0;
catch
sclrExpire = 1;
end
|
|
Contact us at files@mathworks.com