Esempio n. 1
0
        public static SortedDictionary <string, TFSStateManager> LoadFuzzFiles(string directoryName)
        {
            SortedDictionary <string, TFSStateManager> ret = new SortedDictionary <string, TFSStateManager>();

            foreach (var file in Directory.GetFiles(directoryName))
            {
                if (file.ToLower().EndsWith(".fuzz"))
                {
                    string          output = File.ReadAllText(file);
                    TFSStateManager deserializedStateManager = JsonConvert.DeserializeObject <TFSStateManager>(output);
                    ret.Add(Path.GetFileName(file), deserializedStateManager);
                }
            }

            return(ret);
        }
Esempio n. 2
0
        public static void SaveFuzzFile(string directoryName, TFSStateManager sm)
        {
            string output = JsonConvert.SerializeObject(sm);

            var fuzzFiles = LoadFuzzFiles(directoryName);

            foreach (KeyValuePair <string, TFSStateManager> kvp in fuzzFiles)
            {
                if (kvp.Value.ProjectName == sm.ProjectName && kvp.Value.TeamName == sm.TeamName &&
                    kvp.Value.AreaId == sm.AreaId)
                {
                    File.Delete(Path.Combine(@"{0}\{1}", directoryName, kvp.Key));
                }
            }

            string path = string.Format(@"{0}\{1}.fuzz", directoryName, Guid.NewGuid());

            // This text is added only once to the file.
            // Create a file to write to.

            File.WriteAllText(path, output);
        }