private void WriteIntAtPosition(int value, int writePosition)
        {
            var oldPosition = UW.BaseStream.Position;

            UW.BaseStream.Position = writePosition;
            UW.Write(value);
            UW.BaseStream.Position = oldPosition;
        }
 private void SerializeDependsTable(int exportCount)
 {
     WriteIntAtPosition((int)UW.BaseStream.Position, DependsOffsetPosition);
     for (int i = 0; i < exportCount; i++)
     {
         UW.Write(0);
     }
 }
        private void initHeader()
        {
            UW.BaseStream.Position = 0;
            //Tag
            UW.Write(UnrealPackage.Signature);
            //File Version
            var version = (int)(DummyFileVersion & 0x0000FFFFU) | DummyLicenseeVersion << 16;

            UW.Write(version);
            //Total HeaderSize will be calculated later
            UW.Write(0);
            //Group name
            UW.WriteString("None");
            //Package flags
            UW.Write(DummyPackageFlag);

            //Name / Import / Export count and offsets
            UW.Write(0);
            UW.Write(1);
            UW.Write(2);
            UW.Write(3);
            UW.Write(4);
            UW.Write(5);

            //DependsOffset / ImportExportGuidsOffset / ImportGuidsCount / ExportGuidsCount / ThumbnailTableOffset
            UW.Write(0);
            UW.Write(0);
            UW.Write(0);
            UW.Write(0);
            UW.Write(0);

            //guid (this might work?..)
            UW.Write(Guid.Parse(package.GUID).ToByteArray(), 0, 16);

            //Generations
            package.Generations.Serialize(this);

            //EngineVersion
            UW.Write(DummyEngineVersion);

            //CookerVersion
            UW.Write(DummyCookerVersion);
            //CompressionFlags
            UW.Write(DummyCompression);
            //compressedChunks
            UW.Write(DummyCompressedChunksData);
            //Unknown5
            UW.Write(DummyUnknown5);
            //UnknownStringArray
            UW.Write(DummyUnknownStringArray);
            //UnknownTypeArray
            UW.Write(DummyUnknownTypeArray);
        }
Exemplo n.º 4
0
        internal void DisposeBuffer()
        {
            if (UR != null)
            {
                UR.Dispose();
                UR = null;
            }

            if (UW != null)
            {
                UW.Dispose();
                UW = null;
            }

            // Closed by the above, but this is just for ensurance.
            Dispose();
        }
        private void SerializeExportSerialData(List <DummyExportTableItem> exportsToSerialize)
        {
            int noneIndex = package.Names.FindIndex((n) => n.Name == "None");

            foreach (var dummyExport in exportsToSerialize)
            {
                var exportObject = dummyExport.original;
                var dummyClass   = dummyFactory.Create(exportObject.ClassName);
                if (dummyClass != null)
                {
                    dummyClass.Write(this, package);
                }
                else
                {
                    //We just need the netindex and a None FName
                    package.Stream.Position = exportObject.SerialOffset;
                    //NetIndex
                    UW.Write(package.Stream.ReadInt32());
                    //None index and count
                    UW.Write(noneIndex);
                    UW.Write(0);
                }
            }
        }
Exemplo n.º 6
0
 protected override void HandleTransformChanged(object o, UW.ClassroomPresenter.Model.PropertyEventArgs args)
 {
     this.Invalidate();
     base.HandleTransformChanged(o, args);
 }
 public void ForceUpdate(UW.ClassroomPresenter.Network.Groups.Group receivers)
 {
     //Nothing
 }
 public override void ForceUpdate(UW.ClassroomPresenter.Network.Groups.Group receivers)
 {
     this.SendImage(receivers);
 }
Exemplo n.º 9
0
        public void Serialize()
        {
            initHeader();

            //Serialize name table
            var nameOffset = UW.BaseStream.Position;

            WriteIntAtPosition(package.Names.Count(), NameCountPosition);
            WriteIntAtPosition((int)nameOffset, NameCountPosition + 4);

            foreach (var name in package.Names)
            {
                name.Serialize(this);
            }

            //Serialize imports table
            var importOffset = UW.BaseStream.Position;

            WriteIntAtPosition(package.Imports.Count(), ImportCountPosition);
            WriteIntAtPosition((int)importOffset, ImportCountPosition + 4);
            foreach (var import in package.Imports)
            {
                import.Serialize(this);
            }

            var exportsToSerialize = package.Exports;

            //var exportsToSerialize = new List<UExportTableItem>() { package.Exports[1], package.Exports[3] };
            //WriteIntAtPosition();
            var exportOffset = UW.BaseStream.Position;

            WriteIntAtPosition(exportsToSerialize.Count(), ExportCountPosition);
            WriteIntAtPosition((int)exportOffset, ExportCountPosition + 4);

            int footerNumbers             = 8;
            int calculatedTotalHeaderSize = (int)(UW.BaseStream.Position + ExportTableItemSize * exportsToSerialize.Count()) + footerNumbers * 4; //24 = unknown footer data
            int serialOffset = calculatedTotalHeaderSize;

            foreach (var export in exportsToSerialize)
            {
                switch (export.ClassName)
                {
                case "Texture2D":
                    DummyExportTableSerialize(export, serialOffset, MinimalTexture2D.serialSize);
                    serialOffset += MinimalTexture2D.serialSize;
                    break;

                default:
                    DummyExportTableSerialize(export, serialOffset, DummySerialSize);
                    serialOffset += DummySerialSize;
                    break;
                }

                //export.Serialize( this );
            }
            //unknown footer info
            WriteIntAtPosition((int)UW.BaseStream.Position, 49);
            WriteIntAtPosition((int)UW.BaseStream.Position, 53);
            WriteIntAtPosition((int)UW.BaseStream.Position, 65);
            for (int ii = 0; ii < footerNumbers; ii++)
            {
                UW.Write(0);
            }

            WriteIntAtPosition((int)UW.BaseStream.Position, TotalHeaderSizePosition);

            int noneIndex = package.Names.FindIndex((n) => n.Name == "None");

            foreach (var exportObject in exportsToSerialize)
            {
                switch (exportObject.ClassName)
                {
                case "Texture2D":
                    new MinimalTexture2D().Write(this, package);
                    //MinimalTexture2D.Write(this, package);
                    break;

                default:
                    //We just need the netindex and a None FName
                    package.Stream.Position = exportObject.SerialOffset;
                    //NetIndex
                    UW.Write(package.Stream.ReadInt32());
                    //None index and count
                    UW.Write(noneIndex);
                    UW.Write(0);
                    break;
                }
            }

            //var stream = package.Stream;
            //// Serialize tables
            //var namesBuffer = new UObjectStream(stream);
            //foreach (var name in package.Names)
            //{
            //    name.Serialize(namesBuffer);
            //}

            //var importsBuffer = new UObjectStream(stream);
            //foreach (var import in package.Imports)
            //{
            //    import.Serialize(importsBuffer);
            //}

            //var exportsBuffer = new UObjectStream(stream);
            //foreach (var export in package.Exports)
            //{
            //    //export.Serialize( exportsBuffer );
            //}

            //stream.Seek(0, SeekOrigin.Begin);

            //stream.Write(Signature);

            //// Serialize header
            //var version = (int)(Version & 0x0000FFFFU) | (LicenseeVersion << 16);
            //stream.Write(version);

            //var headerSizePosition = stream.Position;
            //if (Version >= VHeaderSize)
            //{
            //    stream.Write((int)HeaderSize);
            //    if (Version >= VGroup)
            //    {
            //        stream.WriteString(Group);
            //    }
            //}

            //stream.Write(PackageFlags);

            //_TablesData.NamesCount = (uint)Names.Count;
            //_TablesData.ExportsCount = (uint)Exports.Count;
            //_TablesData.ImportsCount = (uint)Imports.Count;

            //var tablesDataPosition = stream.Position;
            //_TablesData.Serialize(stream);

            //// TODO: Serialize Heritages

            //stream.Write(Guid.NewGuid().ToByteArray(), 0, 16);
            //Generations.Serialize(stream);

            //if (Version >= VEngineVersion)
            //{
            //    stream.Write(EngineVersion);
            //    if (Version >= VCOOKEDPACKAGES)
            //    {
            //        stream.Write(CookerVersion);

            //        if (Version >= VCompression)
            //        {
            //            if (IsCooked())
            //            {
            //                stream.Write(CompressionFlags);
            //                CompressedChunks.Serialize(stream);
            //            }
            //        }
            //    }
            //}

            //// TODO: Unknown data
            //stream.Write((uint)0);

            //// Serialize objects

            //// Write tables

            //// names
            //Log.Info("Writing names at position " + stream.Position);
            //_TablesData.NamesOffset = (uint)stream.Position;
            //var namesBytes = namesBuffer.GetBuffer();
            //stream.Write(namesBytes, 0, (int)namesBuffer.Length);

            //// imports
            //Log.Info("Writing imports at position " + stream.Position);
            //_TablesData.ImportsOffset = (uint)stream.Position;
            //var importsBytes = importsBuffer.GetBuffer();
            //stream.Write(importsBytes, 0, (int)importsBuffer.Length);

            //// exports
            //Log.Info("Writing exports at position " + stream.Position);

            //// Serialize tables data again now that offsets are known.
            //var currentPosition = stream.Position;
            //stream.Seek(tablesDataPosition, SeekOrigin.Begin);
            //_TablesData.Serialize(stream);
            //stream.Seek(currentPosition, SeekOrigin.Begin);
        }
Exemplo n.º 10
0
 public RecvLogMessage( long time, UW.ClassroomPresenter.Network.Messages.Message msg )
     : base(time)
 {
     this.message = msg;
 }
Exemplo n.º 11
0
 public SendLogMessage( long time, UW.ClassroomPresenter.Network.Messages.Message msg, MessagePriority prior )
     : base(time)
 {
     this.message = msg;
     this.priority = prior;
 }
Exemplo n.º 12
0
 public void LogMessageSend( UW.ClassroomPresenter.Network.Messages.Message message, MessagePriority priority )
 {
     using( Synchronizer.Lock( this.SyncRoot ) ) {
         this.LogMessages.Add( new SendLogMessage( AccurateTiming.Now, message, priority ) );
     }
 }
Exemplo n.º 13
0
 public void LogMessageRecv( UW.ClassroomPresenter.Network.Messages.Message message )
 {
     using( Synchronizer.Lock( this.SyncRoot ) ) {
         this.LogMessages.Add( new RecvLogMessage( AccurateTiming.Now, message ) );
     }
 }
Exemplo n.º 14
0
 private void displayMessageEventRecursive(UW.ClassroomPresenter.Network.Messages.Message msg)
 {
     this.appendText("-----");
     string longtype = msg.GetType().ToString();
     string shorttype = longtype.Substring(longtype.LastIndexOf(".") + 1);
     this.appendText("Type: " + shorttype);
     if (msg is DeckSlideContentMessage) {
         DeckSlideContentMessage dscm = msg as DeckSlideContentMessage;
         this.appendText("Content Hash: " + dscm.Content.key.ToString());
         this.m_Image = dscm.Content.image;
     } else if (msg is PresentationEndedMessage) {
         //Nothing really interesting here...
     } else if (msg is TableOfContentsEntryMessage) {
         TableOfContentsEntryMessage tocem = msg as TableOfContentsEntryMessage;
         string toDisplay = "Path From Root: ";
         int[] path = tocem.PathFromRoot;
         for (int i = 0; i < path.Length; i++) {
             toDisplay += " " + path[i].ToString();
         }
         this.appendText(toDisplay);
     } else if (msg is TableOfContentsEntryRemovedMessage) {
         TableOfContentsEntryRemovedMessage tocerm = msg as TableOfContentsEntryRemovedMessage;
         this.appendText("Entry ID: " + tocerm.TargetId.ToString());
     } else if (msg is InstructorMessage) {
         InstructorMessage im = msg as InstructorMessage;
         this.appendText("Linked Navigation: " + im.ForcingStudentNavigationLock.ToString());
         this.appendText("Student Submissions: " + im.AcceptingStudentSubmissions.ToString());
     } else if (msg is StudentMessage) {
         //Nothing really interesting here...
     } else if (msg is PublicMessage) {
         //Nothing really interesting here...
     } else if (msg is InstructorCurrentPresentationChangedMessage) {
         InstructorCurrentPresentationChangedMessage icpcm = msg as InstructorCurrentPresentationChangedMessage;
         this.appendText("Human Name: " + icpcm.HumanName);
     } else if (msg is InstructorCurrentDeckTraversalChangedMessage) {
         InstructorCurrentDeckTraversalChangedMessage icdtcm = msg as InstructorCurrentDeckTraversalChangedMessage;
         this.appendText("Traversal ID: " + icdtcm.TargetId.ToString());
     } else if (msg is DeckInformationMessage) {
         DeckInformationMessage dim = msg as DeckInformationMessage;
         this.appendText("Disposition: " + dim.Disposition);
         this.appendText("Human Name: " + dim.HumanName);
         this.appendText("Deck BG Color: " + dim.DeckBackgroundColor);
     } else if (msg is SlideDeckTraversalMessage) {
         SlideDeckTraversalMessage sdtm = msg as SlideDeckTraversalMessage;
         this.appendText("Traversal ID: " + sdtm.TargetId.ToString());
     } else if (msg is DeckTraversalRemovedFromPresentationMessage) {
         DeckTraversalRemovedFromPresentationMessage dtrfpm = msg as DeckTraversalRemovedFromPresentationMessage;
         this.appendText("Traversal ID: " + dtrfpm.TargetId.ToString());
     } else if (msg is ImageSheetMessage) {
         ImageSheetMessage ism = msg as ImageSheetMessage;
         this.appendText("MD5: " + ism.MD5.ToString());
     } else if (msg is InkSheetInformationMessage) {
         InkSheetInformationMessage isim = msg as InkSheetInformationMessage;
         this.appendText("Disposition: " + isim.Disposition.ToString());
     } else if (msg is InkSheetStrokesAddedMessage) {
         InkSheetStrokesAddedMessage issam = msg as InkSheetStrokesAddedMessage;
         this.appendText("Disposition: " + issam.Disposition.ToString());
     } else if (msg is InkSheetStrokesDeletingMessage) {
         InkSheetStrokesDeletingMessage issdm = msg as InkSheetStrokesDeletingMessage;
         this.appendText("Disposition: " + issdm.Disposition.ToString());
     } else if (msg is PresentationInformationMessage) {
         PresentationInformationMessage pim = msg as PresentationInformationMessage;
         this.appendText("Human Name: " + pim.HumanName);
     } else if (msg is RealTimeInkSheetMessage) {
         RealTimeInkSheetMessage rtism = msg as RealTimeInkSheetMessage;
         this.appendText("Disposition: " + rtism.Disposition.ToString());
     } else if (msg is RealTimeInkSheetInformationMessage) {
         RealTimeInkSheetInformationMessage rtisim = msg as RealTimeInkSheetInformationMessage;
         this.appendText("Disposition: " + rtisim.Disposition.ToString());
     } else if (msg is RealTimeInkSheetDataMessage) {
         RealTimeInkSheetDataMessage rtisdm = msg as RealTimeInkSheetDataMessage;
         this.appendText("Stylus ID: " + rtisdm.StylusId.ToString());
         this.appendText("# of Packets: " + rtisdm.Packets.Length);
     } else if (msg is RealTimeInkSheetPacketsMessage) {
         RealTimeInkSheetPacketsMessage rtispm = msg as RealTimeInkSheetPacketsMessage;
         this.appendText("Stylus ID: " + rtispm.StylusId.ToString());
         this.appendText("# of Packets: " + rtispm.Packets.Length);
     } else if (msg is RealTimeInkSheetStylusUpMessage) {
         RealTimeInkSheetStylusUpMessage rtissup = msg as RealTimeInkSheetStylusUpMessage;
         this.appendText("Stylus ID: " + rtissup.StylusId.ToString());
         this.appendText("# of Packets: " + rtissup.Packets.Length);
     } else if (msg is RealTimeInkSheetStylusDownMessage) {
         RealTimeInkSheetStylusDownMessage rtissdm = msg as RealTimeInkSheetStylusDownMessage;
         this.appendText("Stylus ID: " + rtissdm.StylusId.ToString());
         this.appendText("# of Packets: " + rtissdm.Packets.Length);
     } else if (msg is SheetRemovedMessage) {
         SheetRemovedMessage srm = msg as SheetRemovedMessage;
         this.appendText("Disposition: " + srm.Disposition.ToString());
     } else if (msg is SlideInformationMessage) {
         SlideInformationMessage sim = msg as SlideInformationMessage;
         this.appendText("LocalID: " + sim.LocalId.ToString());
         this.appendText("Title: " + sim.Title);
         this.appendText("Zoom: " + sim.Zoom);
         this.appendText("Slide BG Color: " + sim.SlideBackgroundColor);
     } else if (msg is SlideDeletedMessage) {
         SlideDeletedMessage sdm = msg as SlideDeletedMessage;
         this.appendText("ID: " + sdm.TargetId);
     } else if (msg is TextSheetMessage) {
         //Nothing interesting here...
     } else {
         //Unknown!
     }
     //Do the recursive thing
     if (msg.Child != null) {
         this.displayMessageEventRecursive(msg.Child);
     }
 }
 public void ForceUpdate(UW.ClassroomPresenter.Network.Groups.Group receivers)
 {
     sender_.Post(delegate() {
         this.SendStatusHelper(receivers);
     });
 }
 public override void ForceUpdate( UW.ClassroomPresenter.Network.Groups.Group receivers )
 {
     this.SendQuickPollSheet( receivers );
 }