Exemple #1
0
        public static void ExtractAndDelete(string theserverfolder)
        {
            ClientAndServer.ExtractResourcesForBoth();

            ClientAndServer.Runoneachvpk(ClientAndServer.Returndirvpks(theserverfolder));
            ClientAndServer.DeleteVpks(ClientAndServer.Returnallvpks(theserverfolder));
            string resourceData = Resources.delete;

            // var words = resourceData.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();

            string[] items = resourceData.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            Parallel.ForEach(items, lines =>
            {
                string fun = Path.Combine(theserverfolder, lines);

                FileAttributes attr = 0;
                if (File.Exists(fun) || Directory.Exists(fun))
                {
                    attr = File.GetAttributes(fun);
                }
                if (attr.HasFlag(FileAttributes.Directory))
                {
                    MiscFunctions.DeleteDir(Path.Combine(theserverfolder, lines));
                }
                else
                {
                    MiscFunctions.DeleteFile(Path.Combine(theserverfolder, lines));
                }
            });
        }
        public static void ClientNohook(string fun = "-n", string imounts = "")
        {
            List <string> mounts = new List <string>();
            string        sourcesdk2007Installdir = "";
            string        ocinstalldir            = "";

            ClientAndServer.ExtractResourcesForBoth();
            mounts = OpenClientFormOrCheckForCommandLineMounts(fun, mounts, imounts);
            if (mounts == null)
            {
                mounts = new List <string>();
            }
            Tuple <string, string, List <string> > ocAnd2007AndLocations = NewWay.NewWayStart(mounts);

            if (ocAnd2007AndLocations != null)
            {
            }
            if (ocAnd2007AndLocations == null || (ocAnd2007AndLocations.Item1 == "" | ocAnd2007AndLocations.Item2 == "" | ocAnd2007AndLocations.Item3.Count == 0))
            {
                ocAnd2007AndLocations = OldWay.oldwaysetup(mounts);
            }

            if (ocAnd2007AndLocations != null)
            {
                List <string> storedlocations = ocAnd2007AndLocations.Item3;
                ocinstalldir            = ocAnd2007AndLocations.Item1;
                sourcesdk2007Installdir = ocAnd2007AndLocations.Item2;
                Console.WriteLine(@"Found The directories");
                Thread.Sleep(1000);
                Console.WriteLine(ocinstalldir);
                Console.WriteLine(sourcesdk2007Installdir);
                Console.WriteLine(string.Join(Environment.NewLine, storedlocations.Cast <string>().ToArray()));

                InstallClientMounts2(sourcesdk2007Installdir, storedlocations, ocinstalldir);
            }
            else
            {
                Console.WriteLine("Error Required Information not found");
                Console.WriteLine("Please make sure you have source SDK Base 2007 installed and try again.");
                Console.WriteLine("Press Any Key to close this window");
                Console.ReadKey();
                Environment.Exit(-1);
            }
        }