Ejemplo n.º 1
0
 virtual public void ImbedJossData()
 {
     if (PositionAtFirstNodeOfType("Joss Header"))
     {
         Node.Set("Version", JossVersion.ToString());
     }
     else
     {
         AddNode("Joss Header", "Version=" + JossVersion);
     }
 }
Ejemplo n.º 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);
    }
Ejemplo n.º 3
0
    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;
    }