Exemplo n.º 1
0
        public void SaveAllInfos2File()
        {
            List <SavableInfo> fileInfos = new List <SavableInfo>();

            foreach (var item in rooms)
            {
                fileInfos.Add(item.ToSavableInfo());
            }

            string path = Path.Combine(Path.LogsDirectory, string.Format("{0}.txt", DateTime.Now.ToString("yyMMddHHmmss")));

            File.AppendAllText(path, JsonUtility.ToJson(fileInfos));
        }
Exemplo n.º 2
0
        public void SaveAllInfos2File(string filename)
        {
            List <SavableInfo> fileInfos = new List <SavableInfo>();

            foreach (var item in rooms)
            {
                fileInfos.Add(item.ToSavableInfo());
            }

            string path = Path.Combine(Path.LogsDirectory, filename);
            int    copy = 0;

            while (File.Exists(path))
            {
                path = string.Format("{0}\\{1}\\{2}\\{3}", Path.LogsDirectory, Path.GetFileNameWitoutExtension(path), copy++, Path.GetExtension(path));
            }
            File.AppendAllText(path, JsonUtility.ToJson(fileInfos));
        }