public override void ReadRow(SharedTableData.SharedTableEntry keyEntry, CsvReader reader)
        {
            if (m_ImportTable == null)
            {
                return;
            }

            // Get the entry or create one
            StringTableEntry entry = m_ImportTable.GetEntry(keyEntry.Id) ?? m_ImportTable.AddEntry(keyEntry.Id, string.Empty);

            // Get the metadata or add one
            var metadata = entry.GetMetadata <MyCustomDataMetadata>();

            if (metadata == null)
            {
                metadata = new MyCustomDataMetadata();
                entry.AddMetadata(metadata);
            }

            if (m_SomeValueIndex != -1)
            {
                metadata.someValue = reader.GetField(m_SomeValueIndex);
            }

            if (m_SomeOtherValueIndex != -1)
            {
                metadata.someOtherValue = reader.GetField <int>(m_SomeOtherValueIndex);
            }
        }
예제 #2
0
        public override void PullMetadata(StringTableEntry entry, Comment metadata, string cellValue, string cellNote)
        {
            if (string.IsNullOrEmpty(cellValue))
            {
                if (metadata != null)
                {
                    entry.RemoveMetadata(metadata);
                }

                // If the entry is empty then just remove the whole thing
                if (string.IsNullOrEmpty(entry.Value) && entry.MetadataEntries.Count == 0)
                {
                    entry.RemoveFromTable();
                }
            }
            else
            {
                if (metadata != null)
                {
                    metadata.CommentText = cellValue;
                }
                else
                {
                    entry.AddMetadata(new Comment {
                        CommentText = cellValue
                    });
                }
            }
        }
예제 #3
0
    public override PushFields PushFields => PushFields.ValueAndNote; // For our example we use both value and note.

    public override void PullMetadata(StringTableEntry entry, MyCustomDataMetadata metadata, string cellValue, string cellNote)
    {
        // Metadata will be null if the entry does not already contain any.
        if (metadata == null)
        {
            metadata = new MyCustomDataMetadata();
            entry.AddMetadata(metadata);
        }

        metadata.someValue     = cellValue;
        metadata.someNoteValue = cellNote;
    }