From 50dfcf7e146864b60ff3f3bf243b29264e41a74d Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Mon, 3 Aug 2026 13:42:40 +0200 Subject: [PATCH] first commit --- .gitignore | 4 + InventarManager.slnx | 4 + InventarManager/AGENTS.md | 38 +++ InventarManager/Apis/Inventree.cs | 44 ++++ InventarManager/Apis/Netbox.cs | 44 ++++ InventarManager/Apis/SnipeIT.cs | 44 ++++ InventarManager/Form1.Designer.cs | 220 ++++++++++++++++++ InventarManager/Form1.cs | 49 ++++ InventarManager/Form1.resx | 123 ++++++++++ InventarManager/Helper/WebRequest.cs | 51 ++++ InventarManager/InventarManager.csproj | 57 +++++ InventarManager/InventarManager.csproj.user | 8 + InventarManager/Models/Manufacturer.cs | 23 ++ .../Inventree/InventreeManufacturer.cs | 28 +++ .../Specific/Netbox/NetboxManufacturer.cs | 28 +++ .../Specific/SnipeIt/SnipeItManufacturer.cs | 32 +++ InventarManager/Program.cs | 16 ++ .../example-config/settings.conf.example | 11 + 18 files changed, 824 insertions(+) create mode 100644 .gitignore create mode 100644 InventarManager.slnx create mode 100644 InventarManager/AGENTS.md create mode 100644 InventarManager/Apis/Inventree.cs create mode 100644 InventarManager/Apis/Netbox.cs create mode 100644 InventarManager/Apis/SnipeIT.cs create mode 100644 InventarManager/Form1.Designer.cs create mode 100644 InventarManager/Form1.cs create mode 100644 InventarManager/Form1.resx create mode 100644 InventarManager/Helper/WebRequest.cs create mode 100644 InventarManager/InventarManager.csproj create mode 100644 InventarManager/InventarManager.csproj.user create mode 100644 InventarManager/Models/Manufacturer.cs create mode 100644 InventarManager/Models/Specific/Inventree/InventreeManufacturer.cs create mode 100644 InventarManager/Models/Specific/Netbox/NetboxManufacturer.cs create mode 100644 InventarManager/Models/Specific/SnipeIt/SnipeItManufacturer.cs create mode 100644 InventarManager/Program.cs create mode 100644 InventarManager/example-config/settings.conf.example diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..275baec --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vs +InventarManager/bin +InventarManager/obj +settings.conf \ No newline at end of file diff --git a/InventarManager.slnx b/InventarManager.slnx new file mode 100644 index 0000000..877e726 --- /dev/null +++ b/InventarManager.slnx @@ -0,0 +1,4 @@ + + + + diff --git a/InventarManager/AGENTS.md b/InventarManager/AGENTS.md new file mode 100644 index 0000000..6ff58f2 --- /dev/null +++ b/InventarManager/AGENTS.md @@ -0,0 +1,38 @@ +# Repository Guidelines + +## Project Overview + +`InventarManager` is a .NET Windows Forms application focused on asset and master data management (e.g., manufacturers, models, etc.). It serves as a central hub to synchronize data across three different platforms: **Inventree**, **Netbox**, and **SnipeIT**. Additionally, the application supports the generation of asset labels. + +## Project Structure & Module Organization + +The project is a .NET Windows Forms application organized as follows: + +- `Apis/`: Contains integration logic for external services (e.g., `Inventree.cs`, `Netbox.cs`, `SnipeIT.cs`). +- `Helper/`: Contains utility classes and helper functions (e.g., `WebRequest.cs`). +- `Models/`: Contains the data models used throughout the application. +- `Form1.cs`: The primary user interface component. + +## Build, Test, and Development Commands + +The project is designed to be developed using **Visual Studio**. + +- **Build**: Use `dotnet build` from the terminal or the Build command in Visual Studio. +- **Run**: Use `dotnet run` or the Start button in Visual Studio. + +## Coding Style & Naming Conventions + +- **Language**: C# (.NET 10.0) +- **Naming**: Follow standard .NET conventions: + - `PascalCase` for classes, methods, and properties. + - `camelCase` for local variables and private fields. +- **Features**: The project utilizes `ImplicitUsings` and nullable reference types. + +## Testing Guidelines + +There are currently no automated tests included in this repository. + +## Commit & Pull Request Guidelines + +- **Commit Messages**: Keep commit messages concise and descriptive of the changes (e.g., `Add feature X`, `Fix bug Y`). +- **Pull Requests**: Ensure all changes are documented and tested locally before submission. diff --git a/InventarManager/Apis/Inventree.cs b/InventarManager/Apis/Inventree.cs new file mode 100644 index 0000000..b46fc0c --- /dev/null +++ b/InventarManager/Apis/Inventree.cs @@ -0,0 +1,44 @@ +using BlubbFish.Applications.InventarManager.Helpers; +using BlubbFish.Applications.InventarManager.Models.Specific.Inventree; +using LitJson; + +namespace BlubbFish.Applications.InventarManager.Apis { + class Inventree { + private String server; + private String key; + private WebRequest http; + + public Inventree(String server, String key) { + this.server = server; + this.key = key; + this.http = new WebRequest(); + this.http.SetAuthToken(this.key); + } + + public Boolean Connect() { + try { + JsonData json = JsonMapper.ToObject(this.http.RequestString("https://" + this.server + "/api/version/")); + if(json.ContainsKey("version") && json["version"].IsObject && json["version"].ContainsKey("server") && json["version"]["server"].IsString && json["version"]["server"].ToString().StartsWith("1")) { + return true; + } + } catch { + } + return false; + } + + public List GetManufacturer() { + try { + SortedSet ret = []; + JsonData json = JsonMapper.ToObject(this.http.RequestString("https://" + this.server + "/api/company/?is_manufacturer=true")); + if(json.IsArray && json.Count > 0) { + foreach(JsonData man in json) { + ret.Add(new InventreeManufacturer(man)); + } + } + return [.. ret]; + } catch { + } + return []; + } + } +} diff --git a/InventarManager/Apis/Netbox.cs b/InventarManager/Apis/Netbox.cs new file mode 100644 index 0000000..984e2f6 --- /dev/null +++ b/InventarManager/Apis/Netbox.cs @@ -0,0 +1,44 @@ +using BlubbFish.Applications.InventarManager.Helpers; +using BlubbFish.Applications.InventarManager.Models.Specific.Netbox; +using LitJson; + +namespace BlubbFish.Applications.InventarManager.Apis { + class Netbox { + private String server; + private String key; + private WebRequest http; + + public Netbox(String server, String key) { + this.server = server; + this.key = key; + this.http = new WebRequest(); + this.http.SetAuthToken(this.key); + } + + public Boolean Connect() { + try { + JsonData json = JsonMapper.ToObject(this.http.RequestString("https://" + this.server + "/api/status/")); + if(json.ContainsKey("netbox-version") && json["netbox-version"].IsString && json["netbox-version"].ToString().StartsWith("4")) { + return true; + } + } catch { + } + return false; + } + + public List GetManufacturer() { + try { + SortedSet ret = []; + JsonData json = JsonMapper.ToObject(this.http.RequestString("https://" + this.server + "/api/dcim/manufacturers/")); + if(json.ContainsKey("count") && json["count"].IsInt && Int32.TryParse(json["count"].ToString(), out Int32 count) && count > 0) { + foreach(JsonData man in json["results"]) { + ret.Add(new NetboxManufacturer(man)); + } + } + return [.. ret]; + } catch { + } + return []; + } + } +} diff --git a/InventarManager/Apis/SnipeIT.cs b/InventarManager/Apis/SnipeIT.cs new file mode 100644 index 0000000..ebac877 --- /dev/null +++ b/InventarManager/Apis/SnipeIT.cs @@ -0,0 +1,44 @@ +using BlubbFish.Applications.InventarManager.Helpers; +using BlubbFish.Applications.InventarManager.Models.Specific.SnipeIt; +using LitJson; + +namespace BlubbFish.Applications.InventarManager.Apis { + class SnipeIT { + private String server; + private String key; + private WebRequest http; + + public SnipeIT(String server, String key) { + this.server = server; + this.key = key; + this.http = new WebRequest(); + this.http.SetAuthToken(this.key, "Bearer"); + } + + public Boolean Connect() { + try { + JsonData json = JsonMapper.ToObject(this.http.RequestString("https://" + this.server + "/api/v1/version")); + if(json.ContainsKey("version") && json["version"].IsString && json["version"].ToString().StartsWith("v8")) { + return true; + } + } catch { + } + return false; + } + + public List GetManufacturer() { + try { + SortedSet ret = []; + JsonData json = JsonMapper.ToObject(this.http.RequestString("https://" + this.server + "/api/v1/manufacturers")); + if(json.ContainsKey("total") && json["total"].IsInt && Int32.TryParse(json["total"].ToString(), out Int32 count) && count > 0) { + foreach(JsonData man in json["rows"]) { + ret.Add(new SnipeItManufacturer(man)); + } + } + return [.. ret]; + } catch { + } + return []; + } + } +} \ No newline at end of file diff --git a/InventarManager/Form1.Designer.cs b/InventarManager/Form1.Designer.cs new file mode 100644 index 0000000..1d1b2bb --- /dev/null +++ b/InventarManager/Form1.Designer.cs @@ -0,0 +1,220 @@ +namespace BlubbFish.Applications.InventarManager { + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.button1 = new Button(); + this.statusStrip1 = new StatusStrip(); + this.tabControl1 = new TabControl(); + this.tabPage1 = new TabPage(); + this.tabPage2 = new TabPage(); + this.tabControl2 = new TabControl(); + this.tabPage3 = new TabPage(); + this.listBox3 = new ListBox(); + this.listBox2 = new ListBox(); + this.listBox1 = new ListBox(); + this.textBox1 = new TextBox(); + this.button2 = new Button(); + this.tabPage4 = new TabPage(); + this.label1 = new Label(); + this.tabControl1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabControl2.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new Point(1050, 812); + this.button1.Name = "button1"; + this.button1.Size = new Size(121, 29); + this.button1.TabIndex = 0; + this.button1.Text = "Einstellungen"; + this.button1.UseVisualStyleBackColor = true; + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new Size(20, 20); + this.statusStrip1.Location = new Point(0, 844); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new Size(1183, 22); + this.statusStrip1.TabIndex = 1; + this.statusStrip1.Text = "statusStrip1"; + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new Point(12, 12); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new Size(1159, 794); + this.tabControl1.TabIndex = 2; + // + // tabPage1 + // + this.tabPage1.Location = new Point(4, 29); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new Padding(3); + this.tabPage1.Size = new Size(1151, 761); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "tabPage1"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.tabControl2); + this.tabPage2.Location = new Point(4, 29); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new Padding(3); + this.tabPage2.Size = new Size(1151, 761); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Stammdaten"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabControl2 + // + this.tabControl2.Controls.Add(this.tabPage3); + this.tabControl2.Controls.Add(this.tabPage4); + this.tabControl2.Location = new Point(6, 6); + this.tabControl2.Name = "tabControl2"; + this.tabControl2.SelectedIndex = 0; + this.tabControl2.Size = new Size(1139, 749); + this.tabControl2.TabIndex = 0; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.label1); + this.tabPage3.Controls.Add(this.listBox3); + this.tabPage3.Controls.Add(this.listBox2); + this.tabPage3.Controls.Add(this.listBox1); + this.tabPage3.Controls.Add(this.textBox1); + this.tabPage3.Controls.Add(this.button2); + this.tabPage3.Location = new Point(4, 29); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new Padding(3); + this.tabPage3.Size = new Size(1131, 716); + this.tabPage3.TabIndex = 0; + this.tabPage3.Text = "Hersteller"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // listBox3 + // + this.listBox3.FormattingEnabled = true; + this.listBox3.Location = new Point(825, 91); + this.listBox3.Name = "listBox3"; + this.listBox3.Size = new Size(300, 604); + this.listBox3.TabIndex = 4; + // + // listBox2 + // + this.listBox2.FormattingEnabled = true; + this.listBox2.Location = new Point(403, 91); + this.listBox2.Name = "listBox2"; + this.listBox2.Size = new Size(300, 604); + this.listBox2.TabIndex = 3; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new Point(6, 91); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new Size(300, 604); + this.listBox1.TabIndex = 2; + // + // textBox1 + // + this.textBox1.Location = new Point(212, 8); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new Size(913, 27); + this.textBox1.TabIndex = 1; + // + // button2 + // + this.button2.Location = new Point(6, 6); + this.button2.Name = "button2"; + this.button2.Size = new Size(94, 29); + this.button2.TabIndex = 0; + this.button2.Text = "Laden"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += this.button2_Click; + // + // tabPage4 + // + this.tabPage4.Location = new Point(4, 29); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Padding = new Padding(3); + this.tabPage4.Size = new Size(1131, 716); + this.tabPage4.TabIndex = 1; + this.tabPage4.Text = "tabPage4"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new Point(147, 10); + this.label1.Name = "label1"; + this.label1.Size = new Size(59, 20); + this.label1.TabIndex = 5; + this.label1.Text = "Suchen:"; + // + // Form1 + // + this.AutoScaleDimensions = new SizeF(8F, 20F); + this.AutoScaleMode = AutoScaleMode.Font; + this.ClientSize = new Size(1183, 866); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.tabControl1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.tabControl2.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } + + #endregion + + private Button button1; + private StatusStrip statusStrip1; + private TabControl tabControl1; + private TabPage tabPage1; + private TabPage tabPage2; + private TabControl tabControl2; + private TabPage tabPage3; + private TabPage tabPage4; + private TextBox textBox1; + private Button button2; + private ListBox listBox3; + private ListBox listBox2; + private ListBox listBox1; + private Label label1; + } +} diff --git a/InventarManager/Form1.cs b/InventarManager/Form1.cs new file mode 100644 index 0000000..9f4039c --- /dev/null +++ b/InventarManager/Form1.cs @@ -0,0 +1,49 @@ + +using BlubbFish.Applications.InventarManager.Apis; +using BlubbFish.Applications.InventarManager.Models.Specific.Inventree; +using BlubbFish.Applications.InventarManager.Models.Specific.Netbox; +using BlubbFish.Applications.InventarManager.Models.Specific.SnipeIt; + +namespace BlubbFish.Applications.InventarManager { + public partial class Form1 : Form { + private Netbox netbox; + private SnipeIT snipeit; + private Inventree inventree; + + public Form1() { + this.InitializeComponent(); + this.ConnectServer(); + } + + private void ConnectServer() { + this.netbox = new Netbox(url, api_key); + this.netbox.Connect(); + + this.snipeit = new SnipeIT(url, api_key); + this.snipeit.Connect(); + + this.inventree = new Inventree(url, api_key); + this.inventree.Connect(); + } + + private void button2_Click(Object sender, EventArgs e) { + List n = this.netbox.GetManufacturer(); + this.listBox1.Items.Clear(); + foreach(NetboxManufacturer m in n) { + this.listBox1.Items.Add(m); + } + + List s = this.snipeit.GetManufacturer(); + this.listBox2.Items.Clear(); + foreach(SnipeItManufacturer m in s) { + this.listBox2.Items.Add(m); + } + + List i = this.inventree.GetManufacturer(); + this.listBox3.Items.Clear(); + foreach(InventreeManufacturer m in i) { + this.listBox3.Items.Add(m); + } + } + } +} diff --git a/InventarManager/Form1.resx b/InventarManager/Form1.resx new file mode 100644 index 0000000..0ea29a6 --- /dev/null +++ b/InventarManager/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/InventarManager/Helper/WebRequest.cs b/InventarManager/Helper/WebRequest.cs new file mode 100644 index 0000000..a5a92b1 --- /dev/null +++ b/InventarManager/Helper/WebRequest.cs @@ -0,0 +1,51 @@ +using System.Net; + +namespace BlubbFish.Applications.InventarManager.Helpers { + internal class WebRequest { + private readonly HttpClient client = new(); + + public void SetAuthToken(String token, String type = "Token") => this.SetHeader("Authorization", type + " " + token); + + private void SetHeader(String type, String value) { + if(this.client.DefaultRequestHeaders.Contains(type)) { + _ = this.client.DefaultRequestHeaders.Remove(type); + } + this.client.DefaultRequestHeaders.Add(type, value); + } + + public String RequestString(String address, String json = "", Boolean withoutput = true, RequestMethod method = RequestMethod.GET) { + String ret = null; + try { + HttpResponseMessage response = null; + if(method == RequestMethod.POST || method == RequestMethod.PUT) { + HttpContent content = new StringContent(json); + content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); + //content.Headers.Add("Content-Type", "application/json"); + if(method == RequestMethod.POST) { + response = this.client.PostAsync(address, content).Result; + } else if(method == RequestMethod.PUT) { + response = this.client.PutAsync(address, content).Result; + } + content.Dispose(); + } else if(method == RequestMethod.GET) { + response = this.client.GetAsync(address).Result; + } + if(!response.IsSuccessStatusCode) { + throw new Exception(response.StatusCode + ": " + response.ReasonPhrase); + } + if(withoutput && response != null) { + ret = response.Content.ReadAsStringAsync().Result; + } + } catch(Exception e) { + throw new WebException("Error while requesting Resource: \"" + address + "\" Method: " + method + " Data: " + json + " Fehler: " + e.Message); + } + return ret; + } + + public enum RequestMethod { + GET, + POST, + PUT + } + } +} diff --git a/InventarManager/InventarManager.csproj b/InventarManager/InventarManager.csproj new file mode 100644 index 0000000..e14feec --- /dev/null +++ b/InventarManager/InventarManager.csproj @@ -0,0 +1,57 @@ + + + + WinExe + net10.0-windows + true + enable + + + + 1.3.1 + $(AssemblyVersion) + $(AssemblyVersion) + BlubbFish + BlubbFish.Applications.InventarManager + Create Inventree PO Barcodes + BlubbFish + InventarManager.Applications.BlubbFish + Copyright © BlubbFish 2026 - 14.02.2026 + de-DE + LICENSE + https://git.blubbfish.net/vs_projects/InventreeBarcodeGenerator + https://git.blubbfish.net/vs_projects/InventreeBarcodeGenerator.git + git + + 1.3.1 - 2026-02-32 - Add PackageListNumber + 1.3.0 - 2026-02-19 - Change DataMatrix to real Json + 1.2.0 - 2026-02-18 - Fix Quantity on Labels so that you can recieve only partial deliverys + 1.1.0 - 2026-02-14 - Rewrote to DataGridView + 1.0.0 - 2025-11-23 - Init + + README.md + + + + + + + + + + + True + \ + + + True + \ + + + + + + + + + \ No newline at end of file diff --git a/InventarManager/InventarManager.csproj.user b/InventarManager/InventarManager.csproj.user new file mode 100644 index 0000000..f61322e --- /dev/null +++ b/InventarManager/InventarManager.csproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + diff --git a/InventarManager/Models/Manufacturer.cs b/InventarManager/Models/Manufacturer.cs new file mode 100644 index 0000000..6021137 --- /dev/null +++ b/InventarManager/Models/Manufacturer.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace BlubbFish.Applications.InventarManager.Models { + abstract class Manufacturer : IComparable { + public String Name { + get; + protected set; + } + + public Int32 CompareTo(Object obj) { + if(obj is null) { + return 1; + } + if(obj is Manufacturer m) { + return m.Name.CompareTo(this.Name) * -1; + } + return 1; + } + } +} diff --git a/InventarManager/Models/Specific/Inventree/InventreeManufacturer.cs b/InventarManager/Models/Specific/Inventree/InventreeManufacturer.cs new file mode 100644 index 0000000..63d46e0 --- /dev/null +++ b/InventarManager/Models/Specific/Inventree/InventreeManufacturer.cs @@ -0,0 +1,28 @@ +using LitJson; + +namespace BlubbFish.Applications.InventarManager.Models.Specific.Inventree { + internal class InventreeManufacturer : Manufacturer { + public InventreeManufacturer(JsonData man) { + this.Name = man["name"].ToString(); + this.Id = Int32.Parse(man["pk"].ToString()); + this.Description = man["description"].ToString(); + this.Website = man["website"].ToString(); + this.Phone = man["phone"].ToString(); + } + + public Int32 Id { + get; + } + public String Description { + get; + } + public String Website { + get; + } + public String Phone { + get; + } + + public override String ToString() => this.Name; + } +} diff --git a/InventarManager/Models/Specific/Netbox/NetboxManufacturer.cs b/InventarManager/Models/Specific/Netbox/NetboxManufacturer.cs new file mode 100644 index 0000000..b5ffd94 --- /dev/null +++ b/InventarManager/Models/Specific/Netbox/NetboxManufacturer.cs @@ -0,0 +1,28 @@ +using LitJson; + +namespace BlubbFish.Applications.InventarManager.Models.Specific.Netbox { + class NetboxManufacturer : Manufacturer { + public NetboxManufacturer(JsonData man) { + this.Name = man["name"].ToString(); + this.Id = Int32.Parse(man["id"].ToString()); + this.Display = man["display"].ToString(); + this.Slug = man["slug"].ToString(); + this.Description = man["description"].ToString(); + } + + public Int32 Id { + get; + } + public String Display { + get; + } + public String Slug { + get; + } + public String Description { + get; + } + + public override String ToString() => this.Name; + } +} diff --git a/InventarManager/Models/Specific/SnipeIt/SnipeItManufacturer.cs b/InventarManager/Models/Specific/SnipeIt/SnipeItManufacturer.cs new file mode 100644 index 0000000..728fd9e --- /dev/null +++ b/InventarManager/Models/Specific/SnipeIt/SnipeItManufacturer.cs @@ -0,0 +1,32 @@ +using LitJson; + +namespace BlubbFish.Applications.InventarManager.Models.Specific.SnipeIt { + internal class SnipeItManufacturer : Manufacturer { + public SnipeItManufacturer(JsonData man) { + this.Name = man["name"].ToString(); + this.Id = Int32.Parse(man["id"].ToString()); + this.Url = man["url"].ToString(); + this.SupportUrl = man["support_url"].ToString(); + this.SupportPhone = man["support_phone"].ToString(); + this.SupportEmail = man["support_email"].ToString(); + } + + public Int32 Id { + get; + } + public String Url { + get; + } + public String SupportUrl { + get; + } + public String SupportPhone { + get; + } + public String SupportEmail { + get; + } + + public override String ToString() => this.Name; + } +} diff --git a/InventarManager/Program.cs b/InventarManager/Program.cs new file mode 100644 index 0000000..d516830 --- /dev/null +++ b/InventarManager/Program.cs @@ -0,0 +1,16 @@ +namespace BlubbFish.Applications.InventarManager { + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/InventarManager/example-config/settings.conf.example b/InventarManager/example-config/settings.conf.example new file mode 100644 index 0000000..fe22394 --- /dev/null +++ b/InventarManager/example-config/settings.conf.example @@ -0,0 +1,11 @@ +[inventree] +url=[inventree-url] +api_key={inventree-api-key] + +[snipeit] +url=[snipeit-url] +api_key={snipeit-api-key] + +[netbox] +url=[netbox-url] +api_key={netbox-api-key] \ No newline at end of file