Example #1
0
        void ph_NextDownload(Packet pa)
        {
            NextDownloadPacket p = pa as NextDownloadPacket;

            Thread.Sleep(100);
            progress[1]              = 0;
            progress[2]              = p.ChunkSize;
            CurrentDownload          = Mods.Find(p.Identifier);
            CurrentDownload.Contents = new byte[CurrentDownload.Size];
            if (!Server.Shutdown)
            {
                SplashScreen.UpdateStatusText("Downloading " + CurrentDownload.Name);
            }
            else
            {
                SplashScreen.UpdateStatusTextWithStatus("Downloading " + CurrentDownload.Name + "(Server Shutdown Mode)", TypeOfMessage.Warning);
            }
            MinecraftModUpdater.Logger.Log(Logger.Level.Info, "Starting download of " + CurrentDownload.Name);
            if (modImages.Images.ContainsKey(CurrentDownload.File))
            {
                SplashScreen.GetScreen().setDownloadPicture(modImages.Images[CurrentDownload.File]);
            }
            CurrentDownload.PostDownload = p.PostDownloadCLI;
            string path   = Properties.Settings.Default.MinecraftPath + "\\" + CurrentDownload.File.Replace(CurrentDownload.File.Split('\\').Last(), "").TrimEnd('\\').Replace("clientmods", "mods");
            bool   exists = Directory.Exists(path);

            if (!exists)
            {
                Directory.CreateDirectory(path);
            }
        }
Example #2
0
        private void HandleDownloadInfo(Packet pa)
        {
            NextDownloadPacket p = pa as NextDownloadPacket;

            currentDownload = mods.IndexOf(mods.Find(new Predicate <Mod>(delegate(Mod m)
            {
                return(m.Identifier == p.Identifier);
            }))); //I know, get the mod so we can get the index so we can get the mod.
        }