Compare commits
7 Commits
edab522e0e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f38c944c37 | ||
|
|
5a0c6bff65 | ||
|
|
4c066cbdc8 | ||
|
|
34a081e8f9 | ||
|
|
1dc48d2d85 | ||
|
|
1459205ef3 | ||
|
|
ca229fbd89 |
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using InfosysPublisher.Classes;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -7,6 +8,8 @@ using System.Reflection;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
|
//[assembly: AssemblyVersion("2024.08.02.0")]
|
||||||
|
//Publish location:InfosysPublisher
|
||||||
namespace InfosysPublisher
|
namespace InfosysPublisher
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -14,5 +17,38 @@ namespace InfosysPublisher
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
internal static string SqlConnectionString = @"Server=192.168.111.99\INFOSYS;Database=IsStoritve;User Id=infosys;Password=is2005is;MultipleActiveResultSets=True;Encrypt=false";
|
||||||
|
|
||||||
|
internal static Settings.Application? _application;
|
||||||
|
internal static User User;
|
||||||
|
internal static Version CurrentVersion;
|
||||||
|
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
// On start stuff here
|
||||||
|
//base.OnStartup(e);
|
||||||
|
_application = WinSettings.GetSettings();
|
||||||
|
|
||||||
|
CurrentVersion = typeof(App).Assembly.GetName().Version;
|
||||||
|
|
||||||
|
if (_application == null)
|
||||||
|
{
|
||||||
|
OpenSettings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var win = new WinLogin();
|
||||||
|
win.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void OpenSettings()
|
||||||
|
{
|
||||||
|
var win = new WinSettings();
|
||||||
|
win.ShowDialog();
|
||||||
|
if (win.DialogResult != null && (bool)win.DialogResult)
|
||||||
|
{
|
||||||
|
_application = WinSettings.GetSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,5 +102,32 @@ namespace ResevalnaScanner.Classes
|
|||||||
|
|
||||||
return Encoding.UTF8.GetString(plainTextBytes, 0, byteCount).Trim();
|
return Encoding.UTF8.GetString(plainTextBytes, 0, byteCount).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public const int SALT_SIZE = 24; // size in bytes
|
||||||
|
public const int HASH_SIZE = 256; // size in bytes
|
||||||
|
public const int ITERATIONS = 20000; // number of pbkdf2 iterations
|
||||||
|
|
||||||
|
public static (byte[] Hash, byte[] Salt) CreatePasswordHash(string iText, byte[]? iSalt = null)
|
||||||
|
{
|
||||||
|
byte[] salt;
|
||||||
|
if (iSalt == null)
|
||||||
|
{
|
||||||
|
salt = new byte[SALT_SIZE];
|
||||||
|
using var rng = RandomNumberGenerator.Create();
|
||||||
|
rng.GetBytes(salt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
salt = iSalt;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pbkdf2 = new Rfc2898DeriveBytes(iText, salt, ITERATIONS, HashAlgorithmName.SHA256);
|
||||||
|
return (pbkdf2.GetBytes(HASH_SIZE), salt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool CompareByteArrays(byte[] iArray, byte[] iArrayToCompare)
|
||||||
|
{
|
||||||
|
return iArray.Length == iArrayToCompare.Length && !iArray.Where((t, i) => t != iArrayToCompare[i]).ToList().Any();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
16
InfosysPublisher/Classes/User.cs
Normal file
16
InfosysPublisher/Classes/User.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace InfosysPublisher.Classes
|
||||||
|
{
|
||||||
|
internal class User
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Surname { get; set; }
|
||||||
|
public string Username { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<AssemblyVersion>1.0.1.0</AssemblyVersion>
|
<AssemblyVersion>2026.03.20.0</AssemblyVersion>
|
||||||
<ApplicationIcon>infosysPublisher.ico</ApplicationIcon>
|
<ApplicationIcon>infosysPublisher.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="SSH.NET" Version="2020.0.2" />
|
<PackageReference Include="SSH.NET" Version="2020.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
50
InfosysPublisher/WinLogin.xaml
Normal file
50
InfosysPublisher/WinLogin.xaml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<Window x:Class="InfosysPublisher.WinLogin"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:InfosysPublisher"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="WinLogin" Height="350" Width="500">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="20"/>
|
||||||
|
<RowDefinition Height="30"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="25"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="10"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Viewbox Grid.Row="1">
|
||||||
|
<TextBlock>Infosys-Publisher</TextBlock></Viewbox>
|
||||||
|
<Viewbox Grid.Row="2">
|
||||||
|
<TextBlock Name="tblVersion">Version: xxxx-xx-xx-xx</TextBlock>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<Viewbox Grid.Row="4">
|
||||||
|
<TextBlock>Username:</TextBlock>
|
||||||
|
</Viewbox>
|
||||||
|
<Viewbox Grid.Row="5">
|
||||||
|
<TextBox Name="tbUsername" Width="300"></TextBox>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<Viewbox Grid.Row="6">
|
||||||
|
<TextBlock>Password:</TextBlock>
|
||||||
|
</Viewbox>
|
||||||
|
<Viewbox Grid.Row="7">
|
||||||
|
<PasswordBox Name="tbPassword" Width="300"></PasswordBox>
|
||||||
|
</Viewbox>
|
||||||
|
|
||||||
|
<Button Grid.Row="9" Width="300" Click="Login_OnClick">
|
||||||
|
<Viewbox>
|
||||||
|
<TextBlock>Login</TextBlock>
|
||||||
|
</Viewbox>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
123
InfosysPublisher/WinLogin.xaml.cs
Normal file
123
InfosysPublisher/WinLogin.xaml.cs
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
using Renci.SshNet;
|
||||||
|
using ResevalnaScanner.Classes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using InfosysPublisher.Classes;
|
||||||
|
using Microsoft.Data.SqlClient;
|
||||||
|
|
||||||
|
namespace InfosysPublisher
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for WinLogin.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class WinLogin : Window
|
||||||
|
{
|
||||||
|
public WinLogin()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
tbUsername.KeyDown += (sender, args) =>
|
||||||
|
{
|
||||||
|
if (args.Key != Key.Enter) return;
|
||||||
|
tbPassword.Focus();
|
||||||
|
};
|
||||||
|
tbPassword.KeyDown += (sender, args) =>
|
||||||
|
{
|
||||||
|
if (args.Key != Key.Enter) return;
|
||||||
|
Login();
|
||||||
|
};
|
||||||
|
|
||||||
|
tblVersion.Text = $"Version: {App.CurrentVersion}";
|
||||||
|
|
||||||
|
tbUsername.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Login_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Login();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void Login()
|
||||||
|
{
|
||||||
|
var succeeded = false;
|
||||||
|
var isLockedOut = false;
|
||||||
|
|
||||||
|
var username = tbUsername.Text;
|
||||||
|
var password = tbPassword.Password;
|
||||||
|
|
||||||
|
tbPassword.Password = "";
|
||||||
|
|
||||||
|
User user = null;
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
using var sqlConnection = new SqlConnection(App.SqlConnectionString);
|
||||||
|
sqlConnection.Open();
|
||||||
|
|
||||||
|
var sqlCommandString = @"
|
||||||
|
SELECT ID_Uporabnik,
|
||||||
|
UporabniskoIme,
|
||||||
|
Ime,
|
||||||
|
Priimek,
|
||||||
|
GesloBytes,
|
||||||
|
SaltBytes,
|
||||||
|
Aktiven
|
||||||
|
FROM Uporabnik
|
||||||
|
WHERE UporabniskoIme = @uporabniskoIme
|
||||||
|
AND GesloBytes IS NOT NULL
|
||||||
|
AND SaltBytes IS NOT NULL"
|
||||||
|
;
|
||||||
|
|
||||||
|
using var sqlCommand = new SqlCommand(sqlCommandString, sqlConnection);
|
||||||
|
sqlCommand.Parameters.AddWithValue("uporabniskoIme", username);
|
||||||
|
|
||||||
|
using var sqlDataReader = sqlCommand.ExecuteReader();
|
||||||
|
if (sqlDataReader.Read())
|
||||||
|
{
|
||||||
|
if (sqlDataReader.GetString("UporabniskoIme") == username
|
||||||
|
&& Encryption.CompareByteArrays(Encryption.CreatePasswordHash(password, (byte[])sqlDataReader.GetValue("SaltBytes")).Hash, (byte[])sqlDataReader.GetValue("GesloBytes")))
|
||||||
|
{
|
||||||
|
if (sqlDataReader.GetBoolean("Aktiven"))
|
||||||
|
{
|
||||||
|
user = new User
|
||||||
|
{
|
||||||
|
Id = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("ID_Uporabnik")),
|
||||||
|
Name = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Ime")),
|
||||||
|
Surname = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Priimek")),
|
||||||
|
Username = sqlDataReader.GetString(sqlDataReader.GetOrdinal("UporabniskoIme")),
|
||||||
|
};
|
||||||
|
succeeded = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isLockedOut = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//zato da ne takoj konca
|
||||||
|
Encryption.CompareByteArrays(Encryption.CreatePasswordHash(password).Hash, new byte[4] { 0, 1, 0, 1 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbPassword.Password = "";
|
||||||
|
|
||||||
|
if (!succeeded)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Wrong login data!", "Login", MessageBoxButton.OK, MessageBoxImage.Stop);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
App.User = user;
|
||||||
|
this.Hide();
|
||||||
|
var win = new WinMain();
|
||||||
|
win.ShowDialog();
|
||||||
|
this.Show();
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="InfosysPublisher.MainWindow"
|
<Window x:Class="InfosysPublisher.WinMain"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
xmlns:local="clr-namespace:InfosysPublisher"
|
xmlns:local="clr-namespace:InfosysPublisher"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Icon="infosysPublisher.ico"
|
Icon="infosysPublisher.ico"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
Title="Infosys-Publisher" Height="445" Width="580">
|
Title="Infosys-Publisher" Height="445" Width="580">
|
||||||
<Grid Margin="10, 0, 10, 10">
|
<Grid Margin="10, 0, 10, 10">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -43,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="ChbPripraviSamoZip" 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>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Microsoft.Data.SqlClient;
|
||||||
using Path = System.IO.Path;
|
using Path = System.IO.Path;
|
||||||
|
|
||||||
namespace InfosysPublisher
|
namespace InfosysPublisher
|
||||||
@@ -28,7 +29,7 @@ namespace InfosysPublisher
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MainWindow.xaml
|
/// Interaction logic for MainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
public partial class WinMain : Window
|
||||||
{
|
{
|
||||||
#region Classes
|
#region Classes
|
||||||
|
|
||||||
@@ -38,26 +39,52 @@ 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 Settings.Application? _application;
|
|
||||||
|
|
||||||
|
|
||||||
private string _projectPath;
|
private string _projectPath;
|
||||||
private List<Project> _projects;
|
private List<Project> _projects;
|
||||||
private Project? _selectedProject = null;
|
private Project? _selectedProject = null;
|
||||||
private string _selectedProjectSubPath = "";
|
private string _selectedProjectSubPath = "";
|
||||||
private string _selectedProjectPublishLocation = "";
|
private string _selectedProjectPublishLocation = "";
|
||||||
private string _selectedProjectVersion = "";
|
private string _selectedProjectVersion = "";
|
||||||
|
private string _selectedProjectGuid = "";
|
||||||
|
|
||||||
private const string SftpArchivePath = "Archive";
|
//private static readonly string SftpServerAddress = "192.168.111.75";
|
||||||
public MainWindow()
|
//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()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
var version = typeof(App).Assembly.GetName().Version;
|
var version = typeof(App).Assembly.GetName().Version;
|
||||||
this.Title += " " + version;
|
this.Title += " " + version;
|
||||||
|
|
||||||
_application = WinSettings.GetSettings();
|
App._application = WinSettings.GetSettings();
|
||||||
|
|
||||||
TbProjectsPath.LostFocus += TbProjectsPath_LostFocus;
|
TbProjectsPath.LostFocus += TbProjectsPath_LostFocus;
|
||||||
CbProjects.SelectionChanged += CbProjects_SelectionChanged;
|
CbProjects.SelectionChanged += CbProjects_SelectionChanged;
|
||||||
@@ -66,20 +93,14 @@ namespace InfosysPublisher
|
|||||||
BtnSettings.Click += BtnSettings_Click;
|
BtnSettings.Click += BtnSettings_Click;
|
||||||
|
|
||||||
Closing += MainWindow_Closing;
|
Closing += MainWindow_Closing;
|
||||||
|
|
||||||
if (_application == null)
|
|
||||||
{
|
|
||||||
OpenSettings();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TbProjectsPath.Text = _application.LastFolder;
|
TbProjectsPath.Text = App._application.LastFolder;
|
||||||
LoadProjects();
|
LoadProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnSettings_Click(object sender, RoutedEventArgs e)
|
private void BtnSettings_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
OpenSettings();
|
App.OpenSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
|
private void MainWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
|
||||||
@@ -91,15 +112,7 @@ namespace InfosysPublisher
|
|||||||
WinSettings.SaveSettings(settings);
|
WinSettings.SaveSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenSettings()
|
|
||||||
{
|
|
||||||
var win = new WinSettings();
|
|
||||||
win.ShowDialog();
|
|
||||||
if (win.DialogResult != null && (bool)win.DialogResult)
|
|
||||||
{
|
|
||||||
_application = WinSettings.GetSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CbProjects_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void CbProjects_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -162,43 +175,106 @@ namespace InfosysPublisher
|
|||||||
.Where(x => x.Name is "App.xaml.cs" or "Program.cs")
|
.Where(x => x.Name is "App.xaml.cs" or "Program.cs")
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
if (projectFileInfos.Count <= 0)
|
||||||
|
{
|
||||||
|
projectFileInfos = new DirectoryInfo(projectSubPath)
|
||||||
|
.GetDirectories("Properties")
|
||||||
|
.SelectMany(x => x.GetFiles("AssemblyInfo.cs"))
|
||||||
|
.ToList();
|
||||||
|
};
|
||||||
|
|
||||||
if (projectFileInfos.Count <= 0) return;
|
if (projectFileInfos.Count <= 0) return;
|
||||||
|
|
||||||
var csLines = File.ReadLines(projectFileInfos[0].FullName).ToList();
|
var csLines = File.ReadLines(projectFileInfos[0].FullName).ToList();
|
||||||
|
|
||||||
|
var tmpSelectedProjectVersion = "";
|
||||||
|
var tmpSelectedProjectSubPath = "";
|
||||||
|
var tmpSelectedProjectPublishLocation = "";
|
||||||
|
var tmpSelectedProjectGuid = "";
|
||||||
|
|
||||||
csLines.Where(csLine => csLine.StartsWith("[assembly: AssemblyVersion("))
|
csLines.Where(csLine => csLine.StartsWith("[assembly: AssemblyVersion("))
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(csLine =>
|
.ForEach(csLine =>
|
||||||
{
|
{
|
||||||
_selectedProjectVersion = csLine.Replace("[assembly: AssemblyVersion(\"", "").Replace("\")]", "");
|
tmpSelectedProjectVersion = csLine.Replace("[assembly: AssemblyVersion(\"", "").Replace("\")]", "");
|
||||||
_selectedProjectSubPath = projectSubPath;
|
tmpSelectedProjectSubPath = projectSubPath;
|
||||||
|
|
||||||
System.Diagnostics.Debug.WriteLine(_selectedProjectVersion);
|
System.Diagnostics.Debug.WriteLine(tmpSelectedProjectVersion);
|
||||||
});
|
});
|
||||||
if (_selectedProjectSubPath != "")
|
if (tmpSelectedProjectSubPath != "")
|
||||||
{
|
{
|
||||||
csLines.Where(csLine => csLine.StartsWith("//Publish location:"))
|
csLines.Where(csLine => csLine.StartsWith("//Publish location:"))
|
||||||
.ToList()
|
.ToList()
|
||||||
.ForEach(csLine =>
|
.ForEach(csLine =>
|
||||||
{
|
{
|
||||||
_selectedProjectPublishLocation = csLine.Replace("//Publish location:", "");
|
tmpSelectedProjectPublishLocation = csLine.Replace("//Publish location:", "");
|
||||||
|
|
||||||
System.Diagnostics.Debug.WriteLine(_selectedProjectPublishLocation);
|
System.Diagnostics.Debug.WriteLine(tmpSelectedProjectPublishLocation);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Guid za paket vnos dela, tiste ko ga imajo v program cd
|
||||||
|
csLines.Where(csLine => csLine.Contains("public static string GuidAplikacije"))
|
||||||
|
.ToList()
|
||||||
|
.ForEach(csLine =>
|
||||||
|
{
|
||||||
|
tmpSelectedProjectGuid = csLine.Split('"')[1];
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.WriteLine(tmpSelectedProjectGuid);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmpSelectedProjectVersion == ""
|
||||||
|
|| tmpSelectedProjectSubPath == ""
|
||||||
|
|| tmpSelectedProjectPublishLocation == "") return;
|
||||||
|
|
||||||
|
//ce se ni guidja pogledam v nlog
|
||||||
|
if (tmpSelectedProjectGuid == "")
|
||||||
|
{
|
||||||
|
var projectNlogConfig= new DirectoryInfo(projectSubPath)
|
||||||
|
.GetFiles("NLog.config")
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (projectFileInfos.Count <= 0) return;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var xmlDocument = new XmlDocument();
|
||||||
|
xmlDocument.Load(projectNlogConfig[0].FullName);
|
||||||
|
|
||||||
|
var node = xmlDocument
|
||||||
|
.GetElementsByTagName("variable")
|
||||||
|
.Cast<XmlNode>()
|
||||||
|
.FirstOrDefault(x => x.Attributes != null
|
||||||
|
&& x.Attributes.Cast<XmlAttribute>().Any(y => y.Name == "name"
|
||||||
|
&& y.Value is "AplikacijaGuid" or "GuidApplication"));
|
||||||
|
|
||||||
|
if (node != null)
|
||||||
|
tmpSelectedProjectGuid = node.Attributes["value"].Value;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
MessageBox.Show(exception.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tmpSelectedProjectGuid == "") return;
|
||||||
|
|
||||||
|
_selectedProjectVersion = tmpSelectedProjectVersion;
|
||||||
|
_selectedProjectSubPath = tmpSelectedProjectSubPath;
|
||||||
|
_selectedProjectPublishLocation = tmpSelectedProjectPublishLocation;
|
||||||
|
_selectedProjectGuid = tmpSelectedProjectGuid;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (_selectedProjectVersion == "" || _selectedProjectSubPath == "" || _selectedProjectPublishLocation == "")
|
if (_selectedProjectVersion == "" || _selectedProjectSubPath == "" || _selectedProjectPublishLocation == "" || _selectedProjectGuid == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LblProjectInfo.Content = $"Verzija: {_selectedProjectVersion} Pot: {_selectedProjectPublishLocation}";
|
LblProjectInfo.Content = $"Verzija: {_selectedProjectVersion} Pot: {_selectedProjectPublishLocation} Guid: {_selectedProjectGuid}";
|
||||||
|
|
||||||
BtnPublish.IsEnabled = true;
|
BtnPublish.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void BtnPublish_Click(object sender, RoutedEventArgs e)
|
private async void BtnPublish_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_selectedProject == null || _application == null)
|
if (_selectedProject == null || App._application == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var releaseFolder = Path.Combine(_selectedProjectSubPath, @"bin\Release");
|
var releaseFolder = Path.Combine(_selectedProjectSubPath, @"bin\Release");
|
||||||
@@ -208,12 +284,15 @@ namespace InfosysPublisher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TbOutput.Text = $"{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Publish start";
|
||||||
|
|
||||||
|
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(() =>
|
||||||
{
|
{
|
||||||
var diReleaseFolder = new DirectoryInfo(releaseFolder);
|
var diReleaseFolder = new DirectoryInfo(releaseFolder);
|
||||||
|
|
||||||
foreach (var file in diReleaseFolder.GetFiles())
|
foreach (var file in diReleaseFolder.GetFiles())
|
||||||
{
|
{
|
||||||
file.Delete();
|
file.Delete();
|
||||||
@@ -225,6 +304,7 @@ namespace InfosysPublisher
|
|||||||
});
|
});
|
||||||
|
|
||||||
LblLoading.Content = $"Rebuild {_selectedProject.Path}";
|
LblLoading.Content = $"Rebuild {_selectedProject.Path}";
|
||||||
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Rebuild {_selectedProject.Path}";
|
||||||
var output = "";
|
var output = "";
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -241,17 +321,18 @@ namespace InfosysPublisher
|
|||||||
//cmd.StandardInput.WriteLine("echo Oscar");
|
//cmd.StandardInput.WriteLine("echo Oscar");
|
||||||
cmd.StandardInput.Flush();
|
cmd.StandardInput.Flush();
|
||||||
cmd.StandardInput.Close();
|
cmd.StandardInput.Close();
|
||||||
cmd.WaitForExit(_application.BuildSeconds * 1000);
|
cmd.WaitForExit(App._application.BuildSeconds * 1000);
|
||||||
output = cmd.StandardOutput.ReadToEnd();
|
output = cmd.StandardOutput.ReadToEnd();
|
||||||
Debug.WriteLine("\n\n\n\n");
|
Debug.WriteLine("\n\n\n\n");
|
||||||
Debug.WriteLine(output);
|
Debug.WriteLine(output);
|
||||||
//System.Diagnostics.Process.Start("CMD.exe", "");
|
//System.Diagnostics.Process.Start("CMD.exe", "");
|
||||||
});
|
});
|
||||||
TbOutput.Text = output;
|
TbOutput.Text += "\n" + output;
|
||||||
|
|
||||||
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 += $"\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);
|
||||||
|
|
||||||
@@ -260,29 +341,48 @@ namespace InfosysPublisher
|
|||||||
ZipFile.CreateFromDirectory(releaseFolder, zipPath, CompressionLevel.Optimal, false);
|
ZipFile.CreateFromDirectory(releaseFolder, zipPath, CompressionLevel.Optimal, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ChbPripraviSamoZip.IsChecked != null && (bool) ChbPripraviSamoZip.IsChecked)
|
LblLoading.Content = $"Upload to SFTP";
|
||||||
|
await UploadSftp(zipDirectory, zipPath);
|
||||||
|
|
||||||
|
LblLoading.Content = $"Version";
|
||||||
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Version {_selectedProjectVersion}";
|
||||||
|
WriteVersion();
|
||||||
|
|
||||||
|
GridProgress.Visibility = Visibility.Hidden;
|
||||||
|
LblLoading.Content = "";
|
||||||
|
|
||||||
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> End";
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UploadSftp(string zipDirectory, string zipPath)
|
||||||
|
{
|
||||||
|
if (ChbCreateOnlyZip.IsChecked != null && (bool)ChbCreateOnlyZip.IsChecked)
|
||||||
{
|
{
|
||||||
Process.Start("explorer.exe", zipDirectory);
|
Process.Start("explorer.exe", zipDirectory);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
var publishToAll = ChbPublishToAll.IsChecked ?? false;
|
||||||
|
|
||||||
|
//InfosysUpdate
|
||||||
|
//v&H6c$wTbTkgSgdWvL*8k$st3#z5X
|
||||||
|
var error = "";
|
||||||
|
foreach(var sftpServer in _sftpServers)
|
||||||
{
|
{
|
||||||
//InfosysUpdate
|
LblLoading.Content = $"Upload to SFTP: {sftpServer.SftpServerAddress}";
|
||||||
//v&H6c$wTbTkgSgdWvL*8k$st3#z5X
|
TbOutput.Text += $"\n{DateTime.Now:dd.MM.yyyy HH:mm:ss}> Upload to SFTP {sftpServer.SftpServerAddress}";
|
||||||
LblLoading.Content = $"Upload to SFTP";
|
|
||||||
var error = "";
|
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var sftpClient = new SftpClient(_application.SftpServerAddress, _application.SftpPort,
|
using var sftpClient = new SftpClient(sftpServer.SftpServerAddress, sftpServer.SftpPort, sftpServer.SftpUsername, sftpServer.SftpPassword);
|
||||||
_application.SftpUsername, _application.SftpPassword);
|
|
||||||
sftpClient.Connect();
|
sftpClient.Connect();
|
||||||
|
|
||||||
if (!sftpClient.Exists(_selectedProjectPublishLocation))
|
if (!sftpClient.Exists(_selectedProjectPublishLocation))
|
||||||
sftpClient.CreateDirectory(_selectedProjectPublishLocation);
|
sftpClient.CreateDirectory(_selectedProjectPublishLocation);
|
||||||
|
|
||||||
if (!sftpClient.Exists(SftpArchivePath))
|
if (!sftpClient.Exists(sftpServer.SftpArchivePath))
|
||||||
sftpClient.CreateDirectory(SftpArchivePath);
|
sftpClient.CreateDirectory(sftpServer.SftpArchivePath);
|
||||||
|
|
||||||
var files = sftpClient.ListDirectory(_selectedProjectPublishLocation).ToList();
|
var files = sftpClient.ListDirectory(_selectedProjectPublishLocation).ToList();
|
||||||
var xmlVersion = "";
|
var xmlVersion = "";
|
||||||
@@ -320,9 +420,9 @@ namespace InfosysPublisher
|
|||||||
File.Delete(tmpXmlFile);
|
File.Delete(tmpXmlFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlVersion != "")
|
if (publishToAll && xmlVersion != "")
|
||||||
{
|
{
|
||||||
var projectArchive = SftpArchivePath + "/" + _selectedProjectPublishLocation;
|
var projectArchive = sftpServer.SftpArchivePath + "/" + _selectedProjectPublishLocation;
|
||||||
if (!sftpClient.Exists(projectArchive))
|
if (!sftpClient.Exists(projectArchive))
|
||||||
sftpClient.CreateDirectory(projectArchive);
|
sftpClient.CreateDirectory(projectArchive);
|
||||||
|
|
||||||
@@ -354,15 +454,50 @@ namespace InfosysPublisher
|
|||||||
<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";
|
||||||
|
var genPublishLocationTmp = _selectedProjectPublishLocation + "/" + "Package_tmp.zip";
|
||||||
|
|
||||||
|
if (publishToAll)
|
||||||
{
|
{
|
||||||
sftpClient.UploadFile(fileStream, _selectedProjectPublishLocation + "/" + "Update.xml",
|
using (var fileStream = new FileStream(zipPath, FileMode.Open))
|
||||||
true);
|
{
|
||||||
|
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))
|
using (var fileStream = new FileStream(zipPath, FileMode.Open))
|
||||||
{
|
{
|
||||||
sftpClient.UploadFile(fileStream, _selectedProjectPublishLocation + "/" + "Package.zip",
|
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);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,14 +510,52 @@ namespace InfosysPublisher
|
|||||||
error += ex.ToString();
|
error += ex.ToString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (error != "")
|
|
||||||
{
|
|
||||||
MessageBox.Show(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GridProgress.Visibility = Visibility.Hidden;
|
|
||||||
LblLoading.Content = "";
|
if (error != "")
|
||||||
|
{
|
||||||
|
MessageBox.Show(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteVersion()
|
||||||
|
{
|
||||||
|
using var sqlConnection = new SqlConnection(App.SqlConnectionString);
|
||||||
|
sqlConnection.Open();
|
||||||
|
|
||||||
|
var sqlCommandString = @"
|
||||||
|
DECLARE @idVerzija INT = NULL
|
||||||
|
|
||||||
|
SELECT TOP 1 @idVerzija = ID_Verzija
|
||||||
|
FROM AplikacijaVerzija
|
||||||
|
WHERE GUID_Aplikacija_FK = @guid
|
||||||
|
AND Verzija = @verzija
|
||||||
|
|
||||||
|
IF @idVerzija IS NULL
|
||||||
|
BEGIN
|
||||||
|
CREATE TABLE #tmpId(
|
||||||
|
ID INT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO AplikacijaVerzija (GUID_Aplikacija_FK, Verzija)
|
||||||
|
OUTPUT inserted.ID_Verzija INTO #tmpId
|
||||||
|
VALUES (@guid, @verzija)
|
||||||
|
|
||||||
|
SELECT TOP 1 @idVerzija = Id FROM #tmpId
|
||||||
|
END
|
||||||
|
|
||||||
|
INSERT INTO AplikacijaVerzijaRevizija (ID_AplikacijaVerzija_FK, ID_Uporabnik_FK)
|
||||||
|
VALUES (@idVerzija, @idUporabnik);";
|
||||||
|
using var sqlCommand = new SqlCommand(sqlCommandString, sqlConnection);
|
||||||
|
sqlCommand.Parameters.AddWithValue("guid", _selectedProjectGuid);
|
||||||
|
sqlCommand.Parameters.AddWithValue("verzija", _selectedProjectVersion);
|
||||||
|
sqlCommand.Parameters.AddWithValue("idUporabnik", App.User.Id);
|
||||||
|
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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