|
What you explained, I understand. I'm wondering, however if there's code I can write that will embed the dlls during compile time.
|
|
|
|
|
No, there's no code you write, but you can use ILMerge to combine your .DLL's with your .EXE file. You can get ILMerge from a Nuget package called "ILMerge.Tools". You can then write up a command line in your Post Build Event to run the tool with an appropriate command line to combine your files.
Be warned though. This will result in an executable file the size of your original compiled .EXE plus all of the .DLL's you end up baking into it combined.
But none of this is going to solve that FIPS problem.
|
|
|
|
|
I am unable to get this command to work via a powershell runspace in c#. it works fine in powershell.
Remove-DistributionGroupMember -Identity <groupname> -Member <upn> -Confirm:$false
My guess is that I am not loading the correct command set but I am unable to determine how to do that in this case. This code works for adding users to groups, deleting users, etc, I just change the powershell code to send but for Remove-DistributionGroupMember I get the general command not found error.
any ideas?
public void RemoveUserFromGroup()
{
InitialSessionState iss = InitialSessionState.CreateDefault();
iss.ImportPSModule(new[] { "MSOnline" });
using (Runspace myRunSpace = RunspaceFactory.CreateRunspace(iss))
{
myRunSpace.Open();
using (System.Management.Automation.PowerShell powershell = System.Management.Automation.PowerShell.Create())
{
powershell.Runspace = myRunSpace;
Command connect = new Command("Connect-MsolService");
System.Security.SecureString secureString = new System.Security.SecureString();
string myPassword = loginPassword;
foreach (char c in myPassword)
secureString.AppendChar(c);
connect.Parameters.Add("Credential", new PSCredential(IdSenderEmail, secureString));
powershell.Commands.AddCommand(connect);
Collection<PSObject> results = null;
Collection<ErrorRecord> errors = null;
results = powershell.Invoke();
errors = powershell.Streams.Error.ReadAll();
var PSCommand = "Remove-DistributionGroupMember -Identity '"+IdGroupName+"' -Member '"+IdUPN+"' -Confirm:$false";
powershell.Commands.Clear();
Command getuser = new Command(PSCommand);
powershell.Commands.AddCommand(getuser);
results = null;
errors = null;
try
{
results = powershell.Invoke();
if (results != null && results.Count > 0)
{
foreach (PSObject item in results)
{
IdExceptionError = item.ToString();
}
}
}
catch (Exception ex)
{
IdExceptionError = ex.ToString();
}
finally
{
myRunSpace.Close();
myRunSpace.Dispose();
}
}
}
}
|
|
|
|
|
|
Thanks Richard. Unfortunately that did not resolve this issue changing MSOnline to Exchange. I appreciate the links to the documentation though.
|
|
|
|
|
I went back and re-wrote my script after playing around with this
Programmatic Access via Remote PowerShell in Exchange Server 2010 – You Had Me At EHLO…[^]
Here is the working version in case anyone has a need for it.
public void RemoveUserFromGroup()
{
string connectionUri = "https://outlook.office365.com/powershell-liveid/";
System.Security.SecureString secureString = new System.Security.SecureString();
string myPassword = loginPassword;
foreach (char c in myPassword)
secureString.AppendChar(c);
PSCredential credential = new PSCredential(IdSenderEmail, secureString);
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri(connectionUri), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
PowerShell powershell = PowerShell.Create();
PSCommand command = new PSCommand();
command.AddCommand("Remove-DistributionGroupMember");
command.AddParameter("Identity", IdGroupName);
command.AddParameter("Member", IdUPN);
command.AddParameter("Confirm", false);
powershell.Commands = command;
try
{
runspace.Open();
powershell.Runspace = runspace;
Collection<System.Management.Automation.PSObject> result = powershell.Invoke();
if (powershell.Streams.Error.Count > 0 )
{
IdExceptionError = "Unable to removed User from the Group. You may not have permission.";
}
else
{
IdExceptionError = "Removed User from the Group. It can take several minutes for the change to appear here.";
}
}
catch (Exception ex)
{
IdExceptionError = ex.ToString();
}
finally
{
runspace.Dispose();
runspace = null;
powershell.Dispose();
powershell = null;
}
}
|
|
|
|
|
There are likely many examples for that task available on the web, but I do not know the technical terms.
I have a list of point (in this case, System.Drawing.Point), and I am looking for a closed line around them. All points of the list must be inside, some other points may be inside additionally, but their number should be as low as possible. And, actually, I do not need the line proper: knowing its length is enough.
Finding a rectangle enclosing all the points of the list is very easy - but there are too many other points enclosed. Another issue is that there might be "holes", not all points have a direct neighbor (in "8 neighborhood").
Could you give me some pointers where to look for? Thanks a lot.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
Hi,
you want a “convex hull” algorithm; there are some excellent articles on the subject right here at CP, mostly by Eric Ouellet.
|
|
|
|
|
You type faster than me
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Convex hull - Wikipedia[^] is probably a good starting point. Good hunting!
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
This is the case
I download several Fields to a datatable including an image, that copy to "AccesoryImage"
<br />
Image AccessoryImage = Image.FromStream(newMemoryStream((byte[])SKUInformationDataTable.Rows[AccessoriesRow]["IM_Image"]));
<small> This works great, the problem is that the catalog from de DB had some items whitout a image, and I need to call a default image (from project resources catalog).
How can I make the comparation if the AccessoryImage is NULL or empty I was thinking something like this but dosent work
Image AccessoryImage = Image.FromStream(new MemoryStream((byte[])SKUInformationDataTable.Rows[AccessoriesRow]["IM_Image"]));
var ImagenDefault = new Bitmap(MESWMP.Properties.Resources.ImagenDefaultMan);
if (AccessoryImage == NULL){ AccessoryImage = BitmapToByte(MESWMP.Properties.Resources.ImagenDefaultMan);}
AccessoryRadPanel.BackgroundImage = AccessoryImage;
|
|
|
|
|
Something like this should work:
DataRow row = SKUInformationDataTable.Rows[AccessoriesRow];
Image AccessoryImage = row.IsNull("IM_Image")
? (Image)new Bitmap(MESWMP.Properties.Resources.ImagenDefaultMan)
: Image.FromStream((byte[])row["IM_Image"]);
DataRow.IsNull Method (System.Data) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
tks a lot, works like a charm!!
|
|
|
|
|
I have your home typical network. We have Spectrum for our ISP. From time to time the router's IP changes. THis is expected of course as I don't want to pay for a static IP address.
What would be involved in writing a small app that detects when the IP address changes? I could of course write some kind of looping process that keeps comparing it somehow, but I was wondering if there is some way of using an event handler.
Any thoughts on this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You probably can't detect the change unless you poll for the IP address. Your "home network" is probably on the wrong side of the cable modem to get any kind of hint of what's going on.
The traffic to change the modem IP isn't routed to the inside of the network and you can't really get the IP address without going to an external site and having it tell you the IP address the request was sent from, which will NOT be your machine IP, but your cable modems IP.
|
|
|
|
|
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You can only tell by asking the outside world what the IP is - the internet IP is not transferred into the LAN with "normal" messages.
Have a look here: Using IP based Geolocation - and why it's pretty much useless.[^] It includes an app I knocked up to find out my IP so I could tell when it changed. You'd need to modify it to run in a thread in your app, but that's not too complicated.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I am new to API and MVC. I have a MVC application which calls a third party Api. The Api returns the data in Json format.
I want to get the Json data and map it to a class object.
modified 28-Aug-18 10:02am.
|
|
|
|
|
|
Hi there,
I'm trying to make a program which sends a command and getting certain values from the result from an invisble command line program which has the current values.
Here's a HelloWorld-esque example:
How can I get this working? (e.g putting only that number 5 next to the amount)
~wesley9946
|
|
|
|
|
Wesley there is a problem with your question - this is your first post and you want us to click on a link that is not recognised. And you are looking for "invisible" code, immediately raises the level of paranoia in most of us.
Post your code rather than a link.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
With "invisible", I mean that there's a hidden cmd running in the background, somehow I couldn't get the image in the post so that's why I made a link to it.
So.... the problem here is that i don't know the piece of code that makes the winform read and filter the info from that hidden cmd so maybe you can help me with that.
|
|
|
|
|
You have to realise that we can't see your screen, can't access your HDD, and can't read your mind - we only get exactly what you type to work with. While there are ways to run a command from a C# program without a window attached and to retrieve the output from it, we don't know what - exactly - you are doing at the moment, or how you do it.
So show us the code that kicks off the command - copy'n'paste of the relevant fragments are good - and explain what you mean by "hidden cmd" - because there are a a number of things that could be as well - a windowless CMD prompt, a windows service (which has no UI, and can never have one), ... We don't know and we can't see!
And we can't tell you what code you need to use unless we understand what your problem is in the first place, so help us to help you!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|