Skip to content

Commit

Permalink
Usercontrol GeneXus update
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonza committed Aug 30, 2016
1 parent 9c5add6 commit 2d3e709
Show file tree
Hide file tree
Showing 36 changed files with 323 additions and 8 deletions.
22 changes: 22 additions & 0 deletions helpers/elevate/elevate.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "elevate", "elevate\elevate.csproj", "{ED2E2A9B-3DB7-496F-B117-6F9B6FF5F1E1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ED2E2A9B-3DB7-496F-B117-6F9B6FF5F1E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED2E2A9B-3DB7-496F-B117-6F9B6FF5F1E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED2E2A9B-3DB7-496F-B117-6F9B6FF5F1E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED2E2A9B-3DB7-496F-B117-6F9B6FF5F1E1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added helpers/elevate/elevate.v12.suo
Binary file not shown.
6 changes: 6 additions & 0 deletions helpers/elevate/elevate/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
62 changes: 62 additions & 0 deletions helpers/elevate/elevate/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
//using System.Threading.Tasks;
using System.Diagnostics;

namespace elevate
{
class Program
{
static void Main(string[] args)
{
string cmd = "";
string sargs = "";

for (int i = 0; i < args.Length; i++)
{
if (i == 0)
cmd = args[0];
else {
sargs += args[i] + " ";
//Console.WriteLine(args[i]);
}

}

string curPath = System.IO.Directory.GetCurrentDirectory(); // AppDomain.CurrentDomain.BaseDirectory;

sargs += "\"" + curPath.Trim() + "\"";
//sargs += curPath;


// System.IO.Directory.SetCurrentDirectory(curPath);

Console.WriteLine(sargs);

ProcessStartInfo startInfo = new ProcessStartInfo( "cmd.exe", "/C " + cmd + " " + sargs);

startInfo.Verb = "runas";

// startInfo.UseShellExecute = false;
// startInfo.RedirectStandardInput = true;
// startInfo.RedirectStandardOutput = true;

startInfo.WorkingDirectory = curPath;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.CreateNoWindow = false;

// Console.WriteLine(startInfo.WorkingDirectory);
// Console.WriteLine(cmd);
try
{
Process batch = Process.Start(startInfo);
batch.WaitForExit();
}catch{
Console.WriteLine("We can't elevate permissions");
}

}
}
}
36 changes: 36 additions & 0 deletions helpers/elevate/elevate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("elevate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("elevate")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c089e618-52de-4f56-9c6a-67c3a85e9417")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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")]
Binary file added helpers/elevate/elevate/bin/Debug/elevate.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions helpers/elevate/elevate/bin/Debug/elevate.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
Binary file added helpers/elevate/elevate/bin/Debug/elevate.pdb
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions helpers/elevate/elevate/bin/Debug/elevate.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
11 changes: 11 additions & 0 deletions helpers/elevate/elevate/bin/Debug/elevate.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<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">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file not shown.
6 changes: 6 additions & 0 deletions helpers/elevate/elevate/bin/Release/elevate.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
Binary file added helpers/elevate/elevate/bin/Release/elevate.pdb
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions helpers/elevate/elevate/bin/Release/elevate.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>

<supportedRuntime version="v2.0.50727"/></startup>
</configuration>
11 changes: 11 additions & 0 deletions helpers/elevate/elevate/bin/Release/elevate.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<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">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
55 changes: 55 additions & 0 deletions helpers/elevate/elevate/elevate.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{ED2E2A9B-3DB7-496F-B117-6F9B6FF5F1E1}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>elevate</RootNamespace>
<AssemblyName>elevate</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</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>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
D:\Develop\GenexusComponents\elevate\elevate\bin\Debug\elevate.exe.config
D:\Develop\GenexusComponents\elevate\elevate\bin\Debug\elevate.exe
D:\Develop\GenexusComponents\elevate\elevate\bin\Debug\elevate.pdb
D:\Develop\GenexusComponents\elevate\elevate\obj\Debug\elevate.csprojResolveAssemblyReference.cache
D:\Develop\GenexusComponents\elevate\elevate\obj\Debug\elevate.exe
D:\Develop\GenexusComponents\elevate\elevate\obj\Debug\elevate.pdb
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\bin\Debug\elevate.exe.config
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\obj\Debug\elevate.exe
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\obj\Debug\elevate.pdb
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\bin\Debug\elevate.exe
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\bin\Debug\elevate.pdb
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\obj\Debug\elevate.csprojResolveAssemblyReference.cache
Binary file not shown.
Binary file added helpers/elevate/elevate/obj/Debug/elevate.exe
Binary file not shown.
Binary file added helpers/elevate/elevate/obj/Debug/elevate.pdb
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\bin\Release\elevate.exe.config
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\bin\Release\elevate.exe
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\bin\Release\elevate.pdb
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\obj\Release\elevate.exe
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\obj\Release\elevate.pdb
D:\Develop\GenexusComponents\usercontrol-generator\helpers\elevate\elevate\obj\Release\elevate.csprojResolveAssemblyReference.cache
Binary file not shown.
Binary file not shown.
Binary file added helpers/elevate/elevate/obj/Release/elevate.pdb
Binary file not shown.
20 changes: 20 additions & 0 deletions helpers/updgx.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
echo off

rem Move to UC folder
cd /D %3

rem Remove quotes
set gxbase=%2
set gxbase
set gxbase=%gxbase:"=%
set gxbase

SET gxuc="%gxbase%\UserControls\%1"
echo %gxuc%

ECHO Updating GeneXus at: %gxuc%
xcopy .\build\debug %gxuc% /E /I /Y

ECHO Installing UserControl
SET gxpath="%gxbase%\Genexus.exe"
%gxpath% -install
4 changes: 3 additions & 1 deletion lib/config-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export default class ConfigClass {

// Complete object structure
let cobj = {
gxpath: "C:\\Program Files (x86)\\Artech\\GeneXus\\GeneXusXEv3\\"
gxpath: "C:\\Program Files (x86)\\Artech\\GeneXus\\GeneXusXEv3\\",
gxtestkb: ""
};

if (fs.existsSync(cfile)){
Expand All @@ -19,6 +20,7 @@ export default class ConfigClass {
// replace attributes with loaded data
// for compatibility with previous versions
cobj.gxpath = data.gxpath;
cobj.gxtestkb = data.gxtestkb;

}else {
fs.writeFile(cfile, JSON.stringify(cobj), 'utf8', ()=>{} );
Expand Down
25 changes: 24 additions & 1 deletion lib/usercontrol-build-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,36 @@ export default class UsercontrolBuildView extends BaseForm{
this.writeOutput(this.convert.toHtml(line), 'error');
}
}

gulpExit( code, updgx) {
this.writeOutput("Exited with code " + code, "" + (code ? 'error' : ''));
this.process = null;

if (!updgx && this.environment=="debug" && process.platform=='win32') {
this.updateGx();
}
}

writeOutput(text){
this.appendValue("text-console", `<pre>${text}</pre>`);
}

// Update GeneXus
updateGx(){
var args, command, projpath;

command = path.join( Usercontrol.getPackageBasePath(), "helpers","elevate", "elevate", "bin", "Release", "elevate.exe");
console.log("command: " + command);

let conf = ConfigClass.get();

if (fs.existsSync(conf.gxpath)){
var updgx = path.join( Usercontrol.getPackageBasePath(), "helpers", "updgx.bat");
args = [ updgx, this.GXUC.getAttribute("Name"), '"'+conf.gxpath+'"' ]; //

Usercontrol.exec( command, args, Usercontrol.getProjectPath(), (out) => this.gulpOut(out), (out) => this.gulpErr(out), (code) => {this.gulpExit( code, true);} );
}else {
this.writeOutput( `GeneXus doesn't exists in the specified path (${conf.gxpath})` );
}
}
}
33 changes: 29 additions & 4 deletions templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ var uglify = require('gulp-uglify');
var minifycss = require('gulp-minify-css');

// Fill below var to update our testkb
var myTestKB = ""; // C:/KBs/TestKb/CSharp/web/MyUC
// var myTestKB = ""; // C:/KBs/TestKb/CSharp/web/MyUC
var gxconfig = {gxtestkb: ""};

var cfile = path.join(__dirname, "config.json");
console.log(cfile);

if (fs.existsSync(cfile) ){
var data = JSON.parse(fs.readFileSync( cfile, 'utf8'));
if (data.gxtestkb)
gxconfig.gxtestkb = path.join( data.gxtestkb, util.env.ucname);
}

gulp.task('debug', function(cb) {
runSequence('clean', ['copyall', 'copyalltest']);
Expand All @@ -24,12 +34,27 @@ gulp.task('release', function(cb) {

// Update Test KB
gulp.task('copyalltest', function() {
if (isDirectorySync(myTestKB)){
gulp.src('src/**/*')
.pipe(gulp.dest(myTestKB));
if (gxconfig.gxtestkb){
console.log(`TestKB: ${gxconfig.gxtestkb}`);

if (!isDirectorySync(gxconfig.gxtestkb)){
try{
fs.mkdirSync(gxconfig.gxtestkb);
}
catch(ex){
console.log("TestKB path can't be created");
}
}

if (isDirectorySync(gxconfig.gxtestkb)){
gulp.src('src/**/*')
.pipe(gulp.dest(gxconfig.gxtestkb));
}

}else {
console.log("No TestKB defined");
}

});

gulp.task('clean', function() {
Expand Down
4 changes: 2 additions & 2 deletions templates/src/nameRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ function {UC.Name}($)
{
this.show = function()
{
$(this.getContainerControl()).html('<h1>Hello world!</h1>');
this.setHtml('<h1>Hello world!</h1>');
}

this.destroy = function()
this.destroy = function()
{
// Add your cleanup code here. This method will be called when the control is destroyed.
}
Expand Down

0 comments on commit 2d3e709

Please sign in to comment.