Пример #1
0
        /// <summary>
        /// constructor a acpi data from a acpi name space
        /// </summary>
        /// <param name="acpiNs">acpi name space</param>
        public AcpiData(AmlBuilder.AcpiNS acpiNs)
        {
            Type = AcpiDataType.Unknown;
            switch (acpiNs.Type)
            {
            case "Integer":
                this.Type = AcpiDataType.Int;
                Value     = acpiNs.ulValue;
                break;

            case "String":
                this.Type = AcpiDataType.String;
                strValue  = new string(acpiNs.strValue.ToArray());
                break;

            case "Buffer":
                this.Type    = AcpiDataType.Buffer;
                this.bpValue = new byte[acpiNs.pbValue.Length];
                Array.Copy(acpiNs.pbValue, 0, this.bpValue, 0, acpiNs.pbValue.Length);
                break;

            case "Package":
                this.Type    = AcpiDataType.Packge;
                this.bpValue = new byte[acpiNs.pbValue.Length];
                Array.Copy(acpiNs.pbValue, 0, this.bpValue, 0, acpiNs.pbValue.Length);
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Build the tree view data
        /// </summary>
        /// <param name="root"></param>
        /// <param name="Path"></param>
        private void BuildAcpiObjects(TreeNode root, string Path)
        {
            string names = "";

            AcpiWinLog.Log(Path);
            int Length = acpiLib.GetNamePath(Path, ref names);

            if (Length > 0)
            {
                //
                // TreeNode node = root.Nodes.Add(Path);
                //
                int nStart = 0;
                AmlBuilder.AcpiNS acpiNSRoot = amlBuilder.GetCurrentPath();

                while (nStart < names.Length)
                {
                    string Name     = names.Substring(nStart, 4);
                    string FullPath = Path + Name;
                    ushort nType    = 0;
                    string type     = "";
                    AcpiWinLog.Log(FullPath);
                    if (Name == "----")
                    {
                        type    = "Field";
                        nStart += 4;
                        continue;
                    }

                    type = acpiLib.GetTypeStringByName(FullPath, ref nType);
                    AmlBuilder.AcpiNS acpiNs = amlBuilder.AddChildItem(FullPath, nType);

                    TreeNode subNode = root.Nodes.Add(string.Format("{0} [{1}]", Name, type));
                    // Create C# AcpiNS Data

                    // Full Path to Acpi Path
                    string FullNamePath   = "\\";
                    int    nFullPathStart = 4;
                    while (nFullPathStart < FullPath.Length)
                    {
                        FullNamePath   += FullPath.Substring(nFullPathStart, 4);
                        nFullPathStart += 4;
                        if (nFullPathStart < FullPath.Length)
                        {
                            FullNamePath += ".";
                        }
                    }
                    subNode.Tag         = FullPath;
                    subNode.Name        = FullNamePath;
                    subNode.ToolTipText = type;
                    subNode.ImageIndex  = nType;
                    // set the child
                    amlBuilder.SetCurrentPath(acpiNs);
                    BuildAcpiObjects(subNode, Path + Name);
                    // restore to parent
                    amlBuilder.SetCurrentPath(acpiNSRoot);
                    nStart += 4;
                }
            }
        }