コード例 #1
0
ファイル: IniLocations.cs プロジェクト: memoarfaa/fb2epub
        public void Load()
        {
            Clear();
            if (!string.IsNullOrEmpty(_iniPath))
            {
                string count = IniAccessFunctions.IniReadValue(_iniPath, "TARGETS", "TargetsCount");
                int    targetsCount;
                if (int.TryParse(count, out targetsCount) && targetsCount > 0)
                {
                    for (int i = 0; i < targetsCount; i++)
                    {
                        Location location = new Location();
                        location.ReadLocation(_iniPath, i);
                        if (!string.IsNullOrEmpty(location.Path) && Directory.Exists(location.Path))
                        {
                            Add(location);
                        }
                    }
                }

                string singleDestination = IniAccessFunctions.IniReadValue(_iniPath, "TARGETS", "SingleDestination");
                int    singleDestinationInt;
                if (int.TryParse(singleDestination, out singleDestinationInt))
                {
                    SingleDestination = singleDestinationInt;
                }
            }
        }
コード例 #2
0
ファイル: IniLocations.cs プロジェクト: memoarfaa/fb2epub
        public void Save()
        {
            if (!string.IsNullOrEmpty(_iniPath))
            {
                IniAccessFunctions.IniWriteValue(_iniPath, "TARGETS", "TargetsCount", Count.ToString());
                int i = 0;
                foreach (var location in this)
                {
                    location.WriteLocation(_iniPath, i++);
                }

                IniAccessFunctions.IniWriteValue(_iniPath, "TARGETS", "SingleDestination", SingleDestination.ToString());
            }
        }