Example #1
0
        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;
                }
            }
        }
Example #2
0
        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());
            }
        }