Changed loc of datafiles into AppData/local/InvManager
This commit is contained in:
parent
6635225a8d
commit
b1d2bfc88a
30
BARCODE/Repair_pc_ids.2.txt
Normal file
30
BARCODE/Repair_pc_ids.2.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
1463671755
|
||||||
|
7020175153
|
||||||
|
5404717746
|
||||||
|
3296685637
|
||||||
|
0736311783
|
||||||
|
9076156940
|
||||||
|
5837970452
|
||||||
|
4352106486
|
||||||
|
9547078358
|
||||||
|
1798072890
|
||||||
|
1389587524
|
||||||
|
3541155156
|
||||||
|
8190600237
|
||||||
|
2774273532
|
||||||
|
4811090670
|
||||||
|
1317029903
|
||||||
|
6191218542
|
||||||
|
6626901383
|
||||||
|
0898950400
|
||||||
|
2743029532
|
||||||
|
9237839921
|
||||||
|
4168614523
|
||||||
|
9812526007
|
||||||
|
2588574302
|
||||||
|
1200837449
|
||||||
|
8481657818
|
||||||
|
4044723385
|
||||||
|
8222876041
|
||||||
|
0008935301
|
||||||
|
0061659415
|
@ -30,7 +30,7 @@ Public Class AddMachine
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
Main.StatusLabel.Text = "Tentative d'ajout de l'ordinateur à la base de données..."
|
Main.StatusLabel.Text = "Tentative d'ajout de l'ordinateur à la base de données..."
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & Main.dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Dim cmd As New SQLiteCommand(con)
|
Dim cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "INSERT INTO computers_desc VALUES ('" & NewIDBox.Text & "','" & NewNameBox.Text & "'," & NewEtatBox.SelectedIndex & "," & CheckToNumeric(NewSerieCheckBox) & ",'" & Replace(NewDetailsBox.Text, "'", "_*_") & "',0,'N/A','" & NewGivenByBox.Text & "');"
|
cmd.CommandText = "INSERT INTO computers_desc VALUES ('" & NewIDBox.Text & "','" & NewNameBox.Text & "'," & NewEtatBox.SelectedIndex & "," & CheckToNumeric(NewSerieCheckBox) & ",'" & Replace(NewDetailsBox.Text, "'", "_*_") & "',0,'N/A','" & NewGivenByBox.Text & "');"
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
Public Class Logger
|
Public Class Logger
|
||||||
'DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
'DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
|
||||||
|
|
||||||
Dim logFileName As String = "logs\" & DateTime.Now.ToString("yyyy-MM-dd") & ".txt"
|
Dim logFileName As String = Main.localAppData & "logs\" & DateTime.Now.ToString("yyyy-MM-dd") & ".txt"
|
||||||
|
|
||||||
Public Sub Load()
|
Public Sub Load()
|
||||||
If Not My.Computer.FileSystem.DirectoryExists("logs") Then My.Computer.FileSystem.CreateDirectory("logs")
|
If Not My.Computer.FileSystem.DirectoryExists(Main.localAppData & "logs") Then My.Computer.FileSystem.CreateDirectory(Main.localAppData & "logs")
|
||||||
If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"--------------------------------------------------------------", "------------------- LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy") & " -------------------", "--------------------------------------------------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Init software"})
|
If Not My.Computer.FileSystem.FileExists(logFileName) Then File.WriteAllLines(logFileName, {"--------------------------------------------------------------", "------------------- LOG FILE - " & DateTime.Now.ToString("dd/MM/yyyy") & " -------------------", "--------------------------------------------------------------", "[" & DateTime.Now.ToString("HH:mm:ss") & "][INFO] Init software"})
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
Imports System.Data.SQLite
|
Imports System.Data.SQLite
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
Imports System.Environment
|
||||||
|
|
||||||
Public Class Main
|
Public Class Main
|
||||||
'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
|
'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
|
||||||
@ -8,6 +9,8 @@ Public Class Main
|
|||||||
Dim manualID_selected As Boolean = False
|
Dim manualID_selected As Boolean = False
|
||||||
Dim idList As New ArrayList
|
Dim idList As New ArrayList
|
||||||
Public log As New Logger
|
Public log As New Logger
|
||||||
|
Public Shared localAppData As String = GetFolderPath(SpecialFolder.LocalApplicationData) & "\InvManager\"
|
||||||
|
Public Shared dbLocFile As String = localAppData & "db.sqlite"
|
||||||
|
|
||||||
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
log.Load()
|
log.Load()
|
||||||
@ -20,7 +23,8 @@ Public Class Main
|
|||||||
''' Function to check if app is running for the first time
|
''' Function to check if app is running for the first time
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Private Sub CheckIfFirstRun()
|
Private Sub CheckIfFirstRun()
|
||||||
If Not My.Computer.FileSystem.FileExists("db.sqlite") Then
|
If Not My.Computer.FileSystem.DirectoryExists(localAppData) Then My.Computer.FileSystem.CreateDirectory(localAppData)
|
||||||
|
If Not My.Computer.FileSystem.FileExists(dbLocFile) Then
|
||||||
If MsgBox("La base de données SQLite est introuvable ou inaccessible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inaccessible") = 1 Then
|
If MsgBox("La base de données SQLite est introuvable ou inaccessible, souhaitez-vous la régénérer ?", 4161, "Base SQLite absente ou inaccessible") = 1 Then
|
||||||
RegenerateDB()
|
RegenerateDB()
|
||||||
Else
|
Else
|
||||||
@ -38,7 +42,7 @@ Public Class Main
|
|||||||
Dim dtr As SQLiteDataReader
|
Dim dtr As SQLiteDataReader
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Using cmd As New SQLiteCommand(con)
|
Using cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & idToCheck & ";"
|
cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & idToCheck & ";"
|
||||||
@ -145,7 +149,7 @@ Public Class Main
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
StatusLabel.Text = "Reconstructions de la base SQLite..."
|
StatusLabel.Text = "Reconstructions de la base SQLite..."
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Dim cmd As New SQLiteCommand(genesis_seq, con)
|
Dim cmd As New SQLiteCommand(genesis_seq, con)
|
||||||
cmd.ExecuteNonQuery()
|
cmd.ExecuteNonQuery()
|
||||||
@ -173,7 +177,7 @@ Public Class Main
|
|||||||
InvList.DisplayMember = "Nom"
|
InvList.DisplayMember = "Nom"
|
||||||
Try
|
Try
|
||||||
StatusLabel.Text = "Récupération des données depuis la base SQLite..."
|
StatusLabel.Text = "Récupération des données depuis la base SQLite..."
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Using cmd As New SQLiteCommand(con)
|
Using cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "SELECT id,name FROM computers_desc;"
|
cmd.CommandText = "SELECT id,name FROM computers_desc;"
|
||||||
@ -229,7 +233,7 @@ Public Class Main
|
|||||||
Dim dtr As SQLiteDataReader
|
Dim dtr As SQLiteDataReader
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Using cmd As New SQLiteCommand(con)
|
Using cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "SELECT * FROM computers_desc WHERE id='" & IDBox.Text & "';"
|
cmd.CommandText = "SELECT * FROM computers_desc WHERE id='" & IDBox.Text & "';"
|
||||||
@ -279,7 +283,7 @@ Public Class Main
|
|||||||
Dim dtr As SQLiteDataReader
|
Dim dtr As SQLiteDataReader
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Using cmd As New SQLiteCommand(con)
|
Using cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "SELECT * FROM computers_progress WHERE id='" & machineID & "';"
|
cmd.CommandText = "SELECT * FROM computers_progress WHERE id='" & machineID & "';"
|
||||||
@ -346,7 +350,7 @@ Public Class Main
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
StatusLabel.Text = "Supression d'un ordinateur de la base de données..."
|
StatusLabel.Text = "Supression d'un ordinateur de la base de données..."
|
||||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||||
con.Open()
|
con.Open()
|
||||||
Dim cmd As New SQLiteCommand(con)
|
Dim cmd As New SQLiteCommand(con)
|
||||||
cmd.CommandText = "DELETE FROM computers_desc WHERE id='" & IDBox.Text & "';"
|
cmd.CommandText = "DELETE FROM computers_desc WHERE id='" & IDBox.Text & "';"
|
||||||
@ -391,7 +395,7 @@ Public Class Main
|
|||||||
Private Sub DBAccessToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DBAccessToolStripMenuItem.Click
|
Private Sub DBAccessToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DBAccessToolStripMenuItem.Click
|
||||||
Dim p As New ProcessStartInfo
|
Dim p As New ProcessStartInfo
|
||||||
p.FileName = "explorer.exe"
|
p.FileName = "explorer.exe"
|
||||||
p.Arguments = Directory.GetCurrentDirectory
|
p.Arguments = localAppData
|
||||||
p.UseShellExecute = False
|
p.UseShellExecute = False
|
||||||
Process.Start(p)
|
Process.Start(p)
|
||||||
End Sub
|
End Sub
|
||||||
|
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' en utilisant '*', comme indiqué ci-dessous :
|
' en utilisant '*', comme indiqué ci-dessous :
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("0.10.2.4")>
|
<Assembly: AssemblyVersion("0.11.1.6")>
|
||||||
<Assembly: AssemblyFileVersion("0.10.2.4")>
|
<Assembly: AssemblyFileVersion("0.11.1.6")>
|
||||||
|
Reference in New Issue
Block a user