mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
9a80dc9225
* CP-40844 adds download source action that gets the latest source code in the production stage. Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 refactors download file actions Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> Adds source url to branding.sh Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP40844 refactors code and implements reviewers comments, aswell as better message handeling Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 Sorts messages Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 removes stray console logging Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 Changes to use FirstOrDefault to avoid null exceptions/errors Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 removes unessessary usings Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 code tidy up Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 Removes erroneous root tag from merge conflict resolution Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> CP-40844 sorts messages Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 fixes misnamed method and adds sourceurl parameter to brandmanager Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 Source url now uses XCUpdates url and just substitues the name of the file Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 Adds source url to xenadmin-build.ps1 Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 defines log4net in each class not just inherited Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 removes unused class variable Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 removes unneeded class variable and uses parent property instead. Simplifies messages for source download and client update. Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 reduces public exposure of member variables/properties Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 merges download x file actions into single file. Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 overide ReleaseDownloadedContent in DownloadAndUpdateClientAction to handle disposal of FileStream Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 minor fixes/tidy up Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 defaults the download latest source button to be invisible. Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 if there is no client update detected then we shouldnt show a where to save dialog Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 Directs user to xenserver website to download source if automatic update checks are turned off. Renames message OUT_OF_DATE_WEBSITE to WEBSITE_DOWNLOADS Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 updates source param to sourceUrl in XCUpdates.xml Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 moves strings to Messages and applys source name string to relevant places Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 removes sourceurl from brand manager Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * CP-40844 uses string literal rather than string join Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * Some more corrections. Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> --------- Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com> Co-authored-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
90 lines
3.1 KiB
C#
90 lines
3.1 KiB
C#
/* Copyright (c) Cloud Software Group, Inc.
|
|
*
|
|
* Redistribution and use in source and binary forms,
|
|
* with or without modification, are permitted provided
|
|
* that the following conditions are met:
|
|
*
|
|
* * Redistributions of source code must retain the above
|
|
* copyright notice, this list of conditions and the
|
|
* following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above
|
|
* copyright notice, this list of conditions and the
|
|
* following disclaimer in the documentation and/or other
|
|
* materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace XenAdmin.Core
|
|
{
|
|
public class ClientVersion
|
|
{
|
|
public Version Version;
|
|
public string Name;
|
|
public bool Latest;
|
|
public bool LatestCr;
|
|
public string Url;
|
|
public string Lang;
|
|
public DateTime TimeStamp;
|
|
public string Checksum;
|
|
public string SourceUrl;
|
|
|
|
public ClientVersion(string version_lang, string name, bool latest, bool latest_cr, string url, string timestamp, string checksum, string sourceUrl)
|
|
{
|
|
ParseVersion(version_lang);
|
|
Name = name;
|
|
Latest = latest;
|
|
LatestCr = latest_cr;
|
|
Url = url;
|
|
DateTime.TryParse(timestamp, out TimeStamp);
|
|
Checksum = checksum;
|
|
SourceUrl = sourceUrl;
|
|
}
|
|
|
|
private void ParseVersion(string version_lang)
|
|
{
|
|
string[] bits = version_lang.Split('.');
|
|
List<string> ver = new List<string>();
|
|
foreach (string bit in bits)
|
|
{
|
|
int num;
|
|
if (Int32.TryParse(bit, out num))
|
|
ver.Add(bit);
|
|
else
|
|
Lang = bit;
|
|
}
|
|
Version = new Version(string.Join(".", ver.ToArray()));
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Name;
|
|
}
|
|
|
|
public string VersionAndLang
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(Lang))
|
|
return Version.ToString();
|
|
return string.Format("{0}.{1}", Version.ToString(), Lang);
|
|
}
|
|
}
|
|
}
|
|
} |