Example #1
0
        public List <T> ValidResult <T>(List <T> result, string code, ValidAction <T> validAction)
        {
            for (var i = 0; i < result.Count; i++)
            {
                if (RegValid(code, result[i]))
                {
                    continue;
                }

                result.RemoveAt(i);

                validAction.Invoke(result[i]);

                i--;
            }

            return(result);
        }
 /// <summary> Extension to actions on specified element with log functionality. </summary>
 /// <param name="root">current element.</param>
 /// <param name="Log">VerifiableLog instance</param>
 /// <param name="action">delegate to actions to be performed on current element</param>
 public static void ValidOperation(this OpenXmlElement root, LogUtil.VerifiableLog Log, ValidAction action)
 {
     Log.Comment("Executing specified actions on current element...");
     action(root);
     Log.Comment("Executed specified actions on current element.");
     Log.Comment("Saving changes...");
     root.PartRootElement().Save();
     Log.Comment("Saved changes successfully.");
     Log.Pass("Specified actions executed without any exceptions.");
 }