Exemplo n.º 1
0
        public void BakResFunc(string def)
        {
            DEparser dp = new DEparser();

            string[] subdirectoryEntries = Directory.GetDirectories(dp.dePATH);


            foreach (string subdirectory in subdirectoryEntries)
            {
                if (dp.IsDigitsOnly(subdirectory.Replace(dp.dePATH + "\\", "")) && subdirectory.Length > 4 && subdirectory.Replace(dp.dePATH + "\\", "") != "0")
                {
                    if (def == "bak")
                    {
                        using (ZipFile zip = new ZipFile())
                        {
                            zip.AddDirectory(subdirectory + @"\profile");
                            zip.Comment = "This zip was created by DE Replays Manager at " + System.DateTime.Now.ToString("G");
                            zip.Save(subdirectory.Replace(dp.dePATH + "\\", "") + ".zip");
                        }
                    }

                    else if (def == "res")
                    {
                        using (ZipFile zip = ZipFile.Read(subdirectory.Replace(dp.dePATH + "\\", "") + ".zip"))
                        {
                            zip.ExtractAll(subdirectory + @"\profile", ExtractExistingFileAction.OverwriteSilently);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.TopMost = true;
            DEparser dp        = new DEparser();
            string   pfiletype = dp.GrabID(File.ReadAllText(@"exclude.txt"));

            string[] disft = pfiletype.Split('|');
            foreach (string s in disft)
            {
                fltypes.Text += s + "\n";
            }

            string[] zips = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.zip");
            if (zips != null)
            {
                foreach (string z in zips)
                {
                    rsbak.Enabled = true;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.TopMost = true;
            //Grab Similtaneous downloads count
            int val = 8;

            if (Int32.TryParse(RegCalls.GetREG(@"SOFTWARE\DERM", "Downloads"), out val))
            {
                slideSIM.Value = Int32.Parse(RegCalls.GetREG(@"SOFTWARE\DERM", "Downloads"));
            }

            DEparser dp        = new DEparser();
            string   pfiletype = dp.GrabID(File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"exclude.txt")));

            string[] disft = pfiletype.Split('|');
            foreach (string s in disft)
            {
                fltypes.Text += s + "\n";
            }

            string[] zips = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.zip");
            if (zips != null)
            {
                foreach (string z in zips)
                {
                    rsbak.Enabled = true;
                    break;
                }
            }
            if (Directory.Exists(RegCalls.GetREG(@"SOFTWARE\DERM", "GamePath")))
            {
                gamepathTXT.Text = RegCalls.GetREG(@"SOFTWARE\DERM", "GamePath");
            }
            else
            {
                MessageBox.Show("GamePath is invalid! Please enter a correct path.", "AoE2DE Not Found!");
                gamepathTXT.Text = RegCalls.GetREG(@"SOFTWARE\DERM", "GamePath");
            }
        }
Exemplo n.º 4
0
        private void ScanDirectories()
        {
            DEparser dp = new DEparser();
            //string[] subdirectoryEntries = Directory.GetDirectories(dp.dePATH);
            var  subdirectoryEntries = new DirectoryInfo(dp.dePATH).GetDirectories("*", SearchOption.AllDirectories).OrderByDescending(x => x.LastWriteTime);
            bool isONCE = false;

            foreach (DirectoryInfo subdirectory in subdirectoryEntries)
            {
                if (dp.IsDigitsOnly(subdirectory.FullName.Replace(dp.dePATH + "\\", "")) && subdirectory.FullName.Length > 4 && subdirectory.FullName.Replace(dp.dePATH + "\\", "") != "0")
                {
                    DIRprofiles.Add(subdirectory.FullName);
                    DirectoryInfo info  = new DirectoryInfo(subdirectory.FullName + "\\profile");
                    FileInfo[]    files = info.GetFiles("*.hki").OrderByDescending(p => p.LastWriteTime).ToArray();
                    foreach (FileInfo file in files)
                    {
                        if (listPROFILE.Items.Contains(file.Name.Replace(".hki", "")))
                        {
                            listPROFILE.Items.Add(file.Name.Replace(".hki", "") + @"(2)");
                            USERprofiles.Add(file.Name.Replace(".hki", "") + @"(2)", subdirectory.FullName);
                            break;
                        }
                        else
                        {
                            if (!isONCE)
                            {
                                isONCE           = true;
                                listPROFILE.Text = file.FullName.Replace(".hki", "");
                            }


                            listPROFILE.Items.Add(file.Name.Replace(".hki", ""));
                            USERprofiles.Add(file.Name.Replace(".hki", ""), subdirectory.FullName);
                            break;
                        }
                    }

                    //    FileInfo fl = new FileInfo(subdirectory + @"\profile\Player.nfp");
                    //DEparser stp = new DEparser();
                    //stp.Decompress(fl);

                    //stp.GetPlayernfp(stp.newFileName);
                    //System.Windows.Forms.Clipboard.SetText(stp.newFileName);
                    //MessageBox.Show(stp.newFileName);



                    //if (!USERprofiles.ContainsKey(stp.CollectPlayerName(stp.playerTEXT).Replace(".hki", "")))
                    //{
                    //    USERprofiles.Add(stp.CollectPlayerName(stp.playerTEXT).Replace(".hki", ""), stp.currentFileName.Replace(@"\profile\Player.nfp", ""));
                    //    listPROFILE.Items.Add(stp.CollectPlayerName(stp.playerTEXT).Replace(".hki", ""));
                    //}
                    //else
                    //{
                    //    USERprofiles.Add(stp.CollectPlayerName(stp.playerTEXT).Replace(".hki", "") + @"(2)", stp.currentFileName.Replace(@"\profile\Player.nfp", ""));
                    //    listPROFILE.Items.Add(stp.CollectPlayerName(stp.playerTEXT).Replace(".hki", "") + @"(2)");
                    //}
                }
            }


            var lastDirectory = new DirectoryInfo(dp.dePATH).GetDirectories("*", SearchOption.AllDirectories).OrderByDescending(x => x.LastWriteTimeUtc);

            foreach (DirectoryInfo fdir in lastDirectory)
            {
                //MessageBox.Show(fdir);
                if (dp.IsDigitsOnly(fdir.FullName.Replace(dp.dePATH + "\\", "")) && fdir.FullName.Length > 4 && fdir.FullName.Replace(dp.dePATH + "\\", "") != "0")
                {
                    //MessageBox.Show(fdir.FullName);
                    foreach (KeyValuePair <string, string> item in USERprofiles)
                    {
                        if (fdir.FullName == item.Value)
                        {
                            RefreshSaves(fdir.FullName);
                            listPROFILE.SelectedIndex = listPROFILE.FindStringExact(item.Key);
                        }
                    }


                    break;
                }
            }
        }