OpenHardwareMonitor not publishing to WMI - c#

According to the docs, OpenHardwareMonitor should publish 2 class (Hardware and Sensor) to the WMI but I cannot see any. I OpenHardwareMonitor has full read & write access to WMI so I'm not sure what's wrong. Am I even going about it the right way and should you be able to see those classes?
EDIT
Probably a cause of the same problem but when attempting to use the namespace OpenHardwareMonitor in my c# app
using OpenHardwareMonitor;
it does not recognise it

I forgot to add the .dll to my resources. Rookie error

Related

How do I Access Mediastore.images in Xamarin app

Attempting to write app that retrieves images from local storage (camera roll) on Android Mobile device. All research suggests using MediaStore.Images to accomplish this. Unable to get clean compile as keep getting error 'object cannot be found'
This is statement producing error : MediaStore.Images.Media.ExternalContentUri;
Also :
string path = cursor.GetString(cursor.GetColumnIndex(
MediaStore.Images.ImageColumns.Data));
Tried declaring separate Interface declaration to no avail
I believe these classes are defined in Android dll which I have reference to.
Very frustrating to a long time C# developer looking to write cross-platform Mobile apps.
looked for sample code on net that would illustrate solution showing exactly how to access/declare/use MediaShow.Images to no avail.
Surprised there does not appear to be a single example of a full solution illustrating its use

Using DeviceEnumeration - connecting IP based camera to windows

I am needing some help. Not very strong into coding but I need to understand why something isn't running for me.
I need to be able to connect an IP based camera to Windows. This is a new feature for windows when 1903 was released. If you look at the link below you will see what I'm referring to.
https://www.howtogeek.com/443847/windows-10-is-getting-built-in-support-for-network-cameras/
The issue is - the cameras I'm using require a password. This is not as simple as going in and adding the device manually. If you see the document below, the "Custom device" pairing is what I'm needing done.
https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/pair-devices
As you can see this has to be coded to accomplish what I need. So this source code was referred to in the link below as something that should be able to do it.
https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/DeviceEnumerationAndPairing/cs
Doing this in C#. Edit: I made sure to put all the shared files in the CS folder.
I'm using Visual studio and i pulled up the entire project but when I run it i'm getting an error that "The parent file, 'Scenario1_DevicePicker.xaml', for the file 'Scenario1_DevicePicker.xaml.cs' cannot be found in the project file.
I get that error for each .cs and .xaml.cs file there is. (Scenarios 1-9)
Can anyone help me out? Perhaps nudge me in the right direction?

AForge.Video.FFMPEG XamlParseException

I'm trying to set up a simple C# application where I want to record multiple USB webcams and save their feeds to some files. I'm using AForge.NET since this seems to be the most popular option for this sort of application. I can record video fine using the AForge.Video.VFW AVIWriter but due to a number of reasons I need to use the AForge.Video.FFMPEG VideoFileWriter. Whenever I try to use this class however, I get a System.Windows.Markup.XamlParseException with no additional information or inner exceptions apart from a little additional information which is quite useless.
I have a simple code example to trigger the exception:
using AForge.Video.FFMPEG;
namespace CameraPrototype {
public partial class MainWindow {
public MainWindow() {
InitializeComponent();
VideoFileWriter videoFileWriter = new VideoFileWriter();
}
}
}
I've also googled a bit around and tried some suggestion mentioned elsewhere:
Checking all the boxes in Exceptions Settings, enabling breaks on all types of exceptions. I had hoped this would give me some more info when the exception was thrown, unfortunately it doesn't change anything.
Copying the FFMPEG DLLs (swscale-2.dll, postproc-52.dll, etc) into the same folder as the application's built executable (../bin/Debug/). I 'm pretty sure the exception has something to do with ffmpeg, but this particular solution isn't working. Perhaps I'm doing something wrong here or I'm missing something for ffmpeg to work?
If anyone have any idea what I might be doing wrong or how I can get more information about the exception, I would really appreciate any help. Let me know if I need to post any other information. Thanks!
Edit:
Though it doesn't really answer the question, I'm also open to suggestions for alternatives to AForge.NET, as long as it lets me record and save video from multiple USB webcams.
You could give Accord.NET a try, it has ffmpeg bundled with the Accord.Video.FFMPEG, no extra setup needed. It provides the same features and functions as AForge.NET plus a little extra, but unless you need extended machine learning functionality, there isn't really a difference.

visual c# button opens file without specifying drive

I work for an IT company where we all carry around flash drives that have our most used programs on them.In my spare time I am hoping to create a "main menu" item that is kind of a fun and convenient way to access these files. I am working on creating this using Visual Studio 2013 and using visual C# windows forms. I have come across a snag however that I can't seem to find a workaround for. I am by no means fluent in C#, but I need to have a button on the windows form open a file without specifying what drive it comes from. I understand that I have to specify a path, but as these will be stored on the flash drives of myself and my coworkers I cannot foresee that the path will always begin with E:. Depending on what USB slot the drive is plugged into it could be N: or F: or the like. I have provided an example below:
Using what I currently know I am opening files using this line of code:
System.Diagnostics.Process.Start("C:/Users/Myname/Desktop/Asmodeus/Anti-Virus/Anti-Virus Installers/avast_free_antivirus_setup.exe");
Is there any way possible I can have the file open simply from
System.Diagnostics.Process.Start("Asmodeus/Anti-Virus/Anti-Virus Installers/avast_free_antivirus_setup.exe");
or something of that nature?
Thanks in advance.
There must have been some mis-communication when I asked my question previously. what I am looking to do is open an executable file via a button click on the windows form using a relative path. I am not able to specify the absolute path because the application will be run from a flash drive and therefore will change depending on what USB slot it is currently inserted into.
What I am hoping to accomplish is insert a line of code that will allow me to open an executable file that is located in the \bin\debug folder along with the application itself. I have a picture for clarification but apparently do not have enough reputation to post it. Thank you and sorry for the earlier confusion.
Usually you can just use Environment.GetFolderPath (MSDN) to give you what you need. It doesn't do absolutely everything, but if you need Desktop and the like, that is plenty.
Depending on the target version of .Net, the SpecialFolders exposed are not all there. It may turn out that you need more than they provide, but in your case it doesn't sound like it.
If there is more you need that is not covered in the default, check out this project. I'm sure there are others like it, but it does a little more than the default BCL version, using the API directly. It is at least something to read and learn (and translate from vb.. use an online translator, very quick). I haven't looked at it, but it seems like you are learning this c#/.net thingy, so it might be helpful
This article is about accessing Windows special folders.
These folders include your “Favorites”, “Cookies”, system libraries and the like.
Here is code, including a large number of constant definitions, plus documentation,
allowing access to and creation of these folders.

Is there a standard way to access the windows services file in .Net?

Is there a standard way in .Net to access and modify the windows services file? Right now I'm just accessing the file via a stream and writing to the file like I would for any other file. The file is located in c:\windows\system32\drivers\etc\, but I'm worried that this may change in 64 bit versions of Windows or may vary in different versions of Windows (I could be wrong and admittedly, I haven't looked into this very much yet). Aside from that, I'm just wondering if there is a standard way, say via WMI and/or the System.Management namespace, to find and modify the services file.
The actual specifics of what I need to do is to check if certain database aliases used for our software are specified for the expected ports. If not, add them.
An open source project called System.Peppers has a class doing this.
There is a registry key that contains the full path to the files you are editing.
Here is a link to the exact class: HostFile class
Use the System.Management.Instrumentation namespace
Sample code here
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=114
you can use System.Environment.SystemDirectory to get to the sys32 folder

Categories