3

Its as weird as I have made it out to be. o.0.

I have checked and double checked and dont even see why it doesnt work... Image of whats happening

Heres the code in use:

try {
    if (!(Directory.Exists(@"C:\SimpleSkype\Identitys")))
        Directory.CreateDirectory(@"C:\SimpleSkype\Identitys");
    //Regex rgx = new Regex("[^a-zA-Z0-9  -]");
    //String dd = rgx.Replace(u.Handle, "");
    string file = Path.Combine(@"C:\", "SimpleSkype", "Identitys", "victim.jpg");
    SaveSkypeAvatarToDisk(u.Handle, file);
    using (Image image = Image.FromFile(@"C:\SimpleSkype\Identitys\victim.jpg")) {
        input += ImageToBase64(image, System.Drawing.Imaging.ImageFormat.Jpeg) + "|";
    }
} catch (Exception eee) {
    MessageBox.Show(eee.ToString());
}
Prashant Kumar
  • 20,069
  • 14
  • 47
  • 63
Sam Clark-Ash
  • 175
  • 1
  • 8
  • Haha its bad wording, its just me copying someones skype profile and savng their picture and 'becoming them' in a way, like the old MSN bots > – Sam Clark-Ash Jul 29 '13 at 11:13
  • 4
    What happens if you (for test purposes only) put `Thread.Sleep(2000);` inbetween `SaveSkypeAvatarToDisk()` and the call to `Image.FromFile()`? – Matthew Watson Jul 29 '13 at 11:15
  • 1
    What happens when you launch the program as administrator? – Andy Jul 29 '13 at 11:15
  • What does SaveSkypeAvatarToDisk do? What if you use the path that you created rather than the string? using (Image image = Image.FromFile(file)) – Dutts Jul 29 '13 at 11:16
  • You can try using lowercase, both in directory and in your code. And by the way - which line triggers the exception? – Kamil T Jul 29 '13 at 11:18
  • Do you see the file when you use `Directory.GetFiles(@"c:\SimpleSkype\Identitys", "*.jpg");` ? – 0699 Jul 29 '13 at 12:46
  • None of these things work D: – Sam Clark-Ash Jul 30 '13 at 21:26
  • Put something like this above AND below the SaveSkypeAvatarToDisk line: if (File.Exists(file)) MessageBox.Show("Exists"); Does the mbox pop up both times? – SimonGoldstone Jul 31 '13 at 09:07
  • if you open the file at SaveSkypeAvatarToDisk, do you close it before leaving? – kpull1 Jul 31 '13 at 10:19

1 Answers1

0

Try using Application.DoEvents() (http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx), that should delay the next line execution until the file is created.