Innovenergy_trunk/csharp/Lib/Protocols/DBus/Env.cs

23 lines
815 B
C#

// Copyright 2006 Alp Toker <alp@atoker.com>
// Copyright 2016 Tom Deseyn <tom.deseyn@gmail.com>
// This software is made available under the MIT License
// See COPYING for details
using InnovEnergy.Lib.Protocols.DBus.Protocol.Header;
namespace InnovEnergy.Lib.Protocols.DBus;
internal static class Env
{
private const String MachineUuidPath = @"/var/lib/dbus/machine-id";
public static Endian Endianness { get; } = BitConverter.IsLittleEndian ? Endian.Little : Endian.Big;
public static String MachineId { get; } = File.Exists(MachineUuidPath)
? Guid.Parse(File.ReadAllText(MachineUuidPath)[..32]).ToString()
: Guid.Empty.ToString();
public static UInt16 UserId { get; } = (UInt16) Interop.geteuid();
}