private bool CheckComponentGUID(ComponentWrapper component, string text, ComponentMessageObject CMO)
 {
     if (string.IsNullOrEmpty(component.Guid))
     {
         if (!string.IsNullOrEmpty(component.Name) || !string.IsNullOrEmpty(component.ProjectPath))
         {
             WEMessage message = new WEMessage();
             message.Message       = text + "GUID missing in " + GetStringByComponentType(component.ComponentType);
             message.MessageObject = CMO;
             this.OnWarning(message);
         }
         return(false);
     }
     return(true);
 }
 private void CompareComponentName(ComponentWrapper component, string Name, string text, ComponentMessageObject CMO)
 {
     if (string.Compare(component.Name, Name, StringComparison.Ordinal) != 0)
     {
         WEMessage message = new WEMessage();
         message.Message       = text + "Name mismatch. Component Name: \"" + component.Name + "\" " + GetStringByComponentType(component.ComponentType) + " Name:\"" + Name + "\"";
         message.MessageObject = CMO;
         this.OnWarning(message);
     }
 }
        private void CanTFindComponentsReference(ComponentWrapper component, string text, ComponentMessageObject CMO)
        {
            WEMessage message = new WEMessage();

            message.Message       = text + "Can't find " + GetStringByComponentType(component.ComponentType) + " with GUID " + component.Guid;
            message.MessageObject = CMO;
            this.OnWarning(message);
        }
        private void CheckComponent(ComponentWrapper OwnerComponent, string text, ComponentWrapper component)
        {
            ComponentMessageObject CMO = new ComponentMessageObject();

            CMO.Component = OwnerComponent;

            ComponentsChecked++;
            switch (component.ComponentType)
            {
                #region Library
            case ComponentTypeWrapper.Library:
                if (!CheckComponentGUID(component, text, CMO))
                {
                    return;
                }

                LibraryWrapper LW = PK.Wrapper.FindLibrary(component.Guid);
                if (LW == null)
                {
                    CanTFindComponentsReference(component, text, CMO);
                    return;
                }
                CompareComponentName(component, LW.Name, text, CMO);
                CompareComponentProjectPath(component, LW.ProjectPath, text, CMO);
                break;

                #endregion
                #region Feature
            case ComponentTypeWrapper.Feature:
                if (!CheckComponentGUID(component, text, CMO))
                {
                    return;
                }

                FeatureWrapper FW = PK.Wrapper.FindFeature(component.Guid);
                if (FW == null)
                {
                    CanTFindComponentsReference(component, text, CMO);
                    return;
                }
                CompareComponentName(component, FW.Name, text, CMO);
                CompareComponentProjectPath(component, FW.ProjectPath, text, CMO);
                break;

                #endregion
                #region Assembly
            case ComponentTypeWrapper.MFAssembly:
                if (!CheckComponentGUID(component, text, CMO))
                {
                    return;
                }

                AssemblyWrapper AW = PK.Wrapper.FindAssembly(component.Guid);
                if (AW == null)
                {
                    CanTFindComponentsReference(component, text, CMO);
                    return;
                }
                CompareComponentName(component, AW.Name, text, CMO);
                CompareComponentProjectPath(component, AW.ProjectPath, text, CMO);
                break;

                #endregion
            case ComponentTypeWrapper.MFSolution:
                break;

                #region Processors
            case ComponentTypeWrapper.Processor:
                if (!CheckComponentGUID(component, text, CMO))
                {
                    return;
                }

                ProcessorWrapper PW = PK.Wrapper.FindProcessor(component.Guid);
                if (PW == null)
                {
                    CanTFindComponentsReference(component, text, CMO);
                    return;
                }
                CompareComponentName(component, PW.Name, text, CMO);
                CompareComponentProjectPath(component, PW.ProjectPath, text, CMO);
                break;

                #endregion
            case ComponentTypeWrapper.OperatingSystem:
                break;

            case ComponentTypeWrapper.BuildTool:
                break;

                #region ISA
            case ComponentTypeWrapper.ISA:
                if (!CheckComponentGUID(component, text, CMO))
                {
                    return;
                }

                ISAWrapper IW = PK.Wrapper.FindISA(component.Guid);
                if (IW == null)
                {
                    CanTFindComponentsReference(component, text, CMO);
                    return;
                }
                CompareComponentName(component, IW.Name, text, CMO);
                break;

                #endregion
            case ComponentTypeWrapper.BuildParameter:
                break;

                #region LibraryCategory
            case ComponentTypeWrapper.LibraryCategory:
                if (!CheckComponentGUID(component, text, CMO))
                {
                    return;
                }

                LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(component.Guid);
                if (LCW == null)
                {
                    CanTFindComponentsReference(component, text, CMO);
                    return;
                }

                CompareComponentName(component, LCW.Name, text, CMO);

                CompareComponentProjectPath(component, LCW.ProjectPath, text, CMO);
                break;

                #endregion
                #region Unknown
            case ComponentTypeWrapper.Unknown:
                WEMessage UMessage = new WEMessage();
                UMessage.Message       = text + "Component with \"Type\": " + GetStringByComponentType(component.ComponentType);
                UMessage.MessageObject = CMO;
                this.OnWarning(UMessage);
                break;

                #endregion
            default:
                break;
            }
        }
 private void CompareComponentProjectPath(ComponentWrapper component, string ProjectPath, string text, ComponentMessageObject CMO)
 {
     if (component.Name == "COM_PAL")
     {
     }
     if (string.Compare(component.ProjectPath, ProjectPath, true) != 0)
     {
         WEMessage message = new WEMessage();
         message.Message       = text + "Project Path mismatch. Component Project Path: \"" + component.ProjectPath + "\" " + GetStringByComponentType(component.ComponentType) + " Project Path:\"" + ProjectPath + "\"";
         message.MessageObject = CMO;
         this.OnWarning(message);
     }
 }
 private bool CheckComponentGUID(ComponentWrapper component, string text, ComponentMessageObject CMO)
 {
     if (string.IsNullOrEmpty(component.Guid))
     {
         if (!string.IsNullOrEmpty(component.Name) || !string.IsNullOrEmpty(component.ProjectPath))
         {
             WEMessage message = new WEMessage();
             message.Message = text + "GUID missing in " + GetStringByComponentType(component.ComponentType);
             message.MessageObject = CMO;
             this.OnWarning(message);
         }
         return false;
     }
     return true;
 }
        private void VerifyStubs()
        {
            this.OnMessage("Running Stubs Verification...\r\n");

            List <LibraryWrapper> CheckList = new List <LibraryWrapper>();

            LibraryWrapper[] LWS = PK.Wrapper.GetLibraries();
            foreach (LibraryWrapper LW in LWS)
            {
                if (LW.IsStub)
                {
                    CheckList.Add(LW);
                }
            }

            foreach (LibraryWrapper LW in CheckList)
            {
                ComponentMessageObject CMO = new ComponentMessageObject();
                CMO.Component = ComponentWrapper.GetComponentWrapper(LW);

                if (LW.HasLibraryCategory == false)
                {
                    WEMessage message = new WEMessage();
                    message.Message       = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\" has not have library category";
                    message.MessageObject = CMO;
                    this.OnWarning(message);
                }
                else
                {
                    LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(LW.LibraryCategory.Guid);
                    if (string.Compare(LCW.StubLibrary.Guid, LW.Guid, true) != 0)
                    {
                        WEMessage message = new WEMessage();
                        message.Message       = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\": " + GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has wrong GUID in it's StubLibrary field";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }

                    if (string.Compare(LCW.StubLibrary.Name, LW.Name, true) != 0)
                    {
                        WEMessage message = new WEMessage();
                        message.Message       = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\": " + GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has wrong NAME in it's StubLibrary field";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }

                    if (string.Compare(LCW.StubLibrary.ProjectPath, LW.ProjectPath, true) != 0)
                    {
                        WEMessage message = new WEMessage();
                        message.Message       = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\": " + GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has wrong ProjectPath in it's StubLibrary field";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }
                }
            }

            LibraryCategoryWrapper[] LCWS = PK.Wrapper.GetLibraryCategories();
            foreach (LibraryCategoryWrapper LCW in LCWS)
            {
                ComponentMessageObject CMO = new ComponentMessageObject();
                CMO.Component = ComponentWrapper.GetComponentWrapper(LCW);

                if (LCW.StubLibrary.Guid == null)
                {
                    WEMessage message = new WEMessage();
                    message.Message       = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has not have stub library";
                    message.MessageObject = CMO;
                    this.OnWarning(message);
                }
                else
                {
                    LibraryWrapper LW = PK.Wrapper.FindLibrary(LCW.StubLibrary.Guid);
                    if (LW == null)
                    {
                        WEMessage message = new WEMessage();
                        message.Message       = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" Stub Library: Can't find library with GUID";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }
                    else
                    {
                        if (string.Compare(LCW.StubLibrary.Name, LW.Name, true) != 0)
                        {
                            WEMessage message = new WEMessage();
                            message.Message       = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" Stub Library: Name mismatch. Stub component Name is \"" + LCW.StubLibrary.Name + "\" " + GetStringByComponentType(ComponentTypeWrapper.Library) + " Name is \"" + LW.Name + "\"";
                            message.MessageObject = CMO;
                            this.OnWarning(message);
                        }

                        if (string.Compare(LCW.StubLibrary.ProjectPath, LW.ProjectPath, true) != 0)
                        {
                            WEMessage message = new WEMessage();
                            message.Message       = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" Stub Library: Project Path mismatch. Stub component Project Path is \"" + LCW.StubLibrary.Name + "\" " + GetStringByComponentType(ComponentTypeWrapper.Library) + " Project Path is \"" + LW.Name + "\"";
                            message.MessageObject = CMO;
                            this.OnWarning(message);
                        }
                    }
                }
            }

            this.OnMessage("Verified " + CheckList.Count + " object(s).\r\n\r\n");
        }
 private void CanTFindComponentsReference(ComponentWrapper component, string text, ComponentMessageObject CMO)
 {
     WEMessage message = new WEMessage();
     message.Message = text + "Can't find " + GetStringByComponentType(component.ComponentType) + " with GUID " + component.Guid;
     message.MessageObject = CMO;
     this.OnWarning(message);
 }
 private void CompareComponentName(ComponentWrapper component, string Name, string text, ComponentMessageObject CMO)
 {
     if (string.Compare(component.Name, Name, StringComparison.Ordinal) != 0)
     {
         WEMessage message = new WEMessage();
         message.Message = text + "Name mismatch. Component Name: \"" + component.Name + "\" " + GetStringByComponentType(component.ComponentType) + " Name:\"" + Name + "\"";
         message.MessageObject = CMO;
         this.OnWarning(message);
     }
 }
 private void CompareComponentProjectPath(ComponentWrapper component, string ProjectPath, string text, ComponentMessageObject CMO)
 {
     if (component.Name == "COM_PAL")
     {
     }
     if (string.Compare(component.ProjectPath, ProjectPath, true) != 0)
     {
         WEMessage message = new WEMessage();
         message.Message = text + "Project Path mismatch. Component Project Path: \"" + component.ProjectPath + "\" " + GetStringByComponentType(component.ComponentType) + " Project Path:\"" + ProjectPath + "\"";
         message.MessageObject = CMO;
         this.OnWarning(message);
     }
 }
        private void CheckComponent(ComponentWrapper OwnerComponent, string text, ComponentWrapper component)
        {
            ComponentMessageObject CMO = new ComponentMessageObject();
            CMO.Component = OwnerComponent;

            ComponentsChecked++;
            switch (component.ComponentType)
            {
                #region Library
                case ComponentTypeWrapper.Library:
                    if (!CheckComponentGUID(component, text, CMO)) return;

                    LibraryWrapper LW = PK.Wrapper.FindLibrary(component.Guid);
                    if (LW == null)
                    {
                        CanTFindComponentsReference(component, text, CMO);
                        return;
                    }
                    CompareComponentName(component, LW.Name, text, CMO);
                    CompareComponentProjectPath(component, LW.ProjectPath, text, CMO);
                    break;
                #endregion
                #region Feature
                case ComponentTypeWrapper.Feature:
                    if (!CheckComponentGUID(component, text, CMO)) return;

                    FeatureWrapper FW = PK.Wrapper.FindFeature(component.Guid);
                    if (FW == null)
                    {
                        CanTFindComponentsReference(component, text, CMO);
                        return;
                    }
                    CompareComponentName(component, FW.Name, text, CMO);
                    CompareComponentProjectPath(component, FW.ProjectPath, text, CMO);
                    break;
                #endregion
                #region Assembly
                case ComponentTypeWrapper.MFAssembly:
                    if (!CheckComponentGUID(component, text, CMO)) return;

                    AssemblyWrapper AW = PK.Wrapper.FindAssembly(component.Guid);
                    if (AW == null)
                    {
                        CanTFindComponentsReference(component, text, CMO);
                        return;
                    }
                    CompareComponentName(component, AW.Name, text, CMO);
                    CompareComponentProjectPath(component, AW.ProjectPath, text, CMO);
                    break;
                #endregion
                case ComponentTypeWrapper.MFSolution:
                    break;
                #region Processors
                case ComponentTypeWrapper.Processor:
                    if (!CheckComponentGUID(component, text, CMO)) return;

                    ProcessorWrapper PW = PK.Wrapper.FindProcessor(component.Guid);
                    if (PW == null)
                    {
                        CanTFindComponentsReference(component, text, CMO);
                        return;
                    }
                    CompareComponentName(component, PW.Name, text, CMO);
                    CompareComponentProjectPath(component, PW.ProjectPath, text, CMO);
                    break;
                #endregion
                case ComponentTypeWrapper.OperatingSystem:
                    break;
                case ComponentTypeWrapper.BuildTool:
                    break;
                #region ISA
                case ComponentTypeWrapper.ISA:
                    if (!CheckComponentGUID(component, text, CMO)) return;

                    ISAWrapper IW = PK.Wrapper.FindISA(component.Guid);
                    if (IW == null)
                    {
                        CanTFindComponentsReference(component, text, CMO);
                        return;
                    }
                    CompareComponentName(component, IW.Name, text, CMO);
                    break;
                #endregion
                case ComponentTypeWrapper.BuildParameter:
                    break;
                #region LibraryCategory
                case ComponentTypeWrapper.LibraryCategory:
                    if (!CheckComponentGUID(component, text, CMO)) return;

                    LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(component.Guid);
                    if (LCW == null)
                    {
                        CanTFindComponentsReference(component, text, CMO);
                        return;
                    }

                    CompareComponentName(component, LCW.Name, text, CMO);

                    CompareComponentProjectPath(component, LCW.ProjectPath, text, CMO);
                    break;
                #endregion
                #region Unknown
                case ComponentTypeWrapper.Unknown:
                    WEMessage UMessage = new WEMessage();
                    UMessage.Message = text + "Component with \"Type\": " + GetStringByComponentType(component.ComponentType);
                    UMessage.MessageObject = CMO;
                    this.OnWarning(UMessage);
                    break;
                #endregion
                default:
                    break;
            }
        }
        private void VerifyStubs()
        {
            this.OnMessage("Running Stubs Verification...\r\n");

            List<LibraryWrapper> CheckList = new List<LibraryWrapper>();

            LibraryWrapper[] LWS = PK.Wrapper.GetLibraries();
            foreach (LibraryWrapper LW in LWS)
            {
                if (LW.IsStub)
                    CheckList.Add(LW);
            }

            foreach (LibraryWrapper LW in CheckList)
            {
                ComponentMessageObject CMO = new ComponentMessageObject();
                CMO.Component = ComponentWrapper.GetComponentWrapper(LW);

                if (LW.HasLibraryCategory == false)
                {
                    WEMessage message = new WEMessage();
                    message.Message = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\" has not have library category";
                    message.MessageObject = CMO;
                    this.OnWarning(message);
                }
                else
                {
                    LibraryCategoryWrapper LCW = PK.Wrapper.FindLibraryCategory(LW.LibraryCategory.Guid);
                    if (string.Compare(LCW.StubLibrary.Guid, LW.Guid, true) != 0)
                    {
                        WEMessage message = new WEMessage();
                        message.Message = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\": " + GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has wrong GUID in it's StubLibrary field";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }

                    if (string.Compare(LCW.StubLibrary.Name, LW.Name, true) != 0)
                    {
                        WEMessage message = new WEMessage();
                        message.Message = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\": " + GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has wrong NAME in it's StubLibrary field";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }

                    if (string.Compare(LCW.StubLibrary.ProjectPath, LW.ProjectPath, true) != 0)
                    {
                        WEMessage message = new WEMessage();
                        message.Message = "Stub " + GetStringByComponentType(ComponentTypeWrapper.Library) + " \"" + LW.Name + "\": " + GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has wrong ProjectPath in it's StubLibrary field";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }
                }
            }

            LibraryCategoryWrapper[] LCWS = PK.Wrapper.GetLibraryCategories();
            foreach (LibraryCategoryWrapper LCW in LCWS)
            {
                ComponentMessageObject CMO = new ComponentMessageObject();
                CMO.Component = ComponentWrapper.GetComponentWrapper(LCW);

                if (LCW.StubLibrary.Guid == null)
                {
                    WEMessage message = new WEMessage();
                    message.Message = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" has not have stub library";
                    message.MessageObject = CMO;
                    this.OnWarning(message);
                }
                else
                {
                    LibraryWrapper LW = PK.Wrapper.FindLibrary(LCW.StubLibrary.Guid);
                    if (LW == null)
                    {
                        WEMessage message = new WEMessage();
                        message.Message = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" Stub Library: Can't find library with GUID";
                        message.MessageObject = CMO;
                        this.OnWarning(message);
                    }
                    else
                    {
                        if (string.Compare(LCW.StubLibrary.Name, LW.Name, true) != 0)
                        {
                            WEMessage message = new WEMessage();
                            message.Message = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" Stub Library: Name mismatch. Stub component Name is \"" + LCW.StubLibrary.Name + "\" " + GetStringByComponentType(ComponentTypeWrapper.Library) + " Name is \"" + LW.Name + "\"";
                            message.MessageObject = CMO;
                            this.OnWarning(message);
                        }

                        if (string.Compare(LCW.StubLibrary.ProjectPath, LW.ProjectPath, true) != 0)
                        {
                            WEMessage message = new WEMessage();
                            message.Message = GetStringByComponentType(ComponentTypeWrapper.LibraryCategory) + " \"" + LCW.Name + "\" Stub Library: Project Path mismatch. Stub component Project Path is \"" + LCW.StubLibrary.Name + "\" " + GetStringByComponentType(ComponentTypeWrapper.Library) + " Project Path is \"" + LW.Name + "\"";
                            message.MessageObject = CMO;
                            this.OnWarning(message);
                        }
                    }
                }
            }

            this.OnMessage("Verified " + CheckList.Count + " object(s).\r\n\r\n");
        }