Beispiel #1
0
        public static void SaveFens(List <string> fens, List <string> keywords)
        {
            if (!Directory.Exists(m_fenFolderPath))
            {
                Directory.CreateDirectory(m_fenFolderPath);
            }

            foreach (var fen in fens)
            {
                string filePath = StorageManager.GetNewFenPath();

                File.WriteAllText(filePath, fen);
                AddFile(filePath, keywords);
                ExerciseManager.AddExercise(filePath, keywords);
            }
        }
Beispiel #2
0
        public static void SaveFens(List <string> fens, List <string> keywords)
        {
            if (!Directory.Exists(m_fenFolderPath))
            {
                Directory.CreateDirectory(m_fenFolderPath);
            }

            var rnd = new Random();

            foreach (var fen in fens)
            {
                string filePath;
                do
                {
                    var num = rnd.Next();
                    filePath = m_fenFolderPath + "\\" + num.ToString();
                } while (File.Exists(filePath));

                File.WriteAllText(filePath, fen);
                AddFile(filePath, keywords);
                ExerciseManager.AddExercise(filePath, keywords);
            }
        }