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) {
|
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;
|
Constraint c;
|
||||||
ZERO(&c);
|
ZERO(&c);
|
||||||
c.group = SS.GW.activeGroup;
|
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) {
|
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;
|
Group g;
|
||||||
ZERO(&g);
|
ZERO(&g);
|
||||||
g.visible = true;
|
g.visible = true;
|
||||||
|
|
|
@ -12,6 +12,23 @@ void SolveSpace::CheckLicenseFromRegistry(void) {
|
||||||
|
|
||||||
license.licensed =
|
license.licensed =
|
||||||
LicenseValid(license.line1, license.line2, license.users, license.key);
|
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) {
|
void SolveSpace::Init(char *cmdLine) {
|
||||||
|
@ -257,6 +274,7 @@ void SolveSpace::AddToRecentList(char *file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SolveSpace::GetFilenameAndSave(bool saveAs) {
|
bool SolveSpace::GetFilenameAndSave(bool saveAs) {
|
||||||
|
|
||||||
char newFile[MAX_PATH];
|
char newFile[MAX_PATH];
|
||||||
strcpy(newFile, saveFile);
|
strcpy(newFile, saveFile);
|
||||||
if(saveAs || strlen(newFile)==0) {
|
if(saveAs || strlen(newFile)==0) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ inline double WRAP_SYMMETRIC(double v, double n) {
|
||||||
#define isforname(c) (isalnum(c) || (c) == '_' || (c) == '-' || (c) == '#')
|
#define isforname(c) (isalnum(c) || (c) == '_' || (c) == '-' || (c) == '#')
|
||||||
|
|
||||||
typedef unsigned __int64 QWORD;
|
typedef unsigned __int64 QWORD;
|
||||||
|
typedef signed __int64 SQWORD;
|
||||||
typedef signed long SDWORD;
|
typedef signed long SDWORD;
|
||||||
typedef signed short SWORD;
|
typedef signed short SWORD;
|
||||||
|
|
||||||
|
@ -118,6 +119,7 @@ void InvalidateGraphics(void);
|
||||||
void PaintGraphics(void);
|
void PaintGraphics(void);
|
||||||
void GetGraphicsWindowSize(int *w, int *h);
|
void GetGraphicsWindowSize(int *w, int *h);
|
||||||
SDWORD GetMilliseconds(void);
|
SDWORD GetMilliseconds(void);
|
||||||
|
SQWORD GetUnixTime(void);
|
||||||
|
|
||||||
void dbp(char *str, ...);
|
void dbp(char *str, ...);
|
||||||
#define DBPTRI(tri) \
|
#define DBPTRI(tri) \
|
||||||
|
@ -641,6 +643,8 @@ public:
|
||||||
char line2[512];
|
char line2[512];
|
||||||
char users[512];
|
char users[512];
|
||||||
DWORD key;
|
DWORD key;
|
||||||
|
SQWORD firstUse;
|
||||||
|
int trialDaysRemaining;
|
||||||
} license;
|
} license;
|
||||||
static void MenuHelp(int id);
|
static void MenuHelp(int id);
|
||||||
void CleanEol(char *s);
|
void CleanEol(char *s);
|
||||||
|
|
|
@ -157,7 +157,13 @@ void TextWindow::ShowListOfGroups(void) {
|
||||||
Printf(false, "%Fg %s", SS.license.users);
|
Printf(false, "%Fg %s", SS.license.users);
|
||||||
} else {
|
} else {
|
||||||
Printf(false, "%Fx*** NO LICENSE FILE IS PRESENT ***");
|
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",
|
Printf(false, "%Fx buy at %Fl%f%Llhttp://www.solvespace.com/%E",
|
||||||
&ScreenGoToWebsite);
|
&ScreenGoToWebsite);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
|
|
||||||
|
@ -598,6 +599,13 @@ SDWORD GetMilliseconds(void)
|
||||||
return (SDWORD)d;
|
return (SDWORD)d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SQWORD GetUnixTime(void)
|
||||||
|
{
|
||||||
|
__time64_t ret;
|
||||||
|
_time64(&ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void InvalidateText(void)
|
void InvalidateText(void)
|
||||||
{
|
{
|
||||||
InvalidateRect(TextWnd, NULL, FALSE);
|
InvalidateRect(TextWnd, NULL, FALSE);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user