Commit 0421dc0d by Tapio Haapala

Merge branch 'master' of gitlab.codecrew.fi:liv/moya-info-tools

2 parents cc985b4d 330bb628
Showing with 2332 additions and 460 deletions
......@@ -34,6 +34,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdateLib">
<HintPath>..\..\..\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -89,6 +92,9 @@
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>$(SolutionDir)/../../../\AutoUpdate\src\AutoPublish\bin\Debug\AutoPublish.exe $(ConfigurationName) $(ProjectName) $(SolutionDir) $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UploadUser>f-solu-06</UploadUser>
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>software.f-solutions.fi</UploadHost>
<ProjectName>BarcodeScannerClient</ProjectName>
<Customers>
<Customer>
<Name>moya</Name>
<Password>moya</Password>
<AllowDevelopmentReleases>false</AllowDevelopmentReleases>
<Obfuscate>false</Obfuscate>
</Customer>
</Customers>
<ForceUpdate>false</ForceUpdate>
<DisableUpdate>false</DisableUpdate>
</AutoPublishSettings>
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIFZTCCBE2gAwIBAgIHJ+f2v0HETTANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm
aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5
IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky
ODcwHhcNMTExMTE1MDAxMjI2WhcNMTQxMTE1MDAxMjI2WjBZMRkwFwYDVQQKFBAq
LmYtc29sdXRpb25zLmZpMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0
ZWQxGTAXBgNVBAMUECouZi1zb2x1dGlvbnMuZmkwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCd7ksvWMcxBJiXjX3iOUnXvXynUbFA/rImWXGVHp43UI8K
SUrB8JP3zwRHj2j1ovvtr+Yo39cqAt5+ShtvlGyJB65/JqwyrACCDswY5l0gZNJJ
ijEgzAldWfiVEqR18AIdrjH8WbIRHFWxc3goPgJBfy6QYKnHENyZQeRXu9kc+XlS
YCda3wM5UiDgeUCZYpvsDqUxBBl3dcTDjoEBBYn22TUuMsyikvFHjmTLu8RCj1pv
jW1b2nCwbcJRr+w7VhLCRNO6fx3+T/8+dHkgE/HIggsOmR5weqfqo+w9yyF53YPu
QGzGZ4Yx74B4IDX0AP0MhADHHXEL0fv0SKgLAV+rAgMBAAGjggG+MIIBujAPBgNV
HRMBAf8EBTADAQEAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNV
HQ8BAf8EBAMCBaAwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5
LmNvbS9nZHMxLTU5LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYI
KwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3Np
dG9yeS8wgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3Au
Z29kYWRkeS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdv
ZGFkZHkuY29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSME
GDAWgBT9rGEyk2xF1uLuhV+auud2mWjM5zArBgNVHREEJDAighAqLmYtc29sdXRp
b25zLmZpgg5mLXNvbHV0aW9ucy5maTAdBgNVHQ4EFgQUT1kTmvnHrGt/k2qyoUif
6uqhS6cwDQYJKoZIhvcNAQEFBQADggEBAFYuQGCEwq0JDTZT51ikHqoBUJRJHfKD
yd2lCkuM5eWR5o5hyEpSeI6QBrlF76VdlwIcE7CRmue/7IjOBv3QoDgvycbiKoeK
Me+Fy+afaBCYn1sA9gzVY+nmyFa8GpjJWjlB39SWh0Hkp004rfK4PS75w/+kxsNA
OJHw/CcuXS4HyDmH++mK4XHh6WpLEG5lpp4UyZfNyWLvdo20L9Yi+fM1rHr4Te77
BiRdisAd/NIsfrrYaryHg4qZNWrC6mLPcvTj9C9Cgn2HrZ5Od5a4Fb02p5emr46c
B1+k2tysG9SD60zXu2sbA+CC4yS48h24KdIAI5z1Y7nKW9TJvwkRvMk=
-----END CERTIFICATE-----
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "<$PROJECTNAME$> <$CUSTOMER$> v<$VERSION$>"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\<$BINARYNAMEORIG$>
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\<$BINARYNAMEORIG$>"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\<$BINARYNAMEORIG$>" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
MessageBox MB_OK "Program <$BINARYNAMEORIG$> didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!<$PROJECTNAME$> <$CUSTOMER$> <$VERSIONGROUP$> v<$VERSION$>" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "<$BINARYDIR$>\autoupdate.<$CUSTOMER$>.xml"
File /oname=<$BINARYNAMEORIG$> "<$BINARYDIR$>\<$BINARYNAMEOBF$>"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "<$REFERENCEDASSEMBLY$>"
File "<$DEBUGDATABASES$>"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\<$PROJECTNAME$>"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\<$PROJECTNAME$>.lnk" "$INSTDIR\<$BINARYNAMEORIG$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\Uninstall <$PROJECTNAME$>.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SetShellVarContext current
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\*"
RMDir "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\<$REFERENCEDASSEMBLY$>"
Delete "$INSTDIR\<$DEBUGDATABASES$>"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
\ No newline at end of file
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "BarcodeScannerClient moya v1_00_00"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\BarcodeScannerClient_moya"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\BarcodeScannerClient.exe
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\BarcodeScannerClient" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\BarcodeScannerClient_moya" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\BarcodeScannerClient_moya"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\BarcodeScannerClient.exe"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\BarcodeScannerClient.exe" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\BarcodeScannerClient.exe"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\BarcodeScannerClient.exe"
${If} ${Errors}
MessageBox MB_OK "Program BarcodeScannerClient.exe didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!BarcodeScannerClient moya stable v1_00_00" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\autoupdate.moya.xml"
File /oname=BarcodeScannerClient.exe "I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.pdb"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\BarcodeScannerClient_moya" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\BarcodeScannerClient"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\BarcodeScannerClient moya"
CreateShortCut "$SMPROGRAMS\BarcodeScannerClient moya\BarcodeScannerClient.lnk" "$INSTDIR\BarcodeScannerClient.exe"
CreateShortCut "$SMPROGRAMS\BarcodeScannerClient moya\Uninstall BarcodeScannerClient.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\BarcodeScannerClient\BarcodeScannerClient.lnk"
Delete "$SMPROGRAMS\BarcodeScannerClient\Uninstall BarcodeScannerClient.lnk"
RMDir "$SMPROGRAMS\BarcodeScannerClient"
SetShellVarContext current
Delete "$SMPROGRAMS\BarcodeScannerClient\BarcodeScannerClient.lnk"
Delete "$SMPROGRAMS\BarcodeScannerClient\Uninstall BarcodeScannerClient.lnk"
RMDir "$SMPROGRAMS\BarcodeScannerClient"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\BarcodeScannerClient moya\*"
RMDir "$SMPROGRAMS\BarcodeScannerClient moya"
Delete "$INSTDIR\BarcodeScannerClient.exe"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.pdb"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
......@@ -3,16 +3,38 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardDisplay", "CardDisplay\CardDisplay.csproj", "{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoyaAdminLib", "..\..\MoyaAdmin\MoyaAdminUI\MoyaAdminLib\MoyaAdminLib.csproj", "{095CE28F-5B53-4203-85C6-3A9AFD486407}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Debug|Any CPU.ActiveCfg = Debug|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Debug|Mixed Platforms.Build.0 = Debug|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Debug|x86.ActiveCfg = Debug|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Debug|x86.Build.0 = Debug|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|Any CPU.ActiveCfg = Release|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|Mixed Platforms.ActiveCfg = Release|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|Mixed Platforms.Build.0 = Release|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|x86.ActiveCfg = Release|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|x86.Build.0 = Release|x86
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Debug|Any CPU.Build.0 = Debug|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Debug|x86.ActiveCfg = Debug|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Release|Any CPU.ActiveCfg = Release|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Release|Any CPU.Build.0 = Release|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{095CE28F-5B53-4203-85C6-3A9AFD486407}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -35,6 +35,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdateLib">
<HintPath>..\..\..\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll</HintPath>
</Reference>
<Reference Include="MoyaAdminLib">
<HintPath>..\..\..\MoyaAdmin\MoyaAdminUI\MoyaAdminLib\bin\Debug\MoyaAdminLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
......@@ -49,10 +55,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataClasses\MetaData.cs" />
<Compile Include="DataClasses\Card.cs" />
<Compile Include="DataClasses\CardList.cs" />
<Compile Include="DataClasses\Eventuser.cs" />
<Compile Include="Forms\ApiSettings.cs">
<SubType>Form</SubType>
</Compile>
......@@ -67,11 +69,6 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DataClasses\Reader.cs" />
<Compile Include="DataClasses\ReaderEvent.cs" />
<Compile Include="DataClasses\ReaderEventList.cs" />
<Compile Include="DataClasses\ReaderList.cs" />
<Compile Include="DataClasses\RestClient.cs" />
<EmbeddedResource Include="Forms\ApiSettings.resx">
<DependentUpon>ApiSettings.cs</DependentUpon>
</EmbeddedResource>
......@@ -100,6 +97,9 @@
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>$(SolutionDir)/../../../\AutoUpdate\src\AutoPublish\bin\Debug\AutoPublish.exe $(ConfigurationName) $(ProjectName) $(SolutionDir) $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class Card
{
public int cardId = 0;
public DateTime printTime;
public string state;
public string cardTemplate = "";
public string username = "";
public string wholeName = "";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class Eventuser
{
public int eventUserId = 0;
public string firstname = "";
public string lastname = "";
public string login = "";
public int userID = 0;
public string nick = "";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
namespace CardDisplay.DataClasses
{
public class MetaData
{
public string key = "";
public string value = "";
public string ImportJson()
{
var ser = new JavaScriptSerializer();
return ser.Serialize(this);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class Reader
{
public string description;
public int readerId;
public string identification;
public string readerType;
public override string ToString()
{
string name = identification;
if (description != "")
name += ":" + description;
return name;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class ReaderEvent
{
public int readerEventId = 0;
public DateTime readerEventTime = DateTime.MinValue;
public int readerId = 0;
public Eventuser eventuser;
public int printedCardId = 0;
public string printedCardState = "";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class ReaderEventList
{
public List<ReaderEvent> readerEvents = new List<ReaderEvent>();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
{
public class ReaderList
{
public List<Reader> readers = new List<Reader>();
}
}
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public enum HttpVerb
{
GET,
POST,
PUT,
DELETE
}
namespace HttpUtils
{
public class RestClient
{
public string EndPoint { get; set; }
public HttpVerb Method { get; set; }
public string ContentType { get; set; }
public string PostData { get; set; }
public RestClient()
{
EndPoint = "";
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint)
{
EndPoint = endpoint;
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, HttpVerb method)
{
EndPoint = endpoint;
Method = method;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, HttpVerb method, string postData)
{
EndPoint = endpoint;
Method = method;
ContentType = "application/json";
PostData = postData;
}
public static string GetRequestURL(string server, string parameters)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + parameters + "+" + CardDisplay.Properties.Settings.Default.ApiKey + "+" + CardDisplay.Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + CardDisplay.Properties.Settings.Default.ApiPass);
string url = server + "/rest/" + parameters + "?appkey=" + CardDisplay.Properties.Settings.Default.ApiKey + "&appuser=" + CardDisplay.Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
Console.WriteLine(url);
return url;
}
public static string CalculateSHA1(string text)
{
// Convert the input string to a byte array
byte[] buffer = Encoding.GetEncoding("iso-8859-1").GetBytes(text);
// In doing your test, you won't want to re-initialize like this every time you test a
// string.
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
// The replace won't be necessary for your tests so long as you are consistent in what
// you compare.
string hash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
private static int ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (int)span.TotalSeconds;
}
public string MakeRequest()
{
return MakeRequest("");
}
public string MakeRequest(string parameters)
{
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL(EndPoint,parameters));
request.Method = Method.ToString();
request.ContentLength = 0;
request.ContentType = ContentType;
if (!string.IsNullOrEmpty(PostData) && Method == HttpVerb.POST)
{
var encoding = new UTF8Encoding();
var bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData);
request.ContentLength = bytes.Length;
using (var writeStream = request.GetRequestStream())
{
writeStream.Write(bytes, 0, bytes.Length);
}
}
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;
if (response.StatusCode != HttpStatusCode.OK)
{
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(message);
}
// grab the response
if (response.ContentLength > 0)
{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var reader = new StreamReader(responseStream))
{
responseValue = reader.ReadToEnd();
}
}
}
return responseValue;
}
}
} // class
}
\ No newline at end of file
using CardDisplay.DataClasses;
using CardDisplay.Forms;
using HttpUtils;
using CardDisplay.Forms;
using MoyaAdminLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -18,6 +17,11 @@ namespace CardDisplay
public Form1()
{
InitializeComponent();
RestClient.ApiURL = Properties.Settings.Default.ApiURL;
RestClient.ApiApplicationKey = Properties.Settings.Default.ApiKey;
RestClient.ApiUser = Properties.Settings.Default.ApiUser;
RestClient.ApiPass = Properties.Settings.Default.ApiPass;
}
......@@ -163,7 +167,7 @@ namespace CardDisplay
if (re.eventuser != null)
{
client = new RestClient(Properties.Settings.Default.ApiURL);
ret = client.MakeRequest("user/card/" + re.eventuser.eventUserId);
ret = client.MakeRequest("user/card/" + re.eventuser.eventuserId);
Card card = ser.Deserialize<Card>(ret);
......@@ -215,7 +219,7 @@ namespace CardDisplay
if (re.eventuser != null)
{
client = new RestClient(Properties.Settings.Default.ApiURL);
ret = client.MakeRequest("user/card/" + re.eventuser.eventUserId);
ret = client.MakeRequest("user/card/" + re.eventuser.eventuserId);
Card card = ser.Deserialize<Card>(ret);
......@@ -266,7 +270,7 @@ namespace CardDisplay
if (re.eventuser != null)
{
client = new RestClient(Properties.Settings.Default.ApiURL);
ret = client.MakeRequest("user/card/" + re.eventuser.eventUserId);
ret = client.MakeRequest("user/card/" + re.eventuser.eventuserId);
Card card = ser.Deserialize<Card>(ret);
......
<?xml version="1.0" encoding="utf-8"?>
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UploadUser>f-solu-06</UploadUser>
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>software.f-solutions.fi</UploadHost>
<ProjectName>CardDisplay</ProjectName>
<Customers>
<Customer>
<Name>moya</Name>
<Password>moya</Password>
<AllowDevelopmentReleases>false</AllowDevelopmentReleases>
<Obfuscate>false</Obfuscate>
</Customer>
</Customers>
<ForceUpdate>false</ForceUpdate>
<DisableUpdate>false</DisableUpdate>
</AutoPublishSettings>
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIFZTCCBE2gAwIBAgIHJ+f2v0HETTANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm
aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5
IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky
ODcwHhcNMTExMTE1MDAxMjI2WhcNMTQxMTE1MDAxMjI2WjBZMRkwFwYDVQQKFBAq
LmYtc29sdXRpb25zLmZpMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0
ZWQxGTAXBgNVBAMUECouZi1zb2x1dGlvbnMuZmkwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCd7ksvWMcxBJiXjX3iOUnXvXynUbFA/rImWXGVHp43UI8K
SUrB8JP3zwRHj2j1ovvtr+Yo39cqAt5+ShtvlGyJB65/JqwyrACCDswY5l0gZNJJ
ijEgzAldWfiVEqR18AIdrjH8WbIRHFWxc3goPgJBfy6QYKnHENyZQeRXu9kc+XlS
YCda3wM5UiDgeUCZYpvsDqUxBBl3dcTDjoEBBYn22TUuMsyikvFHjmTLu8RCj1pv
jW1b2nCwbcJRr+w7VhLCRNO6fx3+T/8+dHkgE/HIggsOmR5weqfqo+w9yyF53YPu
QGzGZ4Yx74B4IDX0AP0MhADHHXEL0fv0SKgLAV+rAgMBAAGjggG+MIIBujAPBgNV
HRMBAf8EBTADAQEAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNV
HQ8BAf8EBAMCBaAwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5
LmNvbS9nZHMxLTU5LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYI
KwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3Np
dG9yeS8wgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3Au
Z29kYWRkeS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdv
ZGFkZHkuY29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSME
GDAWgBT9rGEyk2xF1uLuhV+auud2mWjM5zArBgNVHREEJDAighAqLmYtc29sdXRp
b25zLmZpgg5mLXNvbHV0aW9ucy5maTAdBgNVHQ4EFgQUT1kTmvnHrGt/k2qyoUif
6uqhS6cwDQYJKoZIhvcNAQEFBQADggEBAFYuQGCEwq0JDTZT51ikHqoBUJRJHfKD
yd2lCkuM5eWR5o5hyEpSeI6QBrlF76VdlwIcE7CRmue/7IjOBv3QoDgvycbiKoeK
Me+Fy+afaBCYn1sA9gzVY+nmyFa8GpjJWjlB39SWh0Hkp004rfK4PS75w/+kxsNA
OJHw/CcuXS4HyDmH++mK4XHh6WpLEG5lpp4UyZfNyWLvdo20L9Yi+fM1rHr4Te77
BiRdisAd/NIsfrrYaryHg4qZNWrC6mLPcvTj9C9Cgn2HrZ5Od5a4Fb02p5emr46c
B1+k2tysG9SD60zXu2sbA+CC4yS48h24KdIAI5z1Y7nKW9TJvwkRvMk=
-----END CERTIFICATE-----
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "<$PROJECTNAME$> <$CUSTOMER$> v<$VERSION$>"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\<$BINARYNAMEORIG$>
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\<$BINARYNAMEORIG$>"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\<$BINARYNAMEORIG$>" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
MessageBox MB_OK "Program <$BINARYNAMEORIG$> didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!<$PROJECTNAME$> <$CUSTOMER$> <$VERSIONGROUP$> v<$VERSION$>" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "<$BINARYDIR$>\autoupdate.<$CUSTOMER$>.xml"
File /oname=<$BINARYNAMEORIG$> "<$BINARYDIR$>\<$BINARYNAMEOBF$>"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "<$REFERENCEDASSEMBLY$>"
File "<$DEBUGDATABASES$>"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\<$PROJECTNAME$>"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\<$PROJECTNAME$>.lnk" "$INSTDIR\<$BINARYNAMEORIG$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\Uninstall <$PROJECTNAME$>.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SetShellVarContext current
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\*"
RMDir "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\<$REFERENCEDASSEMBLY$>"
Delete "$INSTDIR\<$DEBUGDATABASES$>"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
\ No newline at end of file
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "CardDisplay moya v1_00_00"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\CardDisplay_moya"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\CardDisplay.exe
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\CardDisplay" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\CardDisplay_moya" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\CardDisplay_moya"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\CardDisplay.exe"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\CardDisplay.exe" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\CardDisplay.exe"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\CardDisplay.exe"
${If} ${Errors}
MessageBox MB_OK "Program CardDisplay.exe didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!CardDisplay moya stable v1_00_00" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\autoupdate.moya.xml"
File /oname=CardDisplay.exe "I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\CardDisplay.exe"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\MoyaAdminLib.dll"
File "I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\CardDisplay.pdb"
File "I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\MoyaAdminLib.pdb"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\CardDisplay_moya" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\CardDisplay"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\CardDisplay moya"
CreateShortCut "$SMPROGRAMS\CardDisplay moya\CardDisplay.lnk" "$INSTDIR\CardDisplay.exe"
CreateShortCut "$SMPROGRAMS\CardDisplay moya\Uninstall CardDisplay.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\CardDisplay\CardDisplay.lnk"
Delete "$SMPROGRAMS\CardDisplay\Uninstall CardDisplay.lnk"
RMDir "$SMPROGRAMS\CardDisplay"
SetShellVarContext current
Delete "$SMPROGRAMS\CardDisplay\CardDisplay.lnk"
Delete "$SMPROGRAMS\CardDisplay\Uninstall CardDisplay.lnk"
RMDir "$SMPROGRAMS\CardDisplay"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\CardDisplay moya\*"
RMDir "$SMPROGRAMS\CardDisplay moya"
Delete "$INSTDIR\CardDisplay.exe"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\MoyaAdminLib.dll"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\CardDisplay.pdb"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\MoyaAdminLib.pdb"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
......@@ -25,9 +25,6 @@
<setting name="ReaderId" serializeAs="String">
<value>0</value>
</setting>
<setting name="LabelTemplateDir" serializeAs="String">
<value>I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\Recources\Labels</value>
</setting>
<setting name="Port" serializeAs="String">
<value />
</setting>
......
......@@ -34,6 +34,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdateLib">
<HintPath>..\..\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll</HintPath>
</Reference>
<Reference Include="MoyaAdminLib">
<HintPath>..\..\MoyaAdmin\MoyaAdminUI\MoyaAdminLib\bin\Debug\MoyaAdminLib.dll</HintPath>
</Reference>
......@@ -59,7 +62,6 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RestClient.cs" />
<Compile Include="Settings.cs">
<SubType>Form</SubType>
</Compile>
......@@ -110,6 +112,9 @@
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>$(SolutionDir)/../../\AutoUpdate\src\AutoPublish\bin\Debug\AutoPublish.exe $(ConfigurationName) $(ProjectName) $(SolutionDir) $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
using BarcodeScannerClient;
using HttpUtils;
//using HttpUtils;
using MoyaAdminLib;
using System;
using System.Collections.Generic;
......@@ -30,6 +30,10 @@ namespace Cloakroom
public Form1()
{
InitializeComponent();
RestClient.ApiURL = Properties.Settings.Default.ApiURL;
RestClient.ApiApplicationKey = Properties.Settings.Default.ApiKey;
RestClient.ApiUser = Properties.Settings.Default.ApiUser;
RestClient.ApiPass = Properties.Settings.Default.ApiPass;
}
private void settingsToolStripButton_Click(object sender, EventArgs e)
......@@ -144,7 +148,7 @@ namespace Cloakroom
private bool printLabel(string barcode)
{
if (Properties.Settings.Default.LabelTemplateDir == null || !Directory.Exists(Properties.Settings.Default.LabelTemplateDir))
if (Properties.Settings.Default.dd == null || !Directory.Exists(Properties.Settings.Default.dd))
{
MessageBox.Show("Cannot find print template");
return false;
......@@ -163,7 +167,7 @@ namespace Cloakroom
//doc.SetPrinter(Objects.Conf.BoxLabelPrinter, false);
if (doc != null)
{
doc.Open(Path.Combine(Properties.Settings.Default.LabelTemplateDir, cloakroomLabel));
doc.Open(Path.Combine(Properties.Settings.Default.dd, cloakroomLabel));
if(selectedUser != null)
doc.GetObject("Name").Text = selectedUser.firstname + " " + selectedUser.lastname;
......
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
......@@ -85,18 +85,6 @@ namespace Cloakroom.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("I:\\devel\\proj\\moya-info-tools\\Cloakroom\\Cloakroom\\Recources\\Labels")]
public string LabelTemplateDir {
get {
return ((string)(this["LabelTemplateDir"]));
}
set {
this["LabelTemplateDir"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Port {
get {
......
......@@ -17,9 +17,6 @@
<Setting Name="ReaderId" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="LabelTemplateDir" Type="System.String" Scope="User">
<Value Profile="(Default)">I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\Recources\Labels</Value>
</Setting>
<Setting Name="Port" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
......
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public enum HttpVerb
{
GET,
POST,
PUT,
DELETE
}
namespace HttpUtils
{
public class RestClient
{
public string EndPoint { get; set; }
public HttpVerb Method { get; set; }
public string ContentType { get; set; }
public string PostData { get; set; }
public RestClient()
{
EndPoint = "";
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint)
{
EndPoint = endpoint;
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, HttpVerb method)
{
EndPoint = endpoint;
Method = method;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, HttpVerb method, string postData)
{
EndPoint = endpoint;
Method = method;
ContentType = "application/json";
PostData = postData;
}
public static string GetRequestURL(string server, string parameters)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + parameters + "+" + Cloakroom.Properties.Settings.Default.ApiKey + "+" + Cloakroom.Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + Cloakroom.Properties.Settings.Default.ApiPass);
string url = server + "/rest/" + parameters + "?appkey=" + Cloakroom.Properties.Settings.Default.ApiKey + "&appuser=" + Cloakroom.Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
Console.WriteLine(url);
return url;
}
public static string CalculateSHA1(string text)
{
// Convert the input string to a byte array
byte[] buffer = Encoding.GetEncoding("iso-8859-1").GetBytes(text);
// In doing your test, you won't want to re-initialize like this every time you test a
// string.
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
// The replace won't be necessary for your tests so long as you are consistent in what
// you compare.
string hash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
private static int ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (int)span.TotalSeconds;
}
public string MakeRequest()
{
return MakeRequest("");
}
public string MakeRequest(string parameters)
{
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL(EndPoint,parameters));
request.Method = Method.ToString();
request.ContentLength = 0;
request.ContentType = ContentType;
if (!string.IsNullOrEmpty(PostData) && Method == HttpVerb.POST)
{
var encoding = new UTF8Encoding();
var bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData);
request.ContentLength = bytes.Length;
using (var writeStream = request.GetRequestStream())
{
writeStream.Write(bytes, 0, bytes.Length);
}
}
using (var response = (HttpWebResponse)request.GetResponse())
{
var responseValue = string.Empty;
if (response.StatusCode != HttpStatusCode.OK)
{
var message = String.Format("Request failed. Received HTTP {0}", response.StatusCode);
throw new ApplicationException(message);
}
// grab the response
if (response.ContentLength > 0)
{
using (var responseStream = response.GetResponseStream())
{
if (responseStream != null)
using (var reader = new StreamReader(responseStream))
{
responseValue = reader.ReadToEnd();
}
}
}
return responseValue;
}
}
} // class
}
\ No newline at end of file
using HttpUtils;

using MoyaAdminLib;
using System;
using System.Collections.Generic;
......@@ -51,7 +51,7 @@ namespace Cloakroom
private void loadReaders()
{
string ret = "";
RestClient client = new RestClient(Properties.Settings.Default.ApiURL);
RestClient client = new RestClient();
try
{
ret = client.MakeRequest("reader/List");
......
<?xml version="1.0" encoding="utf-8"?>
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UploadUser>f-solu-06</UploadUser>
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>software.f-solutions.fi</UploadHost>
<ProjectName>Cloakroom</ProjectName>
<Customers>
<Customer>
<Name>moya</Name>
<Password>moya</Password>
<AllowDevelopmentReleases>false</AllowDevelopmentReleases>
<Obfuscate>false</Obfuscate>
</Customer>
</Customers>
<ForceUpdate>false</ForceUpdate>
<DisableUpdate>false</DisableUpdate>
</AutoPublishSettings>
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIFZTCCBE2gAwIBAgIHJ+f2v0HETTANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm
aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5
IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky
ODcwHhcNMTExMTE1MDAxMjI2WhcNMTQxMTE1MDAxMjI2WjBZMRkwFwYDVQQKFBAq
LmYtc29sdXRpb25zLmZpMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0
ZWQxGTAXBgNVBAMUECouZi1zb2x1dGlvbnMuZmkwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCd7ksvWMcxBJiXjX3iOUnXvXynUbFA/rImWXGVHp43UI8K
SUrB8JP3zwRHj2j1ovvtr+Yo39cqAt5+ShtvlGyJB65/JqwyrACCDswY5l0gZNJJ
ijEgzAldWfiVEqR18AIdrjH8WbIRHFWxc3goPgJBfy6QYKnHENyZQeRXu9kc+XlS
YCda3wM5UiDgeUCZYpvsDqUxBBl3dcTDjoEBBYn22TUuMsyikvFHjmTLu8RCj1pv
jW1b2nCwbcJRr+w7VhLCRNO6fx3+T/8+dHkgE/HIggsOmR5weqfqo+w9yyF53YPu
QGzGZ4Yx74B4IDX0AP0MhADHHXEL0fv0SKgLAV+rAgMBAAGjggG+MIIBujAPBgNV
HRMBAf8EBTADAQEAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNV
HQ8BAf8EBAMCBaAwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5
LmNvbS9nZHMxLTU5LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYI
KwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3Np
dG9yeS8wgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3Au
Z29kYWRkeS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdv
ZGFkZHkuY29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSME
GDAWgBT9rGEyk2xF1uLuhV+auud2mWjM5zArBgNVHREEJDAighAqLmYtc29sdXRp
b25zLmZpgg5mLXNvbHV0aW9ucy5maTAdBgNVHQ4EFgQUT1kTmvnHrGt/k2qyoUif
6uqhS6cwDQYJKoZIhvcNAQEFBQADggEBAFYuQGCEwq0JDTZT51ikHqoBUJRJHfKD
yd2lCkuM5eWR5o5hyEpSeI6QBrlF76VdlwIcE7CRmue/7IjOBv3QoDgvycbiKoeK
Me+Fy+afaBCYn1sA9gzVY+nmyFa8GpjJWjlB39SWh0Hkp004rfK4PS75w/+kxsNA
OJHw/CcuXS4HyDmH++mK4XHh6WpLEG5lpp4UyZfNyWLvdo20L9Yi+fM1rHr4Te77
BiRdisAd/NIsfrrYaryHg4qZNWrC6mLPcvTj9C9Cgn2HrZ5Od5a4Fb02p5emr46c
B1+k2tysG9SD60zXu2sbA+CC4yS48h24KdIAI5z1Y7nKW9TJvwkRvMk=
-----END CERTIFICATE-----
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "<$PROJECTNAME$> <$CUSTOMER$> v<$VERSION$>"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\<$BINARYNAMEORIG$>
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\<$BINARYNAMEORIG$>"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\<$BINARYNAMEORIG$>" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
MessageBox MB_OK "Program <$BINARYNAMEORIG$> didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!<$PROJECTNAME$> <$CUSTOMER$> <$VERSIONGROUP$> v<$VERSION$>" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "<$BINARYDIR$>\autoupdate.<$CUSTOMER$>.xml"
File /oname=<$BINARYNAMEORIG$> "<$BINARYDIR$>\<$BINARYNAMEOBF$>"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "<$REFERENCEDASSEMBLY$>"
File "<$DEBUGDATABASES$>"
File "Cloakroom\Recources\Labels\narikkalappu.lbx"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\<$PROJECTNAME$>"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\<$PROJECTNAME$>.lnk" "$INSTDIR\<$BINARYNAMEORIG$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\Uninstall <$PROJECTNAME$>.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SetShellVarContext current
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\*"
RMDir "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\<$REFERENCEDASSEMBLY$>"
Delete "$INSTDIR\<$DEBUGDATABASES$>"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
\ No newline at end of file
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "Cloakroom moya v1_00_01"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\Cloakroom_moya"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\Cloakroom.exe
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\Cloakroom" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\Cloakroom_moya" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\Cloakroom_moya"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\Cloakroom.exe"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\Cloakroom.exe" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\Cloakroom.exe"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\Cloakroom.exe"
${If} ${Errors}
MessageBox MB_OK "Program Cloakroom.exe didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!Cloakroom moya stable v1_00_01" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\autoupdate.moya.xml"
File /oname=Cloakroom.exe "I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\Cloakroom.exe"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\MoyaAdminLib.dll"
File "I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\Interop.bpac.dll"
File "I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\Cloakroom.pdb"
File "I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\MoyaAdminLib.pdb"
File "Cloakroom\Recources\Labels\narikkalappu.lbx"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\Cloakroom_moya" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\Cloakroom"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\Cloakroom moya"
CreateShortCut "$SMPROGRAMS\Cloakroom moya\Cloakroom.lnk" "$INSTDIR\Cloakroom.exe"
CreateShortCut "$SMPROGRAMS\Cloakroom moya\Uninstall Cloakroom.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\Cloakroom\Cloakroom.lnk"
Delete "$SMPROGRAMS\Cloakroom\Uninstall Cloakroom.lnk"
RMDir "$SMPROGRAMS\Cloakroom"
SetShellVarContext current
Delete "$SMPROGRAMS\Cloakroom\Cloakroom.lnk"
Delete "$SMPROGRAMS\Cloakroom\Uninstall Cloakroom.lnk"
RMDir "$SMPROGRAMS\Cloakroom"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\Cloakroom moya\*"
RMDir "$SMPROGRAMS\Cloakroom moya"
Delete "$INSTDIR\Cloakroom.exe"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\MoyaAdminLib.dll"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\Interop.bpac.dll"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\Cloakroom.pdb"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\Cloakroom\Cloakroom\bin\Debug\MoyaAdminLib.pdb"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
......@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardDisplay
namespace MoyaAdminLib
{
public class CardList
{
......
......@@ -48,6 +48,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Card.cs" />
<Compile Include="CardList.cs" />
<Compile Include="ComputerPlace.cs" />
<Compile Include="Controls\EventUserEditor.cs">
<SubType>UserControl</SubType>
......
......@@ -74,20 +74,26 @@ namespace MoyaAdminUI
amountsPerDay.Add(date, 1);
totalAmount++;
if(re.eventuser != null) {
if (amountsPerPersonPerDay.Keys.Contains(re.eventuser))
if (containsSameUser(amountsPerPersonPerDay, re.eventuser))
{
if (amountsPerPersonPerDay[re.eventuser].Keys.Contains(date))
amountsPerPersonPerDay[re.eventuser][date] += 1;
else
amountsPerPersonPerDay[re.eventuser].Add(date, 1);
Eventuser user = getUser(amountsPerPersonPerDay, re.eventuser);
if(user != null && amountsPerPersonPerDay[user].Keys.Contains(date))
//if (amountsPerPersonPerDay[re.eventuser].Keys.Contains(date))
amountsPerPersonPerDay[user][date] += 1;
else if(user != null)
amountsPerPersonPerDay[user].Add(date, 1);
}
else
{
amountsPerPersonPerDay.Add(re.eventuser, new Dictionary<DateTime, int>());
amountsPerPersonPerDay[re.eventuser].Add(date, 1);
}
if (amountsPerPerson.Keys.Contains(re.eventuser))
amountsPerPerson[re.eventuser] += 1;
if (containsSameUser(amountsPerPerson, re.eventuser)) {
Eventuser eu = getUser(amountsPerPerson, re.eventuser);
if(eu != null)
amountsPerPerson[eu] += 1;
}
else
amountsPerPerson.Add(re.eventuser, 1);
}
......@@ -101,10 +107,12 @@ namespace MoyaAdminUI
{
header = new ColumnHeader();
header.Text = date.ToShortDateString();
header.Width = 70;
amountsPerDayListView.Columns.Add(header);
}
ColumnHeader headerSum = new ColumnHeader();
headerSum.Text = "Total amount";
headerSum.Width = 80;
amountsPerDayListView.Columns.Add(headerSum);
ListViewItem lvi = null;
......@@ -128,15 +136,18 @@ namespace MoyaAdminUI
amountsPerPersonListView.Columns.Clear();
header = new ColumnHeader();
header.Text = "Name";
header.Width = 150;
headers.Add(header);
foreach (DateTime date in amountsPerDay.Keys)
{
header = new ColumnHeader();
header.Text = date.ToShortDateString();
header.Width = 70;
headers.Add(header);
}
header = new ColumnHeader();
header.Text = "Total amount";
header.Width = 80;
headers.Add(header);
amountsPerPersonListView.Columns.AddRange(headers.ToArray());
......@@ -167,5 +178,47 @@ namespace MoyaAdminUI
}
}
private Eventuser getUser(Dictionary<Eventuser, int> amountsPerPerson, Eventuser eventuser)
{
foreach (Eventuser user in amountsPerPerson.Keys)
{
if (user.eventuserId == eventuser.eventuserId)
return user;
}
return null;
}
private Eventuser getUser(Dictionary<Eventuser, Dictionary<DateTime, int>> amountsPerPersonPerDay, Eventuser eventuser)
{
foreach (Eventuser user in amountsPerPersonPerDay.Keys)
{
if (user.eventuserId == eventuser.eventuserId)
return user;
}
return null;
}
private bool containsSameUser(Dictionary<Eventuser, int> amountsPerPerson, Eventuser eventuser)
{
foreach (Eventuser user in amountsPerPerson.Keys)
{
if (user.eventuserId == eventuser.eventuserId)
return true;
}
return false;
}
private bool containsSameUser(Dictionary<Eventuser, Dictionary<DateTime, int>> amountsPerPersonPerDay, Eventuser eventuser)
{
foreach (Eventuser user in amountsPerPersonPerDay.Keys)
{
if (user.eventuserId == eventuser.eventuserId)
return true;
}
return false;
}
}
}
......@@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoUpdateLib">
<HintPath>..\..\PrintServer\moyaPrintServer\moyaPrintServer\bin\Debug\AutoUpdateLib.dll</HintPath>
</Reference>
<Reference Include="MoyaAdminLib">
<HintPath>..\..\MoyaAdmin\MoyaAdminUI\MoyaAdminLib\bin\Debug\MoyaAdminLib.dll</HintPath>
</Reference>
......@@ -93,6 +96,9 @@
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>$(SolutionDir)/../../\AutoUpdate\src\AutoPublish\bin\Debug\AutoPublish.exe $(ConfigurationName) $(ProjectName) $(SolutionDir) $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
......
<?xml version="1.0" encoding="utf-8"?>
<AutoPublishSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UploadUser>f-solu-06</UploadUser>
<UploadPath>/home/f-solu-06/software.f-solutions.fi</UploadPath>
<UploadHost>software.f-solutions.fi</UploadHost>
<ProjectName>OrgMealCounter</ProjectName>
<Customers>
<Customer>
<Name>moya</Name>
<Password>moya</Password>
<AllowDevelopmentReleases>false</AllowDevelopmentReleases>
<Obfuscate>false</Obfuscate>
</Customer>
</Customers>
<ForceUpdate>false</ForceUpdate>
<DisableUpdate>false</DisableUpdate>
</AutoPublishSettings>
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIFZTCCBE2gAwIBAgIHJ+f2v0HETTANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm
aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5
IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky
ODcwHhcNMTExMTE1MDAxMjI2WhcNMTQxMTE1MDAxMjI2WjBZMRkwFwYDVQQKFBAq
LmYtc29sdXRpb25zLmZpMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0
ZWQxGTAXBgNVBAMUECouZi1zb2x1dGlvbnMuZmkwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCd7ksvWMcxBJiXjX3iOUnXvXynUbFA/rImWXGVHp43UI8K
SUrB8JP3zwRHj2j1ovvtr+Yo39cqAt5+ShtvlGyJB65/JqwyrACCDswY5l0gZNJJ
ijEgzAldWfiVEqR18AIdrjH8WbIRHFWxc3goPgJBfy6QYKnHENyZQeRXu9kc+XlS
YCda3wM5UiDgeUCZYpvsDqUxBBl3dcTDjoEBBYn22TUuMsyikvFHjmTLu8RCj1pv
jW1b2nCwbcJRr+w7VhLCRNO6fx3+T/8+dHkgE/HIggsOmR5weqfqo+w9yyF53YPu
QGzGZ4Yx74B4IDX0AP0MhADHHXEL0fv0SKgLAV+rAgMBAAGjggG+MIIBujAPBgNV
HRMBAf8EBTADAQEAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNV
HQ8BAf8EBAMCBaAwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5
LmNvbS9nZHMxLTU5LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYI
KwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3Np
dG9yeS8wgYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3Au
Z29kYWRkeS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdv
ZGFkZHkuY29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSME
GDAWgBT9rGEyk2xF1uLuhV+auud2mWjM5zArBgNVHREEJDAighAqLmYtc29sdXRp
b25zLmZpgg5mLXNvbHV0aW9ucy5maTAdBgNVHQ4EFgQUT1kTmvnHrGt/k2qyoUif
6uqhS6cwDQYJKoZIhvcNAQEFBQADggEBAFYuQGCEwq0JDTZT51ikHqoBUJRJHfKD
yd2lCkuM5eWR5o5hyEpSeI6QBrlF76VdlwIcE7CRmue/7IjOBv3QoDgvycbiKoeK
Me+Fy+afaBCYn1sA9gzVY+nmyFa8GpjJWjlB39SWh0Hkp004rfK4PS75w/+kxsNA
OJHw/CcuXS4HyDmH++mK4XHh6WpLEG5lpp4UyZfNyWLvdo20L9Yi+fM1rHr4Te77
BiRdisAd/NIsfrrYaryHg4qZNWrC6mLPcvTj9C9Cgn2HrZ5Od5a4Fb02p5emr46c
B1+k2tysG9SD60zXu2sbA+CC4yS48h24KdIAI5z1Y7nKW9TJvwkRvMk=
-----END CERTIFICATE-----
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "<$PROJECTNAME$> <$CUSTOMER$> v<$VERSION$>"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\<$BINARYNAMEORIG$>
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\<$PROJECTNAME$>_<$CUSTOMER$>"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\<$BINARYNAMEORIG$>"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\<$BINARYNAMEORIG$>" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
${If} ${Errors}
MessageBox MB_OK "Program <$BINARYNAMEORIG$> didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!<$PROJECTNAME$> <$CUSTOMER$> <$VERSIONGROUP$> v<$VERSION$>" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "<$BINARYDIR$>\autoupdate.<$CUSTOMER$>.xml"
File /oname=<$BINARYNAMEORIG$> "<$BINARYDIR$>\<$BINARYNAMEOBF$>"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "<$REFERENCEDASSEMBLY$>"
File "<$DEBUGDATABASES$>"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\<$PROJECTNAME$>_<$CUSTOMER$>" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\<$PROJECTNAME$>"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\<$PROJECTNAME$>.lnk" "$INSTDIR\<$BINARYNAMEORIG$>"
CreateShortCut "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\Uninstall <$PROJECTNAME$>.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SetShellVarContext current
Delete "$SMPROGRAMS\<$PROJECTNAME$>\<$PROJECTNAME$>.lnk"
Delete "$SMPROGRAMS\<$PROJECTNAME$>\Uninstall <$PROJECTNAME$>.lnk"
RMDir "$SMPROGRAMS\<$PROJECTNAME$>"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>\*"
RMDir "$SMPROGRAMS\<$PROJECTNAME$> <$CUSTOMER$>"
Delete "$INSTDIR\<$BINARYNAMEORIG$>"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\<$REFERENCEDASSEMBLY$>"
Delete "$INSTDIR\<$DEBUGDATABASES$>"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
\ No newline at end of file
; NSIS script - ONLY for use with AutoPublish/AutoUpdate system
; //keitsi
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;Configuration
SetCompressor lzma
Name "OrgMealCounter moya v1_00_00"
; DO NOT CHANGE OutFile "installer_temp.exe" !!! AutoPublish requires this.
; AutoPublish will move the installer according to autopublish.xml file.
OutFile "installer_temp.exe"
;Folder selection page
; InstallDir "$PROGRAMFILES\OrgMealCounter_moya"
ShowInstDetails show
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; !define MUI_FINISHPAGE_RUN $INSTDIR\OrgMealCounter.exe
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Function GetDotNet
IfFileExists "$WINDIR\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" NextStep
MessageBox MB_OK|MB_ICONEXCLAMATION "You must have the Microsoft .NET Framework 2.0 Installed to use this application. $\n$\nClick 'Open' in the following file dialog to download and run the Microsoft .NET Framework Installer..."
ExecShell Open "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=0856eacb-4362-4b0d-8edd-aab15c5e04f5&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f5%2f6%2f7%2f567758a3-759e-473e-bf8f-52154438565a%2fdotnetfx.exe" SW_SHOWNORMAL
Quit
NextStep:
FunctionEnd
Function .onInit
; Uber users are so uber that they do not need checks ;)
; Call GetDotNet
Call DetectInstallDir
FunctionEnd
Function DetectInstallDir
;Try to get install folder from obsoleted registry key first, if available
ClearErrors
ReadRegStr $INSTDIR HKCU "Software\OrgMealCounter" ""
IfErrors 0 instdirfound
ClearErrors
; No obsoleted regkey present, try to read the correct one
ReadRegStr $INSTDIR HKCU "Software\OrgMealCounter_moya" ""
IfErrors 0 instdirfound
ClearErrors
; No installation dir regkey present at all - use default installation directory.
StrCpy $INSTDIR "$PROGRAMFILES\OrgMealCounter_moya"
instdirfound:
FunctionEnd
Function .onInstSuccess
Exec '"$INSTDIR\OrgMealCounter.exe"'
FunctionEnd
Function WaitProgramClose
IfFileExists "$INSTDIR\OrgMealCounter.exe" loop NotInstalled
loop:
ClearErrors
Delete "$INSTDIR\OrgMealCounter.exe"
${If} ${Errors}
; Delete failed - means the program is still running. Sleep 2 seconds and retry.
Sleep 3000
ClearErrors
Delete "$INSTDIR\OrgMealCounter.exe"
${If} ${Errors}
MessageBox MB_OK "Program OrgMealCounter.exe didn't close in 2 seconds. Automatic update can't continue before it's closed. Please close the program manually and hit OK to retry."
goto loop
${EndIf}
${EndIf}
NotInstalled:
FunctionEnd
Section "!OrgMealCounter moya stable v1_00_00" SecMain
SetShellVarContext current
SetOutPath "$INSTDIR"
Call WaitProgramClose
; SetOverwrite Off
SetOverwrite On
File /oname=autoupdate.xml "I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\autoupdate.moya.xml"
File /oname=OrgMealCounter.exe "I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\OrgMealCounter.exe"
File autoupdate.crt
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
File "I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\MoyaAdminLib.dll"
File "I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\OrgMealCounter.pdb"
File "I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\MoyaAdminLib.pdb"
; Write install path to registry (projectname_customer_versiongroup)
WriteRegStr HKCU "Software\OrgMealCounter_moya" "" $INSTDIR
; Remove obsoleted registry key on install
DeleteRegKey HKCU "Software\OrgMealCounter"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\OrgMealCounter moya"
CreateShortCut "$SMPROGRAMS\OrgMealCounter moya\OrgMealCounter.lnk" "$INSTDIR\OrgMealCounter.exe"
CreateShortCut "$SMPROGRAMS\OrgMealCounter moya\Uninstall OrgMealCounter.lnk" "$INSTDIR\Uninstall.exe"
; Remove shortcuts from old shortcut naming scheme path, if any
SetShellVarContext all
Delete "$SMPROGRAMS\OrgMealCounter\OrgMealCounter.lnk"
Delete "$SMPROGRAMS\OrgMealCounter\Uninstall OrgMealCounter.lnk"
RMDir "$SMPROGRAMS\OrgMealCounter"
SetShellVarContext current
Delete "$SMPROGRAMS\OrgMealCounter\OrgMealCounter.lnk"
Delete "$SMPROGRAMS\OrgMealCounter\Uninstall OrgMealCounter.lnk"
RMDir "$SMPROGRAMS\OrgMealCounter"
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecMain ${LANG_ENGLISH} "Base (required)"
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$SMPROGRAMS\OrgMealCounter moya\*"
RMDir "$SMPROGRAMS\OrgMealCounter moya"
Delete "$INSTDIR\OrgMealCounter.exe"
Delete "$INSTDIR\autoupdate.xml"
Delete "$INSTDIR\autoupdate.crt"
; this line will be replicated for every non-default existing assembly
; that is referenced to the main project.
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\MoyaAdminLib.dll"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\OrgMealCounter.pdb"
Delete "$INSTDIR\I:\devel\proj\moya-info-tools\OrgMealCounter\OrgMealCounter\bin\Debug\MoyaAdminLib.pdb"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
SectionEnd
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!