Exemplo n.º 1
0
        // loads pois without media -> fast search
        private void readPoisDir()
        {
            this.pois = new List <Poi>();
            string poisAreaDir = this.poisDir + "\\" + currentNamedArea.getName();

            // get poi dirs
            DirectoryInfo[] dirs;
            try
            {
                DirectoryInfo dirInfo = new DirectoryInfo(poisAreaDir);
                dirs = dirInfo.GetDirectories();
            }
            catch (Exception e)
            {
                Debug.WriteLine("readPoisDir: can't read dir: " + poisAreaDir, ToString());
                return;
            }
            // read each poi
            foreach (DirectoryInfo dir in dirs)
            {
                FileInfo[] poiFileInfo = dir.GetFiles("poi.xml");
                if (poiFileInfo.Length > 0)
                {
                    Debug.WriteLine("readPoisDir(): found poi, dir: " + dir.Name, ToString());
                    try
                    {
                        string poiSubDir = getPoiSubDir(dir.Name, this.currentNamedArea);
                        Poi    poi       = this.poiMapperHdd.getEmpty(poiSubDir);
                        this.pois.Add(poi);
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine("readPoisDir: couldn't add poi from dir '"
                                        + dir.Name + "' due to error: " + e.Message);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void removePois(NamedArea namedArea)
        {
            if (currentNamedArea.getName().Equals(namedArea.getName()))
            {
                this.pois = new List <Poi>();
            }
            string poisAreaDir = this.poisDir + "\\" + currentNamedArea.getName();

            // get poi dirs
            DirectoryInfo[] dirs;
            try
            {
                DirectoryInfo dirInfo = new DirectoryInfo(poisAreaDir);
                dirInfo.Delete(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine("removePois: can't delete dir: " + poisAreaDir, ToString());
                return;
            }
        }
Exemplo n.º 3
0
 /**
  * Returns poi sub dir by dir name and named area
  */
 private string getPoiSubDir(string dirName, NamedArea namedArea)
 {
     return(namedArea.getName() + "\\" + dirName);
 }