Exemplo n.º 1
0
        static void CalcAdler32(string filename)
        {
            //adler 32
            ICSharpCode.SharpZipLib.Checksums.Adler32 adler=new ICSharpCode.SharpZipLib.Checksums.Adler32();

            FileStream fs=new FileStream(filename, FileMode.Open, FileAccess.Read);
            BinaryReader br=new BinaryReader(fs);

            byte[] textToHash=br.ReadBytes((int)fs.Length);

            adler.Reset();
            adler.Update(textToHash);
            string adler32=String.Format("{0:x}", adler.Value);

            Console.WriteLine("Der Adler32 lautet: {0}", adler32);
        }
Exemplo n.º 2
0
        static void CreateClientUpdate(string folderLastFullClient, string folderUpdateTarget)
        {
            if(Globals.folder_root=="")
            {
                Console.WriteLine("Bitte geben sie in den Optionen den Pfad zum Invertika Repository an.");
                return;
            }

            string FolderDev=Globals.folder_root;
            string FolderLastClient=folderLastFullClient;
            string FolderTarget=folderUpdateTarget;

            if(FileSystem.ExistsDirectory(FolderTarget))
            {
                FileSystem.RemoveDirectory(FolderTarget, true);
            }

            FileSystem.CreateDirectory(FolderTarget, true);

            //Dev Verzeichniss
            List<string> filesDev=new List<string>();

            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_client, false, "*.xml"));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_data, false, "*.xml"));

            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_client_data_fonts));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_client_data_graphics));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_data_graphics));

            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_client_data_help));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_client_data_icons));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_data_maps));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_data_music));
            filesDev.AddRange(GetFilesWithoutGit(Globals.folder_data_sfx));

            //Last Client
            List<string> filesNew=new List<string>();

            foreach(string i in filesDev)
            {
                string devRelativ=FileSystem.GetRelativePath(i, FolderDev+FileSystem.PathDelimiter);
                devRelativ=devRelativ.Replace("client"+FileSystem.PathDelimiter+"data"+FileSystem.PathDelimiter, "");
                devRelativ=devRelativ.Replace("client-data"+FileSystem.PathDelimiter, "");
                string devNewClient=FolderLastClient+FileSystem.PathDelimiter+devRelativ;

                if(FileSystem.GetFilename(devRelativ).ToLower()=="cmakelists.txt")
                    continue;
                if(FileSystem.GetFilename(devRelativ).ToLower()=="branding.xml")
                    continue;

                //if(FileSystem.GetFilename(devRelativ)==FileSystem.GetFilename(i))
                //{
                if(FileSystem.ExistsFile(devNewClient))
                {
                    //Weitere Vergleiche
                    long SizeDev=FileSystem.GetFilesize(i);
                    long SizeLastClient=FileSystem.GetFilesize(devNewClient);

                    if(SizeDev==SizeLastClient)
                    {
                        string hashDev=Hash.SHA1.HashFile(i);
                        string hashLastClient=Hash.SHA1.HashFile(devNewClient);

                        if(hashDev==hashLastClient)
                            continue;
                    }
                }
                //}

                filesNew.Add(i);
            }

            //Ziel
            foreach(string i in filesNew)
            {
                string devRelativ2=FileSystem.GetRelativePath(i, FolderDev+FileSystem.PathDelimiter);
                devRelativ2=devRelativ2.Replace("client-data"+FileSystem.PathDelimiter, "");
                devRelativ2=devRelativ2.Replace("client"+FileSystem.PathDelimiter+"data"+FileSystem.PathDelimiter, "");
                string path2=FileSystem.GetPath(devRelativ2, true);

                FileSystem.CreateDirectory(FolderTarget+FileSystem.PathDelimiter+path2, true);

                FileSystem.CopyFile(i, FolderTarget+FileSystem.PathDelimiter+devRelativ2);
            }

            List<string> filestarget=FileSystem.GetFiles(FolderTarget, true);

            //Zip erstellen
            Console.WriteLine("Erstelle Zip Datei...");
            ZipFile z=ZipFile.Create(FolderTarget+FileSystem.PathDelimiter+"update-0.zip");

            z.BeginUpdate();

            foreach(string i in filestarget)
            {
                string rel=FileSystem.GetRelativePath(i, FolderTarget, true);
                z.Add(i, rel);
            }

            z.CommitUpdate();
            z.Close();

            //adler 32
            ICSharpCode.SharpZipLib.Checksums.Adler32 adler=new ICSharpCode.SharpZipLib.Checksums.Adler32();

            FileStream fs=new FileStream(FolderTarget+FileSystem.PathDelimiter+"update-0.zip", FileMode.Open, FileAccess.Read);
            BinaryReader br=new BinaryReader(fs);

            byte[] textToHash=br.ReadBytes((int)fs.Length);

            adler.Reset();
            adler.Update(textToHash);
            string adler32=String.Format("{0:x}", adler.Value);

            StreamWriter sw=new StreamWriter(FolderTarget+FileSystem.PathDelimiter+"adler32.txt");
            sw.WriteLine(adler32);
            sw.Close();

            Console.WriteLine("Vorgang abgeschlossen!");
        }
Exemplo n.º 3
0
        static void CreateDataFolder(string dst)
        {
            string source=Globals.folder_root;

            string target=FileSystem.GetPathWithPathDelimiter(dst);

            List<string> ExcludesDirs=new List<string>();
            ExcludesDirs.Add(".git");
            ExcludesDirs.Add("maps_templates");
            ExcludesDirs.Add("maps_rules");

            List<string> ExcludeFiles=new List<string>();
            ExcludeFiles.Add("CMakeLists.txt");
            ExcludeFiles.Add(".gitignore");

            if(FileSystem.ExistsDirectory(target))
            {
                FileSystem.RemoveDirectory(target, true);
            }

            FileSystem.CreateDirectory(target, true);

            Console.WriteLine("Erzeuge Serverdaten...");
            #region manaserv
            string serverPath=target+"manaserv"+FileSystem.PathDelimiter;

            FileSystem.CreateDirectory(serverPath);
            FileSystem.CreateDirectory(serverPath+"data"+FileSystem.PathDelimiter+"maps"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(serverPath+"data"+FileSystem.PathDelimiter+"scripts"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(serverPath+"data"+FileSystem.PathDelimiter+"scripts"+FileSystem.PathDelimiter+"libs"+FileSystem.PathDelimiter, true);

            //Kopieren
            FileSystem.CopyFiles(source, serverPath, "*.sh");
            FileSystem.CopyFiles(source, serverPath, "*.xml");
            FileSystem.CopyFiles(Globals.folder_data, serverPath+"data"+FileSystem.PathDelimiter, "*.xml");
            FileSystem.CopyFiles(Globals.folder_data, serverPath+"data"+FileSystem.PathDelimiter, "*.xsd");
            FileSystem.CopyFiles(Globals.folder_data, serverPath+"data"+FileSystem.PathDelimiter, "*.xsl");
            FileSystem.CopyFiles(Globals.folder_data_maps, serverPath+"data"+FileSystem.PathDelimiter+"maps"+FileSystem.PathDelimiter, "*.tmx");

            FileSystem.CopyDirectory(Globals.folder_data_scripts, serverPath+"data"+FileSystem.PathDelimiter+"scripts"+FileSystem.PathDelimiter, true, ExcludesDirs);
            FileSystem.CopyFiles(Globals.folder_data, serverPath+"data"+FileSystem.PathDelimiter, "*.xml");
            #endregion

            Console.WriteLine("Erzeuge Clientdaten...");
            #region manaclient-full
            string clientPath=target+"manaclient-full"+FileSystem.PathDelimiter;

            FileSystem.CreateDirectory(clientPath);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"fonts"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter+"gui"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter+"images"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter+"items"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter+"sprites"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter+"tiles"+FileSystem.PathDelimiter, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"help", true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"icons", true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"maps", true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"music", true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"sfx", true);

            //Kopieren
            FileSystem.CopyFile(source+"AUTHORS-MANA", clientPath+"AUTHORS-MANA");
            FileSystem.CopyFile(source+"AUTHORS-INVERTIKA", clientPath+"AUTHORS-INVERTIKA");
            FileSystem.CopyFile(source+"COPYING", clientPath+"COPYING");
            FileSystem.CopyFile(Globals.folder_client+"Invertika.url", clientPath+"Invertika.url");

            FileSystem.CopyFiles(Globals.folder_client_data, clientPath+"data"+FileSystem.PathDelimiter, "*.*", ExcludeFiles);
            FileSystem.CopyFiles(Globals.folder_data, clientPath+"data"+FileSystem.PathDelimiter, "*.xml");

            FileSystem.CopyFiles(Globals.folder_client_data_fonts, clientPath+"data"+FileSystem.PathDelimiter+"fonts"+FileSystem.PathDelimiter, "*.ttf");
            FileSystem.CopyDirectory(Globals.folder_client_data_graphics, clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter, true, ExcludesDirs, ExcludeFiles, true);
            FileSystem.CopyDirectory(Globals.folder_data_graphics, clientPath+"data"+FileSystem.PathDelimiter+"graphics"+FileSystem.PathDelimiter, true, ExcludesDirs, ExcludeFiles, true);

            FileSystem.CopyFiles(Globals.folder_client_data_help, clientPath+"data"+FileSystem.PathDelimiter+"help"+FileSystem.PathDelimiter, "*.*", ExcludeFiles);
            FileSystem.CopyFiles(Globals.folder_client_data_icons, clientPath+"data"+FileSystem.PathDelimiter+"icons"+FileSystem.PathDelimiter, "*.*", ExcludeFiles);
            FileSystem.CopyFiles(Globals.folder_data_maps, clientPath+"data"+FileSystem.PathDelimiter+"maps"+FileSystem.PathDelimiter, "*.tmx");
            FileSystem.CopyDirectory(Globals.folder_data_music, clientPath+"data"+FileSystem.PathDelimiter+"music"+FileSystem.PathDelimiter, true, ExcludesDirs, ExcludeFiles);
            FileSystem.CopyDirectory(Globals.folder_data_sfx, clientPath+"data"+FileSystem.PathDelimiter+"sfx"+FileSystem.PathDelimiter, true, ExcludesDirs, ExcludeFiles);
            #endregion

            Console.WriteLine("Erzeuge minimale Clientdaten...");
            #region manaclient-minimal
            clientPath=target+"manaclient-minimal"+FileSystem.PathDelimiter;

            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter+"music", true);

            FileSystem.CreateDirectory(clientPath);
            FileSystem.CopyDirectory(Globals.folder_client_data, clientPath+"data"+FileSystem.PathDelimiter, true, ExcludesDirs, ExcludeFiles);
            FileSystem.CopyFile(source+"AUTHORS-MANA", clientPath+"AUTHORS-MANA");
            FileSystem.CopyFile(source+"AUTHORS-INVERTIKA", clientPath+"AUTHORS-INVERTIKA");
            FileSystem.CopyFile(source+"COPYING", clientPath+"COPYING");
            FileSystem.CopyFile(Globals.folder_client+"Invertika.url", clientPath+"Invertika.url");
            FileSystem.CopyFile(Globals.folder_data_music+"godness.ogg", clientPath+"data"+FileSystem.PathDelimiter+"music"+FileSystem.PathDelimiter+"godness.ogg");
            #endregion

            Console.WriteLine("Erzeuge Datenordner...");
            #region manadata
            clientPath=target+"manadata"+FileSystem.PathDelimiter;

            FileSystem.CreateDirectory(clientPath);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter, true);

            List<string> manaDataExcludeDirs=new List<string>(ExcludesDirs);
            manaDataExcludeDirs.Add("scripts");

            FileSystem.CopyDirectory(Globals.folder_data, clientPath+"data"+FileSystem.PathDelimiter, true, manaDataExcludeDirs, ExcludeFiles);
            #endregion

            Console.WriteLine("Erzeuge Nullupdate...");
            #region manadata zero update
            //Dev Verzeichniss
            clientPath=clientPath+"data"+FileSystem.PathDelimiter;
            List<string> filesNew=FileSystem.GetFiles(clientPath, true);

            //Zip erstellen
            ZipFile z=ZipFile.Create(target+FileSystem.PathDelimiter+"update-zero.zip");

            z.BeginUpdate();

            foreach(string i in filesNew)
            {
                string rel=FileSystem.GetRelativePath(i, clientPath, true);
                z.Add(i, rel);
            }

            z.CommitUpdate();
            z.Close();

            //adler 32
            ICSharpCode.SharpZipLib.Checksums.Adler32 adler=new ICSharpCode.SharpZipLib.Checksums.Adler32();

            FileStream fs=new FileStream(target+FileSystem.PathDelimiter+"update-zero.zip", FileMode.Open, FileAccess.Read);
            BinaryReader br=new BinaryReader(fs);

            byte[] textToHash=br.ReadBytes((int)fs.Length);

            adler.Reset();
            adler.Update(textToHash);
            string adler32=String.Format("{0:x}", adler.Value);

            StreamWriter sw=new StreamWriter(target+FileSystem.PathDelimiter+"adler32.txt");
            sw.WriteLine(adler32);
            sw.Close();
            #endregion
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            #region Init
            if(args.Length!=1)
            {
                Console.WriteLine("Argument fehlt:");
                Console.WriteLine("z.B. mono autoupdate.exe autoupdate.xml");
                return;
            }

            if(!FileSystem.ExistsFile(args[0]))
            {
                Console.WriteLine("Angegebene Datei existiert nicht.");
                return;
            }

            XmlData config;

            try
            {
                config=new XmlData(args[0]);
            }
            catch(Exception e)
            {
                Console.WriteLine("Konfiguration konnte nicht gelesen werden.");
                Console.WriteLine(e.ToString());
                return;
            }

            Console.WriteLine("Autoupdate 1.2.1 wurde gestartet...");

            string workfolder_original=Directory.GetCurrentDirectory();

            string misc_servername=config.GetElementAsString("xml.misc.servername");

            string ftp_data_server=config.GetElementAsString("xml.ftp.data.server");
            string ftp_data_user=config.GetElementAsString("xml.ftp.data.user");
            string ftp_data_password=config.GetElementAsString("xml.ftp.data.password");

            bool irc_active=false;
            string irc_network="";
            string irc_channel="";

            if(config.GetElementAsString("xml.irc.active")!="")
            {
                irc_active=Convert.ToBoolean(config.GetElementAsString("xml.irc.active"));
                irc_network=config.GetElementAsString("xml.irc.network");
                irc_channel=config.GetElementAsString("xml.irc.channel");
            }

            string ftp_update_server=config.GetElementAsString("xml.ftp.update.server");
            string ftp_update_user=config.GetElementAsString("xml.ftp.update.user");
            string ftp_update_password=config.GetElementAsString("xml.ftp.update.password");

            bool activate_data=Convert.ToBoolean(config.GetElementAsString("xml.activate.data"));
            bool activate_update=Convert.ToBoolean(config.GetElementAsString("xml.activate.update"));

            string path_temp_folder=FileSystem.GetPathWithPathDelimiter(config.GetElementAsString("xml.path.temp"));

            string path_repostiory_trunk=FileSystem.GetPathWithPathDelimiter(config.GetElementAsString("xml.path.repository.trunk"));
            string path_repostiory_server=path_repostiory_trunk+"server/";
            string path_repostiory_data=path_repostiory_trunk+"data/";
            string path_repostiory_data_scripts=path_repostiory_data+"/scripts/";
            string path_repostiory_data_maps=path_repostiory_data+"/maps/";

            string path_server_root=FileSystem.GetPathWithPathDelimiter(config.GetElementAsString("xml.path.server.root"));
            string path_server_data=path_server_root+"data/";
            string path_server_data_scripts=path_server_data+"scripts/";
            string path_server_data_maps=path_server_data+"maps/";
            string path_server_start_script=path_server_root+"start-server.sh";
            string path_server_stop_script=path_server_root+"stop-server.sh";

            List<string> ExcludesDirsClient=new List<string>();
            ExcludesDirsClient.Add("maps_templates");
            ExcludesDirsClient.Add("maps_rules");
            ExcludesDirsClient.Add("scripts");
            ExcludesDirsClient.Add(".git");

            List<string> ExcludesDirsServer=new List<string>();
            ExcludesDirsServer.Add("maps_templates");
            ExcludesDirsServer.Add("maps_rules");
            ExcludesDirsServer.Add("graphics");
            ExcludesDirsServer.Add("music");
            ExcludesDirsServer.Add("sfx");
            ExcludesDirsServer.Add(".git");

            List<string> ExcludeFiles=new List<string>();
            ExcludeFiles.Add("CMakeLists.txt");
            #endregion

            #region IRC Message absetzen
            if(irc_active)
            {
                Console.WriteLine("Sende IRC Nachricht...");

                irc.SendDelay=200;
                irc.AutoRetry=true;
                irc.ActiveChannelSyncing=true;

                string[] serverlist=new string[] { irc_network };
                int port=6667;

                irc.Connect(serverlist, port);
                irc.Login("Autoupdate", "Autoupdate", 0, "AutoupdateIRC");
                irc.RfcJoin("#invertika");

                Random rnd=new Random();
                string funkyWord=FunkyWords[rnd.Next(FunkyWords.Length)];
                irc.SendMessage(SendType.Message, irc_channel, String.Format("Autoupdate wurde auf dem Server {0} gestartet. {1}", misc_servername, funkyWord));

                new Thread(new ThreadStart(StartIRCListen)).Start();
            }
            #endregion

            #region Repository updaten
            Console.WriteLine("Update Repository...");
            Directory.SetCurrentDirectory(path_repostiory_data);
            ProcessHelpers.StartProcess("git", "pull", true);
            #endregion

            #region Server stoppen und Serverdaten löschen
            Console.WriteLine("Stoppe Server...");
            Directory.SetCurrentDirectory(path_server_root);
            ProcessHelpers.StartProcess(path_server_stop_script, "", false);

            Console.WriteLine("Lösche Serverdaten...");
            if(FileSystem.ExistsDirectory(path_server_data))
            {
                FileSystem.RemoveDirectory(path_server_data, true, true);
            }

            Console.WriteLine("Lösche temporäres Verzeichnis...");
            if(FileSystem.ExistsDirectory(path_temp_folder))
            {
                FileSystem.RemoveDirectory(path_temp_folder, true, true);
            }
            #endregion

            #region Neue Serverdaten kopieren
            Directory.SetCurrentDirectory(path_server_root);
            Console.WriteLine("Kopiere neue Serverdaten...");

            FileSystem.CreateDirectory(path_server_data_maps, true);

            FileSystem.CopyDirectory(path_repostiory_data, path_server_data, true, ExcludesDirsServer, ExcludeFiles);
            #endregion

            #region Clientdaten
            Console.WriteLine("Erzeuge Verzeichnis mit Clientdaten...");
            string clientPath=path_temp_folder+"clientdata"+FileSystem.PathDelimiter;

            FileSystem.CreateDirectory(clientPath, true);
            FileSystem.CreateDirectory(clientPath+"data"+FileSystem.PathDelimiter, true);
            FileSystem.CopyDirectory(path_repostiory_data, clientPath+"data"+FileSystem.PathDelimiter, true, ExcludesDirsClient);

            List<string> clientDataFiles=FileSystem.GetFiles(clientPath, true);
            #endregion

            #region Clientdaten Update erzeugen und hochladen
            if(activate_update)
            {
                Console.WriteLine("Erstelle Zip Datei für Update...");
                clientPath=clientPath+"data"+FileSystem.PathDelimiter;

                //Zip erstellen
                string zipFilename=path_temp_folder+"update-"+Various.GetTimeID()+".zip";
                ZipFile z=ZipFile.Create(zipFilename);

                z.BeginUpdate();

                int fivePercent=clientDataFiles.Count/20;
                int countZipFiles=0;

                foreach(string i in clientDataFiles)
                {
                    countZipFiles++;

                    if(FileSystem.GetExtension(i).ToLower()=="ogg")
                    {
                        Console.WriteLine("Datei {0} aus dem Update ausgeschlossen.", FileSystem.GetFilename(i));
                        continue;
                    }

                    string rel=FileSystem.GetRelativePath(i, clientPath, true);
                    z.Add(i, rel);

                    if(countZipFiles%fivePercent==0)
                    {
                        Console.Write(".");
                    }
                }

                z.CommitUpdate();
                z.Close();

                //adler 32
                ICSharpCode.SharpZipLib.Checksums.Adler32 adler=new ICSharpCode.SharpZipLib.Checksums.Adler32();

                FileStream fs=new FileStream(zipFilename, FileMode.Open, FileAccess.Read);
                BinaryReader br=new BinaryReader(fs);

                byte[] textToHash=br.ReadBytes((int)fs.Length);

                adler.Reset();
                adler.Update(textToHash);
                string adler32=String.Format("{0:x}", adler.Value);

                //Ressources
                string resFile=path_temp_folder+FileSystem.PathDelimiter+"resources2.txt";
                StreamWriter sw=new StreamWriter(resFile);
                sw.WriteLine("{0} {1}", FileSystem.GetFilename(zipFilename), adler32);
                sw.Close();

                //Newsfile
                string newsFile=path_temp_folder+FileSystem.PathDelimiter+"news.txt";
                sw=new StreamWriter(newsFile);

                sw.WriteLine("##3 Serenity");
                sw.WriteLine("##0");
                sw.WriteLine("##0 Entwicklerserver des Invertika Projektes");
                sw.WriteLine("##0 Automatisches Update wird nach jedem");
                sw.WriteLine("##0 Commit im Repository vorgenommen.");
                sw.WriteLine("##0");
                sw.WriteLine("##0 Status: in Betrieb");
                sw.WriteLine("##0 Autoupdate vom {0}, {1} Uhr.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
                sw.WriteLine("##0");
                sw.WriteLine("##2 Das Invertika Development Team");
                sw.WriteLine("##0");
                sw.Close();

                //Upload
                Console.WriteLine("Beginne FTP Upload der Update Dateien...");
                FTPSClient Client=new FTPSClient();

                NetworkCredential networkCredential=new NetworkCredential();
                networkCredential.Domain=ftp_update_server;
                networkCredential.UserName=ftp_update_user;
                networkCredential.Password=ftp_update_password;

                Console.WriteLine("Verbinde mich mit FTP {0} mittels des Nutzers {1}.", ftp_update_server, ftp_update_user);

                Client.Connect(networkCredential.Domain, networkCredential, ESSLSupportMode.ClearText);

                List<string> currentFTPFiles=Client.GetDirectoryFiles(""); //TODO muss getestet werden

                Console.WriteLine("Lösche bestehende Updatedateien auf dem FTP Server...");
                foreach(string i in currentFTPFiles)
                {
                    if(i.IndexOf("update")!=-1)
                    {
                        Client.DeleteFile(i);
                    }
                }

                Console.WriteLine("Lade Updatedatei hoch...");
                Client.PutFile(zipFilename, FileSystem.GetFilename(zipFilename));
                Client.PutFile(resFile, FileSystem.GetFilename(resFile));
                Client.PutFile(newsFile, FileSystem.GetFilename(newsFile));

                Client.Close();
            }
            #endregion

            #region Server wieder starten
            Console.WriteLine("Starte Server neu...");
            Directory.SetCurrentDirectory(path_server_root);
            ProcessHelpers.StartProcess(path_server_start_script, "", false);
            #endregion

            #region Clientdaten Data erzeugen und hochladen
            if(activate_data)
            {
                //Upload
                Console.WriteLine("Beginne FTP Upload der Data Dateien...");
                FTPSClient ClientData=new FTPSClient();

                NetworkCredential networkCredential=new NetworkCredential();
                networkCredential.Domain=ftp_data_server;
                networkCredential.UserName=ftp_data_user;
                networkCredential.Password=ftp_data_password;

                Console.WriteLine("Verbinde mich mit FTP {0} mittels des Nutzers {1}.", ftp_data_server, ftp_data_user);

                ClientData.Connect(networkCredential.Domain, networkCredential, ESSLSupportMode.ClearText);

                Console.WriteLine("Lade Data Dateien hoch...");

                foreach(string ftpfile in clientDataFiles)
                {
                    string relativeName=FileSystem.GetRelativePath(ftpfile, clientPath);
                    string dirToCreate=FileSystem.GetPath(relativeName, true);

                    if(dirToCreate!="")
                    {
                        string[] folders=dirToCreate.Split(FileSystem.PathDelimiter);
                        string dirTemp="";

                        foreach(string i in folders)
                        {
                            if(i.Trim()=="") continue;
                            if(i=="/") continue;

                            dirTemp+=i+FileSystem.PathDelimiter;

                            try
                            {
                                ClientData.CreateDirectory(dirTemp);
                            }
                            catch
                            {
                            }
                        }
                    }

                    Console.WriteLine("Datei {0} wird hochgeladen...", relativeName);
                    ClientData.PutFile(ftpfile, relativeName);
                }

                ClientData.Close();
            }
            #endregion

            #region IRC Message absetzen und aus Channel verschwinden
            if(irc_active)
            {
                Console.WriteLine("Sende IRC Nachricht...");
                irc.SendMessage(SendType.Message, irc_channel, String.Format("Autoupdate wurde auf dem Server {0} beendet und manaserv wieder gestartet.", misc_servername));
                Thread.Sleep(15000);
                irc.Disconnect();
            }
            #endregion

            #region Ende
            Console.WriteLine("Autoupdate beenden");
            #endregion
        }