Aggiunta funzionalità di gestione log in BSLogReader

Sono stati creati nuovi file e modifiche significative al progetto "BSLogReader", inclusa la creazione della soluzione di Visual Studio e dei file di configurazione. È stata implementata una connessione a un database SQL Server tramite una stringa di connessione nel file di impostazioni.

È stato creato un DataSet fortemente tipizzato (LogDataSet) con tabelle e adattatori per gestire le operazioni di lettura e scrittura dei dati. La classe principale (Main.cs) è stata aggiornata per includere funzionalità di importazione di file di log, con progress bar e gestione degli eventi per l'interfaccia utente.

Sono stati aggiunti file di risorse e impostazioni per supportare la localizzazione e la configurazione dell'applicazione, insieme a classi per gestire le righe di log e le operazioni di database. Infine, sono stati aggiornati i file di progetto e di risorse per riflettere le nuove funzionalità e configurazioni dell'applicazione.
This commit is contained in:
2025-08-17 22:43:01 +02:00
parent 49f452ceb3
commit f3b11cb194
16 changed files with 3024 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31702.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BSLogReader", "BSLogReader\BSLogReader.csproj", "{332BE297-DB6C-484A-AA2F-486615389C1B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{332BE297-DB6C-484A-AA2F-486615389C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{332BE297-DB6C-484A-AA2F-486615389C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{332BE297-DB6C-484A-AA2F-486615389C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{332BE297-DB6C-484A-AA2F-486615389C1B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0069EB46-7604-4007-AD16-88A5FB341E73}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="BSLogReader.Properties.Settings.LogConnectionString"
connectionString="Data Source=DESKTOP-9O9JHFS;Initial Catalog=Log;Persist Security Info=True;User ID=sa;Password=Asti2019"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{332BE297-DB6C-484A-AA2F-486615389C1B}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>BSLogReader</RootNamespace>
<AssemblyName>BSLogReader</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LogDataSet.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>LogDataSet.xsd</DependentUpon>
</Compile>
<Compile Include="Main.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.cs">
<DependentUpon>Main.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="LogDataSet.xsc">
<DependentUpon>LogDataSet.xsd</DependentUpon>
</None>
<None Include="LogDataSet.xsd">
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>LogDataSet.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>
<None Include="LogDataSet.xss">
<DependentUpon>LogDataSet.xsd</DependentUpon>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 e x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="LogDataSet" targetNamespace="http://tempuri.org/LogDataSet1.xsd" xmlns:mstns="http://tempuri.org/LogDataSet1.xsd" xmlns="http://tempuri.org/LogDataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<Connections>
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="LogConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="LogConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.BSLogReader.Properties.Settings.GlobalReference.Default.LogConnectionString" Provider="System.Data.SqlClient" />
</Connections>
<Tables>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="LogTableAdapter" GeneratorDataComponentClassName="LogTableAdapter" Name="Log" UserDataComponentName="LogTableAdapter">
<MainSource>
<DbSource ConnectionRef="LogConnectionString (Settings)" DbObjectName="[Log].dbo.[Log]" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<InsertCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>INSERT INTO [dbo].[Log] ([Data], [Tipo], [Testo]) VALUES (@Data, @Tipo, @Testo)</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="DateTime" Direction="Input" ParameterName="@Data" Precision="0" ProviderType="DateTime" Scale="0" Size="0" SourceColumn="Data" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int16" Direction="Input" ParameterName="@Tipo" Precision="0" ProviderType="SmallInt" Scale="0" Size="0" SourceColumn="Tipo" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="@Testo" Precision="0" ProviderType="Text" Scale="0" Size="0" SourceColumn="Testo" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</InsertCommand>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT Data, Tipo, Testo FROM dbo.[Log]</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="Data" DataSetColumn="Data" />
<Mapping SourceColumn="Tipo" DataSetColumn="Tipo" />
<Mapping SourceColumn="Testo" DataSetColumn="Testo" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="Vw_LogTableAdapter" GeneratorDataComponentClassName="Vw_LogTableAdapter" Name="Vw_Log" UserDataComponentName="Vw_LogTableAdapter">
<MainSource>
<DbSource ConnectionRef="LogConnectionString (Settings)" DbObjectName="[Log].dbo.Vw_Log" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT Data, Tipo, Testo FROM dbo.Vw_Log</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="Data" DataSetColumn="Data" />
<Mapping SourceColumn="Tipo" DataSetColumn="Tipo" />
<Mapping SourceColumn="Testo" DataSetColumn="Testo" />
</Mappings>
<Sources />
</TableAdapter>
</Tables>
<Sources />
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="LogDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="True" msprop:Generator_DataSetName="LogDataSet" msprop:Generator_UserDSName="LogDataSet">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Log" msprop:Generator_TableClassName="LogDataTable" msprop:Generator_TableVarName="tableLog" msprop:Generator_TablePropName="Log" msprop:Generator_RowDeletingName="LogRowDeleting" msprop:Generator_RowChangingName="LogRowChanging" msprop:Generator_RowEvHandlerName="LogRowChangeEventHandler" msprop:Generator_RowDeletedName="LogRowDeleted" msprop:Generator_UserTableName="Log" msprop:Generator_RowChangedName="LogRowChanged" msprop:Generator_RowEvArgName="LogRowChangeEvent" msprop:Generator_RowClassName="LogRow">
<xs:complexType>
<xs:sequence>
<xs:element name="Data" msprop:Generator_ColumnVarNameInTable="columnData" msprop:Generator_ColumnPropNameInRow="Data" msprop:Generator_ColumnPropNameInTable="DataColumn" msprop:Generator_UserColumnName="Data" type="xs:dateTime" minOccurs="0" />
<xs:element name="Tipo" msprop:Generator_ColumnVarNameInTable="columnTipo" msprop:Generator_ColumnPropNameInRow="Tipo" msprop:Generator_ColumnPropNameInTable="TipoColumn" msprop:Generator_UserColumnName="Tipo" type="xs:short" minOccurs="0" />
<xs:element name="Testo" msprop:Generator_ColumnVarNameInTable="columnTesto" msprop:Generator_ColumnPropNameInRow="Testo" msprop:Generator_ColumnPropNameInTable="TestoColumn" msprop:Generator_UserColumnName="Testo" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Vw_Log" msprop:Generator_TableClassName="Vw_LogDataTable" msprop:Generator_TableVarName="tableVw_Log" msprop:Generator_TablePropName="Vw_Log" msprop:Generator_RowDeletingName="Vw_LogRowDeleting" msprop:Generator_RowChangingName="Vw_LogRowChanging" msprop:Generator_RowEvHandlerName="Vw_LogRowChangeEventHandler" msprop:Generator_RowDeletedName="Vw_LogRowDeleted" msprop:Generator_UserTableName="Vw_Log" msprop:Generator_RowChangedName="Vw_LogRowChanged" msprop:Generator_RowEvArgName="Vw_LogRowChangeEvent" msprop:Generator_RowClassName="Vw_LogRow">
<xs:complexType>
<xs:sequence>
<xs:element name="Data" msprop:Generator_ColumnVarNameInTable="columnData" msprop:Generator_ColumnPropNameInRow="Data" msprop:Generator_ColumnPropNameInTable="DataColumn" msprop:Generator_UserColumnName="Data" type="xs:dateTime" minOccurs="0" />
<xs:element name="Tipo" msprop:Generator_ColumnVarNameInTable="columnTipo" msprop:Generator_ColumnPropNameInRow="Tipo" msprop:Generator_ColumnPropNameInTable="TipoColumn" msprop:Generator_UserColumnName="Tipo" type="xs:short" minOccurs="0" />
<xs:element name="Testo" msprop:Generator_ColumnVarNameInTable="columnTesto" msprop:Generator_ColumnPropNameInRow="Testo" msprop:Generator_ColumnPropNameInTable="TestoColumn" msprop:Generator_UserColumnName="Testo" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,199 @@
namespace BSLogReader
{
partial class Main
{
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Pulire le risorse in uso.
/// </summary>
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Codice generato da Progettazione Windows Form
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.ButtonApri = new System.Windows.Forms.Button();
this.TextPercorso = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.ProgressScrivi = new System.Windows.Forms.ProgressBar();
this.TextRighe = new System.Windows.Forms.TextBox();
this.ButtonImporta = new System.Windows.Forms.Button();
this.ButtonStop = new System.Windows.Forms.Button();
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
this.logBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.logDataSet = new BSLogReader.LogDataSet();
this.logTableAdapter = new BSLogReader.LogDataSetTableAdapters.LogTableAdapter();
this.TextFile = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.logBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.logDataSet)).BeginInit();
this.SuspendLayout();
//
// ButtonApri
//
this.ButtonApri.Location = new System.Drawing.Point(12, 12);
this.ButtonApri.Name = "ButtonApri";
this.ButtonApri.Size = new System.Drawing.Size(75, 23);
this.ButtonApri.TabIndex = 0;
this.ButtonApri.Text = "APRI";
this.ButtonApri.UseVisualStyleBackColor = true;
this.ButtonApri.Click += new System.EventHandler(this.ButtonApri_Click);
//
// TextPercorso
//
this.TextPercorso.Enabled = false;
this.TextPercorso.Location = new System.Drawing.Point(93, 14);
this.TextPercorso.Name = "TextPercorso";
this.TextPercorso.Size = new System.Drawing.Size(339, 20);
this.TextPercorso.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 73);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(244, 13);
this.label1.TabIndex = 2;
this.label1.Text = "RIGHE DI LOG IMPORTATE DALL\'ULTIMO FILE";
//
// ProgressScrivi
//
this.ProgressScrivi.Location = new System.Drawing.Point(12, 41);
this.ProgressScrivi.Name = "ProgressScrivi";
this.ProgressScrivi.Size = new System.Drawing.Size(420, 23);
this.ProgressScrivi.TabIndex = 3;
//
// TextRighe
//
this.TextRighe.Enabled = false;
this.TextRighe.Location = new System.Drawing.Point(262, 70);
this.TextRighe.Name = "TextRighe";
this.TextRighe.Size = new System.Drawing.Size(170, 20);
this.TextRighe.TabIndex = 4;
this.TextRighe.Text = "0";
this.TextRighe.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// ButtonImporta
//
this.ButtonImporta.Location = new System.Drawing.Point(438, 12);
this.ButtonImporta.Name = "ButtonImporta";
this.ButtonImporta.Size = new System.Drawing.Size(99, 52);
this.ButtonImporta.TabIndex = 5;
this.ButtonImporta.Text = "IMPORTA";
this.ButtonImporta.UseVisualStyleBackColor = true;
this.ButtonImporta.Click += new System.EventHandler(this.ButtonImporta_Click);
//
// ButtonStop
//
this.ButtonStop.Location = new System.Drawing.Point(438, 70);
this.ButtonStop.Name = "ButtonStop";
this.ButtonStop.Size = new System.Drawing.Size(97, 20);
this.ButtonStop.TabIndex = 6;
this.ButtonStop.Text = "STOP";
this.ButtonStop.UseVisualStyleBackColor = true;
this.ButtonStop.Click += new System.EventHandler(this.ButtonStop_Click);
//
// openFileDialog
//
this.openFileDialog.FileName = "openFileDialog";
this.openFileDialog.Filter = "(*.log)|*.log";
this.openFileDialog.Multiselect = true;
this.openFileDialog.ReadOnlyChecked = true;
this.openFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog_FileOk);
//
// logBindingSource
//
this.logBindingSource.DataMember = "Log";
this.logBindingSource.DataSource = this.logDataSet;
//
// logDataSet
//
this.logDataSet.DataSetName = "LogDataSet";
this.logDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// logTableAdapter
//
this.logTableAdapter.ClearBeforeFill = true;
//
// TextFile
//
this.TextFile.Enabled = false;
this.TextFile.Location = new System.Drawing.Point(158, 96);
this.TextFile.Name = "TextFile";
this.TextFile.Size = new System.Drawing.Size(377, 20);
this.TextFile.TabIndex = 8;
this.TextFile.Text = "0";
this.TextFile.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 99);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(140, 13);
this.label2.TabIndex = 7;
this.label2.Text = "ULTIMO FILE IMPORTATO";
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(547, 125);
this.Controls.Add(this.TextFile);
this.Controls.Add(this.label2);
this.Controls.Add(this.ButtonStop);
this.Controls.Add(this.ButtonImporta);
this.Controls.Add(this.TextRighe);
this.Controls.Add(this.ProgressScrivi);
this.Controls.Add(this.label1);
this.Controls.Add(this.TextPercorso);
this.Controls.Add(this.ButtonApri);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Main";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Log Reader";
this.Load += new System.EventHandler(this.Main_Load);
((System.ComponentModel.ISupportInitialize)(this.logBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.logDataSet)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button ButtonApri;
private System.Windows.Forms.TextBox TextPercorso;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ProgressBar ProgressScrivi;
private System.Windows.Forms.TextBox TextRighe;
private System.Windows.Forms.Button ButtonImporta;
private System.Windows.Forms.Button ButtonStop;
private System.Windows.Forms.OpenFileDialog openFileDialog;
private LogDataSet logDataSet;
private System.Windows.Forms.BindingSource logBindingSource;
private LogDataSetTableAdapters.LogTableAdapter logTableAdapter;
private System.Windows.Forms.TextBox TextFile;
private System.Windows.Forms.Label label2;
}
}

View File

@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace BSLogReader
{
public partial class Main : Form
{
int PassaggiMin = 0;
int PassaggiMax = 1000000;
short Tipoletto = 0;
string Stringa = string.Empty;
public Main()
{
InitializeComponent();
ButtonImporta.Enabled = false;
ButtonStop.Enabled = false;
ProgressScrivi.Minimum = PassaggiMin;
ProgressScrivi.Maximum = PassaggiMax;
}
private async void ButtonImporta_Click(object sender, EventArgs e)
{
this.ButtonApri.Enabled = false;
this.ButtonImporta.Enabled = false;
this.ButtonStop.Enabled = true;
foreach (string percorso in openFileDialog.FileNames)
{
UpdateTextFile(percorso);
Esegui(percorso);
}
MessageBox.Show("Caricamento avvenuto con successo.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.ButtonApri.Enabled = true;
this.ButtonImporta.Enabled = true;
this.ButtonStop.Enabled = false;
}
private void ButtonStop_Click(object sender, EventArgs e)
{
//Running = false;
ButtonApri.Enabled = true;
ButtonImporta.Enabled = true;
ButtonStop.Enabled = false;
}
private void ButtonApri_Click(object sender, EventArgs e)
{
openFileDialog.ShowDialog();
}
private void openFileDialog_FileOk(object sender, CancelEventArgs e)
{
TextPercorso.Text = openFileDialog.FileName.ToString();
ButtonImporta.Enabled = true;
}
private async void Esegui(string Percorso)
{
string Linea = "";
int Passaggi = PassaggiMin;
//Running = true;
IEnumerable<string> lines = File.ReadLines(Percorso);
ProgressScrivi.Maximum = lines.Count();
foreach (string line in lines)
{
if (String.IsNullOrEmpty(line))
continue;
Linea += line;
if (Char.IsDigit(line[1]))
{
Tipoletto = 0;
if (Linea.Contains("INFO"))
Tipoletto = 1;
else if (Linea.Contains("WARNING"))
Tipoletto = 2;
else if (Linea.Contains("ERROR"))
Tipoletto = 3;
if (Linea.Contains("1"))
Tipoletto = 1;
else if (Linea.Contains("2"))
Tipoletto = 2;
else if (Linea.Contains("3"))
Tipoletto = 3;
else if (Linea.Contains("4"))
Tipoletto = 3;
//INSERISCO IL RECORD
try
{
this.logTableAdapter.Insert(DateTime.Now, Tipoletto, Linea);
this.logDataSet.AcceptChanges();
this.logTableAdapter.Update(this.logDataSet);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n Errore al salvataggio dei dati.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
Linea = "";
}
else
{
Linea += line;
}
Passaggi++;
UpdateProgressBar(Passaggi);
}
UpdateTextRighe(lines.Count().ToString());
}
public void UpdateProgressBar(int value)
{
this.ProgressScrivi.Value = value;
}
public void UpdateTextRighe(string value)
{
this.TextRighe.Text = value;
}
public void UpdateTextFile(string value)
{
this.TextFile.Text = value;
}
private void Main_Load(object sender, EventArgs e)
{
//this.logTableAdapter.Fill(this.logDataSet.Log);
}
}
}

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="logBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
<metadata name="logDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>150, 17</value>
</metadata>
<metadata name="logDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>150, 17</value>
</metadata>
<metadata name="logTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>410, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BSLogReader
{
static class Program
{
/// <summary>
/// Punto di ingresso principale dell'applicazione.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("BSLogReader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BSLogReader")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("332be297-db6c-484a-aa2f-486615389c1b")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Codice generato da uno strumento.
// Versione runtime:4.0.30319.42000
//
// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BSLogReader.Properties
{
/// <summary>
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
/// </summary>
// Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
// tramite uno strumento quale ResGen o Visual Studio.
// Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
// con l'opzione /str oppure ricompilare il progetto VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BSLogReader.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
/// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
// Versione runtime:4.0.30319.42000
//
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BSLogReader.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=DESKTOP-9O9JHFS;Initial Catalog=Log;Persist Security Info=True;User I" +
"D=sa;Password=Asti2019")]
public string LogConnectionString {
get {
return ((string)(this["LogConnectionString"]));
}
}
}
}

View File

@@ -0,0 +1,14 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BSLogReader.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="LogConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=DESKTOP-9O9JHFS;Initial Catalog=Log;Persist Security Info=True;User ID=sa;Password=Asti2019&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=DESKTOP-9O9JHFS;Initial Catalog=Log;Persist Security Info=True;User ID=sa;Password=Asti2019</Value>
</Setting>
</Settings>
</SettingsFile>