コード例 #1
0
        public void parseMapJsonData(List <MapDownloadResource> maps, Dictionary <string, string> mapsItemsCodes, Dictionary <string, string> regionItemsCodes, Stream inputStream)
        {
            JsonReader reader = new JsonReader(new InputStreamReader(inputStream, "UTF-8"));

            reader.BeginObject();
            while (reader.HasNext)
            {
                string key = reader.NextName();
                if (key != null)
                {
                    if (key.Equals(VERSION_ID) || key.Equals(XML_VERSION_ID))
                    {
                        reader.SkipValue();
                    }
                    else if (key.Equals(PACKAGES_ID))
                    {
                        readMapsDetails(maps, reader);
                    }
                    else if (key.Equals(WORLD_ID))
                    {
                        reader.BeginObject();
                    }
                    else if (key.Equals(CONTINENTS_ID))
                    {
                        readWorldHierarchy(mapsItemsCodes, reader);
                        reader.EndObject();
                    }
                    else if (key.Equals(REGIONS_ID))
                    {
                        readRegionsDetails(regionItemsCodes, reader);
                    }
                }
            }
            reader.EndObject();
        }
コード例 #2
0
        private void readCurrentRegionDetails(Dictionary <string, string> regionItemsCodes, JsonReader reader)
        {
            reader.BeginObject();
            string currentRegionCode = null;

            while (reader.HasNext)
            {
                string key = reader.NextName();
                if (key != null)
                {
                    if (key.Equals(REGION_CODE_ID))
                    {
                        currentRegionCode = reader.NextString();
                    }
                    else if (key.Equals(SUB_REGIONS_ID))
                    {
                        if (currentRegionCode != null)
                        {
                            readSubRegionsForCurrentRegion(regionItemsCodes, currentRegionCode, reader);
                        }
                    }
                }
            }
            reader.EndObject();
        }
コード例 #3
0
 private void ReadJsonHead(JsonReader jReader)
 {
     jReader.BeginObject();
     while (jReader.HasNext)
     {
         string name = jReader.NextName();
         if (name.Equals("Items"))
         {
             ReadItemsArray(jReader);
         }
         else if (name.Equals("PropertyList"))
         {
             jReader.BeginArray();
             while (jReader.HasNext)
             {
                 Property.Add(jReader.NextString());
             }
             jReader.EndArray();
         }
         else
         {
             jReader.SkipValue();
         }
     }
     jReader.EndObject();
     jReader.Close();
 }
コード例 #4
0
        private void ReadPropertiesArray(JsonReader jReader)
        {
            jReader.BeginArray();
            List <string> col = new List <string>();

            while (jReader.HasNext)
            {
                jReader.BeginObject();
                while (jReader.HasNext)
                {
                    string name = jReader.NextName();
                    if (name.Equals("Property"))
                    {
                        col.Add(jReader.NextString());
                    }
                    else
                    {
                        jReader.SkipValue();
                    }
                }
                jReader.EndObject();
            }
            jReader.EndArray();
            Rows.Add(col);
        }
コード例 #5
0
        private static Vector2 JsonObjectToPoint(JsonReader reader, float scale)
        {
            float x = 0f;
            float y = 0f;

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "x":
                    x = ValueFromObject(reader);
                    break;

                case "y":
                    y = ValueFromObject(reader);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }
            reader.EndObject();
            return(new Vector2(x * scale, y * scale));
        }
コード例 #6
0
        private static Vector JsonObjectToPoint(JsonReader reader)
        {
            var x = 0d;
            var y = 0d;

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "x":
                    x = ValueFromObject(reader);
                    break;

                case "y":
                    y = ValueFromObject(reader);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();
            return(new Vector(x, y));
        }
コード例 #7
0
        public static AnimatableTextProperties Parse(JsonReader reader, LottieComposition composition)
        {
            AnimatableTextProperties anim = null;

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "a":
                    anim = ParseAnimatableTextProperties(reader, composition);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }
            reader.EndObject();
            if (anim == null)
            {
                // Not sure if this is possible.
                return(new AnimatableTextProperties(null, null, null, null));
            }
            return(anim);
        }
コード例 #8
0
        private void readStatesHierarchy(Dictionary <string, string> mapsItemsCodes, string currentCountryCode, JsonReader reader)
        {
            string currentStateCode = null;

            reader.BeginObject();
            while (reader.HasNext)
            {
                string key = reader.NextName();
                if (key != null)
                {
                    if (key.Equals(STATE_CODE_ID))
                    {
                        currentStateCode = reader.NextString();
                        if ((currentStateCode != null) && (currentCountryCode != null))
                        {
                            mapsItemsCodes.Add(currentStateCode, currentCountryCode);
                        }
                    }
                    else if (key.Equals(CITY_CODES_ID))
                    {
                        reader.BeginArray();
                        while (reader.HasNext)
                        {
                            readCitiesHierarchy(mapsItemsCodes, currentStateCode, reader);
                        }
                        reader.EndArray();
                    }
                }
            }
            reader.EndObject();
        }
コード例 #9
0
 private void readCurrentMapBoundingBoxDetails(MapDownloadResource currentMap, JsonReader reader)
 {
     reader.BeginObject();
     while (reader.HasNext)
     {
         string key = reader.NextName();
         if (key != null)
         {
             if (key.Equals(LAT_MAX_ID))
             {
                 currentMap.setBbLatMax(reader.NextDouble());
             }
             else if (key.Equals(LAT_MIN_ID))
             {
                 currentMap.setBbLatMin(reader.NextDouble());
             }
             else if (key.Equals(LONG_MAX_ID))
             {
                 currentMap.setBbLongMax(reader.NextDouble());
             }
             else if (key.Equals(LONG_MIN_ID))
             {
                 currentMap.setBbLongMin(reader.NextDouble());
             }
         }
     }
     reader.EndObject();
 }
コード例 #10
0
        private void readContinentsHierarchy(Dictionary <string, string> mapsItemsCodes, JsonReader reader)
        {
            string currentContinentCode = null;

            reader.BeginObject();
            while (reader.HasNext)
            {
                string key = reader.NextName();
                if (key != null)
                {
                    if (key.Equals(CONTINENT_CODE_ID))
                    {
                        currentContinentCode = reader.NextString();
                        if (currentContinentCode != null)
                        {
                            mapsItemsCodes.Add(currentContinentCode, "");
                        }
                    }
                    else if (key.Equals(COUNTRIES_ID))
                    {
                        reader.BeginArray();
                        while (reader.HasNext)
                        {
                            readCountriesHierarchy(mapsItemsCodes, currentContinentCode, reader);
                        }
                        reader.EndArray();
                    }
                }
            }
            reader.EndObject();
        }
コード例 #11
0
 private void readCurrentMapTXGDetails(MapDownloadResource currentMap, JsonReader reader)
 {
     reader.BeginObject();
     while (reader.HasNext)
     {
         string key = reader.NextName();
         if (key != null)
         {
             if (key.Equals(TEXTURES_BIG_FILE_ID))
             {
                 currentMap.setTXGFilePath(reader.NextString());
             }
             else if (key.Equals(SIZE_BIG_FILE_ID))
             {
                 currentMap.setTXGFileSize(reader.NextLong());
             }
             else
             {
                 // for now, we skip the tags referring ZIP files details related to TXG files
                 reader.SkipValue();
             }
         }
     }
     reader.EndObject();
 }
コード例 #12
0
        private void readCurrentMapNames(MapDownloadResource currentMap, JsonReader reader)
        {
            string currentMapName = null;

            reader.BeginObject();
            while (reader.HasNext)
            {
                string key = reader.NextName();
                if (key != null)
                {
                    if (key.Equals(TL_NAME_ID))
                    {
                        currentMapName = reader.NextString();
                    }
                    else if (key.Equals(LNG_CODE_ID))
                    {
                        if (currentMapName != null)
                        {
                            currentMap.setName(currentMapName, reader.NextString());
                        }
                    }
                }
            }
            reader.EndObject();
        }
コード例 #13
0
ファイル: CSIJsonSOAP.cs プロジェクト: jekingpan/MyTestPlan
 private void ReadSOAPJsonHead(JsonReader jReader)
 {
     if (jReader.Peek() == JsonToken.Null)
     {
         return;
     }
     jReader.BeginObject();
     while (jReader.HasNext)
     {
         string name = jReader.NextName();
         if (name.Equals("IDOName"))
         {
             iResult.IDOName = jReader.NextString();
         }
         else if (name.Equals("Items"))
         {
             ReadSOAPItemsArray(jReader);
         }
         else if (name.Equals("PropertyList"))
         {
             jReader.BeginArray();
             while (jReader.HasNext)
             {
                 iResult.ObjectNames.Add(jReader.NextString());
             }
             jReader.EndArray();
         }
         else
         {
             jReader.SkipValue();
         }
     }
     jReader.EndObject();
     jReader.Close();
 }
コード例 #14
0
ファイル: CSIJsonSOAP.cs プロジェクト: jekingpan/MyTestPlan
        private void ReadSOAPItem(JsonReader jReader)
        {
            BaseIDOObject col = new BaseIDOObject();

            jReader.BeginObject();
            while (jReader.HasNext)
            {
                string name = jReader.NextName();
                if (name.Equals("EditStatus"))
                {
                    col.EditStatus = jReader.NextInt();
                }
                else if (name.Equals("ID"))
                {
                    col.ID = jReader.NextString();
                }
                else if (name.Equals("Properties"))
                {
                    ReadSOAPPropertiesArray(jReader, ref col);
                }
                else
                {
                    jReader.SkipValue();
                }
            }
            jReader.EndObject();
            iResult.Objects.Add(col);
        }
コード例 #15
0
        private static void ParseFonts(JsonReader reader, Dictionary <string, Font> fonts)
        {
            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "list":
                    reader.BeginArray();
                    while (reader.HasNext())
                    {
                        var font = FontParser.Parse(reader);
                        fonts.Add(font.Name, font);
                    }

                    reader.EndArray();
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();
        }
コード例 #16
0
        /// <summary>
        /// Returns either an <see cref="AnimatablePathValue"/> or an <see cref="AnimatableSplitDimensionPathValue"/>.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="composition"></param>
        /// <returns></returns>
        internal static IAnimatableValue <Vector2?, Vector2?> ParseSplitPath(JsonReader reader, LottieComposition composition)
        {
            AnimatablePathValue  pathAnimation = null;
            AnimatableFloatValue xAnimation    = null;
            AnimatableFloatValue yAnimation    = null;

            bool hasExpressions = false;

            reader.BeginObject();
            while (reader.Peek() != JsonToken.EndObject)
            {
                switch (reader.NextName())
                {
                case "k":
                    pathAnimation = Parse(reader, composition);
                    break;

                case "x":
                    if (reader.Peek() == JsonToken.String)
                    {
                        hasExpressions = true;
                        reader.SkipValue();
                    }
                    else
                    {
                        xAnimation = AnimatableValueParser.ParseFloat(reader, composition);
                    }
                    break;

                case "y":
                    if (reader.Peek() == JsonToken.String)
                    {
                        hasExpressions = true;
                        reader.SkipValue();
                    }
                    else
                    {
                        yAnimation = AnimatableValueParser.ParseFloat(reader, composition);
                    }
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }
            reader.EndObject();

            if (hasExpressions)
            {
                composition.AddWarning("Lottie doesn't support expressions.");
            }

            if (pathAnimation != null)
            {
                return(pathAnimation);
            }
            return(new AnimatableSplitDimensionPathValue(xAnimation, yAnimation));
        }
コード例 #17
0
        private String requestPaymentStatus(String resourcePath)
        {
            if (resourcePath == null)
            {
                return null;
            }

            URL url;
            String urlString;
            HttpURLConnection connection = null;
            String paymentStatus = null;

            try
            {
                urlString = TravellerApp.Droid.PeachPayment.Common.Constants.BASE_URL + "/status?resourcePath=" +
                                        URLEncoder.Encode(resourcePath, "UTF-8");

                Log.Debug(TravellerApp.Droid.PeachPayment.Common.Constants.LOG_TAG, "Status request url: " + urlString);

                url = new URL(urlString);
                connection = (HttpURLConnection)url.OpenConnection();
                connection.ConnectTimeout = TravellerApp.Droid.PeachPayment.Common.Constants.CONNECTION_TIMEOUT;

                JsonReader jsonReader = new JsonReader(
                    new InputStreamReader(connection.InputStream, "UTF-8"));

                jsonReader.BeginObject();

                while (jsonReader.HasNext)
                {
                    if (jsonReader.NextName().Equals("paymentResult"))
                    {
                        paymentStatus = jsonReader.NextString();
                    }
                    else
                    {
                        jsonReader.SkipValue();
                    }
                }

                jsonReader.EndObject();
                jsonReader.Close();

                Log.Debug(TravellerApp.Droid.PeachPayment.Common.Constants.LOG_TAG, "Status: " + paymentStatus);
            }
            catch (Exception e)
            {
                Log.Debug(TravellerApp.Droid.PeachPayment.Common.Constants.LOG_TAG, "Error: ", e);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Disconnect();
                }
            }

            return paymentStatus;
        }
コード例 #18
0
        protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
        {
            base.OnElementChanged(e);

            var activity = this.Context as Activity;

            if (!isShown && (Element != null))
            {
                isShown = true;
                FacebookLogin facebookLogin = (FacebookLogin)Element;

                var auth = new OAuth2Authenticator(
                    clientId: facebookLogin.FacebookSettings.ClientId,
                    scope: facebookLogin.FacebookSettings.Scope,
                    authorizeUrl: new Uri(facebookLogin.FacebookSettings.AuthorizeUrl),
                    redirectUrl: new Uri(facebookLogin.FacebookSettings.RedirectUrl));

                auth.Completed += async(sender, eventArgs) =>
                {
                    string id = string.Empty, token = String.Empty;
                    if (eventArgs.IsAuthenticated)
                    {
                        token = eventArgs.Account.Properties["access_token"];

                        var request = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me?fields=name"), null, eventArgs.Account);
                        await request.GetResponseAsync().ContinueWith(t =>
                        {
                            if (!t.IsFaulted)
                            {
                                var response      = t.Result.GetResponseStream();
                                JsonReader reader = new JsonReader(new InputStreamReader(response, "UTF-8"));

                                reader.BeginObject();
                                while (reader.HasNext)
                                {
                                    var name = reader.NextName();
                                    if (name.Equals("id"))
                                    {
                                        id = reader.NextString();
                                        break;
                                    }
                                    else
                                    {
                                        reader.SkipValue();
                                    }
                                }
                                reader.EndObject();
                            }
                        });
                    }

                    facebookLogin.LoginCompleted(eventArgs.IsAuthenticated, id, token);
                };

                activity.StartActivity(auth.GetUI(activity));
            }
        }
コード例 #19
0
        internal static Mask Parse(JsonReader reader, LottieComposition composition)
        {
            var maskMode = Mask.MaskMode.MaskModeAdd;
            AnimatableShapeValue   maskPath = null;
            AnimatableIntegerValue opacity  = null;

            reader.BeginObject();
            while (reader.HasNext())
            {
                var mode = reader.NextName();
                switch (mode)
                {
                case "mode":
                    switch (reader.NextString())
                    {
                    case "a":
                        maskMode = Mask.MaskMode.MaskModeAdd;
                        break;

                    case "s":
                        maskMode = Mask.MaskMode.MaskModeSubtract;
                        break;

                    case "i":
                        composition.AddWarning(
                            "Animation contains intersect masks. They are not supported but will be treated like add masks.");
                        maskMode = Mask.MaskMode.MaskModeIntersect;
                        break;

                    default:
                        Debug.WriteLine($"Unknown mask mode {mode}. Defaulting to Add.", LottieLog.Tag);
                        maskMode = Mask.MaskMode.MaskModeAdd;
                        break;
                    }

                    break;

                case "pt":
                    maskPath = AnimatableValueParser.ParseShapeData(reader, composition);
                    break;

                case "o":
                    opacity = AnimatableValueParser.ParseInteger(reader, composition);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();

            return(new Mask(maskMode, maskPath, opacity));
        }
コード例 #20
0
        internal static List <Keyframe <T> > Parse <T>(JsonReader reader, LottieComposition composition,
                                                       IValueParser <T> valueParser)
        {
            var keyframes = new List <Keyframe <T> >();

            if (reader.Peek() == JsonToken.String)
            {
                composition.AddWarning("Lottie doesn't support expressions.");
                return(keyframes);
            }

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "k":
                    if (reader.Peek() == JsonToken.StartArray)
                    {
                        reader.BeginArray();

                        if (reader.Peek() == JsonToken.Integer || reader.Peek() == JsonToken.Float)
                        {
                            // For properties in which the static value is an array of numbers.
                            keyframes.Add(KeyframeParser.Parse(reader, composition, valueParser, false));
                        }
                        else
                        {
                            while (reader.HasNext())
                            {
                                keyframes.Add(KeyframeParser.Parse(reader, composition, valueParser, true));
                            }
                        }
                        reader.EndArray();
                    }
                    else
                    {
                        keyframes.Add(KeyframeParser.Parse(reader, composition, valueParser, false));
                    }

                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();

            SetEndFrames <Keyframe <T>, T>(keyframes);
            return(keyframes);
        }
コード例 #21
0
        private String requestCheckoutId(String amount,
                                         String currency)
        {
            String urlString = TravellerApp.Droid.PeachPayment.Common.Constants.BASE_URL + "/token?" +
                               "amount=" + amount +
                               "&currency=" + currency +
                               "&paymentType=PA" +
                               /* store notificationUrl on your server to change it any time without updating the app */
                               "&notificationUrl=http://52.59.56.185:80/notification";
            URL url;
            HttpURLConnection connection = null;
            String            checkoutId = null;

            try
            {
                url        = new URL(urlString);
                connection = (HttpURLConnection)url.OpenConnection();
                connection.ConnectTimeout = TravellerApp.Droid.PeachPayment.Common.Constants.CONNECTION_TIMEOUT;

                JsonReader reader = new JsonReader(
                    new InputStreamReader(connection.InputStream, "UTF-8"));

                reader.BeginObject();

                while (reader.HasNext)
                {
                    if (reader.NextName().Equals("checkoutId"))
                    {
                        checkoutId = reader.NextString();

                        break;
                    }
                }

                reader.EndObject();
                reader.Close();

                Log.Debug(TravellerApp.Droid.PeachPayment.Common.Constants.LOG_TAG, "Checkout ID: " + checkoutId);
            }
            catch (Exception e)
            {
                Log.Debug(TravellerApp.Droid.PeachPayment.Common.Constants.LOG_TAG, "Error: ", e);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Disconnect();
                }
            }

            return(checkoutId);
        }
コード例 #22
0
 private void ReadItem(JsonReader jReader)
 {
     jReader.BeginObject();
     while (jReader.HasNext)
     {
         string name = jReader.NextName();
         if (name.Equals("Properties"))
         {
             ReadPropertiesArray(jReader);
         }
         else
         {
             jReader.SkipValue();
         }
     }
     jReader.EndObject();
 }
コード例 #23
0
 private void readCitiesHierarchy(Dictionary <string, string> mapsItemsCodes, string currentParentCode, JsonReader reader)
 {
     reader.BeginObject();
     while (reader.HasNext)
     {
         string key = reader.NextName();
         if (key != null)
         {
             if (key.Equals(CITY_CODE_ID))
             {
                 string currentCityCode = reader.NextString();
                 if ((currentCityCode != null) && (currentParentCode != null))
                 {
                     mapsItemsCodes.Add(currentCityCode, currentParentCode);
                 }
             }
         }
     }
     reader.EndObject();
 }
コード例 #24
0
        private static AnimatableTextProperties ParseAnimatableTextProperties(JsonReader reader,
                                                                              LottieComposition composition)
        {
            AnimatableColorValue color       = null;
            AnimatableColorValue stroke      = null;
            AnimatableFloatValue strokeWidth = null;
            AnimatableFloatValue tracking    = null;

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "fc":
                    color = AnimatableValueParser.ParseColor(reader, composition);
                    break;

                case "sc":
                    stroke = AnimatableValueParser.ParseColor(reader, composition);
                    break;

                case "sw":
                    strokeWidth = AnimatableValueParser.ParseFloat(reader, composition);
                    break;

                case "t":
                    tracking = AnimatableValueParser.ParseFloat(reader, composition);
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();

            return(new AnimatableTextProperties(color, stroke, strokeWidth, tracking));
        }
コード例 #25
0
 private void readSubRegionsForCurrentRegion(Dictionary <string, string> regionItemsCodes, string currentRegionCode, JsonReader reader)
 {
     reader.BeginArray();
     while (reader.HasNext)
     {
         reader.BeginObject();
         string key = reader.NextName();
         if (key != null)
         {
             if (key.Equals(SUB_REGION_CODE_ID))
             {
                 string subRegionCode = reader.NextString();
                 if (subRegionCode != null)
                 {
                     regionItemsCodes.Add(subRegionCode, currentRegionCode);
                 }
             }
         }
         reader.EndObject();
     }
     reader.EndArray();
 }
コード例 #26
0
        public string CreateSessionToken(string User, string Password, string Configuration)
        {
            //json/token/{config}
            string path   = BasePath + string.Format("/json/token/{0}", Configuration);
            string output = "";

            ReqMethod  = "Get";
            ReqHeaders = new WebHeaderCollection
            {
                { "UserId", User },
                { "Password", Password }
            };
            JsonReader reader = new JsonReader(new Java.IO.StringReader(ExecuteHTTPRequest(path).ToString()));

            reader.BeginObject();
            while (reader.HasNext)
            {
                string name = reader.NextName();
                if (name.Equals("Message"))
                {
                    string msg = reader.NextString();
                    if (!msg.ToLower().Equals("success"))
                    {
                        throw new Exception(msg);
                    }
                }
                else if (name.Equals("Token"))
                {
                    output = reader.NextString();
                }
                else
                {
                    reader.SkipValue();
                }
            }
            reader.EndObject();
            reader.Close();
            return(output);
        }
コード例 #27
0
        internal static Font Parse(JsonReader reader)
        {
            string family = null;
            string name   = null;
            string style  = null;
            float  ascent = 0;

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "fFamily":
                    family = reader.NextString();
                    break;

                case "fName":
                    name = reader.NextString();
                    break;

                case "fStyle":
                    style = reader.NextString();
                    break;

                case "ascent":
                    ascent = reader.NextDouble();
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }
            reader.EndObject();

            Enum.TryParse <SkiaSharp.SKTypefaceStyle>(style, true, out var result);

            return(new Font(family, name, result, ascent));
        }
コード例 #28
0
ファイル: CSIJsonREST.cs プロジェクト: jekingpan/MyTestPlan
 private void ReadRESTProperties(JsonReader jReader)
 {
     try
     {
         BaseIDOObjectItem item = new BaseIDOObjectItem();
         jReader.BeginObject();
         while (jReader.HasNext)
         {
             string name = jReader.NextName();
             if (name.Equals("Name"))
             {
                 item.ItemName = jReader.NextString();
             }
             else if (name.Equals("Value"))
             {
                 JsonToken peek = jReader.Peek();
                 if (peek == JsonToken.Null)
                 {
                     jReader.SkipValue();
                 }
                 else
                 {
                     item.ItemValue = jReader.NextString();
                 }
             }
             else
             {
                 jReader.SkipValue();
             }
         }
         jReader.EndObject();
         iResult.Objects.Last().ObjectItems.Add(item);
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
コード例 #29
0
            private void ReadSampleGroup(JsonReader reader, List <SampleGroup> groups)
            {
                string        groupName = "";
                List <Sample> samples   = new List <Sample>();

                reader.BeginObject();
                while (reader.HasNext)
                {
                    string name = reader.NextName();
                    switch (name)
                    {
                    case "name":
                        groupName = reader.NextString();
                        break;

                    case "samples":
                        reader.BeginArray();
                        while (reader.HasNext)
                        {
                            samples.Add(ReadEntry(reader, false));
                        }
                        reader.EndArray();
                        break;

                    case "_comment":
                        reader.NextString();     // Ignore.
                        break;

                    default:
                        throw new ParserException("Unsupported name: " + name);
                    }
                }
                reader.EndObject();

                SampleGroup group = getGroup(groupName, groups);

                group.samples.AddRange(samples);
            }
コード例 #30
0
        internal static Font Parse(JsonReader reader)
        {
            string family = null;
            string name   = null;
            string style  = null;
            double ascent = 0;

            reader.BeginObject();
            while (reader.HasNext())
            {
                switch (reader.NextName())
                {
                case "fFamily":
                    family = reader.NextString();
                    break;

                case "fName":
                    name = reader.NextString();
                    break;

                case "fStyle":
                    style = reader.NextString();
                    break;

                case "ascent":
                    ascent = reader.NextDouble();
                    break;

                default:
                    reader.SkipValue();
                    break;
                }
            }

            reader.EndObject();

            return(new Font(family, name, style, ascent));
        }