Example #1
0
 virtual public void ImbedJossData()
 {
     if (PositionAtFirstNodeOfType("Joss Header"))
     {
         Node.Set("Version", JossVersion.ToString());
     }
     else
     {
         AddNode("Joss Header", "Version=" + JossVersion);
     }
 }
Example #2
0
    virtual public JossData Copy(JossCopyMode mode = JossCopyMode.no_id, string id_value = "-1")
    {
        JossData result = new JossData();

        result.data_type = this.data_type;
        foreach (var data in this.defined)
        {
            if (data.Key != "id")
            {
                result.Set(data.Key, data.Value);
            }
            else
            {
                switch (mode)
                {
                //keep the original id....
                case JossCopyMode.old_id:
                    result.Set("id", data.Value);
                    break;

                case JossCopyMode.new_id:
                    result.Set("id", id_value);
                    break;

                case JossCopyMode.no_id:
                    result.Remove("id");
                    break;
                }
            }
        }
        foreach (string s in this.data)
        {
            result.data.Add(s);
        }

        return(result);
    }
    public virtual JossData Copy(JossCopyMode mode = JossCopyMode.no_id, string id_value="-1")
    {
        JossData result = new JossData();
        result.data_type = this.data_type;
        foreach (var data in this.defined) {
            if (data.Key != "id") {
                result.Set(data.Key, data.Value);
            } else {
                switch (mode) {
                    //keep the original id....
                 	case JossCopyMode.old_id:
                        result.Set("id", data.Value);
                        break;

                    case JossCopyMode.new_id :
                        result.Set("id", id_value);
                        break;

                    case JossCopyMode.no_id :
                        result.Remove("id");
                        break;
                }
            }
        }
        foreach (string s in this.data)
            result.data.Add(s);

        return result;
    }