Add explicit working folder; rename project from CadSearchGui to PrepStep

Working folder (phase 1): CSV/raw/step/step_finali all used to live split
across two different implicit locations (CSV in the "repo root" found by
walking up for CLAUDE.md, raw/step next to the input distinta file) with
neither shown to the user. That repo-root lookup also silently breaks once
the app runs as a standalone published exe on a machine with no repo/
CLAUDE.md at all. Replaced both with one explicit "cartella di lavoro",
auto-suggested (last used, remembered the same way as the DB path) and
changeable from phase 1, with no dependency on any repo marker file.

Rename: CadSearchGui was the working name from before the app had a
product identity; renamed folders, csproj files, namespace and the
AppData settings folder to PrepStep throughout, matching the exe name
already in use. Product-facing name stays "Cevolani StepPrep".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5 committed 2026-09-21 11:18:43 +02:00
1 parent 6726dd2216
commit 13798ad47c
24 files changed
+211 -129

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
using System.Diagnostics;
namespace PrepStep;
public enum EsitoStep
{
/// <summary>File .stp trovato in "step" e copiato in "step_finali".</summary>
Creato,
/// <summary>Il componente è nell'indice CAD (asm/prt trovato), ma nessuno STEP esportato.</summary>
StepMancante,
/// <summary>Il componente non è nemmeno nell'indice CAD.</summary>
ComponenteNonTrovato,
}
/// <summary>Mostra, per ogni componente della distinta base, se lo STEP corrispondente è stato
/// trovato in "step" e copiato in "step_finali", se manca solo lo STEP (il CAD sorgente c'è,
/// ma non è ancora stato esportato) o se manca anche il CAD sorgente nell'indice.</summary>
public class ReportStepForm : Form
{
public ReportStepForm(List<(string Componente, string Descrizione, EsitoStep Esito)> righe, string cartellaStepFinali)
{
int creati = righe.Count(r => r.Esito == EsitoStep.Creato);
int stepMancanti = righe.Count(r => r.Esito == EsitoStep.StepMancante);
int nonTrovati = righe.Count(r => r.Esito == EsitoStep.ComponenteNonTrovato);
Text = "Report STEP finali";
ClientSize = new Size(720, 440);
StartPosition = FormStartPosition.CenterParent;
Font = new Font("Segoe UI", 9.5f);
var lblInfo = new Label
{
Dock = DockStyle.Top,
AutoSize = true,
Padding = new Padding(12, 8, 12, 8),
Text = $"{creati} copiati, {stepMancanti} da esportare (CAD presente), "
+ $"{nonTrovati} non nell'indice, su {righe.Count} totali. In \"{cartellaStepFinali}\".",
};
var grid = new DataGridView
{
Dock = DockStyle.Fill,
ReadOnly = true,
AllowUserToAddRows = false,
AllowUserToDeleteRows = false,
RowHeadersVisible = false,
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
};
grid.Columns.Add("componente", "Componente");
grid.Columns.Add("descrizione", "Descrizione");
grid.Columns.Add("step", "STEP");
grid.Columns["componente"]!.FillWeight = 20;
grid.Columns["descrizione"]!.FillWeight = 55;
grid.Columns["step"]!.FillWeight = 25;
foreach (var (componente, descrizione, esito) in righe.OrderBy(r => r.Esito).ThenBy(r => r.Componente))
{
var (testo, colore) = esito switch
{
EsitoStep.Creato => ("Creato", Color.DarkGreen),
EsitoStep.StepMancante => ("Da esportare (CAD presente)", Color.DarkOrange),
_ => ("Componente non trovato nel server", Color.DarkRed),
};
int i = grid.Rows.Add(componente, descrizione, testo);
grid.Rows[i].DefaultCellStyle.ForeColor = colore;
}
var btnApriCartella = new Button { Text = "Apri cartella step_finali", Dock = DockStyle.Bottom, Height = 34 };
UiStile.Secondario(btnApriCartella);
btnApriCartella.Click += (_, _) =>
{
try { Process.Start("explorer.exe", cartellaStepFinali); }
catch (Exception ex)
{
MessageBox.Show(this, $"Impossibile aprire Esplora risorse:\n{ex.Message}", "Errore",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
};
Controls.Add(grid);
Controls.Add(lblInfo);
Controls.Add(btnApriCartella);
}
}