예제 #1
0
        /// <summary>
        /// Returns a new array consisting of a combination of two or more
        /// arrays.
        /// </summary>

        public virtual JsonArray Concat(params object[] values)
        {
            JsonArray newArray = new JsonArray(this);

            if (values != null)
            {
                foreach (object value in values)
                {
                    JsonArray arrayValue = value as JsonArray;

                    if (arrayValue != null)
                    {
                        foreach (object arrayValueValue in arrayValue)
                        {
                            newArray.Push(arrayValueValue);
                        }
                    }
                    else
                    {
                        newArray.Push(value);
                    }
                }
            }

            return(newArray);
        }
예제 #2
0
        public virtual JsonArray Concat(params object[] values)
        {
            JsonArray jsonArray = new JsonArray(this);

            if (values != null)
            {
                foreach (object obj in values)
                {
                    JsonArray jsonArray2 = obj as JsonArray;
                    if (jsonArray2 != null)
                    {
                        foreach (object item in jsonArray2)
                        {
                            jsonArray.Push(item);
                        }
                    }
                    else
                    {
                        jsonArray.Push(obj);
                    }
                }
            }
            return(jsonArray);
        }
 private static JsonObject Files(int id, bool includePriorities)
 {
     JsonObject request = CreateBasicObject(ProtocolConstants.METHOD_TORRENTGET, ResponseTag.UpdateFiles);
     JsonObject arguments = GetArgObject(request);
     JsonArray ids = new JsonArray();
     ids.Push(id);
     arguments.Put(ProtocolConstants.KEY_IDS, ids);
     JsonArray fields = new JsonArray();
     fields.Put(ProtocolConstants.FIELD_FILES);
     fields.Put(ProtocolConstants.FIELD_ID);
     if (includePriorities)
     {
         fields.Put(ProtocolConstants.FIELD_PRIORITIES);
         fields.Put(ProtocolConstants.FIELD_WANTED);
     }
     arguments.Put(ProtocolConstants.KEY_FIELDS, fields);
     return request;
 }
예제 #4
0
        /// <summary>
        /// Returns a new array consisting of a combination of two or more
        /// arrays.
        /// </summary>
        public virtual JsonArray Concat(params object[] values)
        {
            JsonArray newArray = new JsonArray(this);

            if (values != null)
            {
                foreach (object value in values)
                {
                    JsonArray arrayValue = value as JsonArray;

                    if (arrayValue != null)
                    {
                        foreach (object arrayValueValue in arrayValue)
                            newArray.Push(arrayValueValue);
                    }
                    else
                    {
                        newArray.Push(value);
                    }
                }
            }

            return newArray;
        }
예제 #5
0
        public JsonObject SearchSignals(JsonObject searchParams)
        {
            JsonArray ar = new JsonArray();
            JsonObject container = new JsonObject();

            int totalRecords = 0;

            SignalManager sm = new SignalManager();
            List<Signal> ret = (List<Signal>)sm.Search(searchParams["city"].ToString(), searchParams["address"].ToString(), searchParams["zip"].ToString(),
                Convert.ToInt32(searchParams["categoryID"]), Convert.ToInt32(searchParams["status"]), Convert.ToInt32(searchParams["start"]), out totalRecords);

            SignalsList s = (SignalsList)new UserControl().LoadControl("/Includes/SignalsList.ascx");
            s.Populate(ret, totalRecords, 10);
            container["html"] = WebUtils.RenderControlToString(s);

            for (int i = 0; i < ret.Count; i++)
            {
                ret[i].Email = string.Empty;

                JsonObject obj = new JsonObject();
                obj["signal"] = ret[i];
                obj["description"] = GetSignalDescription(ret[i]);
                ar.Push(obj);
            }

            container["signals"] = ar;

            return container;
        }
예제 #6
0
        public JsonArray GetSignalsNearby(JsonObject param)
        {
            CheckRequest(param["ajaxSessionKey"].ToString());

            JsonArray ar = new JsonArray();

            SignalManager sm = new SignalManager();
            List<Signal> ret = sm.SearchNearZip(param["zip"].ToString(), Convert.ToInt32(param["signalID"]));

            for (int i = 0; i < ret.Count; i++)
            {
                ret[i].Email = string.Empty;

                JsonObject obj = new JsonObject();
                obj["signal"] = ret[i];
                obj["description"] = GetSignalDescription(ret[i]);
                ar.Push(obj);
            }

            return ar;
        }