push init

main latest
Your Name 2025-04-01 08:44:17 +02:00
parent 06ba1864ae
commit 6366bdf7c2
5 changed files with 183 additions and 0 deletions

6
App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

40
Program.cs Normal file
View File

@ -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);
}
}
}
}

View File

@ -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")]

73
SharpCupsUDPSender.csproj Normal file
View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F862EA32-BA0F-4C8F-B88C-40D05882C19C}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SharpCupsUDPSender</RootNamespace>
<AssemblyName>SharpCupsUDPSender</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

31
SharpCupsUDPSender.sln Normal file
View File

@ -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