Skip to content

Commit

Permalink
Fix: unable to create .exe
Browse files Browse the repository at this point in the history
  • Loading branch information
rzander committed Dec 15, 2022
1 parent 68432f3 commit 0581ebf
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
15 changes: 14 additions & 1 deletion RZ.Base/RZRestAPIv2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Script.Serialization;
//using System.Web.Script.Serialization;

namespace RuckZuck.Base
{
Expand Down Expand Up @@ -750,4 +750,17 @@ public static bool UploadSWEntry(AddSoftware lSoftware, string customerid = "")
return false;
}
}

internal class JavaScriptSerializer
{
internal T Deserialize<T>(string jsonObject)
{
throw new NotImplementedException();
}

internal string Serialize<T>(T jsonObject)
{
throw new NotImplementedException();
}
}
}
41 changes: 22 additions & 19 deletions RZ.Base/RZUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,27 +482,30 @@ public SWUpdate(string ProductName, string ProductVersion, string Manufacturer,

if (SW == null)
{
//Load all MetaData for the specific SW
foreach (AddSoftware SWCheck in RZRestAPIv2.GetSoftwaresAsync(SW.ProductName, SW.ProductVersion, SW.Manufacturer, RZRestAPIv2.CustomerID).Result)
Task.Run(async () =>
{
if (string.IsNullOrEmpty(SWCheck.PSPreReq))
SWCheck.PSPreReq = "$true; ";

//Check PreReq for all Installation-types of the Software
if ((bool)(SWUpdate._RunPSAsync(SWCheck.PSPreReq).GetAwaiter().GetResult())[0].BaseObject)
//Load all MetaData for the specific SW
foreach (AddSoftware SWCheck in await RZRestAPIv2.GetSoftwaresAsync(SW.ProductName, SW.ProductVersion, SW.Manufacturer, RZRestAPIv2.CustomerID))
{
SW = SWCheck;
break;
if (string.IsNullOrEmpty(SWCheck.PSPreReq))
SWCheck.PSPreReq = "$true; ";

//Check PreReq for all Installation-types of the Software
if ((bool)(SWUpdate._RunPSAsync(SWCheck.PSPreReq).GetAwaiter().GetResult())[0].BaseObject)
{
SW = SWCheck;
break;
}
}
}

//SW = RZRestAPIv2.GetSoftwares(ProductName, ProductVersion, Manufacturer, RZRestAPIv2.CustomerID).FirstOrDefault();
//SW = RZRestAPIv2.GetSoftwares(ProductName, ProductVersion, Manufacturer, RZRestAPIv2.CustomerID).FirstOrDefault();

if (SW.Files == null)
SW.Files = new List<contentFiles>();
if (SW.Files == null)
SW.Files = new List<contentFiles>();

if (string.IsNullOrEmpty(SW.PSPreReq))
SW.PSPreReq = "$true; ";
if (string.IsNullOrEmpty(SW.PSPreReq))
SW.PSPreReq = "$true; ";
}).Wait();
}

if (SW.Files != null)
Expand Down Expand Up @@ -721,10 +724,10 @@ public async Task<bool> _DownloadFile2Async(string URL, string FileName, long Fi
{
//_DownloadFile(URL, FileName).Result.ToString();
var httpRequest = (HttpWebRequest)WebRequest.Create(URL);
httpRequest.UserAgent = "chocolatey command line";
//httpRequest.UserAgent = "ruckzuck package manager";
httpRequest.AllowAutoRedirect = true;
httpRequest.MaximumAutomaticRedirections = 5;
Response = httpRequest.GetResponse();
Response = await httpRequest.GetResponseAsync();

// Get back the HTTP response for web server
//Response = (HttpWebResponse)httpRequest.GetResponse();
Expand Down Expand Up @@ -792,7 +795,7 @@ public async Task<bool> _DownloadFile2Async(string URL, string FileName, long Fi
}
}
}
catch(Exception ex)
catch (Exception ex)
{
ex.Message.ToString();
}
Expand Down Expand Up @@ -1651,7 +1654,7 @@ private async Task<bool> _InstallAsync(bool Force = false)
catch (Exception ex)
{
Trace.WriteLine("ERROR: " + ex.Message);
RZRestAPIv2.FeedbackAsync(SW.ProductName, SW.ProductVersion, SW.Manufacturer, "false", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, "ERROR: " + ex.Message, RZRestAPIv2.CustomerID);
RZRestAPIv2.FeedbackAsync(SW.ProductName, SW.ProductVersion, SW.Manufacturer, "false", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, "ERROR: " + ex.Message, RZRestAPIv2.CustomerID).Result.ToString();
downloadTask.Error = true;
downloadTask.ErrorMessage = "WARNING: Product not detected after installation.";
downloadTask.Installed = false;
Expand Down
6 changes: 3 additions & 3 deletions RuckZuck_Tool/DownloadMonitor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void TaskUpdate()
Mutex mRes = null;
if (!Mutex.TryOpenExisting(@"RuckZuck", out mRes))
{
oDL.SWUpd.InstallAsync(false, false).ConfigureAwait(false);
_ = oDL.SWUpd.InstallAsync(false, false);
}

return;
Expand Down Expand Up @@ -131,7 +131,7 @@ private void TaskUpdate()
Mutex mRes = null;
if (!Mutex.TryOpenExisting(@"RuckZuck", out mRes))
{
oDL.SWUpd.InstallAsync(false, false).ConfigureAwait(false);
_ = oDL.SWUpd.InstallAsync(false, false);
}

return;
Expand All @@ -145,7 +145,7 @@ private void TaskUpdate()
Mutex mRes = null;
if (!Mutex.TryOpenExisting(@"RuckZuck", out mRes))
{
oDL.SWUpd.InstallAsync(false, false).ConfigureAwait(false);
_ = oDL.SWUpd.InstallAsync(false, false);
}

return;
Expand Down
2 changes: 1 addition & 1 deletion RuckZuck_Tool/InstallSwPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private void miDownloadFiles_Click(object sender, RoutedEventArgs e)
//oSW.Downloaded += OSW_Downloaded;
oSW.ProgressDetails += OSW_ProgressDetails;
oSW.downloadTask.AutoInstall = false;
_ = oSW.DownloadAsync(false).ConfigureAwait(false);
_ = oSW.DownloadAsync(false);
dm.lDLTasks.Add(oSW.downloadTask);

}
Expand Down
4 changes: 2 additions & 2 deletions RuckZuck_Tool/Properties/Resources.Designer.cs

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

0 comments on commit 0581ebf

Please sign in to comment.