|
So basically, you want us to write your code for you? If we provide assistance, shouldn't you be able to do that by yourself?
There are many ways, and they all depend on what you are trying to achieve. You could use FTP. You can use shared paths to copy to (a really bad idea). You can use something like TCP with a client/server infrastructure. Without knowing more about what you are trying to copy and what the constraints are, it's hard to be any more specific than that.
This space for rent
|
|
|
|
|
Thanks Pete for the quick Response
With some assistance I will be able to do it myself.
With this below Line of code(in vb.net) I am able to copy files from one server to another.The issue is that this copy all Files that are in the source directory folder to destination folder while i just want specific files with extension .txt
below is the code am using
My.Computer.FileSystem.CopyDirectory("\\192.16.0.15\c$\Txxx\", "\\192.16.109.176\D$\d", True)
Is there a way I can be able to just copy only text files and after copying I move the files copied to a backup folder and then delete them
In Vb.net or C# is okay for me
Thanks in advance
|
|
|
|
|
You'd effectively need two operations. The first one is to use Directory.GetFiles[^] to get all the files in a particular directory (or directory structure) that have the .txt extension. Then you would need to iterate over each filename and use File.Copy[^] to copy the files over.
This space for rent
|
|
|
|
|
Hello Pete,
Thank you so much for your Assistance
I am working on your proposed solution and will let you know
|
|
|
|
|
Thanks Pete,
It worked perfectly.Also I realized the folder I was trying to copy from wasn't shared.
Thanks again
|
|
|
|
|
Nicely done.
This space for rent
|
|
|
|
|
I am trying to communicate with a TurnStile but cant understand how that build their commands.
This is example of command:
[^]
The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards?
CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result.
Anyone can help me with that CRC15 calculation?
Regards // Maw
|
|
|
|
|
MaWeRic wrote: Is that really correct? Shouldn't it be A0 05? Well 05 A0 is what they say, so I'm inclined to believe it. Though sending little endian over the network is a bit unusual, it is not all that weird.
As for the CRC16, it seems to use one of the CRC-CCITT polynomials, 0x1021. (I just tried a bunch..)
You should be able to plug that in already available crc code.
|
|
|
|
|
HeyyThanks!
If I try this calculator :
[^]
I try calculate : 05A0
Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that?
Edit: I guess I should send it as 1F4A as documentation says?
I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn
I goggled Little and big endians and I guess little endians means sending reversed order?
//Henrik
|
|
|
|
|
Yes that's probably little endian again.
|
|
|
|
|
Hello,
I am using 'FileSystemWatcher.enableraiseevents' to get the events when a directory, or file in a directory changes.
Initially I have enabled the component and was working properly.
After some time it stopped detecting events, when I check the 'EnableRaisingEvents' it was set to 'False'. In my code I am not setting it to false anywhere.
Is there any possibilities that 'EnableRaisingEvents' sets to 'False' automatically ?
Or what is the cause for my error ?
Please help me.
|
|
|
|
|
Hello, are there any guidelines to migrating a .Net 2.5 application to seamless windows 10 usage?
Or is 2.5 before .net has started its decline into platform nuances and quirks?
|
|
|
|
|
The application should run without problems on Windows 10.
|
|
|
|
|
1) There is no such thing as .NET 2.5 - see .NET Framework version history[^].
2) I suggest you change your username, as it currently makes you look like a spammer.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
0
down vote
favorite
I'm struggling with navigation in asp.net mvc and URLs.
When you are visiting your profile at facebook, the url is facebook.com/yourusername.
At your profile there is a menu with the following links: Timeline, About, Friends etc.
When you click on one of these links, for example Photos, the URL is changed to facebook.com/yourusername/Photos, and the photos are rendered. The menu described above are still there, and so also the profile picture and the cover picture. Its like a partial view has rendered viewing the photos.
I want to accomplish this effect in my project, but I don't know how to do it. I have tried to do it with Partial view but the problem is that the URL is not changed when the partial view is rendered.
Anyone can help me with this? How should I structure it?
|
|
|
|
|
Please use the correct forum for your question. This is not a C# issue.
|
|
|
|
|
Hi,
I have the following code:
<div class="col-lg-12 pull-left">
<div class="user_menu">
<ul>
<li>@Ajax.ActionLink("Wall", "Wall", "Home", new AjaxOptions { UpdateTargetId = "main" })</li>
</ul>
</div>
</div>
<div id="main" class="col-lg-7 pull-left" style="margin-top: 15px;">
</div>
The partial view Is rendered as expected inside my main div. But I want the URL to change when you render the partial. How can I do this?
So when I click on the link, I want to render the partial inside my div AND change the div to http://localhost123/Home/Wall
|
|
|
|
|
|
I've tried code similar to what is below, I keep getting an error that says a parameter is missing and when I trace the error it appears the parameter name is "message" and it is blank.
How can I download an image in powershell, keep it in memory (not save it to a file) and then display it in a picturebox in c#?
I see this error mentioned 100's of times on the net and no one has an answer?
[code]
byte[] pictureByteArray = new byte[0];
object pictureObject = new object();
Collection<PSObject> results = powershellExchange.Invoke();
foreach (PSObject result in results)
{
pictureObject = (result.Properties["PictureData"].Value);
pictureByteArray = Encoding.ASCII.GetBytes(result.Properties["PictureData"].ToString());
}
byte[] originalCoverData;
BinaryFormatter bf = new BinaryFormatter();
using (var ms = new MemoryStream())
{
bf.Serialize(ms, pictureObject);
originalCoverData = ms.ToArray();
}
Image x = null;
x = byteArrayToImage(originalCoverData);
System.IO.MemoryStream stream = new System.IO.MemoryStream(originalCoverData);
pbxDisplayPicture.Image = x;
System.Drawing.Image img2 = System.Drawing.Image.FromStream(stream);
pbxDisplayPicture.Image = img2;
[/code]
[code]
public Image byteArrayToImage(byte[] byteArrayIn)
{
using (MemoryStream mStream = new MemoryStream(byteArrayIn))
{
return Image.FromStream(mStream);
}
}
[/code]
|
|
|
|
|
Where does the error occur?
|
|
|
|
|
Sorry for the delay, it always tells me
"Parameter is not valid" for mStream
public Image byteArrayToImage(byte[] byteArrayIn)
{
using (MemoryStream mStream = new MemoryStream(byteArrayIn))
{
return Image.FromStream(mStream);
}
}
The particular byte array in question is 8716 items, so it seems like the byte array is valid
|
|
|
|
|
turbosupramk3 wrote: it seems like the byte array is valid Are you sure it contains a valid image? The error message suggests that it does not.
|
|
|
|
|
 No I am not, do you have a suggestion on another way I can check?
The code under the Exception snapshot, always has the same error message with the Parameter is not valid at
Quote: at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
at Updator.PictureUpdater.btnViewPicture_Click(Object sender, EventArgs e) in c:\Users\xxxx\Documents\Visual Studio 2012\Projects\Updator\Updator\Form1.cs:line 245
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Updator.Program.Main() in c:\Users\xxx\Documents\Visual Studio 2012\Projects\Exchange Picture Updator\Updator\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
modified 24-May-16 17:25pm.
|
|
|
|
|
I figured it out, I had to build my own byte array and not use memory stream. Memory stream was corrupting the file and making it an additional 28 bytes. I'm not sure why this wasn't on the internet, as it seems 100's of people encounter this?
Thanks for pointing me in the right direction.
byte[] imgBytes = null;
List<byte> imgBytesList = new List<byte>();
object imgObj = null;
Image img = null;
foreach (PSObject obj in exResults)
{
imgObj = obj.Properties["PictureData"].Value;
}
foreach (byte byt in (dynamic)imgObj)
{
imgBytesList.Add(byt);
}
imgBytes = imgBytesList.ToArray();
using (var ms = new MemoryStream(imgBytes))
{
img = Image.FromStream(ms);
}
pbxDisplayPicture.Image = img;
|
|
|
|
|
I have an application that uses a COM object to make a connection to an application. I need to make sure that when my application ends that I call the EndSession and CloseConnection methods of this COM object. I was reading this article: Implementing IDisposable and the Dispose Pattern Properly[^] as I think this is what I would need to do to make sure my closing code always gets called, but it doesn't seem to happen when I stop debugging. The application that I am connecting to still thinks my program is connected. It seems like when I stop debugging (or if I have a program crash, that the Dispose methods don't get called. I also tried to add a Finalizer but that causes a System.Runtime.InteropServices.InvalidComObjectException stating that the COM object that has been separated from it's underlying RCW cannot be used.
private bool disposed;
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (_Session != null)
{
_Session.EndSession();
_Session.CloseConnection();
_Session = null;
}
disposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~SessionConnection()
{
Dispose(false);
}
I'm not sure what is the best way to ensure that the EndSession and CloseConnection methods of my COM object get called even if my program crashes or I stop debugging.
|
|
|
|