public MockRootObject() { _adapter = new ConnectorAdapter(typeof(DummyConnectorFactory)); _connector = _adapter.GetConnector(null); _connector.GetConnector().SuspendWriteProtection("Hoj morho vetvo mojho rodu, kto kramou rukou siahne na tvoju slobodu a co i dusu das v tom boji divokom vol nebyt ako byt otrokom!"); }
protected static Recording <P> Squash(Recording <P> recording) { var squashed = new Recording <P>(); var adapter = new ConnectorAdapter(typeof(DummyConnectorFactory)); var connector = adapter.GetConnector(new object[] { }); T current = (T)Activator.CreateInstance(typeof(T), connector, string.Empty, string.Empty); T next = (T)Activator.CreateInstance(typeof(T), connector, string.Empty, string.Empty); for (int i = 0; i < recording.Frames.LongCount(); i++) { var currentFrame = recording.Frames[i]; P currentObject = currentFrame.Object; long currentObjectStamp = recording.Frames[i].Stamp; CopyToOnline(current, currentObject); var currentTags = current.RetrieveValueTags().ToArray(); var nextFrame = currentFrame; P nextObject = currentObject; long nextObjectStamp = currentObjectStamp; CopyToOnline(next, nextObject); var nextTags = next.RetrieveValueTags().ToArray(); if (i < recording.Frames.LongCount() - 1) { nextFrame = recording.Frames[i + 1]; nextObject = nextFrame.Object; nextObjectStamp = nextFrame.Stamp; CopyToOnline(next, nextObject); nextTags = next.RetrieveValueTags().ToArray(); } var isSame = true; for (int next_index = 0; next_index < nextTags.LongCount(); next_index++) { if (((dynamic)nextTags[next_index]).Cyclic != ((dynamic)currentTags[next_index]).Cyclic) { isSame = false; break; } } if (squashed.Frames.LongCount() == 0) { squashed.Frames.Add(currentFrame); } if (isSame) { squashed.Frames.Last().Stamp = nextObjectStamp; } else { squashed.Frames.Add(nextFrame); } } return(squashed); }