Skip to content

Commit

Permalink
Update to WebUI 2.5.0-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
salvadordf committed Jul 18, 2024
1 parent d237c90 commit a58fe53
Show file tree
Hide file tree
Showing 123 changed files with 5,886 additions and 581 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@ You can also support this project with Liberapay.
* [WebView4Delphi](https://github.com/salvadordf/WebView4Delphi)
* [WebUI4Delphi](https://github.com/salvadordf/WebUI4Delphi)
* [Doxygen](https://github.com/doxygen/doxygen)
* [WebUI.NET](https://github.com/Juff-Ma/WebUI.NET)
2 changes: 1 addition & 1 deletion WebUI4CSharp/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PROJECT_BRIEF =
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.

PROJECT_LOGO = C:/Users/usuario/source/repos/WebUI4CSharp/WebUI4CSharp/res/webui_240.png
PROJECT_LOGO = C:/Users/usuario/source/repos/WebUI4CSharp/assets/webui_csharp.png

# With the PROJECT_ICON tag one can specify an icon that is included in the tabs
# when the HTML document is shown. Doxygen will copy the logo to the output
Expand Down
60 changes: 57 additions & 3 deletions WebUI4CSharp/WebUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class WebUI
/// <summary>
/// WebUI library version.
/// </summary>
public const string WEBUI_VERSION = "2.5.0-beta.1";
public const string WEBUI_VERSION = "2.5.0-beta.2";

/// <summary>
/// Max windows, servers and threads
Expand Down Expand Up @@ -54,7 +54,8 @@ public static bool SetDefaultRootFolder(string path)
}

/// <summary>
/// Set the maximum time in seconds to wait for the window to connect. This affects `show()` and `wait()`.
/// Set the maximum time in seconds to wait for the window to connect.
/// This effect `show()` and `wait()`. Value of `0` means wait forever.
/// </summary>
public static void SetTimeout(UIntPtr second)
{
Expand Down Expand Up @@ -213,13 +214,66 @@ public static void CommonBindCallback(ref webui_event_t e)
}

/// <summary>
/// Control the WebUI behaviour. It's better to call at the beginning.
/// Control the WebUI behaviour. It's recommended to be called at the beginning.
/// </summary>
/// <param name="option">The desired option from `webui_config` enum.</param>
/// <param name="status">The status of the option, `true` or `false`.</param>
public static void SetConfig(webui_config option, bool status)
{
WebUILibFunctions.webui_set_config((UIntPtr) option, status);
}

/// <summary>
/// Get OS high contrast preference.
/// </summary>
/// <returns>Returns True if OS is using high contrast theme.</returns>
public static bool IsHighContrast()
{
return WebUILibFunctions.webui_is_high_contrast();
}

/// <summary>
/// Check if a web browser is installed.
/// </summary>
/// <returns>Returns True if the specified browser is available.</returns>
public static bool BrowserExist(webui_browser browser)
{
return WebUILibFunctions.webui_browser_exist((UIntPtr)browser);
}

/// <summary>
/// Open an URL in the native default web browser.
/// </summary>
/// <param name="url">The URL to open.</param>
public static void OpenUrl(string url)
{
WebUILibFunctions.webui_open_url(url);
}

/// <summary>
/// Get an available usable free network port.
/// </summary>
/// <returns>Returns a free port.</returns>
public static UIntPtr GetFreePort()
{
return WebUILibFunctions.webui_get_free_port();
}

/// <summary>
/// Get the HTTP mime type of a file.
/// </summary>
/// <param name="file">The file name.</param>
/// <returns>Returns the HTTP mime string.</returns>
public static string GetMimeType(string file)
{
string? response = null;
IntPtr buffer = WebUILibFunctions.webui_get_mime_type(file);
if (buffer != IntPtr.Zero)
{
response = WebUI.WebUIStringToCSharpString(buffer);
WebUI.Free(buffer);
}
return string.IsNullOrEmpty(response) ? "text/plain" : response;
}
}
}
96 changes: 96 additions & 0 deletions WebUI4CSharp/WebUI4CSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wpf_text_editor", "..\demos
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "demos", "demos", "{0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "console_virtual_file_system", "..\demos\console_virtual_file_system\console_virtual_file_system.csproj", "{97AC4D46-0024-44CD-889E-A10395696A54}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "winforms_virtual_file_system", "..\demos\winforms_virtual_file_system\winforms_virtual_file_system.csproj", "{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wpf_virtual_file_system", "..\demos\wpf_virtual_file_system\wpf_virtual_file_system.csproj", "{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console_web_app_multi_client", "..\demos\console_web_app_multi_client\console_web_app_multi_client.csproj", "{7A07980F-2F61-43A9-95F8-BCFEA50416B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winforms_web_app_multi_client", "..\demos\winforms_web_app_multi_client\winforms_web_app_multi_client.csproj", "{6890C036-DB68-40CB-855C-258C0F0FC9FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wpf_web_app_multi_client", "..\demos\wpf_web_app_multi_client\wpf_web_app_multi_client.csproj", "{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -311,6 +323,78 @@ Global
{75083401-0D52-4806-8268-55EBC4FB2A66}.Release|x64.Build.0 = Release|x64
{75083401-0D52-4806-8268-55EBC4FB2A66}.Release|x86.ActiveCfg = Release|x86
{75083401-0D52-4806-8268-55EBC4FB2A66}.Release|x86.Build.0 = Release|x86
{97AC4D46-0024-44CD-889E-A10395696A54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Debug|x64.ActiveCfg = Debug|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Debug|x64.Build.0 = Debug|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Debug|x86.ActiveCfg = Debug|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Debug|x86.Build.0 = Debug|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Release|Any CPU.Build.0 = Release|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Release|x64.ActiveCfg = Release|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Release|x64.Build.0 = Release|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Release|x86.ActiveCfg = Release|Any CPU
{97AC4D46-0024-44CD-889E-A10395696A54}.Release|x86.Build.0 = Release|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Debug|x64.ActiveCfg = Debug|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Debug|x64.Build.0 = Debug|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Debug|x86.ActiveCfg = Debug|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Debug|x86.Build.0 = Debug|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Release|Any CPU.Build.0 = Release|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Release|x64.ActiveCfg = Release|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Release|x64.Build.0 = Release|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Release|x86.ActiveCfg = Release|Any CPU
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9}.Release|x86.Build.0 = Release|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Debug|x64.ActiveCfg = Debug|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Debug|x64.Build.0 = Debug|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Debug|x86.ActiveCfg = Debug|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Debug|x86.Build.0 = Debug|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Release|Any CPU.Build.0 = Release|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Release|x64.ActiveCfg = Release|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Release|x64.Build.0 = Release|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Release|x86.ActiveCfg = Release|Any CPU
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023}.Release|x86.Build.0 = Release|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Debug|x64.ActiveCfg = Debug|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Debug|x64.Build.0 = Debug|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Debug|x86.ActiveCfg = Debug|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Debug|x86.Build.0 = Debug|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Release|Any CPU.Build.0 = Release|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Release|x64.ActiveCfg = Release|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Release|x64.Build.0 = Release|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Release|x86.ActiveCfg = Release|Any CPU
{7A07980F-2F61-43A9-95F8-BCFEA50416B4}.Release|x86.Build.0 = Release|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Debug|x64.ActiveCfg = Debug|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Debug|x64.Build.0 = Debug|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Debug|x86.ActiveCfg = Debug|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Debug|x86.Build.0 = Debug|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Release|Any CPU.Build.0 = Release|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Release|x64.ActiveCfg = Release|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Release|x64.Build.0 = Release|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Release|x86.ActiveCfg = Release|Any CPU
{6890C036-DB68-40CB-855C-258C0F0FC9FA}.Release|x86.Build.0 = Release|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Debug|x64.ActiveCfg = Debug|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Debug|x64.Build.0 = Debug|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Debug|x86.ActiveCfg = Debug|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Debug|x86.Build.0 = Debug|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Release|Any CPU.Build.0 = Release|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Release|x64.ActiveCfg = Release|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Release|x64.Build.0 = Release|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Release|x86.ActiveCfg = Release|Any CPU
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -337,6 +421,12 @@ Global
{5BA34C46-3125-4B73-8023-3D36CC45F63C} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{CC1E42D1-FD35-4FBA-9650-D44ACC4DA9D2} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{75083401-0D52-4806-8268-55EBC4FB2A66} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{97AC4D46-0024-44CD-889E-A10395696A54} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{1FFC8DB5-DC3D-4FD9-A6BD-DC49C89016B9} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{47CFBFD9-B2C9-42DB-8F15-7021D0A23023} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{7A07980F-2F61-43A9-95F8-BCFEA50416B4} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{6890C036-DB68-40CB-855C-258C0F0FC9FA} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
{FE746DAC-CE26-4F0C-BCEF-6485ED6CE7B0} = {0A6F48BD-BFC9-4E78-AFCB-F7A8D9BF040B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {00940130-D958-4A46-A924-984323735872}
Expand All @@ -345,13 +435,18 @@ Global
WebUI4CSharp.projitems*{02e75c91-bede-4dd1-af13-bb953fd85f2a}*SharedItemsImports = 5
WebUI4CSharp.projitems*{10951db4-2f8c-481e-a379-abaf6dac9f04}*SharedItemsImports = 5
WebUI4CSharp.projitems*{14d7a22e-c6a3-4556-b7f7-5233f1e29f2c}*SharedItemsImports = 5
WebUI4CSharp.projitems*{1ffc8db5-dc3d-4fd9-a6bd-dc49c89016b9}*SharedItemsImports = 5
WebUI4CSharp.projitems*{3a860be4-8b23-4ab2-9912-5050ddbd6cb7}*SharedItemsImports = 5
WebUI4CSharp.projitems*{3de6fa90-9a24-4e4b-b491-d64de041d9cc}*SharedItemsImports = 5
WebUI4CSharp.projitems*{47cfbfd9-b2c9-42db-8f15-7021d0a23023}*SharedItemsImports = 5
WebUI4CSharp.projitems*{5ba34c46-3125-4b73-8023-3d36cc45f63c}*SharedItemsImports = 5
WebUI4CSharp.projitems*{6890c036-db68-40cb-855c-258c0f0fc9fa}*SharedItemsImports = 5
WebUI4CSharp.projitems*{6e9370d6-3d5c-43e5-8794-48d7631afae6}*SharedItemsImports = 5
WebUI4CSharp.projitems*{6f35fd1f-6a07-4bb7-ab29-86bf280b75b7}*SharedItemsImports = 13
WebUI4CSharp.projitems*{75083401-0d52-4806-8268-55ebc4fb2a66}*SharedItemsImports = 5
WebUI4CSharp.projitems*{7a07980f-2f61-43a9-95f8-bcfea50416b4}*SharedItemsImports = 5
WebUI4CSharp.projitems*{8e2ce7fe-4662-4198-9669-1cd8a34824e0}*SharedItemsImports = 5
WebUI4CSharp.projitems*{97ac4d46-0024-44cd-889e-a10395696a54}*SharedItemsImports = 5
WebUI4CSharp.projitems*{97e3335e-1155-4339-be07-5f6f2c70a0c3}*SharedItemsImports = 5
WebUI4CSharp.projitems*{a40f5b2e-dcb3-42cc-aec1-96ae5b4f582e}*SharedItemsImports = 5
WebUI4CSharp.projitems*{b534ee4f-d2b3-43b0-bbc0-3b24a15ced15}*SharedItemsImports = 5
Expand All @@ -364,5 +459,6 @@ Global
WebUI4CSharp.projitems*{f8f3d60f-47a6-4cb9-821d-33c5768473f7}*SharedItemsImports = 5
WebUI4CSharp.projitems*{f97e01df-912d-4d5b-8c0f-28511a12e6bf}*SharedItemsImports = 5
WebUI4CSharp.projitems*{f9869b76-af44-493d-9cbd-e6b52f5eb12a}*SharedItemsImports = 5
WebUI4CSharp.projitems*{fe746dac-ce26-4f0c-bcef-6485ed6ce7b0}*SharedItemsImports = 5
EndGlobalSection
EndGlobal
24 changes: 22 additions & 2 deletions WebUI4CSharp/WebUIBase64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,33 @@ public static class WebUIBase64
/// </summary>
/// <param name="str">The string to encode.</param>
/// <returns>Returns the base64 encoded string.</returns>
public static string Encode(string str) { return WebUILibFunctions.webui_encode(str); }
public static string? Encode(string str)
{
string? response = null;
IntPtr buffer = WebUILibFunctions.webui_encode(str);
if (buffer != IntPtr.Zero)
{
response = WebUI.WebUIStringToCSharpString(buffer);
WebUI.Free(buffer);
}
return response;
}

/// <summary>
/// Decode a Base64 encoded text.
/// </summary>
/// <param name="str">The string to decode.</param>
/// <returns>Returns the base64 decoded string.</returns>
public static string Decode(string str) { return WebUILibFunctions.webui_decode(str); }
public static string? Decode(string str)
{
string? response = null;
IntPtr buffer = WebUILibFunctions.webui_decode(str);
if (buffer != IntPtr.Zero)
{
response = WebUI.WebUIStringToCSharpString(buffer);
WebUI.Free(buffer);
}
return response;
}
}
}
Loading

0 comments on commit a58fe53

Please sign in to comment.