public void MainMenuSlide() { archiveList = GetComponent <ArchiveList>(); if (!istMainMenuVersteckt) { archiveSlide.SetBool("versteckt", false); mainMenuSlide.SetBool("versteckt", false); //decke.enabled = false; logo.SetActive(false); istMainMenuVersteckt = true; istArchiveVersteckt = false; if (archiveList.deaktivierFigur) { figurSlide.SetBool("versteckt", true); } } else if (istMainMenuVersteckt) { archiveSlide.SetBool("versteckt", true); mainMenuSlide.SetBool("versteckt", true); //decke.enabled = true; logo.SetActive(true); istMainMenuVersteckt = false; istArchiveVersteckt = true; if (archiveList.deaktivierFigur) { figurSlide.SetBool("versteckt", false); } } }
public void TestOneFile() { HistorianKey key1 = new HistorianKey(); HistorianKey key2 = new HistorianKey(); HistorianValue value1 = new HistorianValue(); HistorianValue value2 = new HistorianValue(); Logger.Console.Verbose = VerboseLevel.All; MemoryPoolTest.TestMemoryLeak(); ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); SortedTreeTable <HistorianKey, HistorianValue> master = CreateTable(); SortedTreeTable <HistorianKey, HistorianValue> table1 = CreateTable(); AddData(master, 100, 100, 100); AddData(table1, 100, 100, 100); using (ArchiveListEditor <HistorianKey, HistorianValue> editor = list.AcquireEditLock()) { editor.Add(table1); } using (SortedTreeTableReadSnapshot <HistorianKey, HistorianValue> masterRead = master.BeginRead()) { SortedTreeScannerBase <HistorianKey, HistorianValue> masterScan = masterRead.GetTreeScanner(); masterScan.SeekToStart(); TreeStreamSequential <HistorianKey, HistorianValue> masterScanSequential = masterScan.TestSequential(); using (SequentialReaderStream <HistorianKey, HistorianValue> sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list)) { TreeStreamSequential <HistorianKey, HistorianValue> scanner = sequencer.TestSequential(); int count = 0; while (scanner.Read(key1, value1)) { count++; if (!masterScanSequential.Read(key2, value2)) { throw new Exception(); } if (!key1.IsEqualTo(key2)) { throw new Exception(); } if (!value1.IsEqualTo(value2)) { throw new Exception(); } } if (masterScan.Read(key2, value2)) { throw new Exception(); } } } list.Dispose(); master.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void ConsoleTest3() { MemoryPoolTest.TestMemoryLeak(); ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); DateTime start = DateTime.Now.Date; for (int x = 0; x < 3; x++) { SortedTreeTable <HistorianKey, HistorianValue> table1 = CreateTable(); AddDataTerminal(table1, (ulong)x, start, new TimeSpan(TimeSpan.TicksPerSecond), (ulong)(1000 * x), 1, 60 * 60); using (ArchiveListEditor <HistorianKey, HistorianValue> editor = list.AcquireEditLock()) { editor.Add(table1); } } for (int x = 0; x < 3; x++) { SortedTreeTable <HistorianKey, HistorianValue> table1 = CreateTable(); AddDataTerminal(table1, (ulong)x, start, new TimeSpan(TimeSpan.TicksPerSecond), (ulong)(1000 * x), 1, 60 * 60); using (ArchiveListEditor <HistorianKey, HistorianValue> editor = list.AcquireEditLock()) { editor.Add(table1); } } SeekFilterBase <HistorianKey> filter = TimestampSeekFilter.CreateFromIntervalData <HistorianKey>(start, start.AddMinutes(10), new TimeSpan(TimeSpan.TicksPerSecond * 60), new TimeSpan(TimeSpan.TicksPerSecond)); SequentialReaderStream <HistorianKey, HistorianValue> sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list, null, filter); SortedList <DateTime, FrameData> frames = sequencer.GetFrames(); WriteToConsole(frames); list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void BenchmarkTwoFiles() { MemoryPoolTest.TestMemoryLeak(); const int Max = 1000000; ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); SortedTreeTable <HistorianKey, HistorianValue> table1 = CreateTable(); SortedTreeTable <HistorianKey, HistorianValue> table2 = CreateTable(); AddData(table1, 100, 100, Max / 2); AddData(table2, 101, 100, Max / 2); using (ArchiveListEditor <HistorianKey, HistorianValue> editor = list.AcquireEditLock()) { editor.Add(table1); editor.Add(table2); } SequentialReaderStream <HistorianKey, HistorianValue> sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list); DebugStopwatch sw = new DebugStopwatch(); double sec = sw.TimeEvent(() => { SequentialReaderStream <HistorianKey, HistorianValue> scanner = sequencer; while (scanner.Read(key, value)) { } }); System.Console.WriteLine(Max / sec / 1000000); list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public async Task Refresh() { if (_internalLoadingArchives) { return; } _internalLoadingArchives = true; RefreshOnErrorButton = false; ArchiveList.Clear(); LoadingArchives = true; foreach (var b in Settings.Profile.Bookmarks) { var archive = Archives.GetArchive(b.archiveID); if (archive != null) { Tabs.CloseTabWithId(archive.title); } } await Archives.ReloadArchives(); LoadBookmarks(); Page = 0; LoadingArchives = false; _internalLoadingArchives = false; }
public void TestTwoIdenticalFiles() { MemoryPoolTest.TestMemoryLeak(); ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); HistorianKey key1 = new HistorianKey(); HistorianKey key2 = new HistorianKey(); HistorianValue value1 = new HistorianValue(); HistorianValue value2 = new HistorianValue(); var master = CreateTable(); var table1 = CreateTable(); var table2 = CreateTable(); AddData(master, 100, 100, 100); AddData(table1, 100, 100, 100); AddData(table2, 100, 100, 100); using (var editor = list.AcquireEditLock()) { editor.Add(table1); editor.Add(table2); } using (var masterRead = master.BeginRead()) { var masterScan = masterRead.GetTreeScanner(); masterScan.SeekToStart(); var masterScanSequential = masterScan.TestSequential(); using (var sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list)) { var scanner = sequencer.TestSequential(); while (scanner.Read(key1, value1)) { if (!masterScanSequential.Read(key2, value2)) { throw new Exception(); } if (!key1.IsEqualTo(key2)) { throw new Exception(); } if (!value1.IsEqualTo(value2)) { throw new Exception(); } } if (masterScan.Read(key2, value2)) { throw new Exception(); } } } list.Dispose(); master.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
/// <summary> /// /// </summary> /// <param name="teacher"></param> /// <param name="course"></param> public void CreateCourse(Teacher teacher, Course course) { ArchiveList.Add(new ArchiveItem() { CourseManager = new CourseProcessing() { Course = course, State = EnumState.Awaiting }, Teacher = teacher, StudentsAndRates = null }); }
public void TestTwoFiles() { MemoryPoolTest.TestMemoryLeak(); ArchiveList<HistorianKey, HistorianValue> list = new ArchiveList<HistorianKey, HistorianValue>(null); HistorianKey key1 = new HistorianKey(); HistorianKey key2 = new HistorianKey(); HistorianValue value1 = new HistorianValue(); HistorianValue value2 = new HistorianValue(); var master = CreateTable(); var table1 = CreateTable(); var table2 = CreateTable(); AddData(master, 100, 100, 100); AddData(table1, 100, 100, 100); AddData(master, 101, 100, 100); AddData(table2, 101, 100, 100); using (var editor = list.AcquireEditLock()) { editor.Add(table1); editor.Add(table2); } using (var masterRead = master.BeginRead()) { var masterScan = masterRead.GetTreeScanner(); masterScan.SeekToStart(); var masterScanSequential = masterScan.TestSequential(); using (var sequencer = new SequentialReaderStream<HistorianKey, HistorianValue>(list)) { var scanner = sequencer.TestSequential(); while (scanner.Read(key1, value1)) { if (!masterScanSequential.Read(key2, value2)) throw new Exception(); if (!key1.IsEqualTo(key2)) throw new Exception(); if (!value1.IsEqualTo(value2)) throw new Exception(); } if (masterScan.Read(key2, value2)) throw new Exception(); } } master.Dispose(); list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void BenchmarkRealisticSamples() { MemoryPoolTest.TestMemoryLeak(); const int Max = 1000000; const int FileCount = 1000; ArchiveList <HistorianKey, HistorianValue> list = new ArchiveList <HistorianKey, HistorianValue>(null); DateTime start = DateTime.Now.Date; HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); for (int x = 0; x < FileCount; x++) { SortedTreeTable <HistorianKey, HistorianValue> table1 = CreateTable(); AddData(table1, start.AddMinutes(2 * x), new TimeSpan(TimeSpan.TicksPerSecond), 60, 100, 1, Max / 60 / FileCount); using (ArchiveListEditor <HistorianKey, HistorianValue> editor = list.AcquireEditLock()) { editor.Add(table1); } } SeekFilterBase <HistorianKey> filter = TimestampSeekFilter.CreateFromIntervalData <HistorianKey>(start, start.AddMinutes(2 * FileCount), new TimeSpan(TimeSpan.TicksPerSecond * 2), new TimeSpan(TimeSpan.TicksPerMillisecond)); SequentialReaderStream <HistorianKey, HistorianValue> sequencer = new SequentialReaderStream <HistorianKey, HistorianValue>(list, null, filter); DebugStopwatch sw = new DebugStopwatch(); int xi = 0; double sec = sw.TimeEvent(() => { SequentialReaderStream <HistorianKey, HistorianValue> scanner = sequencer; while (scanner.Read(key, value)) { xi++; } }); System.Console.WriteLine(Max / sec / 1000000); //TreeKeyMethodsBase<HistorianKey>.WriteToConsole(); //TreeValueMethodsBase<HistorianValue>.WriteToConsole(); //Console.WriteLine("KeyMethodsBase calls"); //for (int x = 0; x < 23; x++) //{ // Console.WriteLine(TreeKeyMethodsBase<HistorianKey>.CallMethods[x] + "\t" + ((TreeKeyMethodsBase<HistorianKey>.Method)(x)).ToString()); //} //Console.WriteLine("ValueMethodsBase calls"); //for (int x = 0; x < 5; x++) //{ // Console.WriteLine(TreeValueMethodsBase<HistorianValue>.CallMethods[x] + "\t" + ((TreeValueMethodsBase<HistorianValue>.Method)(x)).ToString()); //} list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
private void LoadArchive(List <string> listFiles) { foreach (string file in listFiles) { IntPtr hArchive = new IntPtr(0); bool ret = SFileOpenArchive(file, 0, 0, ref hArchive); if (ret) { Archives.Add(file, hArchive); ArchiveList.Add(file, new MPQArchive(hArchive)); } } }
/// <summary> /// Creates a stage writer. /// </summary> /// <param name="settings">the settings for this stage</param> /// <param name="archiveList">the archive list</param> /// <param name="rolloverLog">the rollover log</param> public CombineFiles(CombineFilesSettings settings, ArchiveList <TKey, TValue> archiveList, RolloverLog rolloverLog) : base(MessageClass.Framework) { m_settings = settings.CloneReadonly(); m_settings.Validate(); m_archiveList = archiveList; m_createNextStageFile = new SimplifiedArchiveInitializer <TKey, TValue>(settings.ArchiveSettings); m_rolloverLog = rolloverLog; m_rolloverComplete = new ManualResetEvent(false); m_syncRoot = new object(); m_rolloverTask = new ScheduledTask(ThreadingMode.DedicatedForeground, ThreadPriority.BelowNormal); m_rolloverTask.Running += OnExecute; m_rolloverTask.UnhandledException += OnException; m_rolloverTask.Start(m_settings.ExecuteTimer); }
/// <summary> /// Creates a <see cref="WriteProcessor{TKey,TValue}"/>. /// </summary> /// <param name="list">the master list of archive files</param> /// <param name="settings">the settings</param> /// <param name="rolloverLog">the rollover log value</param> public WriteProcessor(ArchiveList <TKey, TValue> list, WriteProcessorSettings settings, RolloverLog rolloverLog) : base(MessageClass.Framework) { m_settings = settings.CloneReadonly(); m_settings.Validate(); m_stagingRollovers = new List <CombineFiles <TKey, TValue> >(); m_firstStageWriter = new FirstStageWriter <TKey, TValue>(settings.FirstStageWriter, list); m_isMemoryOnly = false; m_prebuffer = new PrebufferWriter <TKey, TValue>(settings.PrebufferWriter, m_firstStageWriter.AppendData); m_transactionTracker = new TransactionTracker <TKey, TValue>(m_prebuffer, m_firstStageWriter); foreach (CombineFilesSettings rollover in settings.StagingRollovers) { m_stagingRollovers.Add(new CombineFiles <TKey, TValue>(rollover, list, rolloverLog)); } }
/// <summary> /// Recovers this rollover during an application crash. /// </summary> /// <param name="list"></param> public void Recover(ArchiveList list) { using (var edit = list.AcquireEditLock()) { //If the destination file exists, the rollover is complete. Therefore remove any source file. if (edit.Contains(DestinationFile)) { foreach (var source in SourceFiles) { if (edit.Contains(source)) { edit.TryRemoveAndDelete(source); } } } //Otherwise, delete the destination file (which is allow the ~d2 cleanup to occur). } Delete(); }
public void SetMap(Map map) { ArchiveList.Clear(); if (map == null) { return; } for (int i = 0; i < map.Rooms.Count; i++) { ArchiveList.Add(map.Rooms[i]); } ArchiveList.Add(map.Stage); if (map.Rooms.Count > 0) { SelectedScene = map.Rooms[0]; } }
/// <summary> /// Creates a stage writer. /// </summary> public FirstStageWriter(FirstStageWriterSettings settings, ArchiveList <TKey, TValue> list) : base(MessageClass.Framework) { if (settings is null) { throw new ArgumentNullException("settings"); } m_settings = settings.CloneReadonly(); m_settings.Validate(); m_createNextStageFile = new SimplifiedArchiveInitializer <TKey, TValue>(m_settings.FinalSettings); m_rolloverComplete = new SafeManualResetEvent(false); m_list = list; m_pendingTables1 = new List <SortedTreeTable <TKey, TValue> >(); m_pendingTables2 = new List <SortedTreeTable <TKey, TValue> >(); m_pendingTables3 = new List <SortedTreeTable <TKey, TValue> >(); m_syncRoot = new object(); m_rolloverTask = new ScheduledTask(ThreadingMode.DedicatedForeground, ThreadPriority.Normal); m_rolloverTask.Running += RolloverTask_Running; m_rolloverTask.UnhandledException += OnProcessException; }
/// <summary> /// Creates a new <see cref="RolloverLog"/> /// </summary> /// <param name="settings">the settings</param> /// <param name="list">the list</param> public RolloverLog(RolloverLogSettings settings, ArchiveList list) { m_settings = settings.CloneReadonly(); m_settings.Validate(); if (settings.IsFileBacked) { foreach (var logFile in Directory.GetFiles(settings.LogPath, settings.SearchPattern)) { var log = new RolloverLogFile(logFile); if (log.IsValid) { log.Recover(list); } else { log.Delete(); } } } }
public override string Render() { // TODO: how to check if a settings exists? type = ArchiveList.monthly; // default format = "html"; showPostCount = true; if (widget.Settings.Count > 0) { type = (ArchiveList) Enum.Parse(typeof (ArchiveList), widget.Settings["type"]); format = widget.Settings["format"]; showPostCount = Convert.ToBoolean(widget.Settings["show_post_count"].ToLower()); //int? limit; before = widget.Settings["before"]; after = widget.Settings["after"]; } // TODO: support others list types switch (type) { case ArchiveList.yearly: break; case ArchiveList.daily: break; case ArchiveList.weekly: break; case ArchiveList.postbypost: break; case ArchiveList.monthly: default: return GetMonthly(); } return string.Empty; }
public void ConsoleTest3() { MemoryPoolTest.TestMemoryLeak(); ArchiveList<HistorianKey, HistorianValue> list = new ArchiveList<HistorianKey, HistorianValue>(null); DateTime start = DateTime.Now.Date; for (int x = 0; x < 3; x++) { var table1 = CreateTable(); AddDataTerminal(table1, (ulong)x, start, new TimeSpan(TimeSpan.TicksPerSecond), (ulong)(1000 * x), 1, 60 * 60); using (var editor = list.AcquireEditLock()) { editor.Add(table1); } } for (int x = 0; x < 3; x++) { var table1 = CreateTable(); AddDataTerminal(table1, (ulong)x, start, new TimeSpan(TimeSpan.TicksPerSecond), (ulong)(1000 * x), 1, 60 * 60); using (var editor = list.AcquireEditLock()) { editor.Add(table1); } } var filter = TimestampSeekFilter.CreateFromIntervalData<HistorianKey>(start, start.AddMinutes(10), new TimeSpan(TimeSpan.TicksPerSecond * 60), new TimeSpan(TimeSpan.TicksPerSecond)); var sequencer = new SequentialReaderStream<HistorianKey, HistorianValue>(list, null, filter); var frames = sequencer.GetFrames(); WriteToConsole(frames); list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void BenchmarkRealisticSamples() { MemoryPoolTest.TestMemoryLeak(); const int Max = 1000000; const int FileCount = 1000; ArchiveList<HistorianKey, HistorianValue> list = new ArchiveList<HistorianKey, HistorianValue>(null); DateTime start = DateTime.Now.Date; HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); for (int x = 0; x < FileCount; x++) { var table1 = CreateTable(); AddData(table1, start.AddMinutes(2 * x), new TimeSpan(TimeSpan.TicksPerSecond), 60, 100, 1, Max / 60 / FileCount); using (var editor = list.AcquireEditLock()) { editor.Add(table1); } } var filter = TimestampSeekFilter.CreateFromIntervalData<HistorianKey>(start, start.AddMinutes(2 * FileCount), new TimeSpan(TimeSpan.TicksPerSecond * 2), new TimeSpan(TimeSpan.TicksPerMillisecond)); var sequencer = new SequentialReaderStream<HistorianKey, HistorianValue>(list, null, filter); DebugStopwatch sw = new DebugStopwatch(); int xi = 0; double sec = sw.TimeEvent(() => { var scanner = sequencer; while (scanner.Read(key,value)) { xi++; } }); System.Console.WriteLine(Max / sec / 1000000); //TreeKeyMethodsBase<HistorianKey>.WriteToConsole(); //TreeValueMethodsBase<HistorianValue>.WriteToConsole(); //Console.WriteLine("KeyMethodsBase calls"); //for (int x = 0; x < 23; x++) //{ // Console.WriteLine(TreeKeyMethodsBase<HistorianKey>.CallMethods[x] + "\t" + ((TreeKeyMethodsBase<HistorianKey>.Method)(x)).ToString()); //} //Console.WriteLine("ValueMethodsBase calls"); //for (int x = 0; x < 5; x++) //{ // Console.WriteLine(TreeValueMethodsBase<HistorianValue>.CallMethods[x] + "\t" + ((TreeValueMethodsBase<HistorianValue>.Method)(x)).ToString()); //} list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void BenchmarkThreeFiles() { MemoryPoolTest.TestMemoryLeak(); const int Max = 1000000; ArchiveList<HistorianKey, HistorianValue> list = new ArchiveList<HistorianKey, HistorianValue>(null); HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); var table1 = CreateTable(); var table2 = CreateTable(); var table3 = CreateTable(); AddData(table1, 100, 100, Max / 3); AddData(table2, 101, 100, Max / 3); AddData(table3, 102, 100, Max / 3); using (var editor = list.AcquireEditLock()) { editor.Add(table1); editor.Add(table2); editor.Add(table3); } var sequencer = new SequentialReaderStream<HistorianKey, HistorianValue>(list); DebugStopwatch sw = new DebugStopwatch(); double sec = sw.TimeEvent(() => { var scanner = sequencer; while (scanner.Read(key,value)) { } }); System.Console.WriteLine(Max / sec / 1000000); list.Dispose(); MemoryPoolTest.TestMemoryLeak(); }
public void ListArchivesTest() { string returnString = "{\n" + " \"count\" : 6,\n" + " \"items\" : [ {\n" + " \"createdAt\" : 1395187930000,\n" + " \"duration\" : 22,\n" + " \"id\" : \"ef546c5a-4fd7-4e59-ab3d-f1cfb4148d1d\",\n" + " \"name\" : \"\",\n" + " \"partnerId\" : 123456,\n" + " \"reason\" : \"\",\n" + " \"sessionId\" : \"SESSIONID\",\n" + " \"size\" : 2909274,\n" + " \"status\" : \"available\",\n" + " \"url\" : \"http://tokbox.com.archive2.s3.amazonaws.com/123456%2Fef546c5" + "a-4fd7-4e59-ab3d-f1cfb4148d1d%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6" + "LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n" + " }, {\n" + " \"createdAt\" : 1395187910000,\n" + " \"duration\" : 14,\n" + " \"id\" : \"5350f06f-0166-402e-bc27-09ba54948512\",\n" + " \"name\" : \"\",\n" + " \"partnerId\" : 123456,\n" + " \"reason\" : \"\",\n" + " \"sessionId\" : \"SESSIONID\",\n" + " \"size\" : 1952651,\n" + " \"status\" : \"available\",\n" + " \"url\" : \"http://tokbox.com.archive2.s3.amazonaws.com/123456%2F5350f06" + "f-0166-402e-bc27-09ba54948512%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6" + "LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n" + " }, {\n" + " \"createdAt\" : 1395187836000,\n" + " \"duration\" : 62,\n" + " \"id\" : \"f6e7ee58-d6cf-4a59-896b-6d56b158ec71\",\n" + " \"name\" : \"\",\n" + " \"partnerId\" : 123456,\n" + " \"reason\" : \"\",\n" + " \"sessionId\" : \"SESSIONID\",\n" + " \"size\" : 8347554,\n" + " \"status\" : \"available\",\n" + " \"url\" : \"http://tokbox.com.archive2.s3.amazonaws.com/123456%2Ff6e7ee5" + "8-d6cf-4a59-896b-6d56b158ec71%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6" + "LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n" + " }, {\n" + " \"createdAt\" : 1395183243000,\n" + " \"duration\" : 544,\n" + " \"id\" : \"30b3ebf1-ba36-4f5b-8def-6f70d9986fe9\",\n" + " \"name\" : \"\",\n" + " \"partnerId\" : 123456,\n" + " \"reason\" : \"\",\n" + " \"sessionId\" : \"SESSIONID\",\n" + " \"size\" : 78499758,\n" + " \"status\" : \"available\",\n" + " \"url\" : \"http://tokbox.com.archive2.s3.amazonaws.com/123456%2F30b3ebf" + "1-ba36-4f5b-8def-6f70d9986fe9%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6" + "LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n" + " }, {\n" + " \"createdAt\" : 1394396753000,\n" + " \"duration\" : 24,\n" + " \"id\" : \"b8f64de1-e218-4091-9544-4cbf369fc238\",\n" + " \"name\" : \"showtime again\",\n" + " \"partnerId\" : 123456,\n" + " \"reason\" : \"\",\n" + " \"sessionId\" : \"SESSIONID\",\n" + " \"size\" : 2227849,\n" + " \"status\" : \"available\",\n" + " \"url\" : \"http://tokbox.com.archive2.s3.amazonaws.com/123456%2Fb8f64de" + "1-e218-4091-9544-4cbf369fc238%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6" + "LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n" + " }, {\n" + " \"createdAt\" : 1394321113000,\n" + " \"duration\" : 1294,\n" + " \"id\" : \"832641bf-5dbf-41a1-ad94-fea213e59a92\",\n" + " \"name\" : \"showtime\",\n" + " \"partnerId\" : 123456,\n" + " \"reason\" : \"\",\n" + " \"sessionId\" : \"SESSIONID\",\n" + " \"size\" : 42165242,\n" + " \"status\" : \"available\",\n" + " \"url\" : \"http://tokbox.com.archive2.s3.amazonaws.com/123456%2F832641b" + "f-5dbf-41a1-ad94-fea213e59a92%2Farchive.mp4?Expires=1395188695&AWSAccessKeyId=AKIAI6" + "LQCPIXYVWCQV6Q&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n" + " } ]\n" + " }"; var mockClient = new Mock <HttpClient>(); mockClient.Setup(httpClient => httpClient.Get(It.IsAny <string>())).Returns(returnString); OpenTok opentok = new OpenTok(apiKey, apiSecret); opentok.Client = mockClient.Object; ArchiveList archives = opentok.ListArchives(); Assert.NotNull(archives); Assert.Equal(6, archives.Count); mockClient.Verify(httpClient => httpClient.Get(It.Is <string>(url => url.Equals("v2/partner/" + apiKey + "/archive?offset=0"))), Times.Once()); }
public async Task Refresh() { await ArchiveList.Refresh(); }
public void Search(string query) { ArchiveList.Search(query); }
public SequentialReaderStream(ArchiveList <TKey, TValue> archiveList, SortedTreeEngineReaderOptions readerOptions = null, SeekFilterBase <TKey> keySeekFilter = null, MatchFilterBase <TKey, TValue> keyMatchFilter = null, WorkerThreadSynchronization workerThreadSynchronization = null) { if (readerOptions is null) { readerOptions = SortedTreeEngineReaderOptions.Default; } if (keySeekFilter is null) { keySeekFilter = new SeekFilterUniverse <TKey>(); } if (keyMatchFilter is null) { keyMatchFilter = new MatchFilterUniverse <TKey, TValue>(); } if (workerThreadSynchronization is null) { m_ownsWorkerThreadSynchronization = true; workerThreadSynchronization = new WorkerThreadSynchronization(); } m_workerThreadSynchronization = workerThreadSynchronization; m_pointCount = 0; m_keySeekFilter = keySeekFilter; m_keyMatchFilter = keyMatchFilter; m_keyMatchIsUniverse = m_keyMatchFilter as MatchFilterUniverse <TKey, TValue> != null; if (readerOptions.Timeout.Ticks > 0) { m_timeout = new TimeoutOperation(); m_timeout.RegisterTimeout(readerOptions.Timeout, () => m_timedOut = true); } m_snapshot = archiveList.CreateNewClientResources(); m_snapshot.UpdateSnapshot(); m_tablesOrigList = new List <BufferedArchiveStream <TKey, TValue> >(); for (int x = 0; x < m_snapshot.Tables.Count(); x++) { ArchiveTableSummary <TKey, TValue> table = m_snapshot.Tables[x]; if (table != null) { if (table.Contains(keySeekFilter.StartOfRange, keySeekFilter.EndOfRange)) { try { m_tablesOrigList.Add(new BufferedArchiveStream <TKey, TValue>(x, table)); } catch (Exception e) { //ToDo: Make sure firstkey.tostring doesn't ever throw an exception. StringBuilder sb = new StringBuilder(); sb.AppendLine($"Archive ID {table.FileId}"); sb.AppendLine($"First Key {table.FirstKey.ToString()}"); sb.AppendLine($"Last Key {table.LastKey.ToString()}"); sb.AppendLine($"File Size {table.SortedTreeTable.BaseFile.ArchiveSize}"); sb.AppendLine($"File Name {table.SortedTreeTable.BaseFile.FilePath}"); Log.Publish(MessageLevel.Error, "Error while reading file", sb.ToString(), null, e); } } else { m_snapshot.Tables[x] = null; } } } m_sortedArchiveStreams = new CustomSortHelper <BufferedArchiveStream <TKey, TValue> >(m_tablesOrigList, IsLessThan); m_keySeekFilter.Reset(); if (m_keySeekFilter.NextWindow()) { SeekToKey(m_keySeekFilter.StartOfFrame); } else { Dispose(); } }
public void Search(Category category) { ArchiveList.Search(category); }
/// <summary> /// /// </summary> /// <param name="item"></param> public void AddData(ArchiveItem item) => ArchiveList.Add(item);
/// <summary> /// /// </summary> /// <param name="index"></param> public void RemoveDataAt(int index) => ArchiveList.RemoveAt(index);
/// <summary> /// /// </summary> /// <param name="teacher"></param> /// <param name="course"></param> /// <returns></returns> public ArchiveItem FindData(Teacher teacher, Course course) => ArchiveList.Find(i => i.CourseManager.Course == course && i.Teacher == teacher);
public MainModule(OpenTokService opentokService) { Get["/"] = _ => View["index"]; Get["/host"] = _ => { dynamic locals = new ExpandoObject(); locals.ApiKey = opentokService.OpenTok.ApiKey.ToString(); locals.SessionId = opentokService.Session.Id; locals.Token = opentokService.Session.GenerateToken(); return(View["host", locals]); }; Get["/participant"] = _ => { dynamic locals = new ExpandoObject(); locals.ApiKey = opentokService.OpenTok.ApiKey.ToString(); locals.SessionId = opentokService.Session.Id; locals.Token = opentokService.Session.GenerateToken(); return(View["participant", locals]); }; Get["/history"] = _ => { var page = Request.Query.page.HasValue ? (int)Request.Query.page : 1; var offset = (page - 1) * 5; ArchiveList archives = opentokService.OpenTok.ListArchives(offset, 5); string showPrevious = page > 1 ? "/history?page=" + (page - 1).ToString() : null; string showNext = archives.TotalCount > (offset + 5) ? "/history?page=" + (page + 1).ToString() : null; dynamic locals = new ExpandoObject(); locals.Archives = archives; locals.ShowPrevious = showPrevious; locals.ShowNext = showNext; return(View["history", locals]); }; Get["/download/{id}"] = parameters => { Archive archive = opentokService.OpenTok.GetArchive(parameters.id); return(Response.AsRedirect(archive.Url)); }; Post["/start"] = _ => { Archive archive = opentokService.OpenTok.StartArchive( opentokService.Session.Id, name: ".NET Archiving Sample App", hasAudio: (Boolean)(this.Request.Form.hasAudio), hasVideo: (Boolean)(this.Request.Form.hasVideo), outputMode: (this.Request.Form.outputMode == "composed" ? OutputMode.COMPOSED : OutputMode.INDIVIDUAL) ); return(archive); }; Get["/stop/{id}"] = parameters => { Archive archive = opentokService.OpenTok.StopArchive(parameters.id); return(archive); }; Get["/delete/{id}"] = parameters => { opentokService.OpenTok.DeleteArchive(parameters.id); return(Response.AsRedirect("/history")); }; }
/// <summary> /// Recovers this rollover during an application crash. /// </summary> /// <param name="list"></param> public void Recover(ArchiveList list) { using (var edit = list.AcquireEditLock()) { //If the destination file exists, the rollover is complete. Therefore remove any source file. if (edit.Contains(DestinationFile)) { foreach (var source in SourceFiles) { if (edit.Contains(source)) edit.TryRemoveAndDelete(source); } } //Otherwise, delete the destination file (which is allow the ~d2 cleanup to occur). } Delete(); }
/** * Returns a List of Archive objects, representing archives that are both * both completed and in-progress, for your API key. * * @param offset The index offset of the first archive. 0 is offset of the most recently * started archive. 1 is the offset of the archive that started prior to the most recent * archive. * * @param count The number of archives to be returned. The maximum number of archives * returned is 1000. * * @return A List of Archive objects. */ public ArchiveList ListArchives(int offset, int count) { if (count < 0) { throw new OpenTokArgumentException("count cannot be smaller than 1"); } string url = string.Format("v2/partner/{0}/archive?offset={1}", this.ApiKey, offset); if (count > 0) { url = string.Format("{0}&count={1}", url, count); } string response = Client.Get(url); JObject archives = JObject.Parse(response); JArray archiveArray = (JArray)archives["items"]; ArchiveList archiveList = new ArchiveList(archiveArray.ToObject<List<Archive>>(), (int)archives["count"]); return archiveList; }
public SequentialReaderStream(ArchiveList <TKey, TValue> archiveList, SortedTreeEngineReaderOptions readerOptions = null, SeekFilterBase <TKey> keySeekFilter = null, MatchFilterBase <TKey, TValue> keyMatchFilter = null, WorkerThreadSynchronization workerThreadSynchronization = null) { if (readerOptions == null) { readerOptions = SortedTreeEngineReaderOptions.Default; } if (keySeekFilter == null) { keySeekFilter = new SeekFilterUniverse <TKey>(); } if (keyMatchFilter == null) { keyMatchFilter = new MatchFilterUniverse <TKey, TValue>(); } if (workerThreadSynchronization == null) { m_ownsWorkerThreadSynchronization = true; workerThreadSynchronization = new WorkerThreadSynchronization(); } m_workerThreadSynchronization = workerThreadSynchronization; m_pointCount = 0; m_keySeekFilter = keySeekFilter; m_keyMatchFilter = keyMatchFilter; m_keyMatchIsUniverse = (m_keyMatchFilter as MatchFilterUniverse <TKey, TValue>) != null; if (readerOptions.Timeout.Ticks > 0) { m_timeout = new TimeoutOperation(); m_timeout.RegisterTimeout(readerOptions.Timeout, () => m_timedOut = true); } m_snapshot = archiveList.CreateNewClientResources(); m_snapshot.UpdateSnapshot(); m_tablesOrigList = new List <BufferedArchiveStream <TKey, TValue> >(); for (int x = 0; x < m_snapshot.Tables.Count(); x++) { ArchiveTableSummary <TKey, TValue> table = m_snapshot.Tables[x]; if (table != null) { if (table.Contains(keySeekFilter.StartOfRange, keySeekFilter.EndOfRange)) { m_tablesOrigList.Add(new BufferedArchiveStream <TKey, TValue>(x, table)); } else { m_snapshot.Tables[x] = null; } } } m_sortedArchiveStreams = new CustomSortHelper <BufferedArchiveStream <TKey, TValue> >(m_tablesOrigList, IsLessThan); m_keySeekFilter.Reset(); if (m_keySeekFilter.NextWindow()) { SeekToKey(m_keySeekFilter.StartOfFrame); } else { Dispose(); } }