Exemple #1
0
            private bool Ask(Question question, out bool valid)
            {
                Answer answer = question.Ask(Application, true);

                if (!answer.IsValid)
                {
                    valid = false;
                    return(false);
                }

                valid = true;

                if ((string)answer.SelectedValue == "yes")
                {
                    return(true);
                }

                return(false);
            }
Exemple #2
0
        private void RollbackPathToTime(NetworkContext context, string pathName, DateTime time)
        {
            IServiceAddress address = context.Network.GetRoot(pathName);
            if (address == null)
                throw new ApplicationException("path '" + pathName + "' was not found.");

            Out.WriteLine("Reverting path " + pathName + " to " + time);

            DataAddress[] dataAddresses = context.Network.GetHistoricalPathRoots(address, pathName, time, 20);

            if (dataAddresses.Length == 0) {
                Out.WriteLine("no historical roots found.");
                return;
            }

            Out.WriteLine();
            Out.WriteLine("found the following roots:");
            foreach(DataAddress da in dataAddresses) {
                Out.WriteLine("  " + da);
            }

            Out.WriteLine();
            Out.WriteLine("WARNING: Great care must be taken when rolling back a path. This");
            Out.WriteLine(" operation is only intended as a way to recover from some types");
            Out.WriteLine(" of corruption or other data inconsistency issues.");
            Out.WriteLine(" Before agreeing to rollback the path, ensure there are no open");
            Out.WriteLine(" writable transactions currently active on the path. A commit");
            Out.WriteLine(" write on this path before this operation completes may undo the");
            Out.WriteLine(" rollback or worse, put the path back into an inconsistent ");
            Out.WriteLine(" state.");
            Out.WriteLine();

            Question question = new Question("If you are sure you want to continue type YES (case-sensitive) ", new object[] { "YES", "no" }, 1);
            Answer answer = question.Ask(Application, false);
            if (answer.SelectedOption != 0)
                return;

            Out.WriteLine();

            context.Network.PublishPath(address, pathName, dataAddresses[0]);
            Out.WriteLine("done.");
        }
Exemple #3
0
            private bool Ask(Question question, out bool valid)
            {
                Answer answer = question.Ask(Application, true);
                if (!answer.IsValid) {
                    valid = false;
                    return false;
                }

                valid = true;

                if ((string)answer.SelectedValue == "yes")
                    return true;

                return false;
            }