Пример #1
0
        private MyLocalizationContext CreateOrGetContext(MyStringId contextId, bool disposable)
        {
            MyLocalizationContext context = null;

            if (!disposable)
            {
                m_contexts.TryGetValue(contextId, out context);
                if (context == null)
                {
                    m_contexts.Add(contextId, context = new MyLocalizationContext(contextId));

                    // Look for twin context
                    MyLocalizationContext twin;
                    if (m_disposableContexts.TryGetValue(contextId, out twin))
                    {
                        context.TwinContext = twin;
                        twin.TwinContext    = context;
                    }
                }
            }
            else
            {
                m_disposableContexts.TryGetValue(contextId, out context);
                if (context == null)
                {
                    m_disposableContexts.Add(contextId, context = new MyLocalizationContext(contextId));

                    // Look for twin context
                    MyLocalizationContext twin;
                    if (m_contexts.TryGetValue(contextId, out twin))
                    {
                        context.TwinContext = twin;
                        twin.TwinContext    = context;
                    }
                }
            }

            return(context);
        }
 protected bool Equals(MyLocalizationContext other)
 {
     return m_contextName.Equals(other.m_contextName);
 }
Пример #3
0
 protected bool Equals(MyLocalizationContext other)
 {
     return(m_contextName.Equals(other.m_contextName));
 }
Пример #4
0
        private MyLocalizationContext CreateOrGetContext(MyStringId contextId, bool disposable)
        {
            MyLocalizationContext context = null;
            if (!disposable)
            {
                m_contexts.TryGetValue(contextId, out context);
                if (context == null)
                {
                    m_contexts.Add(contextId, context = new MyLocalizationContext(contextId));

                    // Look for twin context
                    MyLocalizationContext twin;
                    if (m_disposableContexts.TryGetValue(contextId, out twin))
                    {
                        context.TwinContext = twin;
                        twin.TwinContext = context;
                    }
                }
            }
            else
            {
                m_disposableContexts.TryGetValue(contextId, out context);
                if (context == null)
                {
                    m_disposableContexts.Add(contextId, context = new MyLocalizationContext(contextId));

                    // Look for twin context
                    MyLocalizationContext twin;
                    if (m_contexts.TryGetValue(contextId, out twin))
                    {
                        context.TwinContext = twin;
                        twin.TwinContext = context;
                    }
                }
            }

            return context;
        }