1 minute read

I have recently been involved in some work that requires me to program on a Remote Desktop (via RDP over an SSL connection) so there is no development software installed locally. One of the downsides is that due to the restricted nature of the connection only text based copy and paste works, so it is not possible to transfer files onto the development environment. Not only this, but although the local machine has access to the internet, the development environment has none.

The solution? I wrote a console based application called MemCopy to copy files to and from the clipboard as text. It does this by either encoding the file as Base64 then saving it as text on the clipboard, or decoding it from the clipboard.

I’d only written this in one of the environments, so I had to decode it in the other before I could use it - a bit chicken and egg, if you ask me. Anyway, I have attached a link to the encoded text here (you didn’t think I was going to give you the solution on a plate did you?)

The code below is all that was required to decode it. I placed the encoding into the resources as a file.

byte[] buffer = Convert.FromBase64String(Resources.Encoding);
FileStream stream = new FileStream(
    "memcopy.zip", 
    FileMode.Create,
    FileAccess.ReadWrite);
BinaryWriter writer = new BinaryWriter(stream);
writer.Write(buffer);
writer.Close();

The result? Awesomeness.

Tags: ,

Updated: