Permalink
Browse files

Added better support for LessMSI

Improved gui for Util - Simple Html Viewer.h2
Added support for stand-alone exe for Utils/O2_StandAlone_Modules/HostLocalWebsite/Util - Start .NET WebServer on Local Folder.h2
  • Loading branch information...
1 parent 6253fb6 commit 0fc823d3baf13f73811b5dbe562dfc105e118e7a @DinisCruz DinisCruz committed Oct 6, 2012
View
20 3rdParty/LessMSI/API_LessMsi.cs
@@ -1,23 +1,23 @@
-using System;
+using System;
using System.Threading;
using System.Diagnostics;
-using O2.Kernel;
+using O2.Kernel;
using O2.Kernel.ExtensionMethods;
using O2.DotNetWrappers.ExtensionMethods;
using O2.XRules.Database.Utils;
using LessMsi.Msi;
-//O2File:LessMsi.cs
-
+//O2File:LessMsi.cs
+//Installer:LessMsi_Install.cs!LessMsi/lessmsi.exe
//O2Ref:LessMsi/lessmsi.exe
namespace O2.XRules.Database.APIs
{
public class LessMsi_Test
{
- public void test()
+ public void launchGui()
{
- new LessMsi_Install().start();
+ new API_LessMSI().launchGui();
}
}
@@ -58,8 +58,12 @@ public bool extractMsi(string msi, string targetFolder)
}
}
- public static class LessMSI_ExtensionMethods
+ public static class API_LessMSI_ExtensionMethods
{
-
+ public static API_LessMSI launchGui(this API_LessMSI lessMSI)
+ {
+ "lessmsi.exe".assembly_Location().startProcess();
+ return lessMSI;
+ }
}
}
View
2 3rdParty/LessMSI/LessMsi.cs
@@ -37,7 +37,7 @@ public bool install()
{
"Installing {0}".info(ToolName);
return installFromZip_Web();
- return false;
+ //return false;
}
public Process start()
View
57 3rdParty/LessMSI/LessMsi_Install.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Diagnostics;
+using O2.Kernel;
+using O2.Kernel.ExtensionMethods;
+using O2.DotNetWrappers.ExtensionMethods;
+using O2.XRules.Database.Utils;
+//O2File:Tool_API.cs
+
+public class DynamicType
+{
+ public void dynamicMethod()
+ {
+ new O2.XRules.Database.APIs.LessMsi_Install();
+ }
+}
+
+namespace O2.XRules.Database.APIs
+{
+ /*public class LessMsi_Test
+ {
+ public void test()
+ {
+ new LessMsi_Install().start();
+ }
+ }*/
+
+ public class LessMsi_Install : Tool_API
+ {
+ public LessMsi_Install() : this(true)
+ {
+ }
+
+ public LessMsi_Install(bool installNow)
+ {
+ config("LessMsi", "LessMsi.1.0.8", "lessmsi-v1.0.8");
+ Install_Uri = "http://lessmsi.googlecode.com/files/lessmsi-v1.0.8.zip".uri();
+ Executable = Install_Dir.pathCombine("lessmsi.exe");
+ if (installNow)
+ install();
+ }
+
+
+ public bool install()
+ {
+ "Installing {0}".info(ToolName);
+ return installFromZip_Web();
+ return false;
+ }
+
+ public Process start()
+ {
+ if (install())
+ return Executable.startProcess();
+ return null;
+ }
+ }
+}
View
44 3rdParty/LessMSI/Util - view and extract MSI files (using LessMSI).h2
@@ -1,6 +1,48 @@
<?xml version="1.0"?>
<H2>
- <SourceCode>"API_LessMsi.cs".local().executeFirstMethod();
+ <SourceCode>//**************** StandAlone exe package and setup ****************
+//O2Embed:LessMsi\lessmsi.exe
+//O2Package:E:\O2_V4\_TempDir_v4.3.2.0\_ToolsOrApis\LessMsi\wix.dll
+//O2Package:E:\O2_V4\_TempDir_v4.3.2.0\_ToolsOrApis\LessMsi\wixcab.dll
+//O2Package:MSI_Icon.ico
+O2ConfigSettings.O2Version = "LessMSI";
+O2Setup.extractEmbededConfigZips();
+if ("wixcab.dll".local().fileExists())
+{
+ "wixcab.dll".local().file_Copy(PublicDI.config.EmbeddedAssemblies.createDir());
+ "wix.dll".local().file_Copy(PublicDI.config.EmbeddedAssemblies);
+}
+//*******************************************************************
+
+var mainForm = (Form)"lessmsi.exe".assembly().type("MainForm").ctor("");
+O2Thread.staThread(()=&gt; mainForm.ShowDialog());
+mainForm.wait(500);
+//mainForm.resizeFormToControlSize(panel);
+//mainForm.parentForm_AlwaysOnTop();
+mainForm.parentForm().set_Form_Icon("MSI_Icon.ico".local());
+Action&lt;string&gt; loadMSI =
+ (path)=&gt;{
+ mainForm.invokeOnThread(
+ ()=&gt;{
+ mainForm.prop("SelectedMsiFile", new FileInfo(path));
+ mainForm.prop("Presenter").invoke("LoadCurrentFile");
+ mainForm.field("btnUnselectAll").cast&lt;Button&gt;().click();
+ });
+ };
+
+mainForm.controls&lt;DataGridView&gt;(true)
+ .forEach&lt;DataGridView&gt;((dataGridView)=&gt; dataGridView.onDrop(loadMSI));
+
+var menuStrip = mainForm.control&lt;MenuStrip&gt;();
+menuStrip.add_MenuItem("REPL")
+ .add_MenuItem("C# REPL main panel", ()=&gt; mainForm.control&lt;Panel&gt;().script_Me())
+ .add_MenuItem("C# REPL file list", ()=&gt; mainForm.field("fileGrid").script_Me("fileGrid"));
+
+
+//using LessMsi.UI
+//using System.IO;
+//O2File:API_LessMsi.cs
+//O2Ref:LessMsi/lessmsi.exe
</SourceCode>
<ReferencedAssemblies />
</H2>
View
5 Utils/O2_StandAlone_Modules/HostLocalWebsite/Util - Start .NET WebServer on Local Folder.h2
@@ -2,11 +2,12 @@
<H2>
<SourceCode>var topPanel = O2Gui.open&lt;Panel&gt;("Util - Start .NET WebServer on Local Folder",800,400);
topPanel.insert_LogViewer();
-
+
var hostLocalWebsite = topPanel.add_Control&lt;ascx_HostLocalWebsite&gt;();
hostLocalWebsite.start();
//using O2.Tool.HostLocalWebsite.ascx
//O2File:ascx_HostLocalWebsite.cs
-//O2Embed:CassiniDev_4.0.exe</SourceCode>
+//O2Embed:CassiniDev_4.0.exe
+//O2Ref:CassiniDev_4.0.exe</SourceCode>
<ReferencedAssemblies />
</H2>
View
22 Utils/Web/Util - Simple Html Viewer.h2
@@ -5,13 +5,10 @@ var controls = topPanel.add_1x1();
var browser = controls[1].add_WebBrowser();
var htmlText = controls[0].add_TextArea().unlimitedSize();
htmlText.AcceptsTab = true;
-var currentDirectory = Environment.CurrentDirectory;
+var currentDirectory = Environment.CurrentDirectory;
+var autoRender = true;
htmlText.mainMenu()
.add_Menu("File")
-/* .add_MenuItem("render html", true,
- ()=&gt;{
- browser.set_Text(htmlText.get_Text());
- })*/
.add_MenuItem("save",
()=&gt;{
var target = O2Forms.askUserForFileToSave(currentDirectory);
@@ -20,7 +17,9 @@ htmlText.mainMenu()
"saving contents to: {0}".info(target);
htmlText.get_Text().save(target);
}
- });
+ });
+Action&lt;string&gt; render =
+ (html)=&gt; O2Thread.mtaThread(()=&gt; browser.set_Html(html));
htmlText.onDrop(
(file)=&gt;{
if(file.isFile())
@@ -29,9 +28,16 @@ htmlText.onDrop(
currentDirectory = file.directoryName();
}
- });
+ });
+
htmlText.onTextChange(
- (text)=&gt; browser.set_Text(text));
+ (text)=&gt;{
+ render(text);
+ });
+
+htmlText.insert_Below(20)
+ .add_CheckBox("Auto Render Html on Text Change",0,0, (value)=&gt; autoRender= value).autoSize().tick()
+ .append_Link("Render html", ()=&gt; render(htmlText.get_Text()));
htmlText.set_Text("&lt;h1&gt;hello&lt;h1&gt; world");</SourceCode>
<ReferencedAssemblies />
View
BIN _DataFiles/_Images/Icons/MSI_Icon.ico
Binary file not shown.

0 comments on commit 0fc823d

Please sign in to comment.