示例#1
0
        public static Scrap FromValue(Value p_Value)
        {
            // value would be an struct
            // member -> scrap_id
            // value -> struct with scrapentry info

            Scrap s = new Scrap();

            s._sql = p_Value.struct_value["sql"].string_value;

            foreach (KeyValuePair <String, Value> kvp in p_Value.struct_value["scrap"].struct_value)
            {
                Int32 scrap_id = 0;
                if (Int32.TryParse(kvp.Key, out scrap_id))
                {
                    ScrapEntry se = ScrapEntry.FromValue(kvp.Value, scrap_id);
                    s._entries.Add(scrap_id, se);
                }
                else
                {
                    throw new Exception("Invalid scrap_id -> [" + kvp.Key + "]");
                }
            }

            return(s);
        }
示例#2
0
        public static ScrapEntry FromValue(Value p_Value, Int32 p_ScrapId)
        {
            ScrapEntry se = new ScrapEntry();

            se._scrap_id = p_ScrapId;
            se._settime  = DateTime.Parse(p_Value.struct_value["settime"].string_value);
            se._regtime  = DateTime.Parse(p_Value.struct_value["regtime"].string_value);
            se._text     = p_Value.struct_value["text"].string_value;
            Int32.TryParse(p_Value.struct_value["nid"].string_value, out se._nid);
            Int32.TryParse(p_Value.struct_value["flags"].string_value, out se._flags);

            return(se);
        }
示例#3
0
        public static ScrapEntry FromValue(Value p_Value, Int32 p_ScrapId)
        {
            ScrapEntry se = new ScrapEntry();

            se._scrap_id = p_ScrapId;
            se._settime = DateTime.Parse(p_Value.struct_value["settime"].string_value);
            se._regtime = DateTime.Parse(p_Value.struct_value["regtime"].string_value);
            se._text = p_Value.struct_value["text"].string_value;
            Int32.TryParse(p_Value.struct_value["nid"].string_value, out se._nid);
            Int32.TryParse(p_Value.struct_value["flags"].string_value, out se._flags);

            return se;
        }