예제 #1
0
        //Save program settings
        private void saveProgramSettings()
        {
            xmlSettingsEditor xmlAppSettings = new xmlSettingsEditor();

            //Open XML file for writing
            xmlAppSettings.openXmlWriter(appPath + "/Settings.xml", appName + " " + appVersion + " settings data");

            //Set list font
            xmlAppSettings.writeXmlEntry("ListFont", mainSettings.listFont);

            //Set DexDrive port
            xmlAppSettings.writeXmlEntry("ComPort", mainSettings.communicationPort);

            //Set title encoding
            xmlAppSettings.writeXmlEntry("TitleEncoding", mainSettings.titleEncoding.ToString());

            //Set List Grid settings
            xmlAppSettings.writeXmlEntry("ShowGrid", mainSettings.showListGrid.ToString());

            //Set glass option switch
            xmlAppSettings.writeXmlEntry("GlassStatusBar", mainSettings.glassStatusBar.ToString());

            //Set icon interpolation settings
            xmlAppSettings.writeXmlEntry("IconInterpolationMode", mainSettings.iconInterpolationMode.ToString());

            //Set icon size options
            xmlAppSettings.writeXmlEntry("IconSize", mainSettings.iconPropertiesSize.ToString());

            //Set backup Memory Cards value
            xmlAppSettings.writeXmlEntry("BackupMemoryCards", mainSettings.backupMemcards.ToString());

            //Set warning message switch
            xmlAppSettings.writeXmlEntry("WarningMessage", mainSettings.warningMessage.ToString());

            //Set window position switch
            xmlAppSettings.writeXmlEntry("RestoreWindowPosition", mainSettings.restoreWindowPosition.ToString());

            //Set format type
            xmlAppSettings.writeXmlEntry("HardwareFormatType", mainSettings.formatType.ToString());

            //Set window X coordinate
            xmlAppSettings.writeXmlEntry("WindowX", this.Location.X.ToString());

            //Set window Y coordinate
            xmlAppSettings.writeXmlEntry("WindowY", this.Location.Y.ToString());

            //Cleanly close opened XML file
            xmlAppSettings.closeXmlWriter();
        }
예제 #2
0
        //Load program settings
        private void loadProgramSettings()
        {
            Point mainWindowLocation = new Point(0, 0);
            xmlSettingsEditor xmlAppSettings = new xmlSettingsEditor();

            //Check if the Settings.xml exists
            if (File.Exists(appPath + "/Settings.xml"))
            {
                //Open XML file for reading, file is auto-closed
                xmlAppSettings.openXmlReader(appPath + "/Settings.xml");

                //Load list font
                mainSettings.listFont = xmlAppSettings.readXmlEntry("ListFont");

                //Load DexDrive COM port
                mainSettings.communicationPort = xmlAppSettings.readXmlEntry("ComPort");

                //Load Title Encoding
                mainSettings.titleEncoding = xmlAppSettings.readXmlEntryInt("TitleEncoding", 0, 1);

                //Load List Grid settings
                mainSettings.showListGrid = xmlAppSettings.readXmlEntryInt("ShowGrid", 0, 1);

                //Load glass option switch
                mainSettings.glassStatusBar = xmlAppSettings.readXmlEntryInt("GlassStatusBar", 0, 1);

                //Load icon interpolation settings
                mainSettings.iconInterpolationMode = xmlAppSettings.readXmlEntryInt("IconInterpolationMode", 0, 1);

                //Load icon size settings
                mainSettings.iconPropertiesSize = xmlAppSettings.readXmlEntryInt("IconSize", 0, 1);

                //Load backup Memory Cards value
                mainSettings.backupMemcards = xmlAppSettings.readXmlEntryInt("BackupMemoryCards", 0, 1);

                //Load warning message switch
                mainSettings.warningMessage = xmlAppSettings.readXmlEntryInt("WarningMessage", 0, 1);

                //Load window position switch
                mainSettings.restoreWindowPosition = xmlAppSettings.readXmlEntryInt("RestoreWindowPosition", 0, 1);

                //Load format type
                mainSettings.formatType = xmlAppSettings.readXmlEntryInt("HardwareFormatType", 0, 1);

                //Check if window position should be read
                if (mainSettings.restoreWindowPosition == 1)
                {
                    mainWindowLocation.X = xmlAppSettings.readXmlEntryInt("WindowX", -65535, 65535);
                    mainWindowLocation.Y = xmlAppSettings.readXmlEntryInt("WindowY", -65535, 65535);

                    //Apply read position
                    this.Location = mainWindowLocation;
                }

                //Apply loaded settings
                applySettings();
            }
        }