.net

How to download FTP files with automatic resume in case of disconnect

浪尽此生 提交于 2021-02-15 02:19:58
问题 I can download FTP files, but the download code does not have a resume facility and multi part files download. Because there are file larger than 500 MB, I can't download them continuously, because the connection gets closed and it starts download from beginning. I wanted my code a resume facility if it gets disconnected. The code I am using is: public string[] GetFileList() { string[] downloadFiles; StringBuilder result = new StringBuilder(); FtpWebRequest reqFTP; try { reqFTP =

How to download FTP files with automatic resume in case of disconnect

北城以北 提交于 2021-02-15 02:16:19
问题 I can download FTP files, but the download code does not have a resume facility and multi part files download. Because there are file larger than 500 MB, I can't download them continuously, because the connection gets closed and it starts download from beginning. I wanted my code a resume facility if it gets disconnected. The code I am using is: public string[] GetFileList() { string[] downloadFiles; StringBuilder result = new StringBuilder(); FtpWebRequest reqFTP; try { reqFTP =

.NET Async in shutdown methods?

故事扮演 提交于 2021-02-13 17:35:50
问题 I have an application that connects to a REST API using async methods. I have this set up using async/await pretty much everywhere that connects to the API, however I have a question and some strange behavior that I don't completely understand. What I want to do is simply return a license in certain scenarios when the program shuts down. This is initiated by a window closing event; the event handler is as follows: async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs

How can I add a Bing Maps Component to my C# Winforms app?

两盒软妹~` 提交于 2021-02-13 17:26:23
问题 I have downloaded, installed, and referenced the Bing Maps control in my Winforms app: ...and I added the following using to Form1.cs: using Microsoft.Maps.MapControl; ...but I still have no Bing Maps control in my Toolbox. I realize this is a WPF control, and I'm using Winforms, but my understanding is that the WPF control can be used in a Winforms app. My question is: How can I make the Bing Maps control visible in the Toolbox OR create the Bing Maps control in code? It probably doesn't

How can I add a Bing Maps Component to my C# Winforms app?

早过忘川 提交于 2021-02-13 17:24:11
问题 I have downloaded, installed, and referenced the Bing Maps control in my Winforms app: ...and I added the following using to Form1.cs: using Microsoft.Maps.MapControl; ...but I still have no Bing Maps control in my Toolbox. I realize this is a WPF control, and I'm using Winforms, but my understanding is that the WPF control can be used in a Winforms app. My question is: How can I make the Bing Maps control visible in the Toolbox OR create the Bing Maps control in code? It probably doesn't

How to make my bot send an e-mail to a given email address?

ⅰ亾dé卋堺 提交于 2021-02-11 18:21:17
问题 I am building a bot using Microsoft Bot Framework (.NET) and I want a Contact dialog where the user writes the subject, the body of the email and the user he wants to send the email to. For example, imagine the bot user is asking questions, if the bot can not propperly answer the question, I would like to throw a contact dialog where the user can contact the administration to ask his/her question via e-mail. As far as I know, I can integrate the email channel with a Office 365 email so my bot

How to Invoke MessageBox on background thread in VB.NET?

拜拜、爱过 提交于 2021-02-11 18:15:40
问题 How do I call Invoke to run MessageBox.Show on my background thread please? When I display a MessageBox on my single background thread, it usually displays behind the main form, so to make the program usable I need to display it in front of the main form. My current code is MessageBox.Show(myMessageText, myTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) without owner. This code is not called from the form itself. but from a helper class I have built outside it. I want to add an owner

Passing byte array to PInvoke call changes it to null

夙愿已清 提交于 2021-02-11 17:46:15
问题 After migration from Visual Studio 2012 to 2013 some PInvoke calls not working as previously. For example, I'm struggling with this code: Signature: [DllImport(LzoDll64Bit)] private static extern int lzo1x_decompress(byte[] src, int src_len, byte[] dst, ref int dst_len, byte[] wrkmem); Usage: byte[] dst = new byte[origlen]; int outlen = origlen; if (Is64Bit()) lzo1x_decompress(src, src.Length - 4, dst, ref outlen, _workMemory); else lzo1x_decompress32(src, src.Length - 4, dst, ref outlen,

Encrypting image data before uploading to azure blob storage

放肆的年华 提交于 2021-02-11 17:45:30
问题 I have the following code that uploads an image to Azure blob storage. I would like to encrypt the image data before uploading to the blob. I already have a helper class for encrypting and decrypting that I can use by calling AESEncryption.Encrypt("plainText", "key", salt"); I'm just trying to figure out how tom integrate my encryption method into the code. Also, I'm guessing that once it's encrypted instead of calling blob.UploadFromFile() I will be calling blob.UploadFromByteArray(). public

Convert Latin characters from Shift JIS to Latin characters in Unicode

浪子不回头ぞ 提交于 2021-02-11 17:29:43
问题 I'm working on parsing files with Shift-JIS encoded strings within the binary data. My current code is this: public static string DecodeShiftJISString(this byte[] data, int index, int length) { byte[] utf8Bytes = Encoding.Convert(Encoding.GetEncoding(932), Encoding.UTF8, data); return Encoding.UTF8.GetString(utf8Bytes); } It works fine and I am able to get usable strings from this method, although when I display strings with Latin characters into my WinForms application, I see that the