Esempio n. 1
0
        /// <summary>
        /// New window allowing a new FM folder to be created.
        /// </summary>
        /// <param name="langIni">'language.ini' data object.</param>
        /// <param name="installedFMsPath">Full path to "FMs" folder. Does not end with \\</param>
        public NewFMFolder(INIFile langIni, string installedFMsPath)
        {
            InitializeComponent();
            if (langIni != null)
            {
                string newTitle = langIni.IniReadValue("FMTable", "NewFMButton");
                if (newTitle != "")
                {
                    Text = newTitle;
                }
                string newLalel = langIni.IniReadValue("FMTable", "NewFMName");
                if (newLalel != "")
                {
                    label1.Text = newLalel;
                }

                FMsPath = installedFMsPath;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Import Darkloader saves and ini settings.
        /// </summary>
        /// <param name="gameFullPath">Location of .exe file's folder (not file itself).</param>
        /// <param name="fmArchivePaths">Locations of FM zip files.</param>
        /// <param name="sevenZipGExePath">7zG.exe location (the file itself).</param>
        /// <param name="tempPath">User's temp path. Ends with \\</param>
        /// <param name="archiveNames">Filenames of FM archives, extension, no path.</param>
        /// <param name="archiveExts">List of valid FM archive extensions, initially read from the .ini file.</param>
        public Tools(string gameFullPath, List <string> fmArchivePaths, string sevenZipGExePath, string tempPath, List <DarkLoaderFMData> dataList, newKeyNames keyNames, INIFile ndlINI, INIFile langIni, List <string> archiveExts, bool gameIsShock2)
        {
            InitializeComponent();
            gamePath           = gameFullPath;
            fmArchiveFullPaths = fmArchivePaths;
            sevenZipGPath      = sevenZipGExePath;
            userTempPath       = tempPath;
            foreach (DarkLoaderFMData datum in dataList)
            {
                dlFMData.Add(datum);
            }

            nKeys = keyNames;

            if (langIni != null)
            {
                string secOldDLTools = "OldDarkloaderTools";
                string secSaveImport = "DLSaveImport";

                Text                = langIni.IniReadValue(secOldDLTools, "DLToolsTitle");
                label1.Text         = langIni.IniReadValue(secOldDLTools, "GamePath");
                lblGamePath.Text    = gamePath;
                btnImportSaves.Text = langIni.IniReadValue(secOldDLTools, "ImportDLSaves");
                btnImportINI.Text   = langIni.IniReadValue(secOldDLTools, "ImportDLFMData");
                btnClose.Text       = langIni.IniReadValue(secOldDLTools, "DLToolsClose");

                overWarnTitle = langIni.IniReadValue(secSaveImport, "OverwriteTitle");
                overMsg1      = langIni.IniReadValue(secSaveImport, "OverwriteLn1");
                overMsg2      = langIni.IniReadValue(secSaveImport, "OverwriteLn2");
                overMsg3      = langIni.IniReadValue(secSaveImport, "OverwriteLn3");
                overMsg4      = langIni.IniReadValue(secSaveImport, "OverwriteLn4");
                overMsg5      = langIni.IniReadValue(secSaveImport, "OverwriteLn5");
                overMsg6      = langIni.IniReadValue(secSaveImport, "OverwriteLn6");
                yBtn          = langIni.IniReadValue(secSaveImport, "Yes");
                yToAllBtn     = langIni.IniReadValue(secSaveImport, "YesToAll");
                nBtn          = langIni.IniReadValue(secSaveImport, "No");
                nToAllBtn     = langIni.IniReadValue(secSaveImport, "NoToAll");
                shock2        = gameIsShock2;
            }

            newINI = ndlINI;
        }
Esempio n. 3
0
        public TagFilter(List <catItem> globalCIList, List <string> globalCatList, List <catItem> restoreInclude, List <catItem> restoreExclude, INIFile langIni)
        {
            InitializeComponent();

            foreach (catItem cI in globalCIList)
            {
                globalCatItems.Add(cI);
            }

            foreach (string s in globalCatList)
            {
                globalCats.Add(s);
            }

            allTags.Nodes.AddRange(FillTree.generateNodes(globalCatItems, globalCats));
            allTags.ExpandAll();

            //restore existing tag filter and get unique cat list from restored filters
            foreach (catItem cI in restoreInclude)
            {
                includeList.Add(cI);
                if (!includeCats.Contains(cI.cat))
                {
                    includeCats.Add(cI.cat);
                }
            }
            foreach (catItem cI in restoreExclude)
            {
                excludeList.Add(cI);
                if (!excludeCats.Contains(cI.cat))
                {
                    excludeCats.Add(cI.cat);
                }
            }
            addToList(includeList, tvInclude, includeCats);
            addToList(excludeList, tvExclude, excludeCats);

            //Set interface text
            if (langIni != null)
            {
                string secTagFilter = "TagFilterWindow";
                Text = langIni.IniReadValue(secTagFilter, "WindowTitle");
                lblAvailTags.Text = langIni.IniReadValue(secTagFilter, "AvailTags");
                lblInc.Text       = langIni.IniReadValue(secTagFilter, "IncludeTags");
                lblExc.Text       = langIni.IniReadValue(secTagFilter, "ExcludeTags");
                btnInclude.Text   = langIni.IniReadValue(secTagFilter, "IncludeBtn");
                btnExclude.Text   = langIni.IniReadValue(secTagFilter, "ExcludeBtn");
                btnRemove.Text    = langIni.IniReadValue(secTagFilter, "RemoveTag");
                btnRemoveAll.Text = langIni.IniReadValue(secTagFilter, "RemoveAll");
                btnOK.Text        = langIni.IniReadValue(secTagFilter, "OK");
                btnCancel.Text    = langIni.IniReadValue(secTagFilter, "Cancel");
                removeAllMessage  = langIni.IniReadValue(secTagFilter, "RemoveAllMsg");
                removeAllMsgTitle = langIni.IniReadValue(secTagFilter, "RemoveAllMsgTitle");
                miscTagCat        = langIni.IniReadValue("Tags", "MiscTagName");
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Initialized using strings read from the table.
        /// </summary>
        public EditFM(
            INIFile langIni,
            string _fmTitle, int _rating, int _finished, string _comment,
            string _disabledMods, string _hexRelDate, string _hexLastPlayed,
            List <string> _textFiles, string currentReadme, bool _gameIsT3,
            string _savegameFilePath, string _fmInstPath, string notPlayedText)
        {
            InitializeComponent();
            tbTitle.Text = _fmTitle;
            selectRating(_rating);
            setFinishedCheckboxes(_finished);
            setReleaseDate(_hexRelDate);
            setLastPlayed(_hexLastPlayed);
            tbComment.Text      = _comment;
            tbDisabledMods.Text = _disabledMods;
            textFiles           = _textFiles;
            savegameFilePath    = _savegameFilePath;
            fmSavesPath         = "";
            gameIsT3            = _gameIsT3;
            foreach (string file in textFiles)
            {
                cbReadme.Items.Add(file);
            }
            if (cbReadme.Items.Count > 0)
            {
                if (currentReadme != "")
                {
                    for (int i = 0; i < cbReadme.Items.Count; i++)
                    {
                        if (textFiles[i] == currentReadme)
                        {
                            cbReadme.SelectedIndex = i;
                            break;
                        }
                    }
                }
                else
                {
                    cbReadme.SelectedIndex = 0;
                }
            }

            fmInstalledPath = _fmInstPath;

            string secCols = "Columns";

            //Set interface text from lang ini
            if (langIni != null)
            {
                Text            = langIni.IniReadValue("EditFM", "EditDetailsTitle");
                lblReadme.Text  = langIni.IniReadValue(secCols, "Readme");
                lblTitle.Text   = langIni.IniReadValue(secCols, "Title");
                lblRating.Text  = langIni.IniReadValue(secCols, "Rating");
                gbFinished.Text = langIni.IniReadValue(secCols, "Finished");

                if (gameIsT3)
                {
                    chkNormal.Text  = langIni.IniReadValue(secCols, "T3Easy");
                    chkHard.Text    = langIni.IniReadValue(secCols, "Normal");
                    chkExpert.Text  = langIni.IniReadValue(secCols, "Hard");
                    chkExtreme.Text = langIni.IniReadValue(secCols, "Expert");
                    fmSavesPath     = _fmInstPath + "\\savegames";
                }
                else
                {
                    chkNormal.Text  = langIni.IniReadValue(secCols, "Normal");
                    chkHard.Text    = langIni.IniReadValue(secCols, "Hard");
                    chkExpert.Text  = langIni.IniReadValue(secCols, "Expert");
                    chkExtreme.Text = langIni.IniReadValue(secCols, "Expert");
                    fmSavesPath     = _fmInstPath + "\\saves";
                }

                lblRelDate.Text         = langIni.IniReadValue(secCols, "ReleaseDate");
                lblLastPlayed.Text      = langIni.IniReadValue(secCols, "LastPlayed");
                chkNotPlayed.Text       = notPlayedText;
                btnGetLastSaveDate.Text = langIni.IniReadValue(secCols, "GetFromSaves");
                lblComment.Text         = langIni.IniReadValue(secCols, "Comment");
                lblDisMods.Text         = langIni.IniReadValue(secCols, "DisabledMods");
                btnOK.Text     = langIni.IniReadValue("TagFilterWindow", "OK");
                btnCancel.Text = langIni.IniReadValue("TagFilterWindow", "Cancel");
            }
            checkForSaves();
        }
Esempio n. 5
0
        private void btnImportINI_Click(object sender, EventArgs e)
        {
            DialogResult dR = openDarkloaderINI.ShowDialog();

            if (dR == DialogResult.OK)
            {
                //ini files
                INIFile oldINI = new INIFile(openDarkloaderINI.FileName);
                //Get sizes in bytes of each FM file
                List <string> foundFilesInArchivePaths = new List <string>();
                foreach (string path in fmArchiveFullPaths)
                {
                    foundFilesInArchivePaths.AddRange(Directory.GetFiles(path, "*.*", SearchOption.AllDirectories));
                }

                foreach (string file in foundFilesInArchivePaths)
                {
                    FileInfo fI        = new FileInfo(file);
                    long     sizeBytes = fI.Length;

                    string ext            = fI.Extension;
                    string simpleFilename = fI.Name;
                    string oldSectionName = simpleFilename;
                    bool   fmIsArchive    = false;

                    if (ext.Length != 0)
                    {
                        simpleFilename = fI.Name.Replace(ext, "");
                        oldSectionName = simpleFilename + "." + sizeBytes;
                        fmIsArchive    = true;
                    }

                    string newSectionName = "FM=" + ArchiveExtract.ArchiveExtracedFolderName(simpleFilename);

                    string newNiceName = newINI.IniReadValue(newSectionName, nKeys.FMTitle);
                    if (newNiceName == simpleFilename || newNiceName == "")
                    {
                        string oldNiceName = oldINI.IniReadValue(oldSectionName, "title").Replace("\"", "");
                        if (oldNiceName != "")
                        {
                            newINI.IniWriteValue(newSectionName, nKeys.FMTitle, oldNiceName);
                        }
                    }

                    string newFinished = newINI.IniReadValue(newSectionName, nKeys.FinishedID);
                    if (newFinished == "")
                    {
                        string oldFinished;
                        if (fmIsArchive)
                        {
                            oldFinished = oldINI.IniReadValue(oldSectionName, "finished");
                        }
                        else
                        {
                            oldFinished = oldINI.INIReadValueNoSize(oldSectionName, "finished");
                        }

                        if (oldFinished != "")
                        {
                            newINI.IniWriteValue(newSectionName, nKeys.FinishedID, oldFinished);
                        }
                    }

                    oldDateToNewDate(oldINI, newINI, oldSectionName, newSectionName, DateType.Release, fmIsArchive);
                    oldDateToNewDate(oldINI, newINI, oldSectionName, newSectionName, DateType.LastPlayed, fmIsArchive);

                    string newComment = newINI.IniReadValue(newSectionName, nKeys.Comment);
                    if (newComment == "")
                    {
                        string oldComment;
                        if (fmIsArchive)
                        {
                            oldComment = oldINI.IniReadValue(oldSectionName, "comment").Replace("\"", "");
                        }
                        else
                        {
                            oldComment = oldINI.INIReadValueNoSize(oldSectionName, "comment").Replace("\"", "");
                        }

                        if (oldComment != "")
                        {
                            newINI.IniWriteValue(newSectionName, nKeys.Comment, oldComment);
                        }
                    }
                }

                iniImported = true; //allows a property to report that the ini was imported so the main form can refresh the table.
            }
        }