c# - How can I get the partition UUID of a disk in .NET -
i need able partition/filesystem uuid of partition, similar how can vol
in windos , ls -l /dev/disks/by-partuuid
in *nix, c# code. what's best way this?
for reference, need able uuid either current directory, or "closest" mount upwards.
edit: bad, should've said front: needs run on mono.
you can write code both platforms , decide @ runtime based on environment.osversion.platform
1 use. make sure write implementations in separate methods (or classes), way runtime won't attempt load pinvoked libraries wrong platform.
for windows can use getvolumeinformation or wmi described in other answer. linux can use directory mentioned in question possibly in conjunction pinvoking readlink or using mono.posix assembly.
Comments
Post a Comment