Skip to content

Commit

Permalink
Version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gsimardnet committed Aug 15, 2019
1 parent d97854c commit eb6d226
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
39 changes: 19 additions & 20 deletions Client/ObjectExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,23 @@ public static string ToContentXML(this DataTable dataTable)
/// <returns></returns>
public static string ToHTML(this DataTable dataTable)
{
string columnHeaders = "";
StringBuilder columnHeaders = new StringBuilder();

foreach (DataColumn dc in dataTable.Columns)
{
columnHeaders += $"\n <th>{dc.ColumnName}</th>";
columnHeaders.Append($"\n <th>{dc.ColumnName}</th>");
}

string rows = "";
StringBuilder rows = new StringBuilder();
foreach (DataRow dr in dataTable.Rows)
{
string row = "";
StringBuilder row = new StringBuilder();
foreach (var i in dr.ItemArray)
{
row += $"\n <td>{HttpUtility.HtmlEncode(i.ToString())}</td>";
row.Append($"\n <td>{HttpUtility.HtmlEncode(i.ToString())}</td>");
}
row = $"\n <tr>{row}</tr>";
rows += row;
row.Append($"\n <tr>{row}</tr>");
rows.Append(row);
}

string html = $@"
Expand Down Expand Up @@ -109,6 +110,7 @@ public static string ToContentJSON(this DataTable dataTable)
}
rows.Add(row);
}
javaScriptSerializer.MaxJsonLength = int.MaxValue;
return javaScriptSerializer.Serialize(rows);
}

Expand All @@ -134,37 +136,34 @@ public static string ToContentXML(this DataRow dataRow)
/// <returns></returns>
public static string ToDelimitedFile(this DataTable dataTable, char delimiter, bool inQuote)
{
string content = "";
StringBuilder content = new StringBuilder();

string lastColumn = dataTable.Columns[dataTable.Columns.Count - 1].ColumnName;
foreach (DataColumn dc in dataTable.Columns)
{
content += dc.ColumnName;
content.Append(dc.ColumnName);
if (dc.ColumnName != lastColumn)
content += delimiter;
content.Append(delimiter);
}

int i = 0;
foreach (DataRow dr in dataTable.Rows)
{
content += Environment.NewLine;
content.Append(Environment.NewLine);

foreach (DataColumn dc in dataTable.Columns)
{
if (inQuote)
content += '"' + dr[dc.ColumnName].ToString() + '"';
content.Append('"' + dr[dc.ColumnName].ToString() + '"');
else
content += dr[dc.ColumnName].ToString();

//if (inQuote)
// content += '"' + dr.Field<string>(dc.ColumnName) + '"';
//else
// content += dr.Field<string>(dc.ColumnName);
content.Append(dr[dc.ColumnName].ToString());

if (dc.ColumnName != lastColumn)
content += delimiter;
content.Append(delimiter);
}
}

return content;
return content.ToString();
}

/// <summary>
Expand Down
9 changes: 9 additions & 0 deletions PowerQueryNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Engine", "Engine\Engine.csproj", "{35C425A2-E884-4306-8285-3FD66A86B601}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{17CC49B9-0954-42EF-95B9-895A9DC29BDE}"
ProjectSection(ProjectDependencies) = postProject
{24503A13-7D35-49D9-B071-A0173CD54276} = {24503A13-7D35-49D9-B071-A0173CD54276}
{C4521615-F8A1-4021-90C4-A2B85EB09703} = {C4521615-F8A1-4021-90C4-A2B85EB09703}
{91D3B517-685E-4806-A17F-5589CFF21E29} = {91D3B517-685E-4806-A17F-5589CFF21E29}
{5DCDA550-A251-4C69-AE33-88D3BC1326FB} = {5DCDA550-A251-4C69-AE33-88D3BC1326FB}
{35C425A2-E884-4306-8285-3FD66A86B601} = {35C425A2-E884-4306-8285-3FD66A86B601}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Setup.Actions", "Setup.Actions\Setup.Actions.csproj", "{C4521615-F8A1-4021-90C4-A2B85EB09703}"
EndProject
Expand Down Expand Up @@ -51,13 +58,15 @@ Global
{17CC49B9-0954-42EF-95B9-895A9DC29BDE}.Debug|x86.ActiveCfg = Debug|x86
{17CC49B9-0954-42EF-95B9-895A9DC29BDE}.Debug|x86.Build.0 = Debug|x86
{17CC49B9-0954-42EF-95B9-895A9DC29BDE}.Release|Any CPU.ActiveCfg = Release|x86
{17CC49B9-0954-42EF-95B9-895A9DC29BDE}.Release|Any CPU.Build.0 = Release|x86
{17CC49B9-0954-42EF-95B9-895A9DC29BDE}.Release|x86.ActiveCfg = Release|x86
{17CC49B9-0954-42EF-95B9-895A9DC29BDE}.Release|x86.Build.0 = Release|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Debug|Any CPU.ActiveCfg = Debug|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Debug|Any CPU.Build.0 = Debug|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Debug|x86.ActiveCfg = Debug|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Debug|x86.Build.0 = Debug|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Release|Any CPU.ActiveCfg = Release|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Release|Any CPU.Build.0 = Release|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Release|x86.ActiveCfg = Release|x86
{C4521615-F8A1-4021-90C4-A2B85EB09703}.Release|x86.Build.0 = Release|x86
{91D3B517-685E-4806-A17F-5589CFF21E29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion Setup/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">
<?include $(sys.CURRENTDIR)\Config.wxi?>
<Product Id="95f93336-b7a9-4a68-acf5-1492ec0c5d72" Name="PowerQueryNet" Language="1033" Version="1.1.0" Manufacturer="Guillaume Simard" UpgradeCode="115ef465-536f-4030-bd2d-44b0edb1bbe5">
<Product Id="95f93336-b7a9-4a68-acf5-1492ec0c5d72" Name="PowerQueryNet" Language="1033" Version="1.1.1" Manufacturer="Guillaume Simard" UpgradeCode="115ef465-536f-4030-bd2d-44b0edb1bbe5">
<Package Id="5e1dc07c-131a-43d4-8a98-4d091537ac0f" InstallPrivileges="elevated" InstallerVersion="200" Platform ="x64" Compressed="yes" InstallScope="perMachine" Languages="1033" SummaryCodepage="1252" Description="[ProductName]" />
<Icon Id="PQNet.ico" SourceFile="Resources\PQNet.ico" />
<Property Id="ARPPRODUCTICON" Value="PQNet.ico" />
Expand Down

0 comments on commit eb6d226

Please sign in to comment.