Example #1
0
        public override void Write(string _fileName, System.IO.FileStream fileStream)
        {
            using (CtfBinaryWriter writer = new CtfBinaryWriter(new LittleEndianBitConverter(), fileStream))
            {
                foreach (KeyValuePair <int, object> e in entry)
                {
                    try
                    {
                        if (Convert.ChangeType(e.Value, parentPage.ctfEntryInfo[e.Key].realType) == null)
                        {
                            writer.WriteEntryData(parentPage.ctfEntryInfo[e.Key].type, parentPage.ctfEntryInfo[e.Key].defaultValue);
                        }
                        else
                        {
                            writer.WriteEntryData(parentPage.ctfEntryInfo[e.Key].type, e.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message + Environment.NewLine +
                                            parentPage.ctfEntryInfo[e.Key].id + " " + parentPage.ctfEntryInfo[e.Key].name);
                    }
                }
            }

            base.Write(_fileName, fileStream);
        }
        public override void Write(string _fileName, System.IO.FileStream fileStream)
        {
            using (CtfBinaryWriter writer = new CtfBinaryWriter(new LittleEndianBitConverter(), fileStream))
            {
                foreach (KeyValuePair<int, object> e in entry)
                {
                    try
                    {
                        if (Convert.ChangeType(e.Value, parentPage.ctfEntryInfo[e.Key].realType) == null)
                        {
                            writer.WriteEntryData(parentPage.ctfEntryInfo[e.Key].type, parentPage.ctfEntryInfo[e.Key].defaultValue);
                        }
                        else
                        {
                            writer.WriteEntryData(parentPage.ctfEntryInfo[e.Key].type, e.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message + Environment.NewLine +
                            parentPage.ctfEntryInfo[e.Key].id + " " + parentPage.ctfEntryInfo[e.Key].name);
                    }
                }
            }

            base.Write(_fileName, fileStream);
        }