// Token: 0x0600785B RID: 30811 RVA: 0x002248A0 File Offset: 0x00222AA0
        private static void GetCargoAndRoot(SNCAnnotation annotation, XmlToken token, out AnnotationResource cargo, out XmlElement root, out bool newCargo, out bool newRoot)
        {
            Invariant.Assert(annotation != null, "Annotation is null.");
            Invariant.Assert((token & (XmlToken.MetaData | XmlToken.Left | XmlToken.Top | XmlToken.XOffset | XmlToken.YOffset | XmlToken.Width | XmlToken.Height | XmlToken.IsExpanded | XmlToken.Author | XmlToken.Text | XmlToken.Ink | XmlToken.ZOrder)) > (XmlToken)0, "No token specified.");
            string cargoName = SNCAnnotation.GetCargoName(token);

            newRoot  = false;
            newCargo = false;
            cargo    = annotation.FindCargo(cargoName);
            if (cargo != null)
            {
                root = SNCAnnotation.FindRootXmlElement(token, cargo);
                if (root == null)
                {
                    newRoot = true;
                    XmlDocument xmlDocument = new XmlDocument();
                    root = xmlDocument.CreateElement(SNCAnnotation.GetXmlName(token), "http://schemas.microsoft.com/windows/annotations/2003/11/base");
                    return;
                }
            }
            else
            {
                newCargo = true;
                cargo    = new AnnotationResource(cargoName);
                XmlDocument xmlDocument2 = new XmlDocument();
                root = xmlDocument2.CreateElement(SNCAnnotation.GetXmlName(token), "http://schemas.microsoft.com/windows/annotations/2003/11/base");
                cargo.Contents.Add(root);
            }
        }
        // Token: 0x0600785A RID: 30810 RVA: 0x00224848 File Offset: 0x00222A48
        private object FindData(XmlToken token)
        {
            object obj = null;

            if (this._cachedXmlElements.ContainsKey(token))
            {
                obj = this._cachedXmlElements[token];
            }
            else
            {
                AnnotationResource annotationResource = this.FindCargo(SNCAnnotation.GetCargoName(token));
                if (annotationResource != null)
                {
                    obj = SNCAnnotation.FindContent(token, annotationResource);
                    if (obj != null)
                    {
                        this._cachedXmlElements.Add(token, obj);
                    }
                }
            }
            return(obj);
        }
        // Token: 0x06007862 RID: 30818 RVA: 0x00224C48 File Offset: 0x00222E48
        private void UpdateContent(StickyNoteControl snc, bool updateAnnotation, XmlToken token)
        {
            Invariant.Assert(snc != null, "Sticky Note Control is null.");
            Invariant.Assert((token & (XmlToken.Text | XmlToken.Ink)) > (XmlToken)0, "No token specified.");
            StickyNoteContentControl content = snc.Content;

            if (content == null)
            {
                return;
            }
            if ((token == XmlToken.Ink && content.Type != StickyNoteType.Ink) || (token == XmlToken.Text && content.Type != StickyNoteType.Text))
            {
                return;
            }
            XmlElement xmlElement = null;

            if (updateAnnotation)
            {
                AnnotationResource annotationResource = null;
                bool flag  = false;
                bool flag2 = false;
                if (!content.IsEmpty)
                {
                    SNCAnnotation.GetCargoAndRoot(this, token, out annotationResource, out xmlElement, out flag2, out flag);
                    content.Save(xmlElement);
                }
                else
                {
                    string cargoName = SNCAnnotation.GetCargoName(token);
                    annotationResource = this.FindCargo(cargoName);
                    if (annotationResource != null)
                    {
                        this._annotation.Cargos.Remove(annotationResource);
                        this._cachedXmlElements.Remove(token);
                    }
                }
                if (flag)
                {
                    Invariant.Assert(xmlElement != null, "XmlElement should have been created.");
                    Invariant.Assert(annotationResource != null, "Cargo should have been retrieved.");
                    annotationResource.Contents.Add(xmlElement);
                }
                if (flag2)
                {
                    Invariant.Assert(annotationResource != null, "Cargo should have been created.");
                    this._annotation.Cargos.Add(annotationResource);
                    return;
                }
            }
            else
            {
                XmlElement xmlElement2 = (XmlElement)this.FindData(token);
                if (xmlElement2 != null)
                {
                    content.Load(xmlElement2);
                    return;
                }
                if (!content.IsEmpty)
                {
                    content.Clear();
                }
            }
        }