Example #1
0
        private void DemoCutByTimeThread(object arg)
        {
            var info = (CutByTimeInfo)arg;

            if (info == null)
            {
                _app.LogError("Invalid thread argument type");
                return;
            }

            var protocol = App.GetProtocolFromFilePath(info.FilePath);

            if (protocol == UDT_DLL.udtProtocol.Invalid)
            {
                _app.LogError("Unrecognized protocol for demo '{0}'", Path.GetFileName(info.FilePath));
                return;
            }

            _app.InitParseArg();
            _app.ParseArg.FileOffset     = info.FileOffset;
            _app.ParseArg.GameStateIndex = info.GameStateIndex;

            try
            {
                UDT_DLL.CutDemoByTime(_app.GetMainThreadContext(), ref _app.ParseArg, info.FilePath, info.StartTime, info.EndTime);
            }
            catch (Exception exception)
            {
                var startTimeDisplay = App.FormatMinutesSeconds(info.StartTime);
                var endTimeDisplay   = App.FormatMinutesSeconds(info.EndTime);
                _app.LogError("Caught an exception while writing cut {0}-{1}: {2}", startTimeDisplay, endTimeDisplay, exception.Message);
            }
        }
Example #2
0
        private void DemoCutThread(object arg)
        {
            var cuts = arg as CutLists;

            if (cuts == null)
            {
                _app.LogError("Invalid thread argument");
                return;
            }

            _app.InitParseArg();
            _app.ParseArg.ProgressCb = (progress, context) => {};

            try
            {
                var progress  = 0.0;
                var fileCount = cuts.FileCuts.Count;
                foreach (var fileCuts in cuts.FileCuts)
                {
                    UDT_DLL.CutDemoByTimes(_app.GetMainThreadContext(), ref _app.ParseArg, fileCuts.FilePath, fileCuts.Cuts);
                    progress += 1.0 / (double)fileCount;
                    _app.SetProgressThreadSafe(100.0 * progress);
                }
            }
            catch (Exception exception)
            {
                _app.LogError("Caught an exception while cutting demos: {0}", exception.Message);
            }
        }
Example #3
0
        private void DemoCutThread(object arg)
        {
            var filePaths = arg as List <string>;

            if (filePaths == null)
            {
                _app.LogError("Invalid thread argument");
                return;
            }

            _app.InitParseArg();

            try
            {
                UDT_DLL.TimeShiftDemos(ref _app.ParseArg, filePaths, _app.Config.MaxThreadCount, _app.Config.TimeShiftSnapshotCount);
            }
            catch (Exception exception)
            {
                _app.LogError("Caught an exception while modifying demos: {0}", exception.Message);
            }
        }