diff --git a/App.config b/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..5c60bcd --- /dev/null +++ b/Program.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace SharpCupsUDPSender +{ + class Program + { + static void Main(string[] args) + { + string ip = "192.168.74.113"; + int port = 631; + string scheme = "https"; + string ippServerHost = "soyouzi.fr"; + int ippServerPort = 443; + + Console.WriteLine($"Sending UDP packet to {ip}:{port}..."); + + int printerType = 2; + string printerState = "3"; + string printerUri = $"{scheme}://{ippServerHost}:{ippServerPort}/printers/EPSON"; + string printerLocation = "\"Idle\""; + string printerInfo = "\"Configuration Error\""; + string printerModel = "\"ESPON Inkjet 9055\""; + + printerInfo = $"\"{DateTimeOffset.Now.ToUnixTimeSeconds().ToString()}\""; + + string packet = $"{printerType:X} {printerState} {printerUri} {printerLocation} {printerInfo} {printerModel} \n"; + + using (UdpClient udpClient = new UdpClient()) + { + byte[] data = Encoding.UTF8.GetBytes(packet); + udpClient.Send(data, data.Length, ip, port); + } + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..aa727d1 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("SharpCupsUDPSender")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Vagrant")] +[assembly: AssemblyProduct("SharpCupsUDPSender")] +[assembly: AssemblyCopyright("Copyright © Vagrant 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("f862ea32-ba0f-4c8f-b88c-40d05882c19c")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SharpCupsUDPSender.csproj b/SharpCupsUDPSender.csproj new file mode 100644 index 0000000..e5b6952 --- /dev/null +++ b/SharpCupsUDPSender.csproj @@ -0,0 +1,73 @@ + + + + + Debug + AnyCPU + {F862EA32-BA0F-4C8F-B88C-40D05882C19C} + Exe + SharpCupsUDPSender + SharpCupsUDPSender + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + 7.3 + prompt + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + 7.3 + prompt + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SharpCupsUDPSender.sln b/SharpCupsUDPSender.sln new file mode 100644 index 0000000..3681007 --- /dev/null +++ b/SharpCupsUDPSender.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35806.99 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCupsUDPSender", "SharpCupsUDPSender.csproj", "{F862EA32-BA0F-4C8F-B88C-40D05882C19C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Debug|x64.ActiveCfg = Debug|x64 + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Debug|x64.Build.0 = Debug|x64 + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Release|Any CPU.Build.0 = Release|Any CPU + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Release|x64.ActiveCfg = Release|x64 + {F862EA32-BA0F-4C8F-B88C-40D05882C19C}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CC79A750-5A14-49FF-A1A0-1A093B402D1C} + EndGlobalSection +EndGlobal