예제 #1
0
        public bool NewUserMap(string mapName, string[] newMap)
        {
            if (saver == null)
            {
                saver = new Saver();
            }
            if (compressor == null)
            {
                compressor = new Compressor();
            }
            string compressedMap;



            // check to see if mapname is in use

            if (MapNameUsed(mapName))
            {
                if (overWriteMap == false)
                {
                    Console.WriteLine("map name already exists");
                    return(false);
                }
            }

            /*/ add map to user map list
             * userMaps.Add(mapName);
             * SaveUserMapsList();*/

            // compress map
            compressor.LoadMap(newMap);
            compressedMap = compressor.GetResult();

            // save compressed map to directory
            saver.SetFileName(mapName);
            //saver.SaveSingle(@"C:\Users\Harry\Documents\2015\sem2\c#\FilerTesting\UserMaps", compressedMap);
            saver.SaveSingle(userMapDirectory, compressedMap);
            //saver.SaveSingle(@"H:\2015\semester 2\PR 283 C#\Theseus\FilerTesting\UserMaps", compressedMap);
            return(true);
        }
예제 #2
0
        public void SaveMultiple(List<AMap> theList, string newPath, string fileName)
        {
            if (compressor == null)
            {
                compressor = new Compressor();
            }
            if (saver == null)
            {
                saver = new Saver();
            }

            string theString = "";
            string[] toSave;

            foreach (AMap m in theList)
            {
                compressor.LoadMap(m.Map);
                theString += m.Name + "&" + compressor.GetResult() + "*";
            }

            toSave = theString.Split(new string[] { "*" }, StringSplitOptions.None);

            //toSave = theString.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            saver.SetFileName(fileName);
            saver.SaveMultiple(newPath, toSave);
        }
예제 #3
0
        public bool NewUserMap(string mapName, string[] newMap)
        {
            if (saver == null)
            {
                saver = new Saver();
            }
            if (compressor == null)
            {
                compressor = new Compressor();
            }
            string compressedMap;

            // check to see if mapname is in use

            if (MapNameUsed(mapName))
            {
                if (overWriteMap == false)
                {
                    Console.WriteLine("map name already exists");
                    return false;
                }

            }
            /*/ add map to user map list
            userMaps.Add(mapName);
            SaveUserMapsList();*/

            // compress map
            compressor.LoadMap(newMap);
            compressedMap = compressor.GetResult();

            // save compressed map to directory
            saver.SetFileName(mapName);
            //saver.SaveSingle(@"C:\Users\Harry\Documents\2015\sem2\c#\FilerTesting\UserMaps", compressedMap);
            saver.SaveSingle(userMapDirectory, compressedMap);
            //saver.SaveSingle(@"H:\2015\semester 2\PR 283 C#\Theseus\FilerTesting\UserMaps", compressedMap);
            return true;
        }