static public List <Info> FilesPdm(IEdmVault5 vault, ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            var list = new List <Info>();

            try
            {
                foreach (EdmCmdData edmCmdData in ppoData)
                {
                    try
                    {
                        var fileId         = edmCmdData.mlObjectID1;
                        var parentFolderId = edmCmdData.mlObjectID2; // for Task
                                                                     //var parentFolderId = edmCmdData.mlObjectID3; // for Addin
                        var fileEdm = (IEdmFile5)vault.GetObject(EdmObjectType.EdmObject_File, fileId);
                        var folder  = (IEdmFolder5)vault.GetObject(EdmObjectType.EdmObject_Folder, parentFolderId);

                        var taskParam = new Info();
                        taskParam.IdPDM          = fileEdm.ID;
                        taskParam.CurrentVersion = fileEdm.CurrentVersion;
                        taskParam.FileName       = fileEdm.Name;
                        taskParam.FolderPath     = folder.LocalPath;
                        taskParam.FolderID       = folder.ID;
                        taskParam.FullFilePath   = folder.LocalPath + "\\" + fileEdm.Name;
                        list.Add(taskParam);
                    }
                    catch (Exception exeption)
                    {
                        Logger.Add("FilesPdm - " + exeption.Message);
                    }
                }
            }
            catch (COMException ex)
            {
                Logger.Add("OnTaskSetup HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message);
            }
            catch (Exception ex)
            {
                Logger.Add(ex.Message + "; " + ex.StackTrace);
            }
            return(list);
        }
示例#2
0
        public void AddFileRef(ref EdmListFile[] BatchListFiles, ref int curIndex, int curLevel, ref List <FileRef> FileRefs)

        {
            try
            {
                while (curIndex < BatchListFiles.Length)
                {
                    EdmListFile curListFile = BatchListFiles[curIndex];
                    //If the depth level of this listfile is <
                    //the current depth level then...
                    if (curListFile.mlParam > curLevel)
                    {
                        //Create a new FileRefs list
                        FileRefs[FileRefs.Count - 1].FileRefs = new List <FileRef>();
                        List <FileRef> fRef = FileRefs[FileRefs.Count - 1].FileRefs;
                        //Recurse using a new FileRefs list
                        AddFileRef(ref BatchListFiles, ref curIndex, curListFile.mlParam, ref fRef);
                    }
                    else
                    {
                        //Create a new FileRef object to hold
                        //the file information
                        FileRef FileRef = new FileRef();
                        //Assign the FileRef properties
                        FileRef.CheckedOutBy = curListFile.mbsLockUser;
                        FileRef.CurrentState = curListFile.moCurrentState.mbsStateName;
                        object[] columnData = (object[])curListFile.moColumnData;
                        FileRef.Description = (string)columnData[0];
                        IEdmFile5 File = default(IEdmFile5);
                        File                   = (IEdmFile5)vault1.GetObject(EdmObjectType.EdmObject_File, curListFile.mlFileID);
                        FileRef.FileName       = File.Name;
                        FileRef.LatestRevision = curListFile.mbsRevisionName;
                        FileRef.LatestVersion  = Convert.ToString(curListFile.mlLatestVersion);
                        FileRef.Number         = (string)columnData[1];
                        FileRef.FileRefs       = null;
                        //Add the FileRef to this level's list
                        FileRefs.Add(FileRef);
                        curIndex += 1;
                    }
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#3
0
        public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            IEdmVault5 tmpVault = poCmd.mpoVault as IEdmVault5; //link to the current vault

            try
            {
                switch (poCmd.meCmdType)
                {
                case EdmCmdType.EdmCmd_CardButton:
                case EdmCmdType.EdmCmd_Menu:
                    if (poCmd.mbsComment == bc_window | poCmd.mlCmdID == 1000)
                    {
                        FileData[] FP = new FileData[ppoData.Length];
                        for (int i = 0; i < ppoData.Length; i++)
                        {
                            var dcFile = tmpVault.GetObject(EdmObjectType.EdmObject_File, ppoData[i].mlObjectID1) as IEdmFile5;
                            if (dcFile != null)
                            {
                                var folder_POS = dcFile.GetFirstFolderPosition();
                                var dcFolder   = dcFile.GetNextFolder(folder_POS);
                                FP[i].VaultName  = tmpVault.Name;
                                FP[i].FileID     = dcFile.ID.ToString();
                                FP[i].FileName   = dcFile.Name;
                                FP[i].FolderID   = dcFolder.ID.ToString();
                                FP[i].FolderPath = dcFolder.LocalPath;
                            }
                        }
                        if (!string.IsNullOrEmpty(FP[0].FileName))
                        {
                            addinWindow f = new addinWindow(ref FP);
                            f.ShowDialog();
                        }
                    }
                    break;
                }
            }
            catch (COMException ex)
            {
                string errorName, errorDesc;
                tmpVault.GetErrorString(ex.ErrorCode, out errorName, out errorDesc);
                tmpVault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);
            }
        }