public override void LoadFromStream(Stream aStream, HCStyle aStyle, ushort aFileVersion) { base.LoadFromStream(aStream, aStyle, aFileVersion); BeginAdd(); try { byte[] vBuffer; if (aFileVersion > 39) { FColumns = (byte)aStream.ReadByte(); Byte vByte = (byte)aStream.ReadByte(); FMultSelect = HC.IsOdd(vByte >> 7); FItemHit = HC.IsOdd(vByte >> 6); FColumnAlign = HC.IsOdd(vByte >> 5); FBoxRight = HC.IsOdd(vByte >> 4); } FItems.Clear(); string vS = ""; HC.HCLoadTextFromStream(aStream, ref vS, aFileVersion); if (vS != "") { string[] vStrings = vS.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None); for (int i = 0; i < vStrings.Length; i++) { AddItem(vStrings[i]); } if (aFileVersion > 35) { HC.HCLoadTextFromStream(aStream, ref vS, aFileVersion); if (vS != "") { vStrings = vS.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None); for (int i = 0; i < vStrings.Length; i++) { FItems[i].TextValue = vStrings[i]; } } } vBuffer = BitConverter.GetBytes(false); for (int i = 0; i < FItems.Count; i++) { aStream.Read(vBuffer, 0, vBuffer.Length); FItems[i].Checked = BitConverter.ToBoolean(vBuffer, 0); } } if (aFileVersion > 33) { this.FRadioStyle = (HCRadioStyle)aStream.ReadByte(); } } finally { EndAdd(); } }
public override void LoadFromStream(Stream aStream, HCStyle aStyle, ushort aFileVersion) { base.LoadFromStream(aStream, aStyle, aFileVersion); HC.HCLoadTextFromStream(aStream, ref FText, aFileVersion); if (aFileVersion > 33) { byte vByte = (byte)aStream.ReadByte(); FReadOnly = HC.IsOdd(vByte >> 7); FPrintOnlyText = HC.IsOdd(vByte >> 6); } else { byte[] vBuffer = BitConverter.GetBytes(FReadOnly); aStream.Read(vBuffer, 0, vBuffer.Length); FReadOnly = BitConverter.ToBoolean(vBuffer, 0); FPrintOnlyText = false; } if (aFileVersion > 15) { FBorderSides.Value = (byte)aStream.ReadByte(); FBorderWidth = (byte)aStream.ReadByte(); } }
public override void LoadFromStream(Stream aStream, HCStyle aStyle, ushort aFileVersion) { base.LoadFromStream(aStream, aStyle, aFileVersion); if (aFileVersion > 51) { byte vByte = (byte)aStream.ReadByte(); FChecked = HC.IsOdd(vByte >> 7); FBoxRight = HC.IsOdd(vByte >> 6); } else { byte[] vBuffer = BitConverter.GetBytes(FChecked); aStream.Read(vBuffer, 0, vBuffer.Length); FChecked = BitConverter.ToBoolean(vBuffer, 0); } HC.HCLoadTextFromStream(aStream, ref FText, aFileVersion); }
private string Convert(string s) { byte[] vSBytes = Encoding.ASCII.GetBytes(s); byte v; for (int i = 0, vLen = vSBytes.Length; i < vLen; i++) { v = (byte)(vSBytes[i] - 1); if (!HC.IsOdd(i)) { v += 5; } //vResult += Encoding.ASCII.GetString(v); vSBytes[i] = v; } return(Encoding.ASCII.GetString(vSBytes)); }
public void LoadFromStream(Stream aStream, ushort aFileVersion) { Int64 vDataSize = 0; byte[] vBuffer = BitConverter.GetBytes(vDataSize); aStream.Read(vBuffer, 0, vBuffer.Length); vDataSize = BitConverter.ToInt64(vBuffer, 0); // if (aFileVersion > 33) { FFormatVersion = (byte)aStream.ReadByte(); } else { FFormatVersion = 1; } if (aFileVersion > 49) { this.FLineSpaceMin = (byte)aStream.ReadByte(); } else { this.FLineSpaceMin = 8; } if (aFileVersion > 53) { byte vByte = (byte)aStream.ReadByte(); FShowParaLastMark = HC.IsOdd(vByte >> 7); } else { FShowParaLastMark = true; } LoadParaStyles(aStream, aFileVersion); LoadTextStyles(aStream, aFileVersion); }
public virtual void LoadFromStream(Stream aStream, HCStyle aStyle, ushort aFileVersion) { byte[] vBuffer = BitConverter.GetBytes(FParaNo); aStream.Read(vBuffer, 0, vBuffer.Length); FParaNo = System.BitConverter.ToInt32(vBuffer, 0); if (aFileVersion > 25) { FOptions.Value = (byte)aStream.ReadByte(); } else { vBuffer = BitConverter.GetBytes(ParaFirst); aStream.Read(vBuffer, 0, vBuffer.Length); ParaFirst = BitConverter.ToBoolean(vBuffer, 0); } if (aFileVersion > 33) { byte vByte = (byte)aStream.ReadByte(); FPrintInvisible = HC.IsOdd(vByte >> 7); } }
public void LoadFromStream(Stream aStream, ushort aFileVersion) { byte[] vBuffer; if (aFileVersion < 15) { int vLineSpace = 0; vBuffer = BitConverter.GetBytes(vLineSpace); aStream.Read(vBuffer, 0, vBuffer.Length); } byte vByte = 0; if (aFileVersion > 16) { vByte = (byte)aStream.ReadByte(); FLineSpaceMode = (ParaLineSpaceMode)vByte; } if (aFileVersion > 30) { vBuffer = BitConverter.GetBytes(FLineSpace); aStream.Read(vBuffer, 0, vBuffer.Length); FLineSpace = BitConverter.ToSingle(vBuffer, 0); } else if (FLineSpaceMode == ParaLineSpaceMode.plsFix) // 旧版本统一按12pt处理 { FLineSpace = 12; } if (aFileVersion < 22) { vBuffer = BitConverter.GetBytes(FFirstIndentPix); aStream.Read(vBuffer, 0, vBuffer.Length); FFirstIndentPix = BitConverter.ToInt32(vBuffer, 0); // vBuffer = BitConverter.GetBytes(FLeftIndentPix); aStream.Read(vBuffer, 0, vBuffer.Length); FLeftIndentPix = BitConverter.ToInt32(vBuffer, 0); } else { vBuffer = BitConverter.GetBytes(FFirstIndent); aStream.Read(vBuffer, 0, vBuffer.Length); FFirstIndent = BitConverter.ToSingle(vBuffer, 0); FFirstIndentPix = HCUnitConversion.MillimeterToPixX(FFirstIndent); // vBuffer = BitConverter.GetBytes(FLeftIndent); aStream.Read(vBuffer, 0, vBuffer.Length); FLeftIndent = BitConverter.ToSingle(vBuffer, 0); FLeftIndentPix = HCUnitConversion.MillimeterToPixX(FLeftIndent); // vBuffer = BitConverter.GetBytes(FRightIndent); aStream.Read(vBuffer, 0, vBuffer.Length); FRightIndent = BitConverter.ToSingle(vBuffer, 0); FRightIndentPix = HCUnitConversion.MillimeterToPixX(FRightIndent); } HC.HCLoadColorFromStream(aStream, ref FBackColor); if (aFileVersion > 31) { vByte = (byte)aStream.ReadByte(); FBreakRough = HC.IsOdd(vByte >> 7); } vByte = (byte)aStream.ReadByte(); FAlignHorz = (ParaAlignHorz)vByte; if (aFileVersion > 17) { vByte = (byte)aStream.ReadByte(); FAlignVert = (ParaAlignVert)vByte; } }
public override void LoadFromStream(Stream AStream, HCStyle AStyle, ushort aFileVersion) { base.LoadFromStream(AStream, AStyle, aFileVersion); FItems.Clear(); string vText = ""; if (aFileVersion > 36) { if (aFileVersion > 40) { byte vByte = (byte)AStream.ReadByte(); FStatic = HC.IsOdd(vByte >> 7); FSaveItem = HC.IsOdd(vByte >> 6); } else { byte[] vBuffer = BitConverter.GetBytes(FSaveItem); AStream.Read(vBuffer, 0, vBuffer.Length); FSaveItem = BitConverter.ToBoolean(vBuffer, 0); } if (FSaveItem) { HC.HCLoadTextFromStream(AStream, ref vText, aFileVersion); string[] vStrings = vText.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None); for (int i = 0; i < vStrings.Length; i++) { FItems.Add(new HCCbbItem(vStrings[i])); } vText = ""; HC.HCLoadTextFromStream(AStream, ref vText, aFileVersion); vStrings = vText.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None); for (int i = 0; i < vStrings.Length; i++) { FItemValues.Add(new HCCbbItem(vStrings[i])); } } } else { HC.HCLoadTextFromStream(AStream, ref vText, aFileVersion); string[] vStrings = vText.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None); for (int i = 0; i < vStrings.Length; i++) { FItems.Add(new HCCbbItem(vStrings[i])); } if ((FItems.Count > 0) && (aFileVersion > 35)) { vText = ""; HC.HCLoadTextFromStream(AStream, ref vText, aFileVersion); vStrings = vText.Split(new string[] { HC.sLineBreak }, StringSplitOptions.None); for (int i = 0; i < vStrings.Length; i++) { FItemValues.Add(new HCCbbItem(vStrings[i])); } } else { FItemValues.Clear(); } FSaveItem = FItems.Count > 0; } }