diff --git a/MTC_Adapter/MTC_Adapter/App.config b/MTC_Adapter/MTC_Adapter/App.config index 0f35a7d..b87651d 100644 --- a/MTC_Adapter/MTC_Adapter/App.config +++ b/MTC_Adapter/MTC_Adapter/App.config @@ -7,16 +7,12 @@ - - - - - - - - - - + + + + + + @@ -84,4 +80,9 @@ + + + + + \ No newline at end of file diff --git a/MTC_Adapter/MTC_Adapter/MTCA.ico b/MTC_Adapter/MTC_Adapter/DATA/CONF/MTCA.ico similarity index 100% rename from MTC_Adapter/MTC_Adapter/MTCA.ico rename to MTC_Adapter/MTC_Adapter/DATA/CONF/MTCA.ico diff --git a/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj b/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj index 232f772..1f2a549 100644 --- a/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj +++ b/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj @@ -48,7 +48,7 @@ 4 - MTCA.ico + DATA\CONF\MTCA.ico bin\CMS-FANUC\ @@ -200,7 +200,7 @@ Always - + Always @@ -311,4 +311,10 @@ + + + + + + \ No newline at end of file diff --git a/MTC_Adapter/MTC_Adapter/MainForm.cs b/MTC_Adapter/MTC_Adapter/MainForm.cs index 57d3e07..c61679e 100644 --- a/MTC_Adapter/MTC_Adapter/MainForm.cs +++ b/MTC_Adapter/MTC_Adapter/MainForm.cs @@ -313,7 +313,7 @@ namespace MTC_Adapter { get { - return string.Format(@"{0}\MTCA.ico", Application.StartupPath); + return string.Format(@"{0}\MTCA.ico", utils.confDir); } } diff --git a/MTC_Adapter/MTC_Adapter/NLog.config b/MTC_Adapter/MTC_Adapter/NLog.config index 7a0f3aa..1c1501f 100644 --- a/MTC_Adapter/MTC_Adapter/NLog.config +++ b/MTC_Adapter/MTC_Adapter/NLog.config @@ -1,41 +1,30 @@ + throwExceptions="false"> - - + - - + + - - - + - - - - + + diff --git a/MTC_Adapter/MTC_Adapter/SetupAdapter.cs b/MTC_Adapter/MTC_Adapter/SetupAdapter.cs index 64a5585..40f53f5 100644 --- a/MTC_Adapter/MTC_Adapter/SetupAdapter.cs +++ b/MTC_Adapter/MTC_Adapter/SetupAdapter.cs @@ -23,7 +23,7 @@ namespace MTC_Adapter { get { - return string.Format(@"{0}\MTCA.ico", Application.StartupPath); + return string.Format(@"{0}\MTCA.ico", utils.confDir); } } /// diff --git a/MTC_Adapter/MTC_Adapter/packages.config b/MTC_Adapter/MTC_Adapter/packages.config index 6d71d1d..e22a3e5 100644 --- a/MTC_Adapter/MTC_Adapter/packages.config +++ b/MTC_Adapter/MTC_Adapter/packages.config @@ -3,4 +3,5 @@ + \ No newline at end of file diff --git a/MTC_Adapter/MTC_Adapter/setupTgt.bat b/MTC_Adapter/MTC_Adapter/setupTgt.bat index 6d95916..7c797a8 100644 --- a/MTC_Adapter/MTC_Adapter/setupTgt.bat +++ b/MTC_Adapter/MTC_Adapter/setupTgt.bat @@ -22,26 +22,26 @@ goto END :CMS echo CMS: copio files CMS - Zogno -del %2"MTCA.ico" +del %2"DATA\CONF\MTCA.ico" del %2"DATA\CONF\Adapter_ItemList.xml" del %2"DATA\CONF\AlarmList.map" del %2"DATA\CONF\EsaKvara.ini" del %2"DATA\CONF\SCM_prodFile.pro" REM del /F /Q %2"DATA\CONF\*.*" -copy %2"Resources\CMS\CMS.ico" %2"MTCA.ico" +copy %2"Resources\CMS\CMS.ico" %2"DATA\CONF\MTCA.ico" REM ora verifico tipo controllo esatto... if %1 == "CMS-FANUC" goto FANUC if %1 == "CMS-SIEMENS" goto SIEMENS :SCM echo SCM: copio files SCM - Rimini -del %2"MTCA.ico" +del %2"DATA\CONF\MTCA.ico" del %2"DATA\CONF\Adapter_ItemList.xml" del %2"DATA\CONF\AlarmList.map" del %2"DATA\CONF\EsaKvara.ini" del %2"DATA\CONF\SCM_prodFile.pro" REM del /F /Q %2"DATA\CONF\*.*" -copy %2"Resources\SCM\SCM.ico" %2"MTCA.ico" +copy %2"Resources\SCM\SCM.ico" %2"DATA\CONF\MTCA.ico" copy %2"Resources\SCM\SCM_ESA.xml" %2"DATA\CONF\Adapter_ItemList.xml" copy %2"Resources\SCM\AlarmListEsaGv.map" %2"DATA\CONF\AlarmList.map" copy %2"Resources\SCM\EsaKvara.ini" %2"DATA\CONF\EsaKvara.ini" diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/PrettyBin.1.1.0.nupkg b/MTC_Adapter/packages/PrettyBin.1.1.0/PrettyBin.1.1.0.nupkg new file mode 100644 index 0000000..2bc747a Binary files /dev/null and b/MTC_Adapter/packages/PrettyBin.1.1.0/PrettyBin.1.1.0.nupkg differ diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/README.md b/MTC_Adapter/packages/PrettyBin.1.1.0/README.md new file mode 100644 index 0000000..43c7c34 --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/README.md @@ -0,0 +1,14 @@ +PrettyBin +========= + +Make bin folder of your project small, pretty and easy to maintain! + +Moves dll,pdb and xml in bin/lib subfolder and ensures, that everything works. + +Your bin folder will look like this: + +/lib + +app.exe + +app.config diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/content/App.config.install.xdt b/MTC_Adapter/packages/PrettyBin.1.1.0/content/App.config.install.xdt new file mode 100644 index 0000000..30e6e7d --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/content/App.config.install.xdt @@ -0,0 +1,15 @@ + + + + + diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/license.txt b/MTC_Adapter/packages/PrettyBin.1.1.0/license.txt new file mode 100644 index 0000000..4379a1b --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/license.txt @@ -0,0 +1,7 @@ +Copyright (c) 2014, Ershov Andrey + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/makePackage.bat b/MTC_Adapter/packages/PrettyBin.1.1.0/makePackage.bat new file mode 100644 index 0000000..703225d --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/makePackage.bat @@ -0,0 +1,2 @@ +del PrettyBin.*.*.*.nupkg +nuget.exe pack PrettyBin.nuspec \ No newline at end of file diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/tools/init.ps1 b/MTC_Adapter/packages/PrettyBin.1.1.0/tools/init.ps1 new file mode 100644 index 0000000..38d8c11 --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/tools/init.ps1 @@ -0,0 +1,3 @@ +param($installPath, $toolsPath, $package, $project) + +Write-Host 'Init BinPrettify' \ No newline at end of file diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/tools/install.ps1 b/MTC_Adapter/packages/PrettyBin.1.1.0/tools/install.ps1 new file mode 100644 index 0000000..d64331e --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/tools/install.ps1 @@ -0,0 +1,156 @@ +param($installPath, $toolsPath, $package, $project) + + +$path = $project.FullName + +$appConfigItem = $project.ProjectItems | where {$_.Name -eq "App.config"} +if ($appConfigItem -eq $null) +{ + throw [System.IO.FileNotFoundException] "Project $path does not have App.config. PrettyBin is for exetutable projects only. " +} + +Write-Host 'Install PrettifyBin; ' +[xml]$doc = [xml](Get-Content $path) + + +# If a Namespace URI was not given, use the Xml document's default namespace. +$NamespaceURI = $doc.DocumentElement.NamespaceURI + Write-Host $NamespaceURI +# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up. +$xmlNsManager = New-Object System.Xml.XmlNamespaceManager($doc.NameTable) +$xmlNsManager.AddNamespace("ns", $NamespaceURI) + + +# ============ This script attemps to Create this tags in csproj: ======== +# +# +# +# +# +# +# + + + + +$targetNode = $doc.SelectSingleNode("//ns:Project/ns:Target[@Name='AfterBuild']", $xmlNsManager) + +if ($targetNode -eq $null) +{ + Write-Host 'No Target AfterBuild Node. Creating' + $targetNode = $doc.CreateElement('Target', $NamespaceURI ) + $targetNode.SetAttribute("Name" ,"AfterBuild") + $doc.Project.AppendChild($targetNode) +} + + +$filesToMoveNode = $targetNode.SelectSingleNode("//ns:ItemGroup/ns:MoveToLibFolder", $xmlNsManager) + +if ($filesToMoveNode -eq $null) +{ + Write-Host 'No ItemGroup whith MoveToLibFolder tag. Creating' + $itemGroup = $doc.CreateElement('ItemGroup', $NamespaceURI) + $filesToMoveNode = $doc.CreateElement('MoveToLibFolder', $NamespaceURI) + + $itemGroup.AppendChild($filesToMoveNode) + $targetNode.AppendChild($itemGroup) +} + +$filesToMoveNode.SetAttribute("Include" ,'$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml') + + +$MoveNode = $targetNode.SelectSingleNode('//ns:Move[contains(@SourceFiles,"@(MoveToLibFolder)")]', $xmlNsManager) +if ($MoveNode -eq $null) +{ + Write-Host 'No Move tag in AfterBuild Target. Creating' + $MoveNode = $doc.CreateElement('Move', $NamespaceURI) + $MoveNode.SetAttribute("SourceFiles" ,'@(MoveToLibFolder)') + $targetNode.AppendChild($MoveNode) +} +$MoveNode.SetAttribute("DestinationFolder",'$(OutputPath)lib') +$MoveNode.SetAttribute("OverwriteReadOnlyFiles","true") + +$doc.Save($path) + +# ============ This script attemps to Edit this tags in App.config: ======== +# +# +# +# +# +# +# +# + +Write-Host 'Edititing App.config' +# find the App.config file +$configItem = $project.ProjectItems | where {$_.Name -eq "App.config"} +# find its path on the file system +$configPath= $configItem.Properties | where {$_.Name -eq "LocalPath"} + +# Get XML content of App.config +[xml]$app = [xml](Get-Content $configPath.Value) + +# If a Namespace URI was not given, use the Xml document's default namespace. +$NamespaceAppURI = $app.DocumentElement.NamespaceURI +# In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up. +$xmlNsManager.AddNamespace("appns", $NamespaceAppURI) + +# Adding of configuration section +$configurationNode = $app.SelectSingleNode("//appns:configuration", $xmlNsManager) + +if ($configurationNode -eq $null) +{ + Write-Host 'No Configuration Node. Creating' + # Для чего тут нужен NamespaceURI + $configurationNode = $app.CreateElement('Configuration', $NamespaceAppURI ) + $configurationNode.SetAttribute("xmlns:xdt" ,"http://schemas.microsoft.com/XML-Document-Transform") + $app.AppendChild($configurationNode) +} + +# Adding of runtime section +$runtimeNode = $configurationNode.SelectSingleNode("//appns:runtime", $xmlNsManager) + +if ($runtimeNode -eq $null) +{ + Write-Host 'No runtime Node. Creating' + $runtimeNode = $app.CreateElement('runtime', $NamespaceAppURI ) + $configurationNode.AppendChild($runtimeNode) +} + +# Adding of assemblyBinding section +Write-Host 'runtimeNode items' +$assemblyBindingNode = $null +foreach ($item in $runtimeNode.ChildNodes) +{ + if ($item.Name -eq 'assemblyBinding') + { + $assemblyBindingNode = $item + break + } +} + +#$assemblyBindingNode = $runtimeNode.SelectSingleNode("//appns:assemblyBinding", $xmlNsManager) + +if ($assemblyBindingNode -eq $null) +{ + Write-Host 'No assemblyBinding Node. Creating' + $assemblyBindingNode = $app.CreateElement('assemblyBinding', $NamespaceAppURI ) + $runtimeNode.AppendChild($assemblyBindingNode) +} +$assemblyBindingNode.SetAttribute("xmlns" ,"urn:schemas-microsoft-com:asm.v1") + +# Adding of probing section +$probingNode = $assemblyBindingNode.SelectSingleNode("//appns:probing", $xmlNsManager) + +if ($probingNode -eq $null) +{ + Write-Host 'No probing Node. Creating' + $probingNode = $app.CreateElement('probing', $NamespaceAppURI ) + $assemblyBindingNode.AppendChild($probingNode) +} +$probingNode.SetAttribute("privatePath" ,"lib;libs") + +$app.save($configPath.Value) + + diff --git a/MTC_Adapter/packages/PrettyBin.1.1.0/tools/uninstall.ps1 b/MTC_Adapter/packages/PrettyBin.1.1.0/tools/uninstall.ps1 new file mode 100644 index 0000000..a2b6844 --- /dev/null +++ b/MTC_Adapter/packages/PrettyBin.1.1.0/tools/uninstall.ps1 @@ -0,0 +1,45 @@ +param($installPath, $toolsPath, $package, $project) + + +Try +{ + $path = $project.FullName + Write-Host 'Uninstall PrettifyBin; ' + [ xml ]$doc = [ xml ](Get-Content $path) + + + # If a Namespace URI was not given, use the Xml document's default namespace. + $NamespaceURI = $doc.DocumentElement.NamespaceURI + Write-Host $NamespaceURI + # In order for SelectSingleNode() to actually work, we need to use the fully qualified node path along with an Xml Namespace Manager, so set them up. + $xmlNsManager = New-Object System.Xml.XmlNamespaceManager($doc.NameTable) + $xmlNsManager.AddNamespace("ns", $NamespaceURI) + + + # ============ This script attemps to remove this tags in csproj: ======== + # + # + # + # + + + $moveNode = $doc.SelectSingleNode("//ns:Project/ns:Target[@Name='AfterBuild']/ns:Move[contains(@SourceFiles,'@(MoveToLibFolder)')]", $xmlNsManager) + + if ($moveNode -ne $null) + { + Write-Host 'We will delete move node' + $moveNode.ParentNode.RemoveChild($moveNode) + } + + + $doc.Save($path) +} +Catch +{ + $ErrorMessage = $_.Exception.Message + $FailedItem = $_.Exception.ItemName + Write-Host $ErrorMessage + Write-Host $FailedItem + Break +} +