eliminato problema update con crash (spero...)

This commit is contained in:
Samuele E. Locatelli
2018-01-29 17:23:27 +01:00
parent fe4381974a
commit 75b8636616
13 changed files with 31 additions and 234 deletions
-1
View File
@@ -38,7 +38,6 @@ namespace IOB_MAN
private void btnOpen_Click(object sender, EventArgs e)
{
apriChild();
//apriDumpAgent();
}
private void apriChild()
+13 -6
View File
@@ -342,20 +342,27 @@ namespace IOB_UT
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String sIpAddr = string.Empty;
foreach (NetworkInterface adapter in nics)
try
{
if (sIpAddr == String.Empty)// only return IP Address from first card
foreach (NetworkInterface adapter in nics)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
foreach (var item in properties.UnicastAddresses)
if (sIpAddr == String.Empty)// only return IP Address from first card
{
if (item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
IPInterfaceProperties properties = adapter.GetIPProperties();
foreach (var item in properties.UnicastAddresses)
{
sIpAddr = item.Address.ToString();
if (item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
sIpAddr = item.Address.ToString();
}
}
}
}
}
catch(Exception exc)
{
lg.Error(exc);
}
return sIpAddr;
}
/// <summary>
+1 -21
View File
@@ -113,21 +113,7 @@ namespace IOB_WIN
#region gestione form e visibilità
/// <summary>
/// apre agent di dump in CMD
/// </summary>
private static void apriDumpAgent()
{
string path = Application.StartupPath;
try
{
Process.Start(string.Format(@"{0}\..\..\dump\dump.exe", path));
}
catch
{
Process.Start(string.Format(@"{0}\dump\dump.exe", path));
}
}
/// <summary>
/// File configurazione default
/// </summary>
@@ -661,12 +647,6 @@ namespace IOB_WIN
// fix buttons start/stop/dump
start.Enabled = false;
stop.Enabled = true;
if (utils.CRB("openDumpOnStart"))
{
displayTaskAndLog("Dump Window starting");
apriDumpAgent();
displayTaskAndLog("Dump Windows OK");
}
displayTaskAndLog("Start Timers");
// inizializzo contatori fast/mid/slow
-1
View File
@@ -38,7 +38,6 @@
<!--Definizione avvio Adapter-->
<add key="autoLoadConf" value="true" />
<add key="autoStartOnLoad" value="true" />
<add key="openDumpOnStart" value="false" />
<add key="startMinimized" value="false" />
<add key="windowCanMax" value="true" />
<add key="trayClose" value="true" />
-9
View File
@@ -106,10 +106,6 @@
<DependentUpon>TestForm.cs</DependentUpon>
</Compile>
<Compile Include="utils.cs" />
<Content Include="dump\dump.c" />
<Content Include="dump\dump.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="ExtLib\S_Fwlib32_V6.3.1.exe" />
<Content Include="logs\.placeholder.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -201,11 +197,6 @@
<None Include="DATA\DAT\SimData.dat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="dump\build.bat" />
<None Include="dump\dump.obj" />
<None Include="dump\Test.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
+4 -2
View File
@@ -348,8 +348,10 @@ namespace IOB_WIN
{
answ = string.Format(@"{0}\{1}", utils.confDir, utils.CRS(keyFile));
}
catch
{ }
catch(Exception exc)
{
lg.Error(exc);
}
return answ;
}
+6 -1
View File
@@ -413,7 +413,12 @@ namespace IOB_WIN
// ferma tutti i child form...
foreach (var ChildForm in this.MdiChildren)
{
ChildForm.Close();
try
{
ChildForm.Close();
}
catch
{ }
}
}
+6 -6
View File
@@ -6,11 +6,6 @@ namespace IOB_WIN
{
static class Program
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool AllocConsole();
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool FreeConsole();
/// <summary>
/// Punto di ingresso principale dell'applicazione.
/// </summary>
@@ -19,7 +14,12 @@ namespace IOB_WIN
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
try
{
Application.Run(new MainForm());
}
catch(Exception exc)
{ }
}
}
}
-1
View File
@@ -1 +0,0 @@
ping -t %1
-1
View File
@@ -1 +0,0 @@
cl dump.c ws2_32.lib
-184
View File
@@ -1,184 +0,0 @@
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/socket.h>
#include <sys/select.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <time.h>
#include <unistd.h>
#endif
#include <sys/types.h>
#include <string.h>
#define PORT 7878
#define HOST "localhost"
#define BUFFER_SIZE 1024
#ifndef _WIN32
#define SOCKET int
#define closesocket close
#endif
void cleanup_and_exit(int ret)
{
#ifdef _WIN32
WSACleanup();
#endif
exit(ret);
}
void usage()
{
fprintf(stderr, "Usage: dump [-t timeout] [host] [port] [file]\n host defaults to localhost\n port defaults to 7878\n file defaults to stdout\n");
exit(0);
}
int main(int argc, char **argv)
{
char hostname[100];
SOCKET sd;
struct sockaddr_in pin;
struct hostent *hp;
char buffer[BUFFER_SIZE];
int port;
FILE *file;
char dump = 0;
char **argvp = argv;
time_t start = 0;
int remaining = 1, timeout = 0, nfds;
struct fd_set fds;
struct timeval tv, *tvp = 0;
#ifdef _WIN32
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2,0), &wsaData) != 0) {
fprintf(stderr, "WSAStartup failed\n");
cleanup_and_exit(1);
}
#endif
if (argc > 1) {
if (strcmp(argv[1], "-h") == 0) {
usage();
} else if (strcmp(argv[1], "-t") == 0) {
if (argc < 3) {
fprintf(stderr, "Missing timeout argument\n");
usage();
}
timeout = atoi(argv[2]);
argc -= 2;
argvp += 2;
}
}
strcpy(hostname,HOST);
if (argc > 1) {
strcpy(hostname,argvp[1]);
}
port = PORT;
if (argc > 2) {
port = atoi(argvp[2]);
}
file = stdout;
if (argc > 3) {
file = fopen(argvp[3], "w");
if (file == NULL) {
perror("fopen");
fprintf(stderr, "Cannot open file %s\n", argv[3]);
exit(1);
}
dump = 1;
}
/* go find out about the desired host machine */
if ((hp = gethostbyname(hostname)) == (void*) 0) {
perror("gethostbyname");
cleanup_and_exit(1);
}
/* fill in the socket structure with host information */
memset(&pin, 0, sizeof(pin));
pin.sin_family = AF_INET;
memcpy(&pin.sin_addr.s_addr, hp->h_addr, hp->h_length);
pin.sin_port = htons(port);
/* grab an Internet domain socket */
if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
cleanup_and_exit(1);
}
/* connect to PORT on HOST */
if (connect(sd,(struct sockaddr *) &pin, sizeof(pin)) == -1) {
perror("connect");
cleanup_and_exit(1);
}
if (dump) {
printf("Connected to %s port %d\n", hostname, port);
}
/* wait for a message to come back from the server */
if (timeout > 0) {
start = time(0);
remaining = timeout;
tv.tv_usec = 0;
tvp = &tv;
}
#ifdef _WIN32
nfds = 1;
#else
nfds = sd + 1;
#endif
while (remaining > 0) {
int n;
FD_ZERO(&fds);
FD_SET(sd, &fds);
tv.tv_sec = remaining;
n = select(nfds, &fds, (fd_set*) 0, (fd_set*) 0, tvp);
if (n < 0) {
closesocket(sd);
perror("recv");
cleanup_and_exit(1);
} else if (n > 0) {
int count = recv(sd, buffer, BUFFER_SIZE, 0);
if (count == -1) {
closesocket(sd);
perror("recv");
cleanup_and_exit(1);
}
if (count == 0)
break;
fwrite(buffer, 1, count, file);
if (dump) {
fputc('.', stdout);
fflush(stdout);
}
fflush(file);
}
if (timeout > 0) {
time_t now = time(0);
remaining -= (int) (now - start);
start = now;
}
}
if (dump) printf("\nFinished\n");
fclose(file);
closesocket(sd);
#ifdef _WIN32
WSACleanup();
#endif
return 0;
}
Binary file not shown.
Vendored
+1 -1
View File
@@ -14,7 +14,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=199']) {
withEnv(['NEXT_BUILD_NUMBER=200']) {
// env.versionNumber = VersionNumber(versionNumberString : '1.17.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '1.17.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'