コード例 #1
0
        public void Associate(UntranslatedText key, object ui, InternalTranslationResult translationResult, ParserTranslationContext context, bool saveResultGlobally)
        {
            // if just one of the things associated with this job, wants to save it, we shall!
            SaveResultGlobally = SaveResultGlobally || saveResultGlobally;

            if (context != null)
            {
                Contexts.Add(context);
                context.Jobs.Add(this);

                TranslationType |= TranslationType.Token;
            }
            else
            {
                if (ui != null && !ui.IsSpammingComponent())
                {
                    Components.Add(new KeyAnd <object>(key, ui));
                }

                if (translationResult != null)
                {
                    TranslationResults.Add(new KeyAnd <InternalTranslationResult>(key, translationResult));
                }

                TranslationType |= TranslationType.Full;
            }
        }
コード例 #2
0
 public ParserTranslationContext(object component, TranslationEndpointManager endpoint, InternalTranslationResult translationResult, ParserResult result)
 {
     Jobs              = new HashSet <TranslationJob>();
     Component         = component;
     Result            = result;
     Endpoint          = endpoint;
     TranslationResult = translationResult;
 }
コード例 #3
0
      public ParserTranslationContext( object component, TranslationEndpointManager endpoint, InternalTranslationResult translationResult, ParserResult result, ParserTranslationContext parentContext )
      {
         Jobs = new HashSet<TranslationJob>();
         ChildrenContexts = new List<ParserTranslationContext>();
         Component = component;
         Result = result;
         Endpoint = endpoint;
         TranslationResult = translationResult;
         ParentContext = parentContext;

         if( parentContext != null )
         {
            // thought: What would happen if I threw an exception after this massive anti-pattern?
            parentContext.ChildrenContexts.Add( this );
         }

         var ctx = this;
         while( ctx != null )
         {
            ctx = ctx.ParentContext;
            LevelsOfRecursion++;
         }
      }