Change the licensing so that we run unrestricted for ninety days
after first execution, but limit the number of constraints to 30 after 90 days. [git-p4: depot-paths = "//depot/solvespace/": change = 1977]
This commit is contained in:
parent
ee6939a761
commit
1ac083a9a2
|
@ -103,6 +103,16 @@ void Constraint::ConstrainCoincident(hEntity ptA, hEntity ptB) {
|
|||
}
|
||||
|
||||
void Constraint::MenuConstrain(int id) {
|
||||
if(SK.constraint.n > 30) {
|
||||
if((!SS.license.licensed) && SS.license.trialDaysRemaining <= 0) {
|
||||
Error("The 90-day trial of SolveSpace has expired, and the light "
|
||||
"version does not support more than 30 constraints in a "
|
||||
"single file.\r\n\r\n"
|
||||
"Choose Help -> Website / Manual to purchase a license.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Constraint c;
|
||||
ZERO(&c);
|
||||
c.group = SS.GW.activeGroup;
|
||||
|
|
|
@ -17,14 +17,6 @@ void Group::AddParam(IdList<Param,hParam> *param, hParam hp, double v) {
|
|||
}
|
||||
|
||||
void Group::MenuGroup(int id) {
|
||||
if(!SS.license.licensed && SK.group.n >= 7) {
|
||||
Error("The free version of this software does not support more "
|
||||
"than six groups.\r\n\r\n"
|
||||
"To remove this restriction, please choose Help -> "
|
||||
"Website / Manual, and purchase a license.");
|
||||
return;
|
||||
}
|
||||
|
||||
Group g;
|
||||
ZERO(&g);
|
||||
g.visible = true;
|
||||
|
|
|
@ -12,6 +12,23 @@ void SolveSpace::CheckLicenseFromRegistry(void) {
|
|||
|
||||
license.licensed =
|
||||
LicenseValid(license.line1, license.line2, license.users, license.key);
|
||||
|
||||
// Now see if we've recorded a previous first use time in the registry. If
|
||||
// yes then we use that, otherwise we record the current time.
|
||||
SQWORD now = GetUnixTime();
|
||||
DWORD timeLow = CnfThawDWORD(0, "FirstUseLow");
|
||||
DWORD timeHigh = CnfThawDWORD(0, "FirstUseHigh");
|
||||
if(timeHigh == 0 && timeLow == 0) {
|
||||
CnfFreezeDWORD((DWORD)((now ) & 0xffffffff), "FirstUseLow");
|
||||
CnfFreezeDWORD((DWORD)((now >> 32) & 0xffffffff), "FirstUseHigh");
|
||||
license.firstUse = now;
|
||||
} else {
|
||||
license.firstUse = (((SQWORD)timeHigh) << 32) | ((SQWORD)timeLow);
|
||||
}
|
||||
|
||||
const int SECONDS_IN_DAY = 60*60*24;
|
||||
license.trialDaysRemaining = 90 -
|
||||
(int)(((now - license.firstUse))/SECONDS_IN_DAY);
|
||||
}
|
||||
|
||||
void SolveSpace::Init(char *cmdLine) {
|
||||
|
@ -257,6 +274,7 @@ void SolveSpace::AddToRecentList(char *file) {
|
|||
}
|
||||
|
||||
bool SolveSpace::GetFilenameAndSave(bool saveAs) {
|
||||
|
||||
char newFile[MAX_PATH];
|
||||
strcpy(newFile, saveFile);
|
||||
if(saveAs || strlen(newFile)==0) {
|
||||
|
|
14
solvespace.h
14
solvespace.h
|
@ -44,6 +44,7 @@ inline double WRAP_SYMMETRIC(double v, double n) {
|
|||
#define isforname(c) (isalnum(c) || (c) == '_' || (c) == '-' || (c) == '#')
|
||||
|
||||
typedef unsigned __int64 QWORD;
|
||||
typedef signed __int64 SQWORD;
|
||||
typedef signed long SDWORD;
|
||||
typedef signed short SWORD;
|
||||
|
||||
|
@ -118,6 +119,7 @@ void InvalidateGraphics(void);
|
|||
void PaintGraphics(void);
|
||||
void GetGraphicsWindowSize(int *w, int *h);
|
||||
SDWORD GetMilliseconds(void);
|
||||
SQWORD GetUnixTime(void);
|
||||
|
||||
void dbp(char *str, ...);
|
||||
#define DBPTRI(tri) \
|
||||
|
@ -636,11 +638,13 @@ public:
|
|||
};
|
||||
Crc crc;
|
||||
struct {
|
||||
bool licensed;
|
||||
char line1[512];
|
||||
char line2[512];
|
||||
char users[512];
|
||||
DWORD key;
|
||||
bool licensed;
|
||||
char line1[512];
|
||||
char line2[512];
|
||||
char users[512];
|
||||
DWORD key;
|
||||
SQWORD firstUse;
|
||||
int trialDaysRemaining;
|
||||
} license;
|
||||
static void MenuHelp(int id);
|
||||
void CleanEol(char *s);
|
||||
|
|
|
@ -157,7 +157,13 @@ void TextWindow::ShowListOfGroups(void) {
|
|||
Printf(false, "%Fg %s", SS.license.users);
|
||||
} else {
|
||||
Printf(false, "%Fx*** NO LICENSE FILE IS PRESENT ***");
|
||||
Printf(false, "%Fx eval / non-commercial use only");
|
||||
if(SS.license.trialDaysRemaining > 0) {
|
||||
Printf(false, "%Fx running as full demo, %d day%s remaining",
|
||||
SS.license.trialDaysRemaining,
|
||||
SS.license.trialDaysRemaining == 1 ? "" : "s");
|
||||
} else {
|
||||
Printf(false, "%Fx demo expired, now running in light mode");
|
||||
}
|
||||
Printf(false, "%Fx buy at %Fl%f%Llhttp://www.solvespace.com/%E",
|
||||
&ScreenGoToWebsite);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "solvespace.h"
|
||||
|
||||
|
@ -598,6 +599,13 @@ SDWORD GetMilliseconds(void)
|
|||
return (SDWORD)d;
|
||||
}
|
||||
|
||||
SQWORD GetUnixTime(void)
|
||||
{
|
||||
__time64_t ret;
|
||||
_time64(&ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void InvalidateText(void)
|
||||
{
|
||||
InvalidateRect(TextWnd, NULL, FALSE);
|
||||
|
|
Loading…
Reference in New Issue
Block a user