Exemplo n.º 1
0
        public override string sort(string sourceFilePath, string targetFilePath)
        {
            string message = "";

            var unsortedList = filetext.read(sourceFilePath);

            if (unsortedList.Count > 0)
            {
                //Sort if there's something to sort
                var sortedList = sort(unsortedList);

                TheResultIsAboutToBeSavedEventArgs args = new TheResultIsAboutToBeSavedEventArgs();
                args.SortedList = sortedList;
                BeforeSavingTheResult(args);

                if (filetext.write(sortedList, targetFilePath))
                {
                    message = "SUCCESS : the result has been saved in a file : " + targetFilePath;
                }
                else
                {
                    message = "ERROR : cannot save the result to the file : " + targetFilePath;
                }
            }
            else
            {
                message = "ERROR : nothing to sort here";
            }

            return(message);
        }
Exemplo n.º 2
0
        protected virtual void BeforeSavingTheResult(TheResultIsAboutToBeSavedEventArgs e)
        {
            EventHandler <TheResultIsAboutToBeSavedEventArgs> handler = TheResultIsAboutToBeSaved;

            if (handler != null)
            {
                handler(this, e);
            }
        }