Ejemplo n.º 1
0
        private TreeNode CreateEmpyrionObjectTreeNode(EmpyrionObject obj)
        {
            int      imageIndex = this.imagesConfigurationObjects.Images.IndexOfKey(obj.Type.ToString());
            TreeNode node       = new TreeNode(GetObjectDisplayName(obj), imageIndex, imageIndex);

            node.Tag = obj;
            foreach (EmpyrionObject child in obj.Children)
            {
                node.Nodes.Add(this.CreateEmpyrionObjectTreeNode(child));
            }
            return(node);
        }
Ejemplo n.º 2
0
        private void treeEmpyrionObjects_AfterSelect(object sender, TreeViewEventArgs e)
        {
            object         obj  = e?.Node?.Tag;
            EmpyrionObject eObj = null;

            if (obj is EmpyrionObject)
            {
                eObj = (EmpyrionObject)obj;
            }

            this.txtRawObject.Text           = obj?.ToString() ?? "";
            this.txtResolvedObject.Text      = eObj?.ToString(true) ?? "";
            splitObjectViews.Panel2Collapsed = string.IsNullOrWhiteSpace(this.txtResolvedObject.Text) || ((eObj?.GetReference()) == null);
        }
Ejemplo n.º 3
0
        public string GetObjectDisplayName(EmpyrionObject obj)
        {
            string localizedName = null;

            if (!string.IsNullOrWhiteSpace(obj.Name) && (this.Localization != null) && this.Localization.SelectedLanguage.ContainsKey(obj.Name))
            {
                localizedName = this.Localization[obj.Name];
            }

            if (!string.IsNullOrWhiteSpace(localizedName))
            {
                if (obj.ID != null)
                {
                    return($"{localizedName} - {obj.Name} [{obj.ID}]");
                }
                return($"{localizedName} - {obj.Name}");
            }
            else if (!string.IsNullOrWhiteSpace(obj.Name))
            {
                if (obj.ID != null)
                {
                    return($"{obj.Name} [{obj.ID.ToString()}]");
                }
                return(obj.Name);
            }
            else if (obj.ID != null)
            {
                return(obj.ID.ToString());
            }
            else if (obj.Properties.ContainsKey("radialtext"))
            {
                if (this.Localization == null)
                {
                    return(obj.Properties["radialtext"]?.Value);
                }
                else
                {
                    return(this.Localization[obj.Properties["radialtext"].Value]);
                }
            }

            return(null);
        }