コード例 #1
0
        public FileReference GetFileReference(string filePath)
        {
            IEdmFolder5    folder;
            IEdmFile5      file    = _vault.GetFileFromPath(filePath, out folder);
            IEdmReference5 fileRef = file.GetReferenceTree(folder.ID);

            return(GetFileReferencesRecursive(fileRef, "A"));
        }
コード例 #2
0
        public void ShowReferences(EdmVault5 vault, string filePath)
        {
            // ERROR: Not supported in C#: OnErrorStatement
            string      projName = null;
            IEdmFile5   file     = default(IEdmFile5);
            IEdmFolder5 folder   = default(IEdmFolder5);

            file = vault.GetFileFromPath(filePath, out folder);

            IEdmReference5 @ref = default(IEdmReference5);

            @ref = file.GetReferenceTree(folder.ID, 0);
            AddReferences(@ref, 0, ref projName);
        }
コード例 #3
0
        public void GetReferencedFiles(IEdmReference10 Reference, string FilePath, int Level, string ProjectName, ref Dictionary <string, string> RefFilesDictionary)
        {
            try
            {
                bool Top = false;
                if (Reference == null)
                {
                    //This is the first time this function is called for this
                    //reference tree; i.e., this is the root
                    Top = true;
                    //Add the top-level file path to the dictionary
                    RefFilesDictionary.Add(FilePath, Level.ToString());
                    IEdmFile5   File         = null;
                    IEdmFolder5 ParentFolder = null;
                    File = vault1.GetFileFromPath(FilePath, out ParentFolder);
                    //Get the reference tree for this file
                    Reference = (IEdmReference10)File.GetReferenceTree(ParentFolder.ID);
                    GetReferencedFiles(Reference, "", Level + 1, ProjectName, ref RefFilesDictionary);
                }
                else
                {
                    //Execute this code when this function is called recursively;
                    //i.e., this is not the top-level IEdmReference in the tree

                    //Recursively traverse the references
                    IEdmPos5        pos        = default(IEdmPos5);
                    IEdmReference10 Reference2 = (IEdmReference10)Reference;
                    pos = Reference2.GetFirstChildPosition3(ProjectName, Top, true, (int)EdmRefFlags.EdmRef_File, "", 0);
                    IEdmReference10 @ref = default(IEdmReference10);
                    while ((!pos.IsNull))
                    {
                        @ref = (IEdmReference10)Reference.GetNextChild(pos);
                        RefFilesDictionary.Add(@ref.FoundPath, Level.ToString());
                        GetReferencedFiles(@ref, "", Level + 1, ProjectName, ref RefFilesDictionary);
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }