Example #1
0
        private static string ReplaceIdWithAssociation(string result, string name, int id, string stringModel)
        {
            var stringToFind = $"\"{name}\":{id}";
            var nameIndex    = result.IndexOf(stringToFind, StringComparison.Ordinal);
            var index        = result.IndexOf(id.ToString(), nameIndex, StringComparison.Ordinal);

            result = StorageManagerUtil.ReplaceString(result, index, index + id.ToString().Length, stringModel);
            return(result);
        }
Example #2
0
        private static string ReplaceListWithAssociationList(string serializedModel, string propName, string strList)
        {
            var propStart = serializedModel.IndexOf($"\"{propName}\":[", StringComparison.Ordinal);
            var start     = serializedModel.IndexOf('[', propStart) + 1;
            var end       = serializedModel.IndexOf(']', start);
            var result    = StorageManagerUtil.ReplaceString(serializedModel, start, end, strList);

            return(result);
        }