65 lines
2.3 KiB
C#
65 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Eugen.NX;
|
|
|
|
namespace ShowInstalledNXversion
|
|
{
|
|
public static class WriteListToDesktop
|
|
{
|
|
public static void Write(string installationFolder, List<string> verList)
|
|
{
|
|
VerList = verList;
|
|
InstallationFolder = installationFolder;
|
|
|
|
string fileName = "InstalledNX-Versions";
|
|
string path = String.Concat(Environment.GetEnvironmentVariable("OneDrive"), "\\Desktop");
|
|
string ext = "txt";
|
|
|
|
List<string> list = new List<string>();
|
|
list = CreateList();
|
|
|
|
File.WriteAllLines(String.Concat(path, "\\", fileName, ".", ext), list);
|
|
}
|
|
|
|
private static string InstallationFolder { set; get; }
|
|
private static List<string> VerList { set; get; }
|
|
|
|
private static List<string> CreateList()
|
|
{
|
|
List<string> list = new List<string>();
|
|
list.Clear();
|
|
list.Add(String.Concat("Installed NX Versions on ", Environment.GetEnvironmentVariable("COMPUTERNAME")));
|
|
list.Add("-------------------------------------");
|
|
list.Add("Base Version:\tInstalled Version:");
|
|
list.Add("-------------------------------------");
|
|
|
|
NxVersion nxVer = new NxVersion(); //Informationen über diese Version abrufen
|
|
|
|
foreach (var item in VerList)
|
|
{
|
|
//NxVersion nxVerion = new NxVersion(String.Concat(InstallationFolder, "\\NX", item)); //Informationen über diese Version abrufen
|
|
nxVer.GetNxVersion(String.Concat(InstallationFolder, "\\NX", item));
|
|
|
|
if (Convert.ToInt32(item) <= 12)
|
|
{
|
|
list.Add(String.Concat("NX", item, "\t\t\t", nxVer.NXpatch));
|
|
}
|
|
else
|
|
{
|
|
list.Add(String.Concat("NX", item, "\t\t\t", "NX ", nxVer.UgiiMajorVersion, ".", nxVer.UgiiMinorVersion));
|
|
}
|
|
}
|
|
|
|
list.Add("-------------------------------------");
|
|
list.Add(String.Concat("Number of installed NX Versions: ", VerList.Count));
|
|
list.Add("-------------------------------------");
|
|
|
|
return list;
|
|
}
|
|
}
|
|
}
|