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
|
||||
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()
|
||||
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 & "');"
|
||||
|
@ -3,10 +3,10 @@
|
||||
Public Class Logger
|
||||
'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()
|
||||
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"})
|
||||
End Sub
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
Imports System.Data.SQLite
|
||||
Imports System.Text
|
||||
Imports System.IO
|
||||
Imports System.Environment
|
||||
|
||||
Public Class Main
|
||||
'Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
|
||||
@ -8,6 +9,8 @@ Public Class Main
|
||||
Dim manualID_selected As Boolean = False
|
||||
Dim idList As New ArrayList
|
||||
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
|
||||
log.Load()
|
||||
@ -20,7 +23,8 @@ Public Class Main
|
||||
''' Function to check if app is running for the first time
|
||||
''' </summary>
|
||||
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
|
||||
RegenerateDB()
|
||||
Else
|
||||
@ -38,7 +42,7 @@ Public Class Main
|
||||
Dim dtr As SQLiteDataReader
|
||||
|
||||
Try
|
||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
||||
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||
con.Open()
|
||||
Using cmd As New SQLiteCommand(con)
|
||||
cmd.CommandText = "SELECT * FROM computers_desc WHERE id=" & idToCheck & ";"
|
||||
@ -145,7 +149,7 @@ Public Class Main
|
||||
|
||||
Try
|
||||
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()
|
||||
Dim cmd As New SQLiteCommand(genesis_seq, con)
|
||||
cmd.ExecuteNonQuery()
|
||||
@ -173,7 +177,7 @@ Public Class Main
|
||||
InvList.DisplayMember = "Nom"
|
||||
Try
|
||||
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()
|
||||
Using cmd As New SQLiteCommand(con)
|
||||
cmd.CommandText = "SELECT id,name FROM computers_desc;"
|
||||
@ -229,7 +233,7 @@ Public Class Main
|
||||
Dim dtr As SQLiteDataReader
|
||||
|
||||
Try
|
||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
||||
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||
con.Open()
|
||||
Using cmd As New SQLiteCommand(con)
|
||||
cmd.CommandText = "SELECT * FROM computers_desc WHERE id='" & IDBox.Text & "';"
|
||||
@ -279,7 +283,7 @@ Public Class Main
|
||||
Dim dtr As SQLiteDataReader
|
||||
|
||||
Try
|
||||
Using con As New SQLiteConnection("URI=file:db.sqlite")
|
||||
Using con As New SQLiteConnection("URI=file:" & dbLocFile)
|
||||
con.Open()
|
||||
Using cmd As New SQLiteCommand(con)
|
||||
cmd.CommandText = "SELECT * FROM computers_progress WHERE id='" & machineID & "';"
|
||||
@ -346,7 +350,7 @@ Public Class Main
|
||||
|
||||
Try
|
||||
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()
|
||||
Dim cmd As New SQLiteCommand(con)
|
||||
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
|
||||
Dim p As New ProcessStartInfo
|
||||
p.FileName = "explorer.exe"
|
||||
p.Arguments = Directory.GetCurrentDirectory
|
||||
p.Arguments = localAppData
|
||||
p.UseShellExecute = False
|
||||
Process.Start(p)
|
||||
End Sub
|
||||
|
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' en utilisant '*', comme indiqué ci-dessous :
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("0.10.2.4")>
|
||||
<Assembly: AssemblyFileVersion("0.10.2.4")>
|
||||
<Assembly: AssemblyVersion("0.11.1.6")>
|
||||
<Assembly: AssemblyFileVersion("0.11.1.6")>
|
||||
|
Reference in New Issue
Block a user