Compare commits
4 Commits
1dc48d2d85
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f38c944c37 | ||
|
|
5a0c6bff65 | ||
|
|
4c066cbdc8 | ||
|
|
34a081e8f9 |
@@ -13,31 +13,9 @@ namespace InfosysPublisher.Classes
|
|||||||
{
|
{
|
||||||
public class Application
|
public class Application
|
||||||
{
|
{
|
||||||
//SQL strežniki
|
|
||||||
//Privatna polja
|
|
||||||
[JsonProperty] private string _sftpUsername;
|
|
||||||
[JsonProperty] private string _sftpPassword;
|
|
||||||
|
|
||||||
//Javna polja
|
|
||||||
public string SftpServerAddress { get; set; }
|
|
||||||
public int SftpPort { get; set; }
|
|
||||||
public int BuildSeconds { get; set; }
|
public int BuildSeconds { get; set; }
|
||||||
public string LastFolder { get; set; }
|
public string LastFolder { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string SftpUsername
|
|
||||||
{
|
|
||||||
get => _sftpUsername.AesDecrypt();
|
|
||||||
set => _sftpUsername = value.AesEncrypt();
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string SftpPassword
|
|
||||||
{
|
|
||||||
get => _sftpPassword.AesDecrypt();
|
|
||||||
set => _sftpPassword = value.AesEncrypt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save(string iPath)
|
public void Save(string iPath)
|
||||||
{
|
{
|
||||||
var json = JsonConvert.SerializeObject(this);
|
var json = JsonConvert.SerializeObject(this);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<AssemblyVersion>2024.08.02.0</AssemblyVersion>
|
<AssemblyVersion>2026.03.20.0</AssemblyVersion>
|
||||||
<ApplicationIcon>infosysPublisher.ico</ApplicationIcon>
|
<ApplicationIcon>infosysPublisher.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -44,12 +44,17 @@
|
|||||||
<TextBox Grid.Row="7" Name="TbOutput" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" IsReadOnly="True"></TextBox>
|
<TextBox Grid.Row="7" Name="TbOutput" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" IsReadOnly="True"></TextBox>
|
||||||
<Grid Grid.Row="8" Margin="3">
|
<Grid Grid.Row="8" Margin="3">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="80px"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="80px"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Grid.Column="0" Name="BtnSettings" Width="80" HorizontalAlignment="Left">Nastavitve</Button>
|
<Button Grid.Column="0" Name="BtnSettings" Width="80" HorizontalAlignment="Left">Nastavitve</Button>
|
||||||
<CheckBox Grid.Column="1" Name="ChbCreateOnlyZip" Width="180" HorizontalAlignment="Left" VerticalAlignment="Center">Pripravi samo zip</CheckBox>
|
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||||
<Button Grid.Column="1" Name="BtnPublish" Width="80" HorizontalAlignment="Right">Potrdi</Button>
|
<CheckBox Name="ChbCreateOnlyZip" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10 0">Pripravi samo zip</CheckBox>
|
||||||
|
<CheckBox Name="ChbPublishToAll" HorizontalAlignment="Left" VerticalAlignment="Center">Publish vsem (vsi brez licence dobijo verzijo)</CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button Grid.Column="2" Name="BtnPublish" Width="80" HorizontalAlignment="Right">Potrdi</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -39,6 +39,22 @@ namespace InfosysPublisher
|
|||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SftpServerData(
|
||||||
|
string sftpServerAddress,
|
||||||
|
int sftpPort,
|
||||||
|
string sftpUsername,
|
||||||
|
string sftpPassword,
|
||||||
|
string path,
|
||||||
|
string sftpArchivePath)
|
||||||
|
{
|
||||||
|
internal string SftpServerAddress { get; } = sftpServerAddress;
|
||||||
|
internal int SftpPort { get; } = sftpPort;
|
||||||
|
internal string SftpUsername { get; } = sftpUsername;
|
||||||
|
internal string SftpPassword { get; } = sftpPassword;
|
||||||
|
internal string Path { get; } = path;
|
||||||
|
internal string SftpArchivePath { get; } = sftpArchivePath;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private string _projectPath;
|
private string _projectPath;
|
||||||
@@ -49,7 +65,18 @@ namespace InfosysPublisher
|
|||||||
private string _selectedProjectVersion = "";
|
private string _selectedProjectVersion = "";
|
||||||
private string _selectedProjectGuid = "";
|
private string _selectedProjectGuid = "";
|
||||||
|
|
||||||
private const string SftpArchivePath = "Archive";
|
//private static readonly string SftpServerAddress = "192.168.111.75";
|
||||||
|
//private static readonly int SftpPort = 300;
|
||||||
|
//private static readonly string SftpUsername = "InfosysUpdate";
|
||||||
|
//private static readonly string SftpPassword = "v&H6c$wTbTkgSgdWvL*8k$st3#z5X";
|
||||||
|
|
||||||
|
//private const string SftpArchivePath = "Archive";
|
||||||
|
|
||||||
|
private static readonly List<SftpServerData> _sftpServers =
|
||||||
|
[
|
||||||
|
new ("sftp2.infosys.si", 22, "is-admin", "4&Xt6x7hX3f#yZ", "", "archive"),
|
||||||
|
new ("192.168.111.75", 300, "InfosysUpdate", "v&H6c$wTbTkgSgdWvL*8k$st3#z5X", "", "Archive"),
|
||||||
|
];
|
||||||
public WinMain()
|
public WinMain()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -217,7 +244,8 @@ namespace InfosysPublisher
|
|||||||
.GetElementsByTagName("variable")
|
.GetElementsByTagName("variable")
|
||||||
.Cast<XmlNode>()
|
.Cast<XmlNode>()
|
||||||
.FirstOrDefault(x => x.Attributes != null
|
.FirstOrDefault(x => x.Attributes != null
|
||||||
&& x.Attributes.Cast<XmlAttribute>().Any(y => y.Name == "name" && y.Value == "AplikacijaGuid"));
|
&& x.Attributes.Cast<XmlAttribute>().Any(y => y.Name == "name"
|
||||||
|
&& y.Value is "AplikacijaGuid" or "GuidApplication"));
|
||||||
|
|
||||||
if (node != null)
|
if (node != null)
|
||||||
tmpSelectedProjectGuid = node.Attributes["value"].Value;
|
tmpSelectedProjectGuid = node.Attributes["value"].Value;
|
||||||
@@ -256,9 +284,9 @@ namespace InfosysPublisher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TbOutput.Text = $"Publish start {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
TbOutput.Text = $"{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Publish start";
|
||||||
|
|
||||||
TbOutput.Text += $"\nClean {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Clean";
|
||||||
GridProgress.Visibility = Visibility.Visible;
|
GridProgress.Visibility = Visibility.Visible;
|
||||||
LblLoading.Content = $"Čiščenje mape {releaseFolder}";
|
LblLoading.Content = $"Čiščenje mape {releaseFolder}";
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
@@ -276,7 +304,7 @@ namespace InfosysPublisher
|
|||||||
});
|
});
|
||||||
|
|
||||||
LblLoading.Content = $"Rebuild {_selectedProject.Path}";
|
LblLoading.Content = $"Rebuild {_selectedProject.Path}";
|
||||||
TbOutput.Text += $"\nRebuild {_selectedProject.Path} {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Rebuild {_selectedProject.Path}";
|
||||||
var output = "";
|
var output = "";
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -304,7 +332,7 @@ namespace InfosysPublisher
|
|||||||
var zipDirectory = new DirectoryInfo(releaseFolder).Parent?.FullName ?? "";
|
var zipDirectory = new DirectoryInfo(releaseFolder).Parent?.FullName ?? "";
|
||||||
var zipPath = Path.Combine(zipDirectory, "Package.zip");
|
var zipPath = Path.Combine(zipDirectory, "Package.zip");
|
||||||
LblLoading.Content = $"Zip {zipPath}";
|
LblLoading.Content = $"Zip {zipPath}";
|
||||||
TbOutput.Text += $"\nZip {zipPath} {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Zip {zipPath}";
|
||||||
if (File.Exists(zipPath))
|
if (File.Exists(zipPath))
|
||||||
File.Delete(zipPath);
|
File.Delete(zipPath);
|
||||||
|
|
||||||
@@ -313,18 +341,20 @@ namespace InfosysPublisher
|
|||||||
ZipFile.CreateFromDirectory(releaseFolder, zipPath, CompressionLevel.Optimal, false);
|
ZipFile.CreateFromDirectory(releaseFolder, zipPath, CompressionLevel.Optimal, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
UploadSftp(zipDirectory, zipPath);
|
LblLoading.Content = $"Upload to SFTP";
|
||||||
|
await UploadSftp(zipDirectory, zipPath);
|
||||||
|
|
||||||
TbOutput.Text += $"\nVersion {_selectedProjectVersion} {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
LblLoading.Content = $"Version";
|
||||||
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Version {_selectedProjectVersion}";
|
||||||
WriteVersion();
|
WriteVersion();
|
||||||
|
|
||||||
GridProgress.Visibility = Visibility.Hidden;
|
GridProgress.Visibility = Visibility.Hidden;
|
||||||
LblLoading.Content = "";
|
LblLoading.Content = "";
|
||||||
|
|
||||||
TbOutput.Text += $"\nEnd {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> End";
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void UploadSftp(string zipDirectory, string zipPath)
|
private async Task UploadSftp(string zipDirectory, string zipPath)
|
||||||
{
|
{
|
||||||
if (ChbCreateOnlyZip.IsChecked != null && (bool)ChbCreateOnlyZip.IsChecked)
|
if (ChbCreateOnlyZip.IsChecked != null && (bool)ChbCreateOnlyZip.IsChecked)
|
||||||
{
|
{
|
||||||
@@ -332,127 +362,157 @@ namespace InfosysPublisher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var publishToAll = ChbPublishToAll.IsChecked ?? false;
|
||||||
|
|
||||||
//InfosysUpdate
|
//InfosysUpdate
|
||||||
//v&H6c$wTbTkgSgdWvL*8k$st3#z5X
|
//v&H6c$wTbTkgSgdWvL*8k$st3#z5X
|
||||||
LblLoading.Content = $"Upload to SFTP";
|
|
||||||
TbOutput.Text += $"\nUpload to SFTP {DateTime.Now:dd.MM.yyyy HH:mm:ss}";
|
|
||||||
var error = "";
|
var error = "";
|
||||||
await Task.Run(() =>
|
foreach(var sftpServer in _sftpServers)
|
||||||
{
|
{
|
||||||
try
|
LblLoading.Content = $"Upload to SFTP: {sftpServer.SftpServerAddress}";
|
||||||
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Upload to SFTP {sftpServer.SftpServerAddress}";
|
||||||
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
using var sftpClient = new SftpClient(App._application.SftpServerAddress, App._application.SftpPort,
|
try
|
||||||
App._application.SftpUsername, App._application.SftpPassword);
|
|
||||||
sftpClient.Connect();
|
|
||||||
|
|
||||||
if (!sftpClient.Exists(_selectedProjectPublishLocation))
|
|
||||||
sftpClient.CreateDirectory(_selectedProjectPublishLocation);
|
|
||||||
|
|
||||||
if (!sftpClient.Exists(SftpArchivePath))
|
|
||||||
sftpClient.CreateDirectory(SftpArchivePath);
|
|
||||||
|
|
||||||
var files = sftpClient.ListDirectory(_selectedProjectPublishLocation).ToList();
|
|
||||||
var xmlVersion = "";
|
|
||||||
//arhiv
|
|
||||||
foreach (var file in files)
|
|
||||||
{
|
{
|
||||||
if (!file.Name.ToLower().EndsWith(".xml"))
|
using var sftpClient = new SftpClient(sftpServer.SftpServerAddress, sftpServer.SftpPort, sftpServer.SftpUsername, sftpServer.SftpPassword);
|
||||||
continue;
|
sftpClient.Connect();
|
||||||
|
|
||||||
var tmpXmlFile = Path.GetTempFileName();
|
if (!sftpClient.Exists(_selectedProjectPublishLocation))
|
||||||
|
sftpClient.CreateDirectory(_selectedProjectPublishLocation);
|
||||||
|
|
||||||
using (var tmpFile = File.OpenWrite(tmpXmlFile))
|
if (!sftpClient.Exists(sftpServer.SftpArchivePath))
|
||||||
{
|
sftpClient.CreateDirectory(sftpServer.SftpArchivePath);
|
||||||
sftpClient.DownloadFile(file.FullName, tmpFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var xmlContent = File.ReadAllText(tmpXmlFile);
|
|
||||||
if (!string.IsNullOrEmpty(xmlContent))
|
|
||||||
{
|
|
||||||
//Oddaljena verzije
|
|
||||||
var xmlDocument = new XmlDocument();
|
|
||||||
xmlDocument.LoadXml(xmlContent);
|
|
||||||
var xmlNode = xmlDocument.SelectSingleNode("/Update");
|
|
||||||
xmlVersion = xmlNode["Version"].InnerText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
error += "\n\n";
|
|
||||||
error += exception.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Delete(tmpXmlFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xmlVersion != "")
|
|
||||||
{
|
|
||||||
var projectArchive = SftpArchivePath + "/" + _selectedProjectPublishLocation;
|
|
||||||
if (!sftpClient.Exists(projectArchive))
|
|
||||||
sftpClient.CreateDirectory(projectArchive);
|
|
||||||
|
|
||||||
var archiveFolderWithoutIndex = projectArchive + "/" + xmlVersion.Replace(".", "_");
|
|
||||||
var archiveFolder = archiveFolderWithoutIndex;
|
|
||||||
var index = 1;
|
|
||||||
while (sftpClient.Exists(archiveFolder))
|
|
||||||
{
|
|
||||||
archiveFolder = archiveFolderWithoutIndex + "_" + index;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
sftpClient.CreateDirectory(archiveFolder);
|
|
||||||
|
|
||||||
|
var files = sftpClient.ListDirectory(_selectedProjectPublishLocation).ToList();
|
||||||
|
var xmlVersion = "";
|
||||||
|
//arhiv
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
if (!file.IsRegularFile)
|
if (!file.Name.ToLower().EndsWith(".xml"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sftpClient.Get(file.FullName).MoveTo(archiveFolder + "/" + file.Name);
|
var tmpXmlFile = Path.GetTempFileName();
|
||||||
|
|
||||||
|
using (var tmpFile = File.OpenWrite(tmpXmlFile))
|
||||||
|
{
|
||||||
|
sftpClient.DownloadFile(file.FullName, tmpFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var xmlContent = File.ReadAllText(tmpXmlFile);
|
||||||
|
if (!string.IsNullOrEmpty(xmlContent))
|
||||||
|
{
|
||||||
|
//Oddaljena verzije
|
||||||
|
var xmlDocument = new XmlDocument();
|
||||||
|
xmlDocument.LoadXml(xmlContent);
|
||||||
|
var xmlNode = xmlDocument.SelectSingleNode("/Update");
|
||||||
|
xmlVersion = xmlNode["Version"].InnerText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
error += "\n\n";
|
||||||
|
error += exception.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Delete(tmpXmlFile);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//Upload
|
if (publishToAll && xmlVersion != "")
|
||||||
var tmpXmlFileUpload = Path.GetTempFileName();
|
{
|
||||||
string xml = $@"<?xml version=""1.0""?>
|
var projectArchive = sftpServer.SftpArchivePath + "/" + _selectedProjectPublishLocation;
|
||||||
|
if (!sftpClient.Exists(projectArchive))
|
||||||
|
sftpClient.CreateDirectory(projectArchive);
|
||||||
|
|
||||||
|
var archiveFolderWithoutIndex = projectArchive + "/" + xmlVersion.Replace(".", "_");
|
||||||
|
var archiveFolder = archiveFolderWithoutIndex;
|
||||||
|
var index = 1;
|
||||||
|
while (sftpClient.Exists(archiveFolder))
|
||||||
|
{
|
||||||
|
archiveFolder = archiveFolderWithoutIndex + "_" + index;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
sftpClient.CreateDirectory(archiveFolder);
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
if (!file.IsRegularFile)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sftpClient.Get(file.FullName).MoveTo(archiveFolder + "/" + file.Name);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Upload
|
||||||
|
var tmpXmlFileUpload = Path.GetTempFileName();
|
||||||
|
string xml = $@"<?xml version=""1.0""?>
|
||||||
<Update>
|
<Update>
|
||||||
<Version>{_selectedProjectVersion}</Version>
|
<Version>{_selectedProjectVersion}</Version>
|
||||||
</Update>";
|
</Update>";
|
||||||
File.WriteAllText(tmpXmlFileUpload, xml);
|
File.WriteAllText(tmpXmlFileUpload, xml);
|
||||||
using (var fileStream = new FileStream(tmpXmlFileUpload, FileMode.Open))
|
|
||||||
{
|
var genPublishLocation = _selectedProjectPublishLocation + "/" + "Package.zip";
|
||||||
sftpClient.UploadFile(fileStream, _selectedProjectPublishLocation + "/" + "Update.xml",
|
var genPublishLocationTmp = _selectedProjectPublishLocation + "/" + "Package_tmp.zip";
|
||||||
true);
|
|
||||||
|
if (publishToAll)
|
||||||
|
{
|
||||||
|
using (var fileStream = new FileStream(zipPath, FileMode.Open))
|
||||||
|
{
|
||||||
|
sftpClient.UploadFile(fileStream, genPublishLocationTmp,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var sftpDirVersion = _selectedProjectPublishLocation + "/" + _selectedProjectVersion;
|
||||||
|
|
||||||
|
if (!sftpClient.Exists(sftpDirVersion))
|
||||||
|
sftpClient.CreateDirectory(sftpDirVersion);
|
||||||
|
|
||||||
|
var versionPublishLocation = sftpDirVersion + "/" + "Package.zip";
|
||||||
|
var versionPublishLocationTmp = sftpDirVersion + "/" + "Package_tmp.zip";
|
||||||
|
|
||||||
|
using (var fileStream = new FileStream(zipPath, FileMode.Open))
|
||||||
|
{
|
||||||
|
sftpClient.UploadFile(fileStream, versionPublishLocationTmp,
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (publishToAll && sftpClient.Exists(genPublishLocation))
|
||||||
|
sftpClient.DeleteFile(genPublishLocation);
|
||||||
|
|
||||||
|
if (sftpClient.Exists(versionPublishLocation))
|
||||||
|
sftpClient.DeleteFile(versionPublishLocation);
|
||||||
|
|
||||||
|
if (publishToAll)
|
||||||
|
sftpClient.RenameFile(genPublishLocationTmp, genPublishLocation);
|
||||||
|
|
||||||
|
sftpClient.RenameFile(versionPublishLocationTmp, versionPublishLocation);
|
||||||
|
|
||||||
|
//XML na koncu
|
||||||
|
if (publishToAll)
|
||||||
|
{
|
||||||
|
using var fileStream = new FileStream(tmpXmlFileUpload, FileMode.Open);
|
||||||
|
sftpClient.UploadFile(fileStream, _selectedProjectPublishLocation + "/" + "Update.xml",
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Delete(tmpXmlFileUpload);
|
||||||
|
sftpClient.Disconnect();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
using (var fileStream = new FileStream(zipPath, FileMode.Open))
|
|
||||||
{
|
{
|
||||||
sftpClient.UploadFile(fileStream, _selectedProjectPublishLocation + "/" + "Package.zip",
|
error += "\n\n";
|
||||||
true);
|
error += ex.ToString();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var sftpDirVersion = _selectedProjectPublishLocation + "/" + _selectedProjectVersion;
|
|
||||||
|
|
||||||
if (!sftpClient.Exists(sftpDirVersion))
|
|
||||||
sftpClient.CreateDirectory(sftpDirVersion);
|
|
||||||
|
|
||||||
using (var fileStream = new FileStream(zipPath, FileMode.Open))
|
|
||||||
{
|
|
||||||
sftpClient.UploadFile(fileStream, sftpDirVersion + "/" + "Package.zip",
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
|
|
||||||
File.Delete(tmpXmlFileUpload);
|
|
||||||
sftpClient.Disconnect();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
error += "\n\n";
|
|
||||||
error += ex.ToString();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (error != "")
|
if (error != "")
|
||||||
{
|
{
|
||||||
MessageBox.Show(error);
|
MessageBox.Show(error);
|
||||||
|
|||||||
@@ -9,29 +9,13 @@
|
|||||||
Title="WinSettings" Height="355" Width="355">
|
Title="WinSettings" Height="355" Width="355">
|
||||||
<Grid Margin="5">
|
<Grid Margin="5">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
|
||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="25"/>
|
||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="25"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="25"/>
|
<RowDefinition Height="25"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Grid.Row="0">SFTP strežnik:</Label>
|
<Label Grid.Row="0">Trajanje build:</Label>
|
||||||
<TextBox Grid.Row="1" Name="TbSftpServer"></TextBox>
|
<TextBox Grid.Row="1" Name="TbBuildDuration"></TextBox>
|
||||||
<Label Grid.Row="2">SFTP port:</Label>
|
|
||||||
<TextBox Grid.Row="3" Name="TbSftpPort"></TextBox>
|
|
||||||
<Label Grid.Row="4">SFTP uporabniško ime:</Label>
|
|
||||||
<TextBox Grid.Row="5" Name="TbSftpUsername"></TextBox>
|
|
||||||
<Label Grid.Row="6">SFTP geslo:</Label>
|
|
||||||
<TextBox Grid.Row="7" Name="TbSftpPassword"></TextBox>
|
|
||||||
<Label Grid.Row="8">Trajanje build:</Label>
|
|
||||||
<TextBox Grid.Row="9" Name="TbBuildDuration"></TextBox>
|
|
||||||
<Button Name="BtnSave" Grid.Row="20" Width="80" HorizontalAlignment="Right">Shrani</Button>
|
<Button Name="BtnSave" Grid.Row="20" Width="80" HorizontalAlignment="Right">Shrani</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ namespace InfosysPublisher
|
|||||||
{
|
{
|
||||||
var settings = new Settings.Application
|
var settings = new Settings.Application
|
||||||
{
|
{
|
||||||
SftpServerAddress = TbSftpServer.Text,
|
|
||||||
SftpPort = Convert.ToInt32(TbSftpPort.Text),
|
|
||||||
SftpUsername = TbSftpUsername.Text,
|
|
||||||
SftpPassword = TbSftpPassword.Text,
|
|
||||||
BuildSeconds = Convert.ToInt32(TbBuildDuration.Text)
|
BuildSeconds = Convert.ToInt32(TbBuildDuration.Text)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,10 +55,6 @@ namespace InfosysPublisher
|
|||||||
{
|
{
|
||||||
var settings = GetSettings() ?? new Settings.Application();
|
var settings = GetSettings() ?? new Settings.Application();
|
||||||
|
|
||||||
TbSftpServer.Text = settings.SftpServerAddress;
|
|
||||||
TbSftpPort.Text = settings.SftpPort.ToString();
|
|
||||||
TbSftpUsername.Text = settings.SftpUsername;
|
|
||||||
TbSftpPassword.Text = settings.SftpPassword;
|
|
||||||
TbBuildDuration.Text = settings.BuildSeconds.ToString();
|
TbBuildDuration.Text = settings.BuildSeconds.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user