cforge: ./branches/13-jobs/cforge/cforge/Program.cs
Bash
bash
(Bash)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace cforge
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("");
Console.WriteLine(@"----------------------------------------------------------------------------");
Console.WriteLine("cforge started");
Console.WriteLine("Build date: " + Resources.BuildTime);
Console.WriteLine("Revision based: " + Resources.CurrentSVNRevision);
Console.WriteLine(@"----------------------------------------------------------------------------");
Console.WriteLine("");
if (Helper.EasyAttachEnabled())
{
Console.WriteLine("Easy attach enabled. Now attach with debugger, and then press Enter here!");
Console.ReadLine();
}
if (args.Length == 1 && args[0].StartsWith("cforge:"))
{
// invokation via URL Handler:
// format is
// "cforge:<command>:additionalargs_or_path_or_whatever
// now we can remove the start
// split for the first ":" and the rest is like the normal commandline
String arg = args[0].Remove(0, "cforge:".Length);
List<string> newargs = new List<string>();
String command = "--" + arg.Split(':')[0];
newargs.Add(command);
if (arg.Split(':').Length > 1)
{
string s = System.Uri.UnescapeDataString(arg.Remove(0, arg.Split(':')[0].Length + 1));
s = System.Uri.UnescapeDataString(s);
newargs.Add(s);
}
if(Helper.EasyAttachEnabled())
{
Console.WriteLine("converting arguments from: ");
foreach (String s in args)
{
Console.WriteLine(s);
}
Console.WriteLine("to: ");
foreach (String s in newargs)
{
Console.WriteLine(s);
}
}
args = newargs.ToArray();
}
if (Helper.EasyAttachEnabled())
{
Console.WriteLine("CWD: " + Directory.GetCurrentDirectory());
Console.WriteLine("User elevated: " + Helper.IsUserElevated());
}
if (!Helper.CheckRegistryProtocol())
{
Console.WriteLine(@"[WARNING] URL Handler is not registered. CFORGE: links will not work properly. Use Setup.bat to do this (at <CODESYS Installation folder>\CFORGE\ )");
}
List<String> liScripts = Helper.GetAllScripts();
bool bDebug = false;
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "-d":
bDebug = true;
if (Helper.IsUserElevated())
Console.WriteLine("Running elevated");
break;
// fallthrough intended
case "-v":
case "--version":
Version version = Assembly.GetEntryAssembly().GetName().Version;
Console.WriteLine("Version: " + version.ToString());
break;
case "--setup":
if (!Helper.IsUserElevated())
{
Console.WriteLine("[INFO] Setup URL Handler and add tool to path. ");
Helper.RunElevated("--setup");
}
else
{
Helper.RegisterProtocol(bDebug);
Helper.AddToSystemPath(bDebug);
}
break;
case "--license-info":
Helper.ShowLicenseInfo();
break;
/* fallthrough intended ! */
case "--help":
case "-h":
ShowUsage();
break;
default:
if (Helper.EasyAttachEnabled())
{
Console.WriteLine("default case: " + args[i]);
}
// check if we have matching script:
if (args[i].StartsWith("--"))
{
String command = args[i].Replace("--", "");
if (liScripts.Contains(command))
{
// the rest of the command is passed as argument to the script
string[] newargs = args.Skip(i + 1).ToArray();
Helper.ExecuteIPyScript(command, newargs, bDebug);
// as we "used" all params...
i = args.Length;
}
else
{
if (Helper.EasyAttachEnabled())
{
Console.WriteLine("no matching script found: " + command);
}
ShowUsage();
}
}
break;
}
}
if (args.Length == 0)
ShowUsage();
Console.WriteLine("");
Console.WriteLine(@"----------------------------------------------------------------------------");
Console.WriteLine("cforge finished.");
Console.WriteLine(@"----------------------------------------------------------------------------");
Console.WriteLine("");
Console.ReadLine();
}
static void ShowUsage()
{
// pad right 32 for description ;-)
Console.WriteLine(@"usage: cforge <command> <arguments>");
Console.WriteLine(@"");
Console.WriteLine(@"internal commands:");
Console.WriteLine(@"-h/--help show this help");
Console.WriteLine(@"--setup register cforge url handler and add cforge to path");
Console.WriteLine(@"--license-info show license information");
Console.WriteLine(@"-v/--version show version information");
Console.WriteLine(@"");
Console.WriteLine(@"");
Console.WriteLine(@"external commands (scripts):");
Console.WriteLine(@"------------------------------");
// generic part
List<String> liCommands = Helper.GetAllScripts();
foreach (String command in liCommands)
{
Helper.ShowUsageIPyScript(command, false);
}
Console.WriteLine(@"");
Console.WriteLine(@"");
}
}
}
Last updated: 2018-04-24
cforge: ./branches/13-jobs/cforge/cforge/app.manifest
Bash
bash
(Bash)
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC-Manifestoptionen
Wenn Sie die Ebene der Benutzerkontensteuerung für Windows ändern möchten, ersetzen Sie den
Knoten "requestedExecutionLevel" wie folgt.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Durch Angabe des Elements "requestedExecutionLevel" wird die Datei- und Registrierungsvirtualisierung deaktiviert.
Entfernen Sie dieses Element, wenn diese Virtualisierung aus Gründen der Abwärtskompatibilität
für die Anwendung erforderlich ist.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Eine Liste der Windows-Versionen, unter denen diese Anwendung getestet
und für die sie entwickelt wurde. Wenn Sie die Auskommentierung der entsprechenden Elemente aufheben,
wird von Windows automatisch die kompatibelste Umgebung ausgewählt. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Gibt an, dass die Anwendung mit DPI-Werten kompatibel ist und von Windows nicht automatisch auf höhere
DPI-Werte skaliert wird. WPF-Anwendungen (Windows Presentation Foundation) sind automatisch mit DPI-Werten kompatibel und müssen sich nicht
anmelden. Für Windows Forms-Anwendungen für .NET Framework 4.6, die sich für diese Einstellung anmelden, muss
auch die Einstellung "'EnableWindowsFormsHighDpiAutoResizing" in der "app.config" auf "true" festgelegt werden. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Designs für allgemeine Windows-Steuerelemente und -Dialogfelder (Windows XP und höher) aktivieren -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
Last updated: 2018-03-30
cforge: ./branches/13-jobs/cforge/cforge/CreatePackage.bat
Bash
bash
(Bash)
REM Create Package from package source folder
set zip="C:\Program Files\7-Zip\7z.exe"
set folder=%1
set name=%2
IF NOT EXIST %zip% ECHO "7zip not found, Package cannot be created!"
IF NOT EXIST %zip% goto failed
IF NOT EXIST %folder% goto failed
IF EXIST "%name%" del "%name%"
cd "%folder%"
%zip% a -tzip "%name%" . -r
:failed
Last updated: 2018-07-13
cforge: ./branches/13-jobs/cforge/cforge/cforge.csproj.user
Bash
bash
(Bash)
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>cforge:list-all</StartArguments>
</PropertyGroup>
</Project>
Last updated: 2018-04-03
cforge: ./branches/13-jobs/cforge/cforge/Makefile
Bash
bash
(Bash)
OUTPUT=bin/Debug/cforge.exe
PACKAGE=../../cforge.package
all: ${OUTPUT}
bin/Debug/cforge.exe: cforge.csproj
# cross build a visual studio project
%.exe:
xbuild $<
# prepared, but doesn't work, yet
%.package: ${OUTPUT}
mono ${OUTPUT} --build $$(dirname $@)/$$(basename $@ .package)
Last updated: 2018-08-09
cforge: ./branches/13-jobs/cforge/cforge/packages.config
Bash
bash
(Bash)
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DynamicLanguageRuntime" version="1.2.1" targetFramework="net461" />
<package id="IronPython" version="2.7.8.1" targetFramework="net461" />
</packages>
Last updated: 2018-03-26
cforge: ./branches/13-jobs/cforge/cforge/App.config
Bash
bash
(Bash)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
Last updated: 2018-03-17
cforge: ./branches/13-jobs/cforge/cforge/license.txt
Bash
bash
(Bash)
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
You must cause any modified files to carry prominent notices stating that You changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
This project makes use of the following 3rd party nuget packages:
This list was generated with this command:
PM > Get-Package | Select-Object Id,LicenseUrl
Id LicenseUrl
-- ----------
DynamicLanguageRuntime https://github.com/IronLanguages/dlr/blob/master/LICENSE
IronPython https://github.com/IronLanguages/ironpython2/blob/master/LICENSE
Currently all used packages are using Apache 2.0 license.
Last updated: 2018-03-20
cforge: ./branches/13-jobs/cforge/cforge/Resources.resx
Bash
bash
(Bash)
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="BuildTime" xml:space="preserve">
<value>$WCNOW$</value>
</data>
<data name="CurrentSVNRevision" xml:space="preserve">
<value>$WCREV$</value>
</data>
<data name="HasLocalModifications" xml:space="preserve">
<value>$WCMODS?(local modifications detected): $</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="license" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>license.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>
Last updated: 2018-04-23
cforge: ./branches/13-jobs/cforge/cforge/cforge.csproj
Bash
bash
(Bash)
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4FEA909F-B6AB-49EF-9EEA-9AED5C2E7792}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>cforge</RootNamespace>
<AssemblyName>cforge</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>cforge.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="IronPython, Version=2.7.8.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\IronPython.dll</HintPath>
</Reference>
<Reference Include="IronPython.Modules, Version=2.7.8.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\IronPython.Modules.dll</HintPath>
</Reference>
<Reference Include="IronPython.SQLite, Version=2.7.8.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\IronPython.SQLite.dll</HintPath>
</Reference>
<Reference Include="IronPython.Wpf, Version=2.7.8.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\IronPython.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Dynamic, Version=1.2.0.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\Microsoft.Dynamic.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting, Version=1.2.0.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\Microsoft.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.Metadata, Version=1.2.0.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronPython-2.7.8\Net45\Microsoft.Scripting.Metadata.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\DynamicLanguageRuntime.1.2.1\lib\net45\Microsoft.VisualStudio.CodeCoverage.Shim.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="app.manifest" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="icon.ico" />
<EmbeddedResource Include="license.txt" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent></PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent></PreBuildEvent>
</PropertyGroup>
</Project>
Last updated: 2018-08-09
cforge: ./branches/13-jobs/cforge/package.manifest
Bash
bash
(Bash)
<?xml version="1.0" encoding="ISO-8859-1"?>
<Package>
<Strings>
<String Id="GeneralName">
<Neutral>cforge Tool</Neutral>
</String>
<String Id="GeneralCopyright">
<Neutral>Copyright (c) 2018 by General Purpose Solutions. No rights reserved.</Neutral>
</String>
<String Id="GeneralDescription">
<Neutral>This package builds the perfect fusion between the Desktop Application CODESYS and the Online Services of CODESYS Forge. It speeds up the major workflows, which you usually need when you are working with CODESYS Forge (Checkout, Build, Checkin, Install, ...).</Neutral>
</String>
<String Id="license">
<Neutral>cforge\license.txt</Neutral>
</String>
</Strings>
<General>
<Id>{BE6F128B-AFD1-4E2D-B51E-2525B0339298}</Id>
<Version>1.0.0.15</Version>
<Name>$GeneralName</Name>
<Vendor>General Purpose Solutions</Vendor>
<Copyright>$GeneralCopyright</Copyright>
<Description>$GeneralDescription</Description>
<LicenseAgreement>$license</LicenseAgreement>
<RequiredInstallerVersion>3.5.10.0</RequiredInstallerVersion>
</General>
<TargetDirectoryDefinitions>
</TargetDirectoryDefinitions>
<Components>
<Component>
<General>
<Id>1</Id>
<Name>Tools</Name>
<Description>Tools</Description>
<Selectable>false</Selectable>
<SelectedByDefault>true</SelectedByDefault>
</General>
<Dependencies>
</Dependencies>
<Items>
<Folder>
<Path>cforge\Package\CFORGE</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\</TargetFolder>
</Folder>
<File>
<Path>packages\IronPython-2.7.8\Net45\IronPython.dll</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\IronPython.xml</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\IronPython.Modules.dll</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\IronPython.Modules.xml</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\DLLs\IronPython.SQLite.dll</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\DLLs\IronPython.SQLite.xml</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\DLLs\IronPython.Wpf.dll</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\DLLs\IronPython.Wpf.xml</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\Microsoft.Dynamic.dll</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\Microsoft.Dynamic.xml</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\Microsoft.Scripting.dll</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>packages\IronPython-2.7.8\Net45\Microsoft.Scripting.xml</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<File>
<Path>cforge\bin\Debug\cforge.exe</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>%AP_ROOT%\CFORGE\</TargetFolder>
</File>
<!--<ExternalCall>
<Installation>
<FileName>%AP_ROOT%\CFORGE\Setup.bat</FileName>
<CreateNoWindow>FALSE</CreateNoWindow>
</Installation>
</ExternalCall>-->
</Items>
</Component>
</Components>
</Package>
Last updated: 2019-01-25
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/action.svn.checkout.py
Bash
bash
(Bash)
# Example Batch:
# set WD=%~d0%~p0
# set USER=<username>
# set PASS=<password>
# set URL=https://forge.codesys.com/svn/drv,gpio-mod,code/trunk/GPIOMods
# "C:\Program Files (x86)\3S CODESYS-V3.5.12.0\CODESYS\Common\CODESYS.exe" --profile="CODESYS V3.5 SP12" --runscript="%WD%\action.svn.checkout.py" --scriptargs="%URL% %USER% %PASS% %WD%" --noUI
import sys
import os.path
import pysvn
system.prompt_handling = PromptHandling.None
if len(sys.argv) <= 1:
print("usage: <url> [<user> <pass> <working dir>]")
sys.exit()
url = sys.argv[1].replace("`````", "'")
if len(sys.argv) > 3:
username = sys.argv[2].replace("`````", "'")
password = sys.argv[3].replace("`````", "'")
else:
credentials = system.ui.query_credentials("Enter SVN credentials")
username = credentials[0]
password = credentials[1]
if len(sys.argv) > 4:
path = sys.argv[4].replace("`````", "'")
else:
path = system.ui.browse_directory_dialog("Choose a checkout folder")
def set_username(req):
req.username = username
req.password = password
req.save = True # Optional
# checkout plain SVN files
pysvn.svn_checkout_non_codesys(username, password, url, path)
# get all CODESYS projects
svn.auth_username_password += set_username
cdsprojects = pysvn.svn_get_directories_with_codesys_projects(username, password, url)
# checkout all CODESYS projects
for p in cdsprojects:
dirbase = path + "\\" + p.rstrip('/').replace("/", "\\")
filebase = os.path.basename(dirbase)
dir = os.path.dirname(dirbase)
print("checkout via SVN...")
try:
svn.checkout(url + "/" + p, dir, filebase + ".library")
except:
pass
print("... checkout done.")
print("save project...")
proj = projects.primary
if proj.find("Project Information"):
proj.save_as(dirbase + ".library")
else:
proj.save_as(dirbase + ".project")
print("... project saved.")
print("closing...")
try:
proj.close()
except:
pass
print("... project closed.")
system.exit()
Last updated: 2020-08-11
cforge: ./branches/13-jobs/cforge/packages/IronPython-2.7.8/Net45/DLLs/IronPython.SQLite.xml
Bash
bash
(Bash)
<?xml version="1.0"?>
<doc>
<assembly>
<name>IronPython.SQLite</name>
</assembly>
<members>
<member name="T:Community.CsharpSqlite.Sqlite3.LockingStrategy">
<summary>
Basic locking strategy for Console/Winform applications
</summary>
</member>
<member name="T:Community.CsharpSqlite.Sqlite3.MediumTrustLockingStrategy">
<summary>
Locking strategy for Medium Trust. It uses the same trick used in the native code for WIN_CE
which doesn't support LockFileEx as well.
</summary>
</member>
<member name="F:Community.CsharpSqlite.Sqlite3.etRADIX">
* The rest are extensions, not normally found in printf() */
</member>
<member name="F:Community.CsharpSqlite.Sqlite3.SQLITE_OK">
* beginning-of-error-codes */
</member>
<member name="F:Community.CsharpSqlite.Sqlite3.SQLITE_CONFIG_SINGLETHREAD">
* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
</member>
<member name="T:Community.CsharpSqlite.Sqlite3.sqlite3_module">
* The methods above are in version 1 of the sqlite_module object. Those
</member>
<member name="M:Community.CsharpSqlite.Sqlite3.sqlite3GetToken(System.String,System.Int32,System.Int32@)">
* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
</member>
</members>
</doc>
Last updated: 2018-07-16
cforge: ./branches/13-jobs/cforge/packages/IronPython-2.7.8/Net45/DLLs/IronPython.Wpf.xml
Bash
bash
(Bash)
<?xml version="1.0"?>
<doc>
<assembly>
<name>IronPython.Wpf</name>
</assembly>
<members>
<member name="T:IronPython.Modules.Wpf">
<summary>
Provides helpers for interacting with Windows Presentation Foundation applications.
</summary>
</member>
<member name="M:IronPython.Modules.Wpf.LoadComponent(IronPython.Runtime.CodeContext,System.Object,System.String)">
<summary>
Loads XAML from the specified XmlReader and returns the deserialized object. Any event handlers
are bound to methods defined in the provided module. Any named objects are assigned to the object.
The provided object is expected to be the same type as the root of the XAML element.
</summary>
</member>
<member name="M:IronPython.Modules.Wpf.LoadComponent(IronPython.Runtime.CodeContext,System.Object,System.IO.Stream)">
<summary>
Loads XAML from the specified XmlReader and returns the deserialized object. Any event handlers
are bound to methods defined in the provided module. Any named objects are assigned to the object.
The provided object is expected to be the same type as the root of the XAML element.
</summary>
</member>
<member name="M:IronPython.Modules.Wpf.LoadComponent(IronPython.Runtime.CodeContext,System.Object,System.Xml.XmlReader)">
<summary>
Loads XAML from the specified XmlReader and returns the deserialized object. Any event handlers
are bound to methods defined in the provided module. Any named objects are assigned to the object.
The provided object is expected to be the same type as the root of the XAML element.
</summary>
</member>
<member name="M:IronPython.Modules.Wpf.LoadComponent(IronPython.Runtime.CodeContext,System.Object,System.IO.TextReader)">
<summary>
Loads XAML from the specified XmlReader and returns the deserialized object. Any event handlers
are bound to methods defined in the provided module. Any named objects are assigned to the object.
The provided object is expected to be the same type as the root of the XAML element.
</summary>
</member>
<member name="M:IronPython.Modules.Wpf.LoadComponent(IronPython.Runtime.CodeContext,System.Object,System.Xaml.XamlXmlReader)">
<summary>
Loads XAML from the specified XmlReader and returns the deserialized object. Any event handlers
are bound to methods defined in the provided module. Any named objects are assigned to the object.
The provided object is expected to be the same type as the root of the XAML element.
</summary>
</member>
</members>
</doc>
Last updated: 2018-07-16
cforge: ./branches/13-jobs/cforge/packages/IronPython-2.7.8/Net45/IKVM.Reflection.License.txt
Bash
bash
(Bash)
Copyright (C) 2002, 2003, 2004 Jeroen Frijters
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
Last updated: 2018-07-16
cforge: ./branches/13-jobs/cforge/cforge.sln
Bash
bash
(Bash)
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cforge", "cforge\cforge.csproj", "{4FEA909F-B6AB-49EF-9EEA-9AED5C2E7792}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4FEA909F-B6AB-49EF-9EEA-9AED5C2E7792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FEA909F-B6AB-49EF-9EEA-9AED5C2E7792}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FEA909F-B6AB-49EF-9EEA-9AED5C2E7792}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FEA909F-B6AB-49EF-9EEA-9AED5C2E7792}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BAA9A0BD-21F1-4CC6-BF28-784922753AC9}
EndGlobalSection
EndGlobal
Last updated: 2018-03-17
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/ui.py
Bash
bash
(Bash)
#!/usr/bin/ipy
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
from System.Drawing import Point, Font, FontStyle, Color, Icon
from System.Windows.Forms import Application, Form, TextBox
from System.Windows.Forms import Label, ToolBar, ToolBarButton, OpenFileDialog, Button, ScrollBars
from System.Windows.Forms import DialogResult, ScrollBars, DockStyle
import sys
import os
import json
import ntpath
GlobalResult = False
class IFormSettings(Form):
def __init__(self, Title, Config, Folder=False, Credentials=False, Info=False, InfoText="", Message=False, PkgName=False, PkgVendor=False, PkgCopyright=False, PkgDescription=False, Repo=False):
self.Config = Config
y = 0
self.TitleLable = Label()
self.TitleLable.Text = Title
self.TitleLable.Parent = self
self.TitleLable.Height = 36
self.TitleLable.Font = Font("Arial", 24,FontStyle.Bold)
self.TitleLable.BackColor = Color.FromArgb(80,80,80)
self.TitleLable.ForeColor = Color.FromArgb(255,255,255)
self.TitleLable.Dock = DockStyle.Top
y += 42
if Repo:
# Repository URL
self.RepoLabel = Label()
self.RepoLabel.Text = "Repo. URL:"
self.RepoLabel.Location = Point(0, y)
self.RepoLabel.Width = 60
self.RepoLabel.Parent = self
self.RepoBox = TextBox()
if "Repo" in Config:
self.RepoBox.Text = Config["Repo"]
self.RepoBox.Enabled = True
self.RepoBox.Location = Point(60, y)
self.RepoBox.Parent = self
self.RepoBox.Width = 300
y += 24
if Folder:
# Folder
self.FolderLabel = Label()
self.FolderLabel.Text = "Folder:"
self.FolderLabel.Location = Point(0, y)
self.FolderLabel.Width = 60
self.FolderLabel.Parent = self
self.FolderBox = TextBox()
if "folder" in Config:
self.FolderBox.Text = Config["folder"]
self.FolderBox.Enabled = True
self.FolderBox.Location = Point(60, y)
self.FolderBox.Parent = self
self.FolderBox.Width = 300
self.FolderButton = Button()
self.FolderButton.Click += self.OnClickBrowse
self.FolderButton.Text = "..."
self.FolderButton.Parent = self
self.FolderButton.Location = Point(364, y)
y += 24
if Credentials:
# Credentials
self.UserLabel = Label()
self.UserLabel.Text = "Username:"
self.UserLabel.Location = Point(0, y)
self.UserLabel.Width = 60
self.UserLabel.Parent = self
self.UserBox = TextBox()
if "user" in Config:
self.UserBox.Text = Config["user"]
self.UserBox.Enabled = True
self.UserBox.Location = Point(60, y)
self.UserBox.Parent = self
self.UserBox.Width = 300
y += 24
self.PassLabel = Label()
self.PassLabel.Text = "Password:"
self.PassLabel.Location = Point(0, y)
self.PassLabel.Width = 60
self.PassLabel.Parent = self
self.PassBox = TextBox()
if "pass" in Config:
self.PassBox.Text = Config["pass"]
self.PassBox.Enabled = True
self.PassBox.PasswordChar = "*"
self.PassBox.Location = Point(60, y)
self.PassBox.Parent = self
self.PassBox.Width = 300
y += 24
if Info:
# Info Box
self.InfoLabel = Label()
self.InfoLabel.Text = "Info:"
self.InfoLabel.Location = Point(0, y)
self.InfoLabel.Width = 60
self.InfoLabel.Parent = self
y += 24
self.InfoBox = TextBox()
self.InfoBox.Text = InfoText
self.InfoBox.Enabled = True
self.InfoBox.ReadOnly = True
self.InfoBox.Location = Point(0, y)
self.InfoBox.Parent = self
self.InfoBox.WordWrap = False
self.InfoBox.Multiline = True
self.InfoBox.ScrollBars = ScrollBars.Horizontal | ScrollBars.Vertical
self.InfoBox.Width = 360
self.InfoBox.Height = 260
y += 280
if Message:
# Message
self.MessageLabel = Label()
self.MessageLabel.Text = "Message:"
self.MessageLabel.Location = Point(0, y)
self.MessageLabel.Width = 60
self.MessageLabel.Parent = self
y += 24
self.MessageBox = TextBox()
self.MessageBox.Text = "Enter Message..."
if "msg" in Config and Config["msg"] != "":
self.MessageBox.Text = Config["msg"]
self.MessageBox.Enabled = True
self.MessageBox.Location = Point(0, y)
self.MessageBox.Parent = self
self.MessageBox.WordWrap = False
self.MessageBox.Multiline = True
self.MessageBox.AcceptsReturn = True
self.MessageBox.ScrollBars = ScrollBars.Horizontal | ScrollBars.Vertical
self.MessageBox.Width = 360
self.MessageBox.Height = 160
y += 180
if PkgName:
# Name
self.PkgNameLabel = Label()
self.PkgNameLabel.Text = "Name:"
self.PkgNameLabel.Location = Point(0, y)
self.PkgNameLabel.Width = 60
self.PkgNameLabel.Parent = self
self.PkgNameBox = TextBox()
if "PkgName" in Config:
self.PkgNameBox.Text = Config["PkgName"]
self.PkgNameBox.Enabled = True
self.PkgNameBox.Location = Point(60, y)
self.PkgNameBox.Parent = self
self.PkgNameBox.Width = 300
y += 24
if PkgVendor:
# Name
self.PkgVendorLabel = Label()
self.PkgVendorLabel.Text = "Vendor:"
self.PkgVendorLabel.Location = Point(0, y)
self.PkgVendorLabel.Width = 60
self.PkgVendorLabel.Parent = self
self.PkgVendorBox = TextBox()
self.PkgVendorBox.Text = "Open Source Software"
if "PkgVendor" in Config and Config["PkgVendor"] != "":
self.PkgVendorBox.Text = Config["PkgVendor"]
self.PkgVendorBox.Enabled = True
self.PkgVendorBox.Location = Point(60, y)
self.PkgVendorBox.Parent = self
self.PkgVendorBox.Width = 300
y += 24
if PkgCopyright:
# Name
self.PkgCopyrightLabel = Label()
self.PkgCopyrightLabel.Text = "Copyright:"
self.PkgCopyrightLabel.Location = Point(0, y)
self.PkgCopyrightLabel.Width = 60
self.PkgCopyrightLabel.Parent = self
self.PkgCopyrightBox = TextBox()
self.PkgCopyrightBox.Text = "all rights reserved"
if "PkgCopyright" in Config and Config["PkgCopyright"] != "":
self.PkgCopyrightBox.Text = Config["PkgCopyright"]
self.PkgCopyrightBox.Enabled = True
self.PkgCopyrightBox.Location = Point(60, y)
self.PkgCopyrightBox.Parent = self
self.PkgCopyrightBox.Width = 300
y += 24
if PkgDescription:
# Name
self.PkgDescriptionLabel = Label()
self.PkgDescriptionLabel.Text = "Descr.:"
self.PkgDescriptionLabel.Location = Point(0, y)
self.PkgDescriptionLabel.Width = 60
self.PkgDescriptionLabel.Parent = self
self.PkgDescriptionBox = TextBox()
if "PkgDescription" in Config:
self.PkgDescriptionBox.Text = Config["PkgDescription"]
self.PkgDescriptionBox.Enabled = True
self.PkgDescriptionBox.Location = Point(60, y)
self.PkgDescriptionBox.Parent = self
self.PkgDescriptionBox.Width = 300
y += 24
# OK / Cancel Button
self.AcceptButton = Button()
self.AcceptButton.Click += self.OnClickOK
self.AcceptButton.Text = "OK"
self.AcceptButton.Parent = self
self.AcceptButton.Location = Point(364, y)
self.AcceptButton.Select()
self.CancelButton = Button()
self.CancelButton.Click += self.OnClickCancel
self.CancelButton.Text = "Cancel"
self.CancelButton.Parent = self
self.CancelButton.Location = Point(0, y)
y += 24
# Self (Dialog)
self.Width = 458
self.Height = y + 50
self.Text = "cforge - " + Title
workingdir = os.path.dirname(sys.argv[0])
self.Icon = Icon(os.path.join(workingdir, "icon.ico"))
self.CenterToScreen()
def OnClickBrowse(self, sender, event):
dialog = OpenFileDialog()
dialog.Filter = "all files (*.*) |*.*"
dialog.ShowHelp = True
dialog.ValidateNames = False;
dialog.CheckFileExists = False;
dialog.CheckPathExists = False;
dialog.FileName = "Folder Selection"
if dialog.ShowDialog(self) == DialogResult.OK:
folder, file = ntpath.split(dialog.FileName)
print (self.FolderBox)
self.FolderBox.Text = folder
def OnClickOK(self, sender, event):
global GlobalResult
# Return content of form in config structure
if hasattr(self, 'RepoBox'):
self.Config["repo"] = self.RepoBox.Text
if hasattr(self, 'FolderBox'):
self.Config["folder"] = self.FolderBox.Text
if hasattr(self, 'UserBox'):
self.Config["user"] = self.UserBox.Text
if hasattr(self, 'PassBox'):
self.Config["pass"] = self.PassBox.Text
if hasattr(self, 'MessageBox'):
self.Config["msg"] = self.MessageBox.Text
if hasattr(self, 'PkgNameBox'):
self.Config["PkgName"] = self.PkgNameBox.Text
if hasattr(self, 'PkgVendorBox'):
self.Config["PkgVendor"] = self.PkgVendorBox.Text
if hasattr(self, 'PkgCopyrightBox'):
self.Config["PkgCopyright"] = self.PkgCopyrightBox.Text
if hasattr(self, 'PkgDescriptionBox'):
self.Config["PkgDescription"] = self.PkgDescriptionBox.Text
GlobalResult = True
self.Dispose()
def OnClickCancel(self, sender, event):
global GlobalResult
# Discard form data, don't return it
GlobalResult = False
self.Dispose()
def GetSettings():
dirname = os.path.expanduser("~\\cforge")
filename = dirname + "\\cache.json"
config = { 'folder' : dirname, 'user' : os.environ["USERNAME"], 'pass' : '', 'msg' : ''}
if not os.path.isfile(filename):
if not os.path.isdir(dirname):
os.mkdir(dirname)
with open(filename, "w") as f:
config = json.dump(config, f)
with open(filename) as f:
config = json.load(f)
return config
def SaveSettings(config):
dirname = os.path.expanduser("~\\cforge")
filename = dirname + "\\cache.json"
with open(filename, "w") as f:
config = json.dump(config, f)
def Dialog(Title, Folder=False, Credentials=False, DefaultFolder="", Info=False, InfoText="", Message=False, PkgName=False, PkgVendor=False, PkgCopyright=False, PkgDescription=False, Repo=False, DefaultRepo=""):
config = GetSettings()
if DefaultFolder != "":
folder, file = ntpath.split(config['folder'])
config['folder'] = os.path.join(folder, DefaultFolder)
if DefaultRepo != "":
config['Repo'] = DefaultRepo
Application.Run(IFormSettings(Title, Folder=Folder, Credentials=Credentials, Info=Info, InfoText=InfoText, Message=Message, Config=config, PkgName=PkgName, PkgVendor=PkgVendor, PkgCopyright=PkgCopyright, PkgDescription=PkgDescription, Repo=Repo))
if GlobalResult:
SaveSettings(config)
return config
else:
return None
#Dialog("Checkout", Folder=True, Credentials=True, DefaultFolder="test,y,z")
#Application.Run(IFormSettings("Checkout", Folder=True, Credentials=True))
#Application.Run(IFormSettings("Checkout", Credentials=True))
#Application.Run(IFormSettings("Checkout", Folder=True))
Last updated: 2018-08-29
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/create-package.py
Bash
bash
(Bash)
import sys, os
import zipfile
import cds_script
import uuid
import ui
ManifestSkeleton="""<?xml version="1.0" encoding="ISO-8859-1"?>
<Package>
<Strings>
<String Id="GeneralName">
<Neutral>%s</Neutral>
</String>
<String Id="GeneralVendor">
<Neutral>%s</Neutral>
</String>
<String Id="GeneralCopyright">
<Neutral>%s</Neutral>
</String>
<String Id="GeneralDescription">
<Neutral>%s</Neutral>
</String>
<String Id="license">
<Neutral>%s</Neutral>
</String>
<String Id="TargetDir">
<Neutral>Target directory</Neutral>
</String>
<String Id="TargetDirDescription">
<Neutral>The target directory where the projects are saved.</Neutral>
</String>
</Strings>
<General>
<Id>{%s}</Id>
<Version>1.0.0.0</Version>
<Name>$GeneralName</Name>
<Vendor>$GeneralVendor</Vendor>
<Copyright>$GeneralCopyright</Copyright>
<Description>$GeneralDescription</Description>
<LicenseAgreement>$license</LicenseAgreement>
<RequiredInstallerVersion>3.5.10.0</RequiredInstallerVersion>
</General>
<TargetDirectoryDefinitions>
<TargetDirectoryDefinition>
<Id>1</Id>
<Name>$TargetDir</Name>
<Description>$TargetDirDescription</Description>
<PromptUser>True</PromptUser>
<DefaultValue>%%USERPROFILE%%\CODESYS Projects\</DefaultValue>
</TargetDirectoryDefinition>
</TargetDirectoryDefinitions>
<Components>
<Component>
<General>
<Id>1</Id>
<Name>Default</Name>
<Description>Default Package</Description>
<Selectable>false</Selectable>
<SelectedByDefault>true</SelectedByDefault>
</General>
<Dependencies>
</Dependencies>
<Items>
%s
</Items>
</Component>
</Components>
</Package>
"""
ManifestItemLibrary = """
<Library>
<Path>%s</Path>
</Library>
"""
ManifestItemDevDesc = """
<DeviceDescription>
<Path>%s</Path>
</DeviceDescription>
"""
ManifestItemProject = """
<File>
<Path>%s</Path>
<IgnoreArchiveFolder>True</IgnoreArchiveFolder>
<TargetFolder>$1</TargetFolder>
<Overwrite>
<Option>Yes</Option>
</Overwrite>
</File>
"""
# This is a cforge command (script file)
# this will be run as ironpython script.
# the filename of this script is automatically the corresponding cforge command
# with some magic functions you can easily integrate it nicely into cforge tool
# cforge_usage:
# here you can return an array of all possible arguments and options that can
# be passed to this command script
def cforge_usage():
help = [
["<path to local repository>", "---"]
]
return help
if len(sys.argv) <= 1:
print("Oh, there are no arguments. Perhaps you forgot something?")
sys.exit()
folder = sys.argv[1]
scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
filename=os.path.join(root, file)
archname=filename[len(path)+1:]
print("Adding file: %s -> %s" % (filename, archname))
ziph.write(filename, arcname=archname)
# Discover package content
packageItems = ""
license = ""
for root, dirs, files in os.walk(folder):
for file in files:
filename=os.path.join(root, file)
archname=filename[len(folder)+1:]
if file.endswith(".project"):
packageItems += ManifestItemProject % (archname)
if file.endswith(".devdesc.xml"):
packageItems += ManifestItemDevDesc % (archname)
if file.endswith(".library"):
packageItems += ManifestItemLibrary % (archname)
if file == "license.txt":
license = archname;
if license == "":
file = open(os.path.join(folder, "license.txt"), "w")
if file:
file.write("Add license text...")
file.close();
license = "license.txt"
config = ui.Dialog("Create Package", PkgName=True, PkgVendor=True, PkgCopyright=True, PkgDescription=True)
if config != None:
guid = uuid.uuid1();
packageManifest = ManifestSkeleton % (config["PkgName"], config["PkgVendor"], config["PkgCopyright"], config["PkgDescription"], "LICENSE.TXT", guid, packageItems)
file = open(os.path.join(folder, "package.manifest"), "w")
if file:
file.write(packageManifest)
file.close();
print packageManifest
Last updated: 2018-08-29
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/build.py
Bash
bash
(Bash)
import sys, os
import re
import zipfile
import cds_script
import ntpath
import ui
# This is a cforge command (script file)
# this will be run as ironpython script.
# the filename of this script is automatically the corresponding cforge command
# with some magic functions you can easily integrate it nicely into cforge tool
# cforge_usage:
# here you can return an array of all possible arguments and options that can
# be passed to this command script
def cforge_usage():
help = [
["<path to local repository>", "---"]
]
return help
if len(sys.argv) <= 1:
print("Oh, there are no arguments. Perhaps you forgot something?")
sys.exit()
folder = sys.argv[1]
scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
# if folder can't be found, try to interpret it as a repo
# name, relatively to the workspace folder
if not os.path.isdir(folder):
config = ui.GetSettings()
workspace, file = ntpath.split(config['folder'])
folder = os.path.join(workspace, folder)
print("building folder: %s" % folder)
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
filename=os.path.join(root, file)
archname=filename[len(path)+1:]
print("Adding file: %s -> %s" % (filename, archname))
ziph.write(filename, arcname=archname)
# Build all packages
xFoundProject = False
for root, dirs, files in os.walk(folder):
for file in files:
# btw, check if some libs or projects are to be built
if file.endswith(".library") or file.endswith(".project"):
xFoundProject = True
if file == "package.manifest":
# Increase Package Version
packageManifest = os.path.join(root, file)
f = open(packageManifest, 'r')
if f:
manifest = f.read()
version = re.findall(r'<Version>([^<]*)</Version>', manifest)
if len(version) == 1:
version = version[0]
version_tuple = version.split('.')
version_tuple[-1] = str(int(version_tuple[-1]) + 1)
new_version = ".".join(version_tuple)
print("Increasing package version number from %s to %s\n" % (version, new_version))
manifest = manifest.replace("<Version>%s</Version>" % version, "<Version>%s</Version>" % new_version)
f.close()
f = open(packageManifest, 'w')
if f:
f.write(manifest)
f.close()
# ZIP package
packageDir = root
packageName = root + ".package"
print("Creating package: '%s' -> '%s'" % (packageDir, packageName))
zipf = zipfile.ZipFile(packageName, 'w', zipfile.ZIP_DEFLATED)
zipdir(packageDir, zipf)
zipf.close()
# Export documentation as markdown
if xFoundProject:
scriptname = os.path.join(scriptpath, "action.markdown.py")
scriptargs = folder
cds_script.RunCodesysWithScript(scriptname, scriptargs, False)
Last updated: 2019-01-25
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/action.markdown.py
Bash
bash
(Bash)
# Example Batch:
# set WD=%~d0%~p0
# "C:\Program Files (x86)\3S CODESYS-V3.5.12.0\CODESYS\Common\CODESYS.exe" --profile="CODESYS V3.5 SP12" --runscript="%WD%\action.plcopenxml.export.py" --scriptargs="test.project" --noUI
import sys, os
import os.path
import clr
clr.AddReference("System.Xml")
from System.Xml.Xsl import XslCompiledTransform
scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
folder=sys.argv[1].replace("`````", "'")
xslfile=os.path.join(scriptpath, "plcopenxml.xslt")
class ER(ExportReporter):
def error(self, object, message):
system.write_message(Severity.Error, "Error exporting %s: %s" % (object, message))
def warning(self, object, message):
system.write_message(Severity.Warning, "Warning exporting %s: %s" % (object, message))
def nonexportable(self, object):
system.write_message(Severity.Information, "Object not exportable: %s" % object)
@property
def aborting(self):
return False;
# Export all libraries and projects
reporter = ER()
for root, dirs, files in os.walk(folder):
for file in files:
if file.endswith(".library") or file.endswith(".project"):
print("Export project '%s'" % file)
filename=str(os.path.join(root, file))
tempname=str(os.path.join(root, file + ".xml"))
mdname=str(os.path.join(root, file + ".md"))
proj = projects.open(filename)
proj.export_xml(reporter, proj.get_children(False), tempname, recursive = True)
proj.close()
# XSLT transform
print("Transform file with %s" % xslfile)
xsl = XslCompiledTransform()
xsl.Load(xslfile)
xsl.Transform(tempname, mdname)
f = open(mdname, "r")
if f:
c = f.read()
f.close()
f = open(mdname, "w")
if f:
f.write(c[41:]);
f.close()
else:
print("error: file not found '%s'" % file)
system.exit()
Last updated: 2018-09-18
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/cds_script.py
Bash
bash
(Bash)
# imports
import sys
import os
#
# this is a general helper module providing some basic functions to
# e.g. run CODESYS or another process with certain arguments
#
#
from System.Diagnostics import Process
from System.Net import WebClient
def RunProcess(workdir, process, args):
exitcode = -1
print("run process: " + process + " " + args)
if not os.path.exists(workdir):
print("Path does not exist: " + workdir)
if not os.path.exists(os.path.join(workdir, process)):
print("File does not exist: " + process)
else:
p = Process()
p.StartInfo.WorkingDirectory=workdir
p.StartInfo.FileName = process
p.StartInfo.Arguments = args
p.Start()
p.WaitForExit()
exitcode = p.ExitCode
print("done: " + str(exitcode))
return exitcode
def RunCodesysWithScript(scriptfilename, scriptargs=None, ui=False):
print(scriptfilename)
# common paths
workingdir = os.path.dirname(sys.argv[0])
cdsdir = os.path.abspath(os.path.join(workingdir, os.path.pardir, os.path.pardir))
#print(cdsdir)
# profile stuff
profiledir=os.path.join(cdsdir,"Profiles")
#print(profiledir)
lastprofile=""
for file in os.listdir(profiledir):
if file.endswith(".profile"):
lastprofile = file.replace(".profile","")
if file.endswith(".profile.xml"):
lastprofile = file.replace(".profile.xml","")
#print(lastprofile)
# exe
codesys_exe = os.path.join(cdsdir, "Common", "CODESYS.exe")
packageman_exe = os.path.join(cdsdir, "Common", "PackageManager.exe")
workdir = os.path.join(cdsdir, "Common")
exitcode = -1
if not os.path.exists(os.path.join(workingdir,scriptfilename)):
print("File does not exist: " + scriptfilename)
else:
p = Process()
p.StartInfo.WorkingDirectory=workdir
p.StartInfo.FileName = codesys_exe
processargs = "--profile='" + lastprofile + "' --runscript='" + os.path.join(workingdir,scriptfilename) + "'"
if not ui:
processargs += " --noUI"
if scriptargs != None:
scriptargs = scriptargs.replace("'", "`````")
processargs += " --scriptargs:'" + scriptargs + "'"
print("running codesys with script " + scriptfilename)
p.StartInfo.Arguments = processargs
p.Start()
p.WaitForExit()
exitcode = p.ExitCode
print("done: " + str(exitcode))
return exitcode
def RunPackageManager(args=None):
# common paths
workingdir = os.path.dirname(sys.argv[0])
cdsdir = os.path.abspath(os.path.join(workingdir, os.path.pardir, os.path.pardir))
#print(cdsdir)
# profile stuff
profiledir=os.path.join(cdsdir,"Profiles")
#print(profiledir)
lastprofile=""
for file in os.listdir(profiledir):
if file.endswith(".profile"):
lastprofile = file.replace(".profile","")
if file.endswith(".profile.xml"):
lastprofile = file.replace(".profile.xml","")
#print(lastprofile)
# exe
packageman_exe = os.path.join(cdsdir, "Common", "PackageManager.exe")
workdir = os.path.join(cdsdir, "Common")
exitcode = -1
p = Process()
p.StartInfo.WorkingDirectory=workdir
p.StartInfo.FileName = packageman_exe
processargs = "--profile='" + lastprofile + "' " + args
print("running packman with args " + args)
p.StartInfo.Arguments = processargs
p.Start()
p.WaitForExit()
exitcode = p.ExitCode
print("done: " + str(exitcode))
return exitcode
Last updated: 2020-08-11
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/commit.py
Bash
bash
(Bash)
import sys, os
import cds_script
import ui
import pysvn
import ntpath
# This is a cforge command (script file)
# this will be run as ironpython script.
# the filename of this script is automatically the corresponding cforge command
# with some magic functions you can easily integrate it nicely into cforge tool
# cforge_usage:
# here you can return an array of all possible arguments and options that can
# be passed to this command script
def cforge_usage():
help = [
["<path to CODESYS project>", "---"]
]
return help
if len(sys.argv) <= 1:
print("Oh, there are no arguments. Perhaps you forgot something?")
sys.exit()
folder = sys.argv[1]
# if folder can't be found, try to interpret it as a repo
# name, relatively to the workspace folder
if not os.path.isdir(folder):
config = ui.GetSettings()
workspace, file = ntpath.split(config['folder'])
folder = os.path.join(workspace, folder)
print("commiting folder: %s" % folder)
stat = pysvn.svn_get_stat(folder)
config = ui.Dialog("Commit", Credentials=True, Info=True, InfoText=stat, Message=True)
if config != None:
scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
scriptname = os.path.join(scriptpath, "action.svn.commit.py")
scriptargs = "%s %s %s %s" % (config["user"], config["pass"], folder, config["msg"])
cds_script.RunCodesysWithScript(scriptname, scriptargs, False)
Last updated: 2019-01-25
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/update.py
Bash
bash
(Bash)
import sys, os
import cds_script
import ui
import ntpath
# This is a cforge command (script file)
# this will be run as ironpython script.
# the filename of this script is automatically the corresponding cforge command
# with some magic functions you can easily integrate it nicely into cforge tool
# cforge_usage:
# here you can return an array of all possible arguments and options that can
# be passed to this command script
def cforge_usage():
help = [
["<path to CODESYS project>", "---"]
]
return help
if len(sys.argv) <= 1:
print("Oh, there are no arguments. Perhaps you forgot something?")
sys.exit()
folder = sys.argv[1]
# if folder can't be found, try to interpret it as a repo
# name, relatively to the workspace folder
if not os.path.isdir(folder):
config = ui.GetSettings()
workspace, file = ntpath.split(config['folder'])
folder = os.path.join(workspace, folder)
print("updating folder: %s" % folder)
config = ui.Dialog("Update", Credentials=True)
if config != None:
scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
scriptname = os.path.join(scriptpath, "action.svn.update.py")
scriptargs = "%s %s %s" % (config["user"], config["pass"], folder)
cds_script.RunCodesysWithScript(scriptname, scriptargs, False)
Last updated: 2019-01-25
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/install.py
Bash
bash
(Bash)
# imports
import sys
import os
from System.Diagnostics import Process
from System.Net import WebClient
# This is a cforge command (script file)
# pass a "url" or local path to a CODESYS package and this script will install it
# via the CODESYS package manager to your CODESYS installation
#
# cforge_usage:
# here you can return an array of all possible arguments and options that can
# be passed to this command script
def cforge_usage():
help = [
["<url_to_package>", "download and install a codesys package"],
["<local path of package>", "install a local codesys package"]
]
return help
if len(sys.argv) == 1:
print("Oh, there are no arguments. Perhaps you forgot something?")
sys.exit()
# download
workingdir = os.path.dirname(sys.argv[0])
downloaddir = os.path.join(os.environ["USERPROFILE"], "downloads")
if not os.path.exists(downloaddir):
os.makedirs(downloaddir)
url = str(sys.argv[1])
print(url)
localname = os.path.join(downloaddir, url.split("/")[-1].split("?")[0])
print(localname)
if not localname.endswith(".package"):
print("no proper local filename found: " + localname)
sys.exit()
print("downloading file...")
web_client = WebClient()
web_client.DownloadFile(url, localname)
print("downloading done!")
# and install local package now:
sys.path.append(workingdir)
import cds_script
cds_script.RunPackageManager("--install='" + localname + "'")
Last updated: 2018-08-22
cforge: ./trunk/cforge/cforge/Package/CFORGE/Scripts/list-all.py
Bash
bash
(Bash)
# imports
import sys
import os
from System.Diagnostics import Process
from System.Net import WebClient
# This is a cforge command (script file)
# this will open the CODESYS PackageManager to list all installed packages
# cforge_usage:
# here you can return an array of all possible arguments and options that can
# be passed to this command script
def cforge_usage():
help = [
["", "no parameters required"]
]
return help
if len(sys.argv) > 1:
print("Oh, there are arguments... didnt expect them")
# common paths
workingdir = os.path.dirname(sys.argv[0])
cdsdir = os.path.abspath(os.path.join(workingdir, os.path.pardir, os.path.pardir))
print(cdsdir)
# profile stuff
profiledir=os.path.join(cdsdir,"Profiles")
print(profiledir)
lastprofile=""
for file in os.listdir(profiledir):
if file.endswith(".profile"):
lastprofile = file.replace(".profile","")
print(lastprofile)
# exe
codesys_exe = os.path.join(cdsdir, "Common", "CODESYS.exe")
packageman_exe = os.path.join(cdsdir, "Common", "PackageManager.exe")
workdir = os.path.join(cdsdir, "Common")
#Process.Start(localname)
p = Process()
p.StartInfo.WorkingDirectory=workdir
p.StartInfo.FileName = packageman_exe
p.StartInfo.Arguments = "--profile='" + lastprofile + "'"
p.Start()
p.WaitForExit()
Last updated: 2018-04-12