Пример #1
0
        public void logAction(XElement parent, Action ref_action)
        {
            XElement action = new XElement("Action");

            addAtrribute(action, "display", ref_action.DisplayText);
            addAtrribute(action, "type", ref_action.LogText);
            addAtrribute(action, "reason", ref_action.Reason);


            if (ref_action.user != null)
            {
                logParameter(action, new Parameter("Date", "Date/Time", DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss")));
                logParameter(action, new Parameter("User", "User", ref_action.user));
            }

            Parameter[] parameters = ref_action.GetParameters();
            foreach (Parameter parameter in parameters)
            {
                if (parameter.doesGenerateLog())
                {
                    logParameter(action, parameter);
                }
            }


            Action[] sub_actions = ref_action.GetSubActions();
            foreach (Action subaction in sub_actions)
            {
                logAction(action, subaction);
            }

            parent.Add(action);
        }