/// <summary> /// 获取命令删除数据 /// </summary> /// <param name="cacheDelete"></param> /// <param name="parameters"></param> /// <returns></returns> private object[] GetDeleteParametersDatas(ServerCacheDelete cacheDelete, object[] parameters) { var deleteParameters = new ArrayList(cacheDelete.ParameterIndexs.Count); cacheDelete.ParameterIndexs.ForEach(index => { deleteParameters.Add(parameters[index]); }); return(deleteParameters.ToArray()); }
private static List <ServerCacheDelete> InitCacheDelete(CommandInfo commandInfo, XmlNodeList deleteNodes) { //loop delete item ServerCacheDelete delete = null; byte parameterIndex = 0; string parameters = null; string[] parameterArray = null; var deletes = new List <ServerCacheDelete>(deleteNodes.Count); foreach (XmlNode node in deleteNodes) { delete = new ServerCacheDelete(); delete.Command = XmlHelper.GetAttribute(node, "name", null); if (string.IsNullOrEmpty(delete.Command)) { continue; } //server delete.Server = XmlHelper.GetAttribute(node, "server", commandInfo.Server); delete.Separator = XmlHelper.GetAttribute(node, "separator", ","); parameters = XmlHelper.GetAttribute(node, "parameters", null); if (parameters != null) { if (string.IsNullOrEmpty(parameters)) { throw new ConfigurationErrorsException(string.Format("empty config delete item parameters {0}.{1} from {2}.{3} in {2}.config ", delete.Server, delete.Command, commandInfo.Server, commandInfo.Name)); } parameterArray = parameters.Split(','); foreach (var parameterName in parameterArray) { if (!commandInfo.NameIndex.TryGetValue(parameterName, out parameterIndex)) { throw new ConfigurationErrorsException(string.Format("{4} is not {0}.{1} parameter list from {2}.{3} in {2}.config ", delete.Server, delete.Command, commandInfo.Server, commandInfo.Name, parameterName)); } delete.ParameterIndexs.Add(parameterIndex); } //if (delete.ParameterIndexs.Count > 0) // delete.ArrayIndex = Convert.ToInt32(XmlHelper.GetAttribute(node, "arrayindex", "-1")); } deletes.Add(delete); } return(deletes.Count > 0 ? deletes : null); }
/// <summary> /// 获取命令删除数据 /// </summary> /// <param name="cacheDelete"></param> /// <param name="parameters"></param> /// <returns></returns> private object[] GetDeleteParametersDatas(ServerCacheDelete cacheDelete, object[] parameters) { var count = cacheDelete.ParameterIndexs.Count; var parames = new object[count]; for (int i = 0; i < count; i++) { parames[i] = parameters[i]; } return(parames); //var deleteParameters = new ArrayList(cacheDelete.ParameterIndexs.Count); //cacheDelete.ParameterIndexs.ForEach(index => //{ // deleteParameters.Add(parameters[index]); //}); //return deleteParameters.ToArray(); }