Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(nameTextBox.Text))
            {
                GeneralUtil.Error("You must give your VDF a name");
                return;
            }

            if (String.IsNullOrEmpty(pathTextBox.Text))
            {
                GeneralUtil.Error("You must give a save path for the VDF");
                return;
            }

            if (!Directory.Exists(Path.GetDirectoryName(pathTextBox.Text)))
            {
                GeneralUtil.Error("The directory where you'd like to save the VDF doesn't exist");
                return;
            }

            VDF vdf = new VDF(nameTextBox.Text);

            vdf.Save(pathTextBox.Text);

            Editor editor = new Editor(menuForm, recent);

            editor.OpenVDF(vdf);
            editor.SetPath(pathTextBox.Text);
            recent.AddItem(pathTextBox.Text);
            recent.Save();
            menuForm.RefreshRecentItems();
            editor.Show();
            closedByUser = false;
            Close();
        }
Пример #2
0
        /// <summary>
        /// Test that loads a vdf file and prints information about it
        /// </summary>
        static void LoadVDFTest()
        {
            string fileToLoad = GetInput("VDF file to load (no extension): ");

            loadedVDF = VDFReader.LoadVDF(fileToLoad + ".vdf");

            PrintInfo(loadedVDF.ToString());
        }
Пример #3
0
        public void OpenVDF(VDF vdf)
        {
            this.vdf = vdf;
            savePath = vdf.savePath;

            // GeneralUtil.Info("VDF Name: " + vdf.name);
            vdfNameText.Text = "VDF Name: " + vdf.name;

            LoadVDF();
        }
Пример #4
0
        public void OpenVDF(string path)
        {
            vdf      = VDFReader.LoadVDF(path);
            savePath = path;

            // GeneralUtil.Info("VDF Name: " + vdf.name);
            vdfNameText.Text = "VDF Name: " + vdf.name;

            LoadVDF();
        }
Пример #5
0
        /// <summary>
        /// Create a VDF based of data gathered
        /// </summary>
        static void CreateVDF()
        {
            vdf = new VDF(vdfName);
            VDFCatagory catagory = new VDFCatagory(catagoryName);

            catagory.AddItem(new VDFStringItem("Catagory String", catagoryString));
            vdf.AddCatagory(catagory);
            vdf.AddItem(new VDFStringItem("String", stringToWrite));
            vdf.AddItem(new VDFIntItem("Int", intToWrite));
        }
Пример #6
0
        private IEnumerable <DirectoryInfo> getLibraryFolders(DirectoryInfo steamInstallPath)
        {
            DirectoryInfo mainSteamApps      = new DirectoryInfo(Path.Combine(steamInstallPath.FullName, @"steamapps"));
            FileInfo      libraryFoldersFile = new FileInfo(Path.Combine(steamInstallPath.FullName, mainSteamApps.FullName, "libraryfolders.vdf"));

            VDF libraryFoldersVdf = new VDF(libraryFoldersFile);

            IEnumerable <DirectoryInfo> libraryFolders = libraryFoldersVdf.Value.Children()
                                                         .Cast <VProperty>().Where(t => Regex.IsMatch(t.Key, @"\d+"))
                                                         .Select(t => new DirectoryInfo(Path.Combine(t.Value.ToString(), "steamapps")));

            return(libraryFolders);
        }
Пример #7
0
        private IEnumerable <VDF> getAppManifests(DirectoryInfo libraryFolder)
        {
            IEnumerable <FileInfo> appManifestFiles = libraryFolder.GetFiles().Where(f => Regex.IsMatch(f.Name, @"appmanifest_\d+\.acf")).ToList();

            return(appManifestFiles.Select(a => {
                VDF vdf;
                try {
                    vdf = new VDF(a);
                } catch (Exception e) {
                    return null;
                }
                vdf.name = Regex.Match(a.Name, @"appmanifest_(?<appId>\d+)\.acf").Groups["appId"].Value;
                return vdf;
            }).Where(v => v != null));
        }