示例#1
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            // If it's already escaped, we use it raw
            if (!string.IsNullOrEmpty(Content) && Content.StartsWith("'"))
            {
                options.Add("content", this.Content);
            }
            else
            {
                options.Add("content", this.Content.Replace("'", "\\'"), !string.IsNullOrEmpty(Content), typeof(string));
            }

            options.Add("disableAutoPan", this.DisableAutoPan, this.DisableAutoPan != DefaultAutoPan, typeof(bool));
            if (this.MaxWidth.HasValue)
            {
                options.Add("maxWidth", this.MaxWidth.Value, typeof(int));
            }
            if (this.PixelOffset != null)
            {
                options.Add("pixelOffset", this.PixelOffset.ToStringNew());
            }
            if (this.Position != null)
            {
                options.Add("position", this.Position.ToStringNew());
            }
            if (ZIndex.HasValue)
            {
                options.Add("zIndex", this.ZIndex.Value, typeof(int));
            }

            return(options);
        }
示例#2
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            if (Position.HasValue)
            {
                options.Add("position", "google.maps.ControlPosition." + Position.Value.ToString().ToUpperInvariant());
            }

            options.Add("style", "google.maps.MapTypeControlStyle." + Enum.GetName(typeof(MapTypeControlStyle), Style).ToUpperInvariant(), Style != MapTypeControlStyle.Default);

            // TODO :: Review MapType
            if ((mapType == typeof(Map) || mapType.Name == "GMap") && MapTypeIds != null && MapTypeIds.Count > 0)
            {
                var types = new JsArrayCollection();

                foreach (var mapTypeId in MapTypeIds)
                {
                    types.Add(mapTypeId);
                }

                options.Add("mapTypeIds", types);
            }

            return(options.ToString());
        }
示例#3
0
        /// <summary>
        /// 查询的数据转化成json数据格式
        /// </summary>
        /// <returns></returns>
        public JsonCollection QueryData2Json()
        {
            DataTable2Json c   = new DataTable2Json();
            JsonCollection rtn = c.ConvertTo(QueryTable);

            return(rtn);
        }
示例#4
0
        protected override JsonObject SerializeItem(BaseItem item, IServerConfigurationManager options, ILibraryManager libraryManager)
        {
            var boxset = item as BoxSet;
            var output = new JsonCollection()
            {
                id        = item.InternalId,
                title     = item.Name ?? string.Empty,
                sorttitle = item.SortName ?? string.Empty,
                // dateadded = item.DateCreated.LocalDateTime,
                communityrating = item.CommunityRating,
                overview        = item.Overview ?? string.Empty,
                releasedate     = item.PremiereDate.HasValue ? item.PremiereDate.Value.LocalDateTime : new DateTime?(),
                year            = item.ProductionYear,
                parentalrating  = item.OfficialRating ?? string.Empty,
                customrating    = item.CustomRating ?? string.Empty,
                displayorder    = boxset.DisplayOrder.ToString(),
                lockdata        = item.IsLocked,
                genres          = item.Genres,
                studios         = item.Studios,
                tags            = item.Tags,
            };

            if (long.TryParse(item.GetProviderId(MetadataProviders.Tmdb), out var l))
            {
                output.tmdbid = l;
            }
            else
            {
                output.tmdbid = null;
            }
            AddPeople(item, output, libraryManager);
            return(output);
        }
示例#5
0
        static void Main(string[] args)
        {
            string jPath = args[0];
            string jText = System.IO.File.ReadAllText(jPath);

            JsonCollection jColl = JsonConvert.DeserializeObject <JsonCollection>(jText);
            //JsonSettings jSettings = JsonConvert.DeserializeObject<JsonSettings>(jText);

            double?breakDist    = 0.0;
            double?refLatitude  = 0.0;
            double?refLongitude = 0.0;
            double?refElevation = 0.0;

            //foreach(JsonSettings json in jColl.JsonSettings)
            //{
            //    string eingabe = json.fileName;
            //    string ausgabe = json.destFileName;
            //    MessageBox.Show(eingabe);
            //    MessageBox.Show(eingabe);
            //}

            var conn = new ConnectionInterface();

            foreach (JsonSettings jSettings in jColl.JsonSettings)
            {
                conn.mapProcess(jSettings, breakDist, refLatitude, refLongitude, refElevation);
            }
        }
示例#6
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            options.Add("opened", Opened, Opened, typeof(bool));

            return(options.ToString());
        }
        public override JsonCollection BuildParams()
        {
            JsonCollection options = base.BuildParams();

            options.Add("bounds", this.Bounds, this.Bounds != null);

            return(options);
        }
        public override JsonCollection BuildParams()
        {
            JsonCollection options = base.BuildParams();

            options.Add("center", this.Center.ToStringNew(), this.Center != null);
            options.Add("radius", this.Radius.Value, this.Radius.HasValue, typeof(double));

            return(options);
        }
        public override JsonCollection BuildParams()
        {
            JsonCollection options = base.BuildParams();

            options.Add("fillColor", this.FillColor, !string.IsNullOrEmpty(FillColor), typeof(string));
            options.Add("fillOpacity", this.FillOpacity.Value, this.FillOpacity.HasValue, typeof(double));

            return(options);
        }
示例#10
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            options.Add("coords", string.Format("[{0}]", string.Join(",", Coords)));
            options.Add("type", Type.ToString(), typeof(string));

            return(string.Format("new google.maps.MarkerShape({0})", options));
        }
示例#11
0
        public JsonCollection BuildParams(bool addInitialComma)
        {
            var optionList = new JsonCollection(addInitialComma);

            optionList.Add("backgroundColor", JavascriptHelper.GetStringFromColor(BackgroundColor), BackgroundColor != DefaultBackColor, typeof(string));
            optionList.Add("center", Center == null ? string.Empty : Center.ToStringNew(), Center != null);
            optionList.Add("disableDefaultUI", DisableDefaultUI, DisableDefaultUI != DefaultDisableDefaultUi, typeof(bool));
            optionList.Add("disableDoubleClickZoom", DisableDoubleClickZoom, DisableDoubleClickZoom != DefaultDisableDoubleClickZoom, typeof(bool));
            optionList.Add("draggable", Draggable, Draggable != DefaultDraggable, typeof(bool));
            optionList.Add("draggableCursor", DraggableCursor.ToString().ToLowerInvariant(), DraggableCursor != Cursor.None, typeof(string));
            optionList.Add("draggingCursor", DraggingCursor.ToString().ToLowerInvariant(), DraggingCursor != Cursor.None, typeof(string));
            optionList.Add("heading", Heading, Heading.HasValue);
            optionList.Add("keyboardShortcuts", KeyboardShortcuts, DisableDefaultUI || KeyboardShortcuts != DefaultKeyboardShortcuts, typeof(bool));
            // TODO :: MapMaker
            // optionList.Add("mapMaker", MapMaker, MapMaker != DefaultMapMaker, typeof(bool));
            if (MapTypeControl.HasValue)
            {
                optionList.Add <bool>("mapTypeControl", MapTypeControl.Value);
            }
            optionList.Add("mapTypeControlOptions", MapTypeControlOptions, MapTypeControlOptions != null);

            if (string.IsNullOrEmpty(CustomMapTypeId))
            {
                optionList.Add("mapTypeId", GetMapType(MapTypeId));
            }
            else
            {
                optionList.Add <string>("mapTypeId", CustomMapTypeId);
            }

            optionList.Add("maxZoom", MaxZoom, MaxZoom.HasValue);
            optionList.Add("minZoom", MinZoom, MinZoom.HasValue);
            optionList.Add("noClear", NoClear, NoClear != DefaultNoClear, typeof(bool));
            optionList.Add("overviewMapControl", OverviewMapControl, OverviewMapControl != DefaultOverviewMapControl, typeof(bool));
            optionList.Add("overviewMapControlOptions", OverviewMapControlOptions, OverviewMapControlOptions != null);
            optionList.Add("panControl", PanControl, PanControl != DefaultPanControl, typeof(bool));
            optionList.Add("panControlOptions", PanControlOptions, PanControlOptions != null);
            optionList.Add("rotateControl", RotateControl, RotateControl != DefaultRotateControl, typeof(bool));
            optionList.Add("rotateControlOptions", RotateControlOptions, RotateControlOptions != null);
            optionList.Add("scaleControl", ScaleControl, ScaleControl != DefaultScaleControl, typeof(bool));
            optionList.Add("scaleControlOptions", ScaleControlOptions, ScaleControlOptions != null);
            optionList.Add("scrollwheel", Scrollwheel, Scrollwheel != DefaultScrollwheel, typeof(bool));
            optionList.Add("streetView", StreetView != null, StreetView != null, typeof(bool));
            optionList.Add("streetViewControl", StreetViewControl, StreetViewControl != DefaultStreetViewControl, typeof(bool));
            optionList.Add("streetViewControlOptions", StreetViewControlOptions, StreetViewControlOptions != null);
            if (Styles.Count > 0)
            {
                optionList.Add("styles", MapTypeStyle.GetStyles(Styles));
            }
            optionList.Add("tilt", Tilt, Tilt.HasValue);
            optionList.Add("zoom", Zoom, Zoom.HasValue, typeof(int));
            optionList.Add("zoomControl", ZoomControl, ZoomControl != DefaultZoomControl, typeof(bool));
            optionList.Add("zoomControlOptions", ZoomControlOptions, ZoomControlOptions != null);

            return(optionList);
        }
        public override string ToString()
        {
            JsonCollection options = new JsonCollection(false);

            options.Add("heading", Heading.Value, Heading.HasValue, typeof(double));
            options.Add("pitch", Pitch.Value, Pitch.HasValue, typeof(double));
            options.Add("zoom", Zoom.Value, Zoom.HasValue, typeof(int));

            return(options.ToString());
        }
示例#13
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            options.Add <string>("elementType", GetElementType());
            options.Add <string>("featureType", GetFeatureType());
            options.Add("stylers", Styler.ToString());

            return(options.ToString());
        }
示例#14
0
        private static JsonCollection CreateJsonCollection(IDatastore datastore, string path)
        {
            if (!collectionCache.TryGetValue(path, out JsonCollection collection))
            {
                collection            = new JsonCollection(datastore, path);
                collectionCache[path] = collection;
            }

            return(collection);
        }
示例#15
0
        public IJsonCollectionConfiguration CreateFrom(JsonCollection json_collection)
        {
            json_collection_configuration.Collection.href     = json_collection.collection.href;
            json_collection_configuration.Collection.items    = json_collection.collection.items;
            json_collection_configuration.Collection.links    = json_collection.collection.links;
            json_collection_configuration.Collection.template = json_collection.collection.template;
            json_collection_configuration.Collection.queries  = json_collection.collection.queries;
            json_collection_configuration.Collection.error    = json_collection.collection.error;

            return(json_collection_configuration);
        }
示例#16
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            if (Position.HasValue)
            {
                options.Add("position", "google.maps.ControlPosition." + Position.Value.ToString().ToUpperInvariant(), Position.Value != ControlPosition.Top_Left);
            }

            return(options.ToString());
        }
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            if (string.IsNullOrEmpty(PositionLiteral))
            {
                options.Add("position", Position == null ? string.Empty : this.Position.ToStringNew(), Position != null);
            }
            else
            {
                options.Add("position", PositionLiteral);
            }

            options.Add("animation", this.Animation.ToString().ToLowerInvariant(), Animation != Animation.None, typeof(string));
            options.Add("clickable", this.Clickable, this.Clickable.HasValue, typeof(bool));
            options.Add("clickable", this.Cursor, !string.IsNullOrEmpty(Cursor), typeof(string));
            options.Add("draggable", this.Draggable, this.Draggable.HasValue, typeof(bool));
            options.Add("flat", this.Flat, this.Flat.HasValue, typeof(bool));
            options.Add("map", this.Map);
            options.Add("optimized", this.Optimized, this.Optimized.HasValue, typeof(bool));
            options.Add("raiseOnDrag", this.RaiseOnDrag, this.RaiseOnDrag.HasValue, typeof(bool));
            options.Add("title", this.Title, !string.IsNullOrEmpty(Title), typeof(string));
            options.Add("visible", this.Visible, this.Visible.HasValue, typeof(bool));
            options.Add("zIndex", this.ZIndex, this.ZIndex.HasValue, typeof(int));

            if (!string.IsNullOrEmpty(this.IconText))
            {
                options.Add("icon", this.IconText);
            }
            else
            {
                options.Add("icon", this.Icon, this.Icon != null);
            }

            if (!string.IsNullOrEmpty(this.ShadowText))
            {
                options.Add("shadow", this.ShadowText);
            }
            else
            {
                options.Add("shadow", this.Shadow, this.Icon != null);
            }

            if (!string.IsNullOrEmpty(this.ShapeText))
            {
                options.Add("shape", this.ShapeText);
            }
            else
            {
                options.Add("shape", this.Shape, this.Shape != null);
            }

            return(options);
        }
        public override JsonCollection BuildParams()
        {
            JsonCollection options = base.BuildParams();

            if (StyleIcon != null)
            {
                options.Add("styleIcon", StyleIcon.ToString());
            }

            return(options);
        }
示例#19
0
    public static string ToJson <T>(List <T> collection)
    {
        if (collection == null)
        {
            throw new InvalidOperationException("JsonHelper : Can't serialize empty collection");
        }
        var wrapper = new JsonCollection <T> {
            Values = collection
        };

        return(JsonUtility.ToJson(wrapper));
    }
示例#20
0
        public override JsonCollection BuildParams()
        {
            var options = new JsonCollection(false);

            options.Add("alt", Alt, !string.IsNullOrEmpty(Alt), typeof(string));
            options.Add("name", Name, !string.IsNullOrEmpty(Name), typeof(string));

            options.Add("maxZoom", this.MaxZoom, this.MaxZoom.HasValue, typeof(int));
            options.Add("minZoom", this.MinZoom, this.MinZoom.HasValue, typeof(int));

            return(options);
        }
示例#21
0
        public override string ToString()
        {
            var options = new JsonCollection(false);

            if (Position.HasValue)
            {
                options.Add("position", "google.maps.ControlPosition." + Position.Value.ToString().ToUpperInvariant(), Position.Value != ControlPosition.Top_Left);
            }
            options.Add("style", "google.maps.ZoomControlStyle." + Enum.GetName(typeof(ZoomControlStyle), this.Style).ToUpperInvariant(), this.Style != ZoomControlStyle.Default);

            return(options.ToString());
        }
示例#22
0
        public void FromJsonTests()
        {
            var result = JsonCollection.FromJson <TestItem>("[{\"id\":\"test1\"}, {\"id\":\"test2\"}]");
            var list   = result.ToList();

            Assert.That(list.Count, Is.EqualTo(2));
            var item = list.Where(i => i.id == "test2");

            Assert.That(item, Is.Not.EqualTo(null));
            var invalidItem = list.Where(i => i.id == "test0");

            Assert.That(invalidItem, Is.Empty);
        }
示例#23
0
        public JsonResult StateChangedValue()
        {
            string json;

            var objectToSerialize = new RootJCollectionObject();

            try
            {
                String geocat = "S";
                objectToSerialize.items = new List <JsonCollection>();
                JsonCollection lstCities = new JsonCollection()
                {
                    Name = "Cities", items = new List <SelectListItem>()
                };
                using (var reader = new StreamReader(Request.InputStream))
                {
                    json = reader.ReadToEnd();
                }
                JObject jObject = JObject.Parse(json);
                int     idRef   = 0;
                if (jObject["stateval"] != null)
                {
                    idRef = Convert.ToInt32(jObject["stateval"].ToString());
                    if (idRef == -1)
                    {
                        geocat = "C";
                        idRef  = Convert.ToInt32(jObject["countryval"].ToString());
                    }
                }
                using (SMGeo.ServiceClient serv = new SMGeo.ServiceClient())
                {
                    CityData[] arrCities = serv.getCityList(idRef, geocat);

                    foreach (CityData cd in arrCities)
                    {
                        lstCities.items.Add(new SelectListItem {
                            Value = cd.IDCity.ToString(), Text = cd.CityName
                        });
                    }
                    objectToSerialize.items.Add(lstCities);
                }
            }
            catch
            {
            }

            var jout = Json(objectToSerialize);

            return(jout);
        }
示例#24
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = base.BuildParams();

            options.AddIfValue("geodesic", this.Geodesic, typeof(bool));

            if (Paths != null)
            {
                options.Add("path", PathArrayName, this.Paths != null);
            }

            options.Add("map", MapId, !string.IsNullOrEmpty(MapId));

            return(options);
        }
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            if (Clickable.HasValue)
            {
                options.Add <bool>("clickable", Clickable.Value);
            }

            options.Add("map", Map, !string.IsNullOrEmpty(Map));

            if (Opacity.HasValue && Opacity.Value >= 0 && Opacity.Value < 1)
            {
                options.Add("opacity", Opacity.Value);
            }

            return(options);
        }
示例#26
0
        static void Main(string[] args)
        {
            string jPath = args[0];
            string jText = System.IO.File.ReadAllText(jPath);

            JsonCollection jColl = JsonConvert.DeserializeObject <JsonCollection>(jText);

            double?breakDist    = 0.0;
            double?refLatitude  = 0.0;
            double?refLongitude = 0.0;
            double?refElevation = 0.0;

            var conn = new ConnectionInterface();

            foreach (JsonSettings jSettings in jColl.JsonSettings)
            {
                conn.mapProcess(jSettings, breakDist, refLatitude, refLongitude, refElevation);
            }
        }
示例#27
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            if (Map != null)
            {
                options.Add("map", this.Map.Id, !string.IsNullOrEmpty(this.Map.Id));
            }

            options.AddIfValue("clickable", this.Clickable, typeof(bool));
            options.AddIfValue("editable", this.Editable, typeof(bool));
            options.Add("strokeColor", this.StrokeColor, !string.IsNullOrEmpty(StrokeColor), typeof(string));
            options.AddIfValue("strokeOpacity", this.StrokeOpacity, typeof(double));
            options.AddIfValue("strokeWeight", this.StrokeWeight, typeof(int));
            options.AddIfValue("visible", this.Visible, typeof(bool));
            options.AddIfValue("zIndex", this.ZIndex, typeof(int));

            return(options);
        }
示例#28
0
        public override JsonCollection BuildParams()
        {
            var options = new JsonCollection(false);

            if (Clickable.HasValue)
            {
                options.Add <bool>("clickable", Clickable.Value);
            }

            if (SuppressInfoWindows.HasValue)
            {
                options.Add <bool>("supressInfoWindows", SuppressInfoWindows.Value);
            }

            options.Add("labelColor", "google.maps.weather.LabelColor." + LabelColor.ToString().ToUpperInvariant(), LabelColor != WeatherLayer.LabelColor.Auto);
            options.Add("temperatureUnits", "google.maps.weather.TemperatureUnit." + TemperatureUnits.ToString().ToUpperInvariant(), TemperatureUnits != WeatherLayer.TemperatureUnit.Default);
            options.Add("windSpeedUnits", "google.maps.weather.WindSpeedUnit." + WindSpeedUnits.ToString().ToUpperInvariant(), WindSpeedUnits != WeatherLayer.WindSpeedUnit.Default);

            return(options);
        }
        public override string ToString()
        {
            JsonCollection options = new JsonCollection(false);

            options.Add <string>("text", JavascriptHelper.PrepareJavascript(Text, false), !string.IsNullOrEmpty(Text));

            if (Color.HasValue)
            {
                options.Add <string>("color", JavascriptHelper.GetStringFromColor(Color.Value));
            }

            if (Fore.HasValue)
            {
                options.Add <string>("fore", JavascriptHelper.GetStringFromColor(Fore.Value));
            }

            if (StarColor.HasValue)
            {
                options.Add <string>("starcolor", JavascriptHelper.GetStringFromColor(StarColor.Value));
            }

            return(options.ToString());
        }
示例#30
0
        public override JsonCollection BuildParams()
        {
            JsonCollection options = new JsonCollection(false);

            options.Add("addressControl", AddressControl.Value, AddressControl.HasValue, typeof(bool));
            options.Add("addressControlOptions", AddressControlOptions.ToString(), AddressControlOptions != null);
            options.Add("disableDoubleClickZoom", DisableDoubleClickZoom.Value, DisableDoubleClickZoom.HasValue, typeof(bool));
            options.Add("enableCloseButton", EnableCloseButton.Value, EnableCloseButton.HasValue, typeof(bool));
            options.Add("imageDateControl", ImageDateControl.Value, ImageDateControl.HasValue, typeof(bool));
            options.Add("linksControl", LinksControl.Value, LinksControl.HasValue, typeof(bool));
            options.Add("panControl", PanControl.Value, PanControl.HasValue, typeof(bool));
            options.Add("panControlOptions", PanControlOptions.ToString(), PanControlOptions != null);
            options.Add("pano", Pano, !string.IsNullOrEmpty(Pano), typeof(string));
            options.Add("panoProvider", PanoProvider, !string.IsNullOrEmpty(PanoProvider));
            options.Add("position", Position.ToStringNew(), Position != null);
            options.Add("pov", Pov.ToString(), Pov != null);
            options.Add("scrollwheel", Scrollwheel.Value, Scrollwheel.HasValue, typeof(bool));
            options.Add("visible", Visible.Value, Visible.HasValue, typeof(bool));
            options.Add("zoomControl", ZoomControl.Value, ZoomControl.HasValue, typeof(bool));
            options.Add("zoomControlOptions", ZoomControlOptions.ToString(), ZoomControlOptions != null);

            return(options);
        }