Ejemplo n.º 1
0
        void IRestartable.Restart()
        {
            if (this.output is IRestartable restartable)
            {
                restartable.Restart();
            }

            this.allowWspBeforeFollowingTag = false;
            this.lastWhitespace             = false;
            this.lineLength        = 0;
            this.longestLineLength = 0;

            this.literalWhitespaceNesting = 0;
            this.literalTags     = false;
            this.literalEntities = false;
            this.cssEscaping     = false;

            this.tagNameIndex         = HtmlNameIndex._NOTANAME;
            this.previousTagNameIndex = HtmlNameIndex._NOTANAME;

            this.isEndTag        = false;
            this.isEmptyScopeTag = false;
            this.copyPending     = false;

            this.outputState = OutputState.OutsideTag;
        }
Ejemplo n.º 2
0
    private void onRecordingStateChange(OBSWebsocket sender, OutputState newState)
    {
        string state;

        switch (newState)
        {
        case OutputState.Starting:
            state = "Recording starting...";
            break;

        case OutputState.Started:
            state = "Stop recording";
            break;

        case OutputState.Stopping:
            state = "Recording stopping...";
            break;

        case OutputState.Stopped:
            state = "Start recording";
            break;

        default:
            state = "State unknown";
            break;
        }

        Debug.Log($"RecordingStateChange: {state}");
        updateRecordingText = state;
    }
Ejemplo n.º 3
0
        public void SetOutputState(OutputState state)
        {
            if (state == null)
            {
                return;
            }

            lock (listOutputslock)
            {
                var results = outputs.Where(x => x.hash == state.hash && x.idx == state.idx).ToList();

                if (results.Count > 0)
                {
                    var oldstate = results[0];
                    oldstate.spent        = state.spent;
                    oldstate.units        = state.units;
                    oldstate.hasoptreturn = state.hasoptreturn;
                }
                else
                {
                    state.Id = state.ToId();
                    outputs.Add(state);
                }
            }
        }
Ejemplo n.º 4
0
 public UnspentTx(UInt256 txHash, int blockIndex, int txIndex, int length, OutputState state)
 {
     this.txHash       = txHash;
     this.blockIndex   = blockIndex;
     this.txIndex      = txIndex;
     this.outputStates = new OutputStates(length, state);
 }
Ejemplo n.º 5
0
        private void UpdateButton(Button button, OutputState state, string label)
        {
            color  color1 = new color();
            string key    = (string)null;

            //TODO: add localization for Playing strings/MetaGen in general
            switch (state)
            {
            case OutputState.Starting:
                color1 = color.Yellow;
                //key = label=="Recording"?"CameraControl.OBS." + label + ".Starting" : "Play Starting";
                key = "Starting " + label;
                break;

            case OutputState.Started:
                color1 = color.Green;
                //key = label=="Recording"?"CameraControl.OBS." + label + ".Stop" : "Stop Play";
                key = "Stop " + label;
                break;

            case OutputState.Stopping:
                color1 = color.Orange;
                //key = label=="Recording"?"CameraControl.OBS." + label + ".Stopping" : "Stopping Play";
                key = "Stopping " + label;
                break;

            case OutputState.Stopped:
                color1 = color.Red;
                //key = label=="Recording"?"CameraControl.OBS." + label + ".Start" : "Start Play";
                key = "Start " + label;
                break;
            }
            Button    button1 = button;
            ref color local1  = ref color1;
Ejemplo n.º 6
0
 public override void Finish()
 {
     if (state_ == OutputState.Header)
     {
         WriteHeader();
     }
     if (state_ == OutputState.Footer)
     {
         state_ = OutputState.Finished;
         base.Finish();
         uint   num   = (uint)(deflater_.TotalIn & 0xFFFFFFFFu);
         uint   num2  = (uint)(crc.Value & 0xFFFFFFFFu);
         byte[] array = new byte[8]
         {
             (byte)num2,
             (byte)(num2 >> 8),
             (byte)(num2 >> 16),
             (byte)(num2 >> 24),
             (byte)num,
             (byte)(num >> 8),
             (byte)(num >> 16),
             (byte)(num >> 24)
         };
         baseOutputStream_.Write(array, 0, array.Length);
     }
 }
        void WriteHeader()
        {
            if (state_ == OutputState.Header)
            {
                state_ = OutputState.Footer;

                int    mod_time   = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L); // Ticks give back 100ns intervals
                byte[] gzipHeader =
                {
                    // The two magic bytes
                    (byte)(GZipConstants.GZIP_MAGIC >> 8), (byte)(GZipConstants.GZIP_MAGIC & 0xff),

                    // The compression type
                    (byte)Deflater.DEFLATED,

                    // The flags (not set)
                    0,

                    // The modification time
                    (byte)mod_time,                        (byte)(mod_time >> 8),
                    (byte)(mod_time >> 16),                (byte)(mod_time >> 24),

                    // The extra flags
                    0,

                    // The OS type (unknown)
                    (byte)255
                };
                baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length);
            }
        }
Ejemplo n.º 8
0
        private void Ws_StreamingStateChanged(OBSWebsocket sender, OutputState type)
        {
            switch (type)
            {
            case OutputState.Started:
                _state.Stream = EOBSStreamingState.Started;
                break;

            case OutputState.Starting:
                _state.Stream = EOBSStreamingState.Starting;
                break;

            case OutputState.Stopping:
                _state.Stream = EOBSStreamingState.Stopping;
                break;

            case OutputState.Stopped:
                _state.Stream = EOBSStreamingState.Stopped;
                break;
            }

            if (StreamingStatusChanged != null)
            {
                StreamingStatusChanged(this, _state);
            }
        }
Ejemplo n.º 9
0
        private void onRecordingStateChange(OBSWebsocket sender, OutputState newState)
        {
            string state = "";

            switch (newState)
            {
            case OutputState.Starting:
                state = "Recording starting...";
                break;

            case OutputState.Started:
                state = "Stop recording";
                break;

            case OutputState.Stopping:
                state = "Recording stopping...";
                break;

            case OutputState.Stopped:
                state = "Start recording";
                break;

            default:
                state = "State unknown";
                break;
            }

            BeginInvoke((MethodInvoker) delegate
            {
                btnToggleRecording.Text = state;
            });
        }
Ejemplo n.º 10
0
 private void WriteHeader()
 {
     if (state_ == OutputState.Header)
     {
         state_ = OutputState.Footer;
         int    num   = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000);
         byte[] array = new byte[10]
         {
             31,
             139,
             8,
             0,
             0,
             0,
             0,
             0,
             0,
             255
         };
         array[4] = (byte)num;
         array[5] = (byte)(num >> 8);
         array[6] = (byte)(num >> 16);
         array[7] = (byte)(num >> 24);
         byte[] array2 = array;
         baseOutputStream_.Write(array2, 0, array2.Length);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Set the state of the general output I/O
        /// </summary>
        /// <param name="Channel">This should be 0 to 7</param>
        /// <param name="State">OFF/ON</param>
        /// <returns></returns>
        public bool SetGeneralOutput(int Channel, OutputState State)
        {
            // if the controller is not connected, return
            if (!this.IsConnected)
            {
                this.LastError = string.Format("The controller is not connected.");
                return(false);
            }

            try
            {
                CommandStruct cmd = new CommandStruct()
                {
                    Command     = EnumCommand.GENOUT,
                    AxisIndex   = Channel / 2,   // calculate axis index by channel
                    GenOutPort  = Channel % 2,   // calculate port by channel
                    GenOutState = State
                };
                _hid_device.Write(cmd.ToBytes());

                return(true);
            }
            catch (Exception ex)
            {
                this.LastError = ex.Message;
                return(false);
            }
        }
Ejemplo n.º 12
0
 protected void OnRecordingStateChanged(OBSWebsocket sender, OutputState outputState)
 {
     foreach (var handler in _recordingStateChangedHandlers)
     {
         handler.Invoke(this, outputState);
     }
 }
Ejemplo n.º 13
0
 private void OutputAttributeName(string name)
 {
     output.Write(' ');
     output.Write(name);
     lineLength += name.Length + 1;
     outputState = OutputState.AfterAttributeName;
 }
Ejemplo n.º 14
0
        void WriteHeader()
        {
            if (state_ == OutputState.Header)
            {
                state_ = OutputState.Footer;

                int    mod_time   = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L);
                byte[] gzipHeader =
                {
                    (byte)(GZipConstants.GZIP_MAGIC >> 8), (byte)(GZipConstants.GZIP_MAGIC & 0xff),

                    (byte)Deflater.DEFLATED,

                    0,

                    (byte)mod_time,                        (byte)(mod_time >> 8),
                    (byte)(mod_time >> 16),                (byte)(mod_time >> 24),

                    0,

                    (byte)255
                };
                baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length);
            }
        }
Ejemplo n.º 15
0
        public override void Finish()
        {
            if ( state_ == OutputState.Header ) {
                WriteHeader();
            }

            if( state_ == OutputState.Footer)
            {
                state_=OutputState.Finished;
                base.Finish();

                uint totalin=(uint)(deflater_.TotalIn&0xffffffff);
                uint crcval=(uint)(crc.Value&0xffffffff);

                byte[] gzipFooter;

                unchecked
                {
                    gzipFooter=new byte[] {
                    (byte) crcval, (byte) (crcval >> 8),
                    (byte) (crcval >> 16), (byte) (crcval >> 24),

                    (byte) totalin, (byte) (totalin >> 8),
                    (byte) (totalin >> 16), (byte) (totalin >> 24)
                };
                }

                baseOutputStream_.Write(gzipFooter, 0, gzipFooter.Length);
            }
        }
        /// <summary>
        /// Finish compression and write any footer information required to stream
        /// </summary>
        public override void Finish()
        {
            // If no data has been written a header should be added.
            if (state_ == OutputState.Header)
            {
                WriteHeader();
            }

            if (state_ == OutputState.Footer)
            {
                state_ = OutputState.Finished;
                base.Finish();

                uint totalin = (uint)(deflater_.TotalIn & 0xffffffff);
                uint crcval  = (uint)(crc.Value & 0xffffffff);

                byte[] gzipFooter;

                unchecked
                {
                    gzipFooter = new byte[] {
                        (byte)crcval, (byte)(crcval >> 8),
                        (byte)(crcval >> 16), (byte)(crcval >> 24),

                        (byte)totalin, (byte)(totalin >> 8),
                        (byte)(totalin >> 16), (byte)(totalin >> 24)
                    };
                }

                baseOutputStream_.Write(gzipFooter, 0, gzipFooter.Length);
            }
        }
Ejemplo n.º 17
0
 private void WriteHeader()
 {
     if (state_ == OutputState.Header)
     {
         state_ = OutputState.Footer;
         int    num = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000);
         byte[] obj = new byte[10]
         {
             31,
             139,
             8,
             0,
             0,
             0,
             0,
             0,
             0,
             byte.MaxValue
         };
         obj[4] = (byte)num;
         obj[5] = (byte)(num >> 8);
         obj[6] = (byte)(num >> 16);
         obj[7] = (byte)(num >> 24);
         byte[] array = obj;
         baseOutputStream_.Write(array, 0, array.Length);
     }
 }
Ejemplo n.º 18
0
            public bool QueryState(OutputState outputState)
            {
                bool inStatus = false;

                Adapter.ViSessionStatusCheck(IviDCPwrInterop.QueryOutputState(Adapter.Session, ChannelName, DCPwrOutputState.getC_Value(outputState), ref inStatus));
                return(inStatus);
            }
Ejemplo n.º 19
0
    private void onStreamingStateChange(OBSWebsocket sender, OutputState newState)
    {
        string state;

        switch (newState)
        {
        case OutputState.Starting:
            state = "Stream starting...";
            break;

        case OutputState.Started:
            state = "Stop streaming";
            break;

        case OutputState.Stopping:
            state = "Stream stopping...";
            break;

        case OutputState.Stopped:
            state = "Start streaming";
            break;

        default:
            state = "State unknown";
            break;
        }

        Debug.Log($"StreamingStateChange: {state}");
        if (tbStreaming)
        {
            tbStreaming.text = state;
        }
    }
Ejemplo n.º 20
0
        public bool Parse(byte[] Buffer)
        {
            byte temp = 0x0;

            using (MemoryStream stream = new MemoryStream(Buffer))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    this.AbsPosition = reader.ReadInt32();

                    // parse Usability
                    temp           = reader.ReadByte();
                    this.IsHomed   = ((temp >> 0) & 0x1) > 0 ? true : false;
                    this.IsRunning = ((temp >> 1) & 0x1) > 0 ? true : false;

                    // parse input signal
                    temp         = reader.ReadByte();
                    this.CWLS    = ((temp >> 0) & 0x1) > 0 ? InputState.Triggered : InputState.Untriggered;
                    this.CCWLS   = ((temp >> 1) & 0x1) > 0 ? InputState.Triggered : InputState.Untriggered;
                    this.ORG     = ((temp >> 2) & 0x1) > 0 ? InputState.Triggered : InputState.Untriggered;
                    this.ZeroOut = ((temp >> 3) & 0x1) > 0 ? InputState.Triggered : InputState.Untriggered;
                    this.IN_A    = ((temp >> 4) & 0x1) > 0 ? InputState.Untriggered : InputState.Triggered;
                    this.IN_B    = ((temp >> 5) & 0x1) > 0 ? InputState.Untriggered : InputState.Triggered;
                    this.OUT_A   = ((temp >> 6) & 0x1) > 0 ? OutputState.Enabled : OutputState.Disabled;
                    this.OUT_B   = ((temp >> 7) & 0x1) > 0 ? OutputState.Enabled : OutputState.Disabled;

                    this.Error        = reader.ReadByte();
                    this.CommandOrder = reader.ReadByte();
                }
            }

            return(true);
        }
Ejemplo n.º 21
0
        private void Obs_RecordingStateChanged(object sender, OutputState type)
        {
            Logger.log?.Info($"Recording State Changed: {type}");
            switch (type)
            {
            case OutputState.Starting:
                recordingCurrentLevel = true;
                break;

            case OutputState.Started:
                recordingCurrentLevel = true;
                Task.Run(() => _obs?.SetFilenameFormatting(DefaultFileFormat));
                break;

            case OutputState.Stopping:
                recordingCurrentLevel = false;
                break;

            case OutputState.Stopped:
                recordingCurrentLevel = false;
                RenameLastRecording(RenameString);
                RenameString = null;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 22
0
 public void StartPlaying(int recording_index = 0, Slot avatar_template = null)
 {
     UniLog.Log("Start playing");
     SetUpConfigSlot();
     //playing = true;
     playing_state       = OutputState.Started;
     playingBeginTime    = DateTime.UtcNow;
     playing_frame_index = 0;
     if (use_grpc_player)
     {
         grpcStreamPlayer.generateAnimation = generate_animation_play;
         grpcStreamPlayer.generateBvh       = recording_bvh;
         if (!grpcStreamPlayer.isPlaying)
         {
             grpcStreamPlayer.StartPlaying(avatar_template);
         }
     }
     else
     {
         streamPlayer.generateAnimation = generate_animation_play;
         streamPlayer.generateBvh       = recording_bvh;
         if (!streamPlayer.isPlaying)
         {
             streamPlayer.StartPlaying(recording_index, avatar_template);
         }
     }
 }
Ejemplo n.º 23
0
        public void StopRecording()
        {
            UniLog.Log("Stop recording");
            metaDataManager.WriteUserMetaData();

            if (recording)
            {
                foreach (var item in userMetaData)
                {
                    User         user     = item.Key;
                    UserMetadata metadata = item.Value;
                    if (metadata.isRecording)
                    {
                        dataBase.UpdateRecordedTime(user.UserID, recording_time / 1000, metadata.isPublic); //in seconds
                    }
                }
            }

            recording       = false;
            recording_state = OutputState.Stopping;

            if (metaRecorder.isRecording)
            {
                metaRecorder.StopRecording();
            }
        }
Ejemplo n.º 24
0
        public void StartRecording()
        {
            UniLog.Log("Start recording");
            SetUpConfigSlot();
            if (!dataManager.have_started_recording_session)
            {
                dataManager.StartRecordingSession();
            }
            if (!recording)
            {
                dataManager.StartSection();
            }
            recording             = true;
            recording_state       = OutputState.Starting;
            recording_frame_index = 0;
            //Set the recordings time to now
            utcNow             = DateTime.UtcNow;
            recordingBeginTime = DateTime.UtcNow;
            if (!metaRecorder.isRecording)
            {
                metaRecorder.StartRecording();
            }

            recording_state = OutputState.Started;
        }
Ejemplo n.º 25
0
        internal ITextSinkEx WriteAttributeName()
        {
            InternalDebug.Assert(this.outputState >= OutputState.WritingTagName);

            if (this.outputState != OutputState.WritingAttributeName)
            {
                if (this.outputState > OutputState.BeforeAttribute)
                {
                    this.OutputAttributeEnd();
                }
#if false
                if (this.lineLength > 255 && this.autoNewLines)
                {
                    if (this.lineLength > this.longestLineLength)
                    {
                        this.longestLineLength = this.lineLength;
                    }

                    this.output.Write("\r\n");
                    this.lineLength = 0;
                }
#endif
                this.output.Write(' ');
                this.lineLength++;
            }

            this.outputState = OutputState.WritingAttributeName;

            this.fallback = null;
            return(this);
        }
Ejemplo n.º 26
0
 public UnspentTx(UInt256 txHash, int blockIndex, int txIndex, int length, OutputState state)
 {
     TxHash = txHash;
     BlockIndex = blockIndex;
     TxIndex = txIndex;
     OutputStates = new OutputStates(length, state);
     IsFullySpent = state == OutputState.Spent;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Disconnects from Websocket and Closes OBS
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="outputState"></param>
 private void disconnectAndCloseOBS(OBSWebsocket sender, OutputState outputState)
 {
     _obs.ReplayBufferStateChanged -= disconnectAndCloseOBS;
     Thread.Sleep(3000);
     //_obs.Disconnect();
     closingOBS = true;
     supporterForm.writeInConsole(System.Drawing.Color.Red, "CLOSING OBS...");
     obsProcess.CloseMainWindow();
 }
Ejemplo n.º 28
0
 public GPSTrackerOutput(string trackerId, int number, OutputState newState, OutputState lastState, OutputTriggerType triggerType)
 {
     this.TrackerId = trackerId;
     this.Number    = number;
     //don't need to know the type from Server POV
     this.Type              = OutputType.Unknown;
     this.ProposedState     = newState;
     this.LastVerifiedState = lastState;
     this.TriggerType       = triggerType;
 }
Ejemplo n.º 29
0
        internal ITextSinkEx WriteTagName()
        {
            InternalDebug.Assert(this.outputState == OutputState.TagStarted ||
                                 this.outputState == OutputState.WritingTagName);

            this.outputState = OutputState.WritingTagName;

            this.fallback = null;
            return(this);
        }
Ejemplo n.º 30
0
 private void OutputAttributeValue(char[] value, int index, int count)
 {
     if (outputState < OutputState.WritingAttributeValue)
     {
         output.Write("=\"");
         lineLength += 2;
     }
     output.Write(value, index, count, this);
     lineLength += count;
     outputState = OutputState.WritingAttributeValue;
 }
Ejemplo n.º 31
0
 public void StopInteracting()
 {
     UniLog.Log("Stop interacting");
     interacting       = false;
     interacting_state = OutputState.Stopping;
     if (metaInteraction.isInteracting)
     {
         metaInteraction.StopInteracting();
     }
     interacting_state = OutputState.Stopped;
 }
Ejemplo n.º 32
0
 private void ObsManager_StateChanged(object sender, OutputState e)
 {
     if (e == OutputState.Started)
     {
         StartStreaming();
     }
     else if (e == OutputState.Stopped)
     {
         StopStreaming();
     }
 }
Ejemplo n.º 33
0
 public override void Close()
 {
     try {
         Finish();
     }
     finally {
         if ( state_ != OutputState.Closed ) {
             state_ = OutputState.Closed;
             if( IsStreamOwner ) {
                 baseOutputStream_.Close();
             }
         }
     }
 }
Ejemplo n.º 34
0
 public override void Finish()
 {
     if (state_ == OutputState.Header)
     {
         WriteHeader();
     }
     if (state_ == OutputState.Footer)
     {
         state_ = OutputState.Finished;
         base.Finish();
         uint num = (uint)(((ulong)deflater_.TotalIn) & 0xffffffffL);
         uint num2 = (uint)(((ulong)crc.Value) & 0xffffffffL);
         byte[] buffer = { (byte)num2, (byte)(num2 >> 8), (byte)(num2 >> 0x10), (byte)(num2 >> 0x18), (byte)num, (byte)(num >> 8), (byte)(num >> 0x10), (byte)(num >> 0x18) };
         baseOutputStream_.Write(buffer, 0, buffer.Length);
     }
 }
Ejemplo n.º 35
0
 public override void Close()
 {
     try
     {
         Finish();
     }
     finally
     {
         if (_state != OutputState.Closed)
         {
             _state = OutputState.Closed;
             if (IsStreamOwner)
             {
                 BaseOutputStream.Close();
             }
         }
     }
 }
Ejemplo n.º 36
0
		void WriteHeader()
		{
			if ( state_ == OutputState.Header ) 
			{
                state_=OutputState.Footer;

				int mod_time = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L);  // Ticks give back 100ns intervals
				byte[] gzipHeader = {
					// The two magic bytes
					(byte) (GZipConstants.GZIP_MAGIC >> 8), (byte) (GZipConstants.GZIP_MAGIC & 0xff),

					// The compression type
					(byte) Deflater.DEFLATED,

					// The flags (not set)
					0,

					// The modification time
					(byte) mod_time, (byte) (mod_time >> 8),
					(byte) (mod_time >> 16), (byte) (mod_time >> 24),

					// The extra flags
					0,

					// The OS type (unknown)
					(byte) 255
				};
				baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length);
			}
		}
Ejemplo n.º 37
0
 protected override void Dispose(bool disposing) {
     if(disposing){
         if(!disposed_){
             try {
                 Finish();
             } finally {
                 if (state_!=OutputState.Closed) {
                     state_=OutputState.Closed;
                     if (IsStreamOwner) {
                         baseOutputStream_.Dispose();
                     }
                 }
             }
             disposed_ = true;
         }
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 38
0
Archivo: Gzip.cs Proyecto: Orvid/Cosmos
        void WriteHeader()
        {
            if (state_ == OutputState.Header)
            {
                state_ = OutputState.Footer;
                int mod_time = (int)((DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000L);
                byte[] gzipHeader = {
					(byte) (0x1F8B >> 8), (byte) (0x1F8B & 0xff),
					(byte) Deflater.DEFLATED,
					0,
					(byte) mod_time, (byte) (mod_time >> 8),
					(byte) (mod_time >> 16), (byte) (mod_time >> 24),
					0,
					(byte) 255
				};
                baseOutputStream_.Write(gzipHeader, 0, gzipHeader.Length);
            }
        }
Ejemplo n.º 39
0
 private void WriteHeader()
 {
     if (_state == OutputState.Header)
     {
         _state = OutputState.Footer;
         DateTime time2 = new DateTime(0x7b2, 1, 1);
         int num = (int)((DateTime.Now.Ticks - time2.Ticks) / 0x989680L);
         byte[] buffer2 = { 0x1f, 0x8b, 8, 0, 0, 0, 0, 0, 0, 0xff };
         buffer2[4] = (byte)num;
         buffer2[5] = (byte)(num >> 8);
         buffer2[6] = (byte)(num >> 0x10);
         buffer2[7] = (byte)(num >> 0x18);
         byte[] buffer = buffer2;
         BaseOutputStream.Write(buffer, 0, buffer.Length);
     }
 }
Ejemplo n.º 40
0
	    /// <summary>
	    /// Finish compression and write any footer information required to stream
	    /// </summary>
	    public override void Finish()
	    {
	        // If no data has been written a header should be added.
	        if ( state_ == OutputState.Header ) {
	            WriteHeader();
	        }

	        if( state_ == OutputState.Footer)
	        {
	            state_=OutputState.Finished;
	            base.Finish();

	            var totalin=(uint)(deflater_.TotalIn&0xffffffff);
	            var crcval=(uint)(crc.Value&0xffffffff);

	            byte[] gzipFooter;

	            unchecked
	            {
	                gzipFooter=new[] {
	                                     (byte) crcval, (byte) (crcval >> 8),
	                                     (byte) (crcval >> 16), (byte) (crcval >> 24),
					
	                                     (byte) totalin, (byte) (totalin >> 8),
	                                     (byte) (totalin >> 16), (byte) (totalin >> 24)
	                                 };
	            }

	            baseOutputStream_.Write(gzipFooter, 0, gzipFooter.Length);
	        }
	    }
Ejemplo n.º 41
0
 public UnspentTx SetOutputState(int index, OutputState value)
 {
     return new UnspentTx(this.TxHash, this.BlockIndex, this.TxIndex, this.TxVersion, this.IsCoinbase, this.OutputStates.Set(index, value));
 }
Ejemplo n.º 42
0
 public UnspentTx(UInt256 txHash, int blockIndex, int txIndex, uint txVersion, bool isCoinbase, int length, OutputState state)
     : this(txHash, blockIndex, txIndex, txVersion, isCoinbase, new OutputStates(length, state))
 { }