Пример #1
0
 public void Create(TranslatorObject translatorObject)
 {
     if (actualObject == null)
     {
         this.actualObject         = translatorObject;
         this.mainTranslatorObject = translatorObject;
     }
     else
     {
         translatorObject.ParentTranslatorObject = actualObject;
         this.actualObject.Objects.Add(keyValuePairName, translatorObject);
         this.actualObject = translatorObject;
     }
 }
Пример #2
0
        private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            Dictionary <string, TranslatorObject> translatorObjectList = new Dictionary <string, TranslatorObject>();
            var data = ConvertUtf8ToUnicode(e.Result);

            if (data != null)
            {
                string           innerText                          = data.FindInnerBlock(OPENSQUAREBRACKET, CLOSESQUAREBRACKET);
                var              substaniveItems                    = data.FindStartBlock(SUBSTANTIV, OPENSQUAREBRACKET, CLOSESQUAREBRACKET);
                var              verbItems                          = data.FindStartBlock(VERB, OPENSQUAREBRACKET, CLOSESQUAREBRACKET);
                TranslatorObject translatorParserVerbObjects        = null;
                TranslatorObject translatorParserSubstantiveObjects = null;
                if (verbItems != String.Empty)
                {
                    translatorParserVerbObjects = TranslatorParserCombinator.Deserialize(verbItems);
                    if (translatorParserVerbObjects.Values.Count > 0)
                    {
                        translatorObjectList.Add(VERB, translatorParserVerbObjects);
                    }
                }
                if (substaniveItems != String.Empty)
                {
                    translatorParserSubstantiveObjects = TranslatorParserCombinator.Deserialize(substaniveItems);
                    if (translatorParserSubstantiveObjects.Values.Count > 0)
                    {
                        translatorObjectList.Add(SUBSTANTIV, translatorParserSubstantiveObjects);
                    }
                }
                if (innerText != String.Empty)
                {
                    var translatorParserObjects = TranslatorParserCombinator.Deserialize(innerText);
                    if (translatorParserObjects.Values.Count > 0)
                    {
                        translatorObjectList.Add(TEXT, translatorParserObjects);
                    }
                }
            }
            DownloadCompleted(translatorObjectList);
        }
Пример #3
0
 public static string Serialize(TranslatorObject jsonObject)
 {
     return(string.Empty);
 }
Пример #4
0
 public void EndObject()
 {
     this.actualObject = this.actualObject.ParentTranslatorObject;
 }