Skip to content

Commit

Permalink
Merge pull request #46 from ironmansoftware/formdesigner
Browse files Browse the repository at this point in the history
Form Designer VS Code Integration.
  • Loading branch information
adamdriscoll authored Jul 3, 2024
2 parents 7806e35 + 3b4d6b9 commit 70f1be1
Show file tree
Hide file tree
Showing 20 changed files with 452 additions and 152 deletions.
10 changes: 10 additions & 0 deletions FormDesigner/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public frmMain(ILanguage language, string designerFile, string codeFile, EventGe
try
{
Initialize(eventGenerationType);

if (!File.Exists(designerFile))
{
File.WriteAllText(designerFile, string.Empty);
}

if (!File.Exists(codeFile))
{
File.WriteAllText(codeFile, string.Empty);
}
}
catch (Exception ex)
{
Expand Down
16 changes: 2 additions & 14 deletions HostInjection/PoshToolsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,24 +226,12 @@ public void OpenPsScriptPad(string fileName)
public void ShowWinFormDesigner(string designerFileName, string codeFileName)
{
var assemblyBasePath = Path.GetDirectoryName(GetType().Assembly.Location);
var designer = Path.Combine(assemblyBasePath, "..", "PowerShellProTools", "FormDesigner", "PSScriptPad.exe");

var process = new Process();
process.StartInfo = new ProcessStartInfo();
process.StartInfo.FileName = designer;
process.StartInfo.Arguments = $"-c=\"{codeFileName}\" -d=\"{designerFileName}\"";
process.Start();
}

public void ShowWpfFormDesigner(string codeFileName)
{
var assemblyBasePath = Path.GetDirectoryName(GetType().Assembly.Location);
var designer = Path.Combine(assemblyBasePath, "..", "PowerShellProTools", "FormDesigner", "PSScriptPad.exe");
var designer = Path.Combine(assemblyBasePath, "..", "PowerShellProTools", "FormDesigner", "WinFormDesigner.exe");

var process = new Process();
process.StartInfo = new ProcessStartInfo();
process.StartInfo.FileName = designer;
process.StartInfo.Arguments = $"-c=\"{codeFileName}\"";
process.StartInfo.Arguments = $"-c \"{codeFileName}\" -d \"{designerFileName}\"";
process.Start();
}

Expand Down
4 changes: 2 additions & 2 deletions PowerShellToolsPro.Cmdlets/PowerShellProTools.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Ironman Software, LLC
#
# Generated on: 7/2/2024
# Generated on: 7/3/2024
#

@{
Expand All @@ -18,7 +18,7 @@ ModuleVersion = '2024.3.0'
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = '47c09e3f-5e87-4d71-aea0-1a0e95f2ccbc'
GUID = 'a1c11aea-84ef-4f8f-a278-0b828fbf1851'

# Author of this module
Author = 'Ironman Software, LLC'
Expand Down
8 changes: 4 additions & 4 deletions PowerShellToolsPro.Cmdlets/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ New-Item -ItemType directory $FormDesigner

Copy-Item -Path (Join-Path $PSScriptRoot 'PowerShellProTools.psm1') -Destination $OutputDirectory

$PSScriptPad = (Join-Path $PSScriptRoot '..\FormDesigner.Host\bin\x64\Release\PSScriptPad.exe')
if (-not (Test-Path $PSScriptPad)) {
$PSScriptPad = (Join-Path $PSScriptRoot '..\FormDesigner.Host\bin\Release\PSScriptPad.exe')
$WinFormDesigner = (Join-Path $PSScriptRoot '..\WinFormDesigner\bin\x64\Release\WinFormDesigner.exe')
if (-not (Test-Path $WinFormDesigner)) {
$WinFormDesigner = (Join-Path $PSScriptRoot '..\WinFormDesigner\bin\Release\WinFormDesigner.exe')
}
Copy-Item -Path $PSScriptPad -Destination $FormDesigner
Copy-Item -Path $WinFormDesigner -Destination $FormDesigner

if ($ENV:APPVEYOR) {
Copy-Item -Path (Join-Path $PSScriptRoot "bin\Any CPU\$Configuration\netstandard2.0\publish\*") -Destination $OutputDirectory -Recurse
Expand Down
3 changes: 3 additions & 0 deletions WinFormDesigner/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura IncludeDebugSymbols='false' />
</Weavers>
141 changes: 141 additions & 0 deletions WinFormDesigner/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
Binary file added WinFormDesigner/Save.ico
Binary file not shown.
Binary file added WinFormDesigner/Save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 5 additions & 9 deletions WinFormDesigner/WinFormDesigner.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 70f1be1

Please sign in to comment.