private static void AppendHistoryFile(ContentRecipesPropHistory tagHistoryName, string sContentUniqueId, string sHistoryValue) { lock (sigLock) { if (sHistoryValue.Trim().Length > 0) { string sHistoryFile = ContentWorkingPath + "\\" + sContentUniqueId + "\\" + tagHistoryName.ToString() + HistoryFileExtension; if (!File.Exists(sHistoryFile)) { CheckAndCreateContentVersionFile(sContentUniqueId); File.WriteAllLines( sHistoryFile, new string[] { sHistoryValue.Trim() }); } else { string[] allHistoryValues = File.ReadAllLines(sHistoryFile); List <string> listAllHistoryValues = new List <string>(allHistoryValues); if (!listAllHistoryValues.Exists((x) => { return(sHistoryValue == x); })) { File.AppendAllLines( sHistoryFile, new string[] { sHistoryValue.Trim() }); } } } } }
internal static List <string> GetHistoryList(ContentRecipesPropHistory tagHistoryName, string sContentUniqueId, string sDefaultHistoryValue) { lock (sigLock) { string sHistoryFile = ContentWorkingPath + "\\" + sContentUniqueId + "\\" + tagHistoryName.ToString() + HistoryFileExtension; if (!File.Exists(sHistoryFile)) { if (sDefaultHistoryValue == null) { return(new List <string>(new string[0])); } else { return(new List <string>(new string[] { sDefaultHistoryValue })); } } else { string[] allHistoryValues = File.ReadAllLines(sHistoryFile); if (allHistoryValues.Length > 0) { return(new List <string>(allHistoryValues)); } else { if (sDefaultHistoryValue == null) { return(new List <string>(new string[0])); } else { return(new List <string>(new string[] { sDefaultHistoryValue })); } } } } }