-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
2,675 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
; Script generated by the Inno Setup Script Wizard. | ||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! | ||
#define ApplicationName 'ESP8266 Wizard' | ||
#define ApplicationVersion '1.4.0' | ||
#define OldAppId '{3793A16D-841C-4E6C-931B-9D5AD44410C9}' | ||
#define Revision 'OpenSource (1.0)' | ||
|
||
[Setup] | ||
; NOTE: The value of AppId uniquely identifies this application. | ||
; Do not use the same AppId value in installers for other applications. | ||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) | ||
AppId={#ApplicationName} | ||
AppName={#ApplicationName} | ||
AppVersion={#ApplicationVersion} | ||
AppPublisher=Mathieu St-Laurent - Relentless research lab | ||
DefaultDirName={pf}\Relentless.rad\ESP8266Wizard | ||
DisableDirPage=no | ||
DisableProgramGroupPage=yes | ||
OutputDir=Release | ||
OutputBaseFilename={#ApplicationName} {#ApplicationVersion} - {#Revision} | ||
SetupIconFile=ESPressif.ico | ||
UninstallDisplayIcon=ESPressif.ico | ||
Compression=lzma | ||
SolidCompression=yes | ||
WizardImageFile=WIFI.bmp | ||
WizardSmallImageFile=WIFISmall.bmp | ||
|
||
[Languages] | ||
Name: english; MessagesFile: compiler:Default.isl | ||
|
||
[Files] | ||
Source: _Distrib\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs | ||
|
||
[Run] | ||
|
||
[UninstallRun] | ||
|
||
[Code] | ||
var | ||
LicenseLinkLabel: TLabel; | ||
//VSOptionsPage: TInputOptionWizardPage; | ||
VSIXInstallerPaths: TStrings; | ||
VSVersions: TStrings; | ||
//procedure ClickVSVersions(Sender: TObject); | ||
//var | ||
// i: Integer; | ||
// f: Boolean; | ||
//begin | ||
// f := False; | ||
// for i := 0 to VSOptionsPage.CheckListBox.Items.Count - 1 do | ||
// if (VSOptionsPage.Values[i]) then | ||
// begin | ||
// f := True; | ||
// break; | ||
// end; | ||
// Wizardform.NextButton.Enabled := f; | ||
//end; | ||
procedure FillVsVersions(); | ||
var | ||
sRegKey: String; | ||
sRegValue: String; | ||
begin | ||
//check vs2017 | ||
sRegKey := 'VisualStudio.DTE.15.0'; | ||
if (RegKeyExists(HKCR, sRegKey)) then | ||
begin | ||
sRegKey := 'SOFTWARE\Microsoft\VisualStudio\SxS\VS7'; | ||
if (RegQueryStringValue(HKLM, sRegKey, '15.0', sRegValue)) then | ||
begin | ||
VSVersions.Add('VS2017'); | ||
VSIXInstallerPaths.Add(sRegValue + 'Common7\IDE\'); | ||
end; | ||
end; | ||
end; | ||
procedure OpenBrowser(Url: string); | ||
var | ||
ErrorCode: Integer; | ||
begin | ||
ShellExec('open', Url, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode); | ||
end; | ||
procedure SourcesLinkClick(Sender: TObject); | ||
begin | ||
OpenBrowser('https://www.example.com/'); | ||
end; | ||
procedure InitializeWizard; | ||
var | ||
//i,ind: Integer; | ||
SourcesLink: TLabel; | ||
begin | ||
LicenseLinkLabel := TLabel.Create(WizardForm); | ||
LicenseLinkLabel.Parent := WizardForm; | ||
LicenseLinkLabel.Left := 8; | ||
LicenseLinkLabel.Top := WizardForm.ClientHeight - LicenseLinkLabel.ClientHeight - 32; | ||
LicenseLinkLabel.Caption := '{#SetupSetting("AppPublisher")}' + #13#10 + 'Revision by : {#Revision}'; | ||
SourcesLink := TLabel.Create(WizardForm); | ||
SourcesLink.Parent := WizardForm; | ||
SourcesLink.Left := LicenseLinkLabel.Left; | ||
SourcesLink.Top := LicenseLinkLabel.Top + LicenseLinkLabel.Height; | ||
SourcesLink.Caption := 'Get source code'; | ||
SourcesLink.OnClick := @SourcesLinkClick; | ||
SourcesLink.ParentFont := True; | ||
SourcesLink.Font.Style := SourcesLink.Font.Style + [fsUnderline, fsBold]; | ||
SourcesLink.Font.Color := clBlue; | ||
SourcesLink.Cursor := crHand; | ||
//VSOptionsPage := CreateInputOptionPage(wpSelectComponents, | ||
// 'Visual Studio version', 'Select version of Visual Studio', 'Select version of Visual Studio', false, false); | ||
//VSOptionsPage.CheckListBox.OnClickCheck := @ClickVSVersions; | ||
//VSOptionsPage.CheckListBox.Enabled := False; | ||
//for i := 0 to VSVersions.Count - 1 do | ||
//begin | ||
// ind := VSOptionsPage.Add(VSVersions[i]); | ||
// VSOptionsPage.Values[ind] := True; | ||
//end; | ||
end; | ||
function InitializeSetup: Boolean; | ||
var | ||
sRegKey: String; | ||
sUnInstall: String; | ||
sVersion: String; | ||
Prompt: Integer; | ||
//OLD Versions are deprecated | ||
//VSIXBefore: Boolean; | ||
begin | ||
VSIXInstallerPaths := TStringList.Create(); | ||
VSVersions := TStringList.Create(); | ||
FillVsVersions(); | ||
sRegKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#OldAppId}_is1'; | ||
if (RegQueryStringValue(HKLM, sRegKey, 'UninstallString', sUnInstall)) then | ||
RegQueryStringValue(HKLM, sRegKey, 'DisplayVersion', sVersion); | ||
sRegKey := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}_is1'); | ||
if (RegQueryStringValue(HKLM, sRegKey, 'UninstallString', sUnInstall)) then | ||
RegQueryStringValue(HKLM, sRegKey, 'DisplayVersion', sVersion); | ||
if (sUnInstall <> '') then | ||
begin | ||
if (sVersion > '{#SetupSetting("AppVersion")}') then | ||
begin | ||
MsgBox('Current version of ESP8266 Wizard was newer.'#13'Install will be canceled', mbInformation, MB_OK); | ||
Result:= False; | ||
end else | ||
begin | ||
//OLD Versions are deprecated | ||
//VSIXBefore:=False; | ||
//if (sVersion < '1.2.3') then VSIXBefore:=True; | ||
if (sVersion = '{#SetupSetting("AppVersion")}') then | ||
Prompt:= MsgBox(ExpandConstant('Same version was detected. Do you want to reinstall it?'), mbInformation, MB_YESNO) | ||
else | ||
Prompt:= MsgBox(ExpandConstant('An older version was detected. Do you want to uninstall it?'), mbInformation, MB_YESNO); | ||
if (Prompt = IDYES) then | ||
begin | ||
sUnInstall:= RemoveQuotes(sUnInstall); | ||
Exec(ExpandConstant(sUnInstall), '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, Prompt); | ||
//OLD Versions are deprecated | ||
//if (VSIXBefore) then | ||
//begin | ||
// ExtractTemporaryFiles('{app}\VSIXInstaller.exe*'); | ||
// ExtractTemporaryFiles('{app}\VSIXAssemblies\*'); | ||
// ExtractTemporaryFiles('{app}\PkgdefMgmt.dll'); | ||
// ExtractTemporaryFiles('{app}\VSHiveStub.exe'); | ||
// Exec(ExpandConstant('{tmp}\')+'{app}\VSIXInstaller', '/uninstall:"ESP8266Wizard.Mathieu St-Laurent.2369a963-05dc-4156-8143-c93633763702"', '', SW_SHOW, ewWaitUntilTerminated, Prompt); | ||
//end; | ||
Result:= True; | ||
end else | ||
Result:= False; | ||
end | ||
end else | ||
Result:= True; | ||
end; | ||
function PrepareToInstall(var NeedsRestart: Boolean): String; | ||
var | ||
Prompt: Integer; | ||
begin | ||
NeedsRestart := False; | ||
if (VSIXInstallerPaths.Count > 0) then | ||
begin | ||
MsgBox(VSIXInstallerPaths[0], mbInformation, MB_OK); | ||
ExtractTemporaryFiles('{app}\ESP8266Wizard.vsix'); | ||
MsgBox(ExpandConstant('{tmp}\')+'{app}\ESP8266Wizard.vsix', mbInformation, MB_OK); | ||
Exec(VSIXInstallerPaths[0] + 'VSIXInstaller', | ||
ExpandConstant('{tmp}\')+'{app}\ESP8266Wizard.vsix', | ||
'', SW_SHOW, ewWaitUntilTerminated, Prompt); | ||
end; | ||
Result:= ''; | ||
end; | ||
function InitializeUninstall: Boolean; | ||
var | ||
Prompt: Integer; | ||
begin | ||
VSIXInstallerPaths := TStringList.Create(); | ||
VSVersions := TStringList.Create(); | ||
FillVsVersions(); | ||
if (VSIXInstallerPaths.Count > 0) then | ||
begin | ||
Exec(VSIXInstallerPaths[0] + 'VSIXInstaller', | ||
'/uninstall:"ESP8266Wizard.Mathieu St-Laurent.2369a963-05dc-4156-8143-c93633763702"', | ||
'', SW_SHOW, ewWaitUntilTerminated, Prompt); | ||
end; | ||
Result:= True; | ||
end; | ||
106 changes: 106 additions & 0 deletions
106
Sources/ESP8266Wizard/ESP8266ClassWizard/ESP8266ClassWizard.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#include "stdafx.h" | ||
#include "MyForm.h" | ||
|
||
namespace ESP8266ClassWizard | ||
{ | ||
public ref class ESP8266ClassWizard : public IWizard | ||
{ | ||
private: | ||
DTE^ m_dte; | ||
|
||
public: | ||
MyForm MainDlg; | ||
String^ Destination; | ||
String^ ProjectName; | ||
|
||
void virtual BeforeOpeningFile(ProjectItem^ projectItem) { ; } | ||
void virtual ProjectFinishedGenerating(Project^ project) { ; } | ||
void virtual ProjectItemFinishedGenerating(ProjectItem^ projectItem) { ; } | ||
void virtual RunFinished() | ||
{ | ||
if (MainDlg.IsFromSdk == true) | ||
{ | ||
String^ SDKExample = MainDlg.BaseFolder + MainDlg.SDKREL + "\\" + MainDlg.SDKVER + "\\Examples\\" + MainDlg.SDKEXAMPLE + "\\"; | ||
String^ Filter = "*.c;*.h;*.cpp"; | ||
List<String^>^ ExampleFileList = gcnew List<String^>(); | ||
|
||
for each (String^ FileFilter in Filter->Split(';')) | ||
ExampleFileList->AddRange(System::IO::Directory::GetFiles(SDKExample, FileFilter, IO::SearchOption::AllDirectories)); | ||
|
||
int SelectItem = 1; | ||
Project^ CurrentProj; | ||
String^ SeekProj = Destination + "\\" + ProjectName + ".vcxproj"; | ||
do | ||
{ | ||
CurrentProj = m_dte->Solution->Projects->Item(SelectItem++); | ||
} | ||
while (String::Compare(CurrentProj->FileName, SeekProj, true)); | ||
|
||
CleanNonNeccessary(CurrentProj->ProjectItems); | ||
|
||
for each (String^ Source in ExampleFileList) | ||
{ | ||
String^ Destination = Source->Replace(SDKExample, ""); | ||
CurrentProj->ProjectItems->AddFromTemplate(Source, Destination); | ||
} | ||
} | ||
} | ||
|
||
void CleanNonNeccessary(ProjectItems^ BaseItem) | ||
{ | ||
for (int i = 1; i <= BaseItem->Count; i++) | ||
{ | ||
ProjectItem^ Items = BaseItem->Item(i); | ||
|
||
for (int j = 0; j < Items->FileCount; j++) | ||
if (Items->FileNames[j]->Contains("user_main.c") || Items->FileNames[j]->Contains("user_config.h")) | ||
Items->Delete(); | ||
|
||
if (Items->ProjectItems != nullptr) | ||
CleanNonNeccessary(Items->ProjectItems); | ||
} | ||
} | ||
|
||
void virtual RunStarted(Object^ automationObject, Dictionary<String^, String^>^ replacementsDictionary, WizardRunKind runKind, array<System::Object ^, 1>^ customParams) | ||
{ | ||
m_dte = (DTE^)automationObject; | ||
|
||
Destination = replacementsDictionary["$destinationdirectory$"]; | ||
ProjectName = replacementsDictionary["$projectname$"]; | ||
|
||
MainDlg.BaseFolder = (String^)Registry::GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ESP8266 Wizard_is1", "InstallLocation", "") + "ESPressif\\"; | ||
if (!IO::Directory::Exists(MainDlg.BaseFolder)) | ||
{ | ||
MessageBox::Show("Some folder seem missing, please repair or reinstall"); | ||
throw gcnew WizardBackoutException(""); | ||
} | ||
|
||
/***Secure Tabale Value Between File/New & Recent ***/ | ||
String^ SolutionName = replacementsDictionary["$specifiedsolutionname$"]; | ||
|
||
if (!SolutionName) | ||
SolutionName = replacementsDictionary["$projectname$"]; | ||
|
||
if (!replacementsDictionary["$solutiondirectory$"]->Contains(SolutionName)) | ||
replacementsDictionary["$solutiondirectory$"] += "\\" + SolutionName; | ||
/*** End-Secure **************************************/ | ||
|
||
if (MainDlg.ShowDialog() == DialogResult::Cancel) | ||
{ | ||
// Where I delete Project Folder | ||
// After Secure It's gonna be more like this and secure gonna be removed. | ||
// if (replacementsDictionary["$solutiondirectory$"]->Contains(SolutionName)) delete | ||
System::IO::Directory::Delete(replacementsDictionary["$solutiondirectory$"], true); | ||
throw gcnew WizardBackoutException(""); | ||
} | ||
|
||
// add an entry to the dictionary to specify the string used for the $greeting$ token | ||
replacementsDictionary->Add("$SDKREL$", MainDlg.SDKREL); | ||
replacementsDictionary->Add("$SDKVER$", MainDlg.SDKVER); | ||
replacementsDictionary->Add("$ProjectExt$", "vcxproj"); | ||
} | ||
|
||
bool virtual ShouldAddProjectItem(String^ filePath) { return true; } | ||
}; | ||
} | ||
|
Binary file not shown.
Oops, something went wrong.