Пример #1
0
        /// <summary>
        /// Load shares from setting files from dir
        /// </summary>
        /// <param name="dir">directory where you want to load your shares from</param>
        public void Load(string dir)
        {
            directory = dir;
            SettingsGroup setting = new SettingsGroup();

            SettingsGroup.Load(dir + FileName + ".xml", out setting, FileName);

            // Share names
            string tmpshareNames = setting.GetString(IndexShareNames);

            if (tmpshareNames != null)
            {
                // Load shares
                string[] tmpNames = tmpshareNames.Split('|');
                foreach (string var in tmpNames)
                {
                    if (var == string.Empty)
                    {
                        continue;
                    }
                    IShare s = new Share(var);
                    s.Load(dir);
                    shares.Add(s.Name, s);
                }
                tmpNames = null;
            }
            // If default share doesnt exist, create it.
            if (!shares.ContainsKey("Default"))
            {
                IShare s = new Share("Default");
                AddShare(s);
            }
            tmpshareNames = null;
            Reload();
        }