コード例 #1
0
        public CallbackStatus UpdateProgress_Callback(ProgressMsg msg, object info, object progctx)
        {
            CallbackTested tested = progctx as CallbackTested;

            Assert.IsNotNull(tested);

            switch (msg)
            {
            case ProgressMsg.UPDATE_BEGIN_COMMAND:
            case ProgressMsg.UPDATE_END_COMMAND:
            {
                ProgressInfo_Update m = (ProgressInfo_Update)info;

                Assert.IsNotNull(m);
                tested.Set();

                UpdateCommand cmd = m.Command;
                switch (cmd.Op)
                {
                case UpdateOp.ADD:
                {
                    var add = cmd.Add;
                    Console.WriteLine($"ADD [{add.FsSourcePath}] -> [{add.WimTargetPath}]");
                }
                break;

                case UpdateOp.DELETE:
                {
                    var del = cmd.Delete;
                    Console.WriteLine($"DELETE [{del.WimPath}]");
                }
                break;

                case UpdateOp.RENAME:
                {
                    var ren = cmd.Rename;
                    Console.WriteLine($"RENAME [{ren.WimSourcePath}] -> [{ren.WimTargetPath}]");
                }
                break;
                }
            }
            break;

            default:
                break;
            }
            return(CallbackStatus.CONTINUE);
        }
コード例 #2
0
        public static CallbackStatus UpdateProgressCallback(ProgressMsg msg, object info, object progctx)
        {
            CallbackTested tested = progctx as CallbackTested;

            Assert.IsNotNull(tested);

            switch (msg)
            {
            case ProgressMsg.UpdateBeginCommand:
            case ProgressMsg.UpdateEndCommand:
            {
                UpdateProgress m = (UpdateProgress)info;
                Assert.IsNotNull(m);

                tested.Set();

                UpdateCommand cmd = m.Command;
                Console.WriteLine($"Commands = {m.CompletedCommands}/{m.TotalCommands}");
                switch (cmd.Op)
                {
                case UpdateOp.Add:
                {
                    AddCommand add = cmd.Add;
                    Console.WriteLine($"ADD [{add.FsSourcePath}] -> [{add.WimTargetPath}]");
                }
                break;

                case UpdateOp.Delete:
                {
                    DeleteCommand del = cmd.Delete;
                    Console.WriteLine($"DELETE [{del.WimPath}]");
                }
                break;

                case UpdateOp.Rename:
                {
                    RenameCommand ren = cmd.Rename;
                    Console.WriteLine($"RENAME [{ren.WimSourcePath}] -> [{ren.WimTargetPath}]");
                }
                break;
                }
            }
            break;
            }

            return(CallbackStatus.Continue);
        }
コード例 #3
0
ファイル: ApplyTests.cs プロジェクト: Taviruni/pebakery
        public WimLibProgressStatus ApplyProgress_Callback(WimLibProgressMsg msg, object info, object progctx)
        {
            CallbackTested tested = progctx as CallbackTested;

            Assert.IsNotNull(tested);

            switch (msg)
            {
            case WimLibProgressMsg.EXTRACT_STREAMS:
            {         // Extract of one file
                WimLibProgressInfoExtract m = (WimLibProgressInfoExtract)info;
                Assert.IsNotNull(m);

                tested.Set();

                Console.WriteLine($"Extract {m.CompletedBytes * 100 / m.TotalBytes}%");
            }
            break;

            default:
                break;
            }
            return(WimLibProgressStatus.CONTINUE);
        }