Beispiel #1
0
        /**********************************************************************************************************************************************/
        public static List <AWS.FileFolder> GetFilesThatContainsName(ADSK.WebServicesTools.WebServiceManager webService, string name)
        {
            List <AWS.FileFolder> files = new List <AWS.FileFolder>();

            AWS.SrchStatus status   = null;
            string         bookmark = string.Empty;

            /******************************************************************* Find files with same document name *********************************************************/
            AWS.PropDef[] filePropertyDefinitions = webService.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
            AWS.PropDef   fileNameProperty        = filePropertyDefinitions.Single(n => n.SysName == "ClientFileName");
            AWS.SrchCond  fileNameCondition       = new AWS.SrchCond
            {
                PropDefId = fileNameProperty.Id,
                PropTyp   = AWS.PropertySearchType.SingleProperty,
                SrchOper  = 1,
                SrchRule  = AWS.SearchRuleType.Must,
                SrchTxt   = name
            };

            /*****************************************************************************************************************************************************************/
            while (status == null || files.Count < status.TotalHits)
            {
                AWS.FileFolder[] filesWithSameDocumentName = webService.DocumentService.FindFileFoldersBySearchConditions(new AWS.SrchCond[] { fileNameCondition }, null, null, true, true, ref bookmark, out status);
                if (filesWithSameDocumentName != null)
                {
                    files.AddRange(filesWithSameDocumentName);
                }
            }
            return(files);
        }
Beispiel #2
0
        static void GetAllVaultInventorFiles()
        {
            Console.WriteLine("Collecting Vault Inventor files...");
            var propDefs = _webSvc.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
            var provider = propDefs.FirstOrDefault(p => p.SysName.ToLower().Equals("provider"));
            var fileExt  = propDefs.FirstOrDefault(p => p.SysName.ToLower().Equals("extension"));

            var srchCond = new Autodesk.Connectivity.WebServices.SrchCond();

            srchCond.PropDefId = provider.Id;
            srchCond.SrchOper  = 3;
            srchCond.SrchRule  = SearchRuleType.Must;
            srchCond.PropTyp   = PropertySearchType.SingleProperty;
            srchCond.SrchTxt   = "Inventor";
            var srchCond2 = new Autodesk.Connectivity.WebServices.SrchCond();

            srchCond2.PropDefId = fileExt.Id;
            srchCond2.SrchOper  = 2;
            srchCond2.SrchRule  = SearchRuleType.Must;
            srchCond2.PropTyp   = PropertySearchType.SingleProperty;
            srchCond2.SrchTxt   = "idw";
            var         srchStatus = new Autodesk.Connectivity.WebServices.SrchStatus();
            string      bookmark   = String.Empty;
            List <long> masterIds  = new List <long>();
            long        counter    = 0;

            do
            {
                var files = _webSvc.DocumentService.FindFilesBySearchConditions(new SrchCond[] { srchCond, srchCond2 }, null, null, true, true, ref bookmark, out srchStatus);
                counter += files.Count();
                Console.WriteLine(String.Format("Files found: {0}/{1}, adding to database ...", counter, srchStatus.TotalHits));
                List <string> transaction = new List <string>();
                foreach (var file in files)
                {
                    if (!file.IsOnSite)
                    {
                        continue;
                    }
                    if (masterIds.Contains(file.MasterId))
                    {
                        continue;
                    }
                    transaction.Add(String.Format("INSERT INTO files (MasterID, Name, HasBOM, JobQueued,Processed, ID) VALUES ('{0}','{1}',0,0,0,'{2}');", file.MasterId, file.Name.Replace("'", "''"), file.Id));
                    masterIds.Add(file.MasterId);
                }
                string sql = String.Join(Environment.NewLine, transaction);
                sql = "BEGIN TRANSACTION;" + Environment.NewLine + sql + Environment.NewLine + "COMMIT;";
                //System.IO.File.WriteAllText(String.Format("transaction_{0}.txt", DateTime.Now.ToString("yyyyMMddHHmmss")), sql);
                var command = new SQLiteCommand(sql, m_dbConnection);
                command.ExecuteNonQuery();
            } while (counter < srchStatus.TotalHits);
        }
        /// <summary>
        /// Find file by 1 to many search criteria as property/value pairs.
        /// Downloads the first file matching all search criterias; include many as required to get the unique file.
        /// Preset Search Operator Options: [Property] is (exactly) [Value]; multiple conditions link up using AND condition.
        /// Preset Download Options: Download Children (recursively) = Enabled, Enforce Overwrite = True
        /// </summary>
        /// <param name="conn">Current Vault Connection</param>
        /// <param name="SearchCriteria">Dictionary of property/value pairs</param>
        /// <returns>Local path/filename</returns>
        public string mGetFilebySearchCriteria(VDF.Vault.Currency.Connections.Connection conn, Dictionary <string, string> SearchCriteria)
        {
            AWS.PropDef[] mFilePropDefs = conn.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
            //iterate mSearchcriteria to get property definitions and build AWS search criteria
            List <AWS.SrchCond> mSrchConds = new List <AWS.SrchCond>();
            int             i            = 0;
            List <AWS.File> totalResults = new List <AWS.File>();

            foreach (var item in SearchCriteria)
            {
                AWS.PropDef  mFilePropDef = mFilePropDefs.Single(n => n.DispName == item.Key);
                AWS.SrchCond mSearchCond  = new AWS.SrchCond();
                {
                    mSearchCond.PropDefId = mFilePropDef.Id;
                    mSearchCond.PropTyp   = AWS.PropertySearchType.SingleProperty;
                    mSearchCond.SrchOper  = 1; //equals
                    if (i == 0)
                    {
                        mSearchCond.SrchRule = AWS.SearchRuleType.May;
                    }
                    else
                    {
                        mSearchCond.SrchRule = AWS.SearchRuleType.Must;
                    }
                    mSearchCond.SrchTxt = item.Value;
                }
                mSrchConds.Add(mSearchCond);
                i++;
            }
            string bookmark = string.Empty;

            AWS.SrchStatus status = null;

            while (status == null || totalResults.Count < status.TotalHits)
            {
                AWS.File[] mSrchResults = conn.WebServiceManager.DocumentService.FindFilesBySearchConditions(
                    mSrchConds.ToArray(), null, null, false, true, ref bookmark, out status);
                if (mSrchResults != null)
                {
                    totalResults.AddRange(mSrchResults);
                }
                else
                {
                    break;
                }
            }
            //if results not empty
            if (totalResults.Count == 1)
            {
                AWS.File wsFile = totalResults.First <AWS.File>();
                VDF.Vault.Currency.Entities.FileIteration mFileIt = new VDF.Vault.Currency.Entities.FileIteration(conn, (wsFile));

                VDF.Vault.Settings.AcquireFilesSettings settings = new VDF.Vault.Settings.AcquireFilesSettings(conn);
                settings.DefaultAcquisitionOption = VCF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download;
                settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeChildren        = true;
                settings.OptionsRelationshipGathering.FileRelationshipSettings.RecurseChildren        = true;
                settings.OptionsRelationshipGathering.FileRelationshipSettings.VersionGatheringOption = VDF.Vault.Currency.VersionGatheringOption.Latest;
                settings.OptionsRelationshipGathering.IncludeLinksSettings.IncludeLinks = false;
                VCF.Vault.Settings.AcquireFilesSettings.AcquireFileResolutionOptions mResOpt = new VCF.Vault.Settings.AcquireFilesSettings.AcquireFileResolutionOptions();
                mResOpt.OverwriteOption           = VCF.Vault.Settings.AcquireFilesSettings.AcquireFileResolutionOptions.OverwriteOptions.ForceOverwriteAll;
                mResOpt.SyncWithRemoteSiteSetting = VCF.Vault.Settings.AcquireFilesSettings.SyncWithRemoteSite.Always;
                settings.AddFileToAcquire(mFileIt, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download);
                VDF.Vault.Results.AcquireFilesResults results = conn.FileManager.AcquireFiles(settings);
                if (results != null)
                {
                    VDF.Vault.Results.FileAcquisitionResult mFilesDownloaded = results.FileResults.Last();
                    return(mFilesDownloaded.LocalPath.FullPath.ToString());
                }
                else
                {
                    return("FileNotFound");
                }
            }
            else
            {
                return("FileNotFound");
            }
        }
        /// <summary>
        /// Find 1 to many file(s) by 1 to many search criteria as property/value pairs.
        /// Returns number of files found, matching the criteria.
        ///
        /// Preset Search Operator Options: [Property] is (exactly) [Value]; multiple conditions link up using AND/OR condition, depending MatchAllCriteria = True/False
        /// </summary>
        /// <param name="conn">Current Vault Connection</param>
        /// <param name="SearchCriteria">Dictionary of property/value pairs</param>
        /// <param name="MatchAllCriteria">Switches AND/OR conditions using multiple criterias. Default is false</param>
        /// <returns>Number of files found</returns>
        public string[] mCheckFilesExistBySearchCriteria(VDF.Vault.Currency.Connections.Connection conn, Dictionary <string, string> SearchCriteria, bool MatchAllCriteria)
        {
            List <String> mFilesFound = new List <string>();

            AWS.PropDef[] mFilePropDefs = conn.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
            //iterate mSearchcriteria to get property definitions and build AWS search criteria
            List <AWS.SrchCond> mSrchConds = new List <AWS.SrchCond>();
            int             i            = 0;
            List <AWS.File> totalResults = new List <AWS.File>();

            foreach (var item in SearchCriteria)
            {
                AWS.PropDef  mFilePropDef = mFilePropDefs.Single(n => n.DispName == item.Key);
                AWS.SrchCond mSearchCond  = new AWS.SrchCond();
                {
                    mSearchCond.PropDefId = mFilePropDef.Id;
                    mSearchCond.PropTyp   = AWS.PropertySearchType.SingleProperty;
                    mSearchCond.SrchOper  = 1; //equals
                    if (i == 0)
                    {
                        mSearchCond.SrchRule = AWS.SearchRuleType.May;
                    }
                    else
                    {
                        if (MatchAllCriteria)
                        {
                            mSearchCond.SrchRule = AWS.SearchRuleType.Must;
                        }
                        else
                        {
                            mSearchCond.SrchRule = AWS.SearchRuleType.May;
                        }
                    }
                    mSearchCond.SrchTxt = item.Value;
                }
                mSrchConds.Add(mSearchCond);
                i++;
            }
            string bookmark = string.Empty;

            AWS.SrchStatus status = null;

            while (status == null || totalResults.Count < status.TotalHits)
            {
                AWS.File[] mSrchResults = conn.WebServiceManager.DocumentService.FindFilesBySearchConditions(
                    mSrchConds.ToArray(), null, null, false, true, ref bookmark, out status);
                if (mSrchResults != null)
                {
                    totalResults.AddRange(mSrchResults);
                }
                else
                {
                    break;
                }
            }
            //if results not empty
            if (totalResults.Count >= 1)
            {
                foreach (AWS.File wsFile in totalResults)
                {
                    mFilesFound.Add(wsFile.Name);
                }
                return(mFilesFound.ToArray());
            }
            else
            {
                return(null);
            }
        }
        private void mCreateExport(IJobProcessorServices context, IJob job)
        {
            List <string> mExpFrmts    = new List <string>();
            List <string> mUploadFiles = new List <string>();

            // read target export formats from settings file
            Settings settings = Settings.Load();

            #region validate execution rules

            mTrace.IndentLevel += 1;
            mTrace.WriteLine("Translator Job started...");

            //pick up this job's context
            Connection connection = context.Connection;
            Autodesk.Connectivity.WebServicesTools.WebServiceManager mWsMgr = connection.WebServiceManager;
            long   mEntId    = Convert.ToInt64(job.Params["EntityId"]);
            string mEntClsId = job.Params["EntityClassId"];

            // only run the job for files
            if (mEntClsId != "FILE")
            {
                return;
            }

            // only run the job for ipt and iam file types,
            List <string> mFileExtensions = new List <string> {
                ".ipt", ".iam"
            };
            ACW.File mFile = mWsMgr.DocumentService.GetFileById(mEntId);
            if (!mFileExtensions.Any(n => mFile.Name.Contains(n)))
            {
                return;
            }

            // apply execution filters, e.g., exclude files of classification "substitute" etc.
            List <string> mFileClassific = new List <string> {
                "ConfigurationFactory", "DesignSubstitute"
            };                                                                                             //add "DesignDocumentation" for 3D Exporters only
            if (mFileClassific.Any(n => mFile.FileClass.ToString().Contains(n)))
            {
                return;
            }

            // you may add addtional execution filters, e.g., category name == "Sheet Metal Part"

            if (settings.ExportFomats == null)
            {
                throw new Exception("Settings expect to list at least one export format!");
            }
            if (settings.ExportFomats.Contains(","))
            {
                mExpFrmts = settings.ExportFomats.Split(',').ToList();
            }
            else
            {
                mExpFrmts.Add(settings.ExportFomats);
            }

            //remove SM formats, if source isn't sheet metal
            if (mFile.Cat.CatName != settings.SmCatDispName)
            {
                if (mExpFrmts.Contains("SMDXF"))
                {
                    mExpFrmts.Remove("SMDXF");
                }
                if (mExpFrmts.Contains("SMSAT"))
                {
                    mExpFrmts.Remove("SMSAT");
                }
            }

            mTrace.WriteLine("Job execution rules validated.");

            #endregion validate execution rules

            #region VaultInventorServer IPJ activation
            //establish InventorServer environment including translator addins; differentiate her in case full Inventor.exe is used
            Inventor.InventorServer mInv          = context.InventorObject as InventorServer;
            ApplicationAddIns       mInvSrvAddIns = mInv.ApplicationAddIns;

            //override InventorServer default project settings by your Vault specific ones
            Inventor.DesignProjectManager projectManager;
            Inventor.DesignProject        mSaveProject, mProject;
            String   mIpjPath      = "";
            String   mWfPath       = "";
            String   mIpjLocalPath = "";
            ACW.File mProjFile;
            VDF.Vault.Currency.Entities.FileIteration mIpjFileIter = null;

            //download and activate the Inventor Project file in VaultInventorServer
            mTrace.IndentLevel += 1;
            mTrace.WriteLine("Job tries activating Inventor project file as enforced in Vault behavior configurations.");
            try
            {
                //Download enforced ipj file
                if (mWsMgr.DocumentService.GetEnforceWorkingFolder() && mWsMgr.DocumentService.GetEnforceInventorProjectFile())
                {
                    mIpjPath = mWsMgr.DocumentService.GetInventorProjectFileLocation();
                    mWfPath  = mWsMgr.DocumentService.GetRequiredWorkingFolderLocation();
                }
                else
                {
                    throw new Exception("Job requires both settings enabled: 'Enforce Workingfolder' and 'Enforce Inventor Project'.");
                }

                String[] mIpjFullFileName = mIpjPath.Split(new string[] { "/" }, StringSplitOptions.None);
                String   mIpjFileName     = mIpjFullFileName.LastOrDefault();

                //get the projects file object for download
                ACW.PropDef[] filePropDefs = mWsMgr.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
                ACW.PropDef   mNamePropDef = filePropDefs.Single(n => n.SysName == "ClientFileName");
                ACW.SrchCond  mSrchCond    = new ACW.SrchCond()
                {
                    PropDefId = mNamePropDef.Id,
                    PropTyp   = ACW.PropertySearchType.SingleProperty,
                    SrchOper  = 3, // is equal
                    SrchRule  = ACW.SearchRuleType.Must,
                    SrchTxt   = mIpjFileName
                };
                string          bookmark     = string.Empty;
                ACW.SrchStatus  status       = null;
                List <ACW.File> totalResults = new List <ACW.File>();
                while (status == null || totalResults.Count < status.TotalHits)
                {
                    ACW.File[] results = mWsMgr.DocumentService.FindFilesBySearchConditions(new ACW.SrchCond[] { mSrchCond },
                                                                                            null, null, false, true, ref bookmark, out status);
                    if (results != null)
                    {
                        totalResults.AddRange(results);
                    }
                    else
                    {
                        break;
                    }
                }
                if (totalResults.Count == 1)
                {
                    mProjFile = totalResults[0];
                }
                else
                {
                    throw new Exception("Job execution stopped due to ambigous project file definitions; single project file per Vault expected");
                }

                //define download settings for the project file
                VDF.Vault.Settings.AcquireFilesSettings mDownloadSettings = new VDF.Vault.Settings.AcquireFilesSettings(connection);
                mDownloadSettings.LocalPath = new VDF.Currency.FolderPathAbsolute(mWfPath);
                mIpjFileIter = new VDF.Vault.Currency.Entities.FileIteration(connection, mProjFile);
                mDownloadSettings.AddFileToAcquire(mIpjFileIter, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download);

                //download project file and get local path
                VDF.Vault.Results.AcquireFilesResults   mDownLoadResult;
                VDF.Vault.Results.FileAcquisitionResult fileAcquisitionResult;
                mDownLoadResult       = connection.FileManager.AcquireFiles(mDownloadSettings);
                fileAcquisitionResult = mDownLoadResult.FileResults.FirstOrDefault();
                mIpjLocalPath         = fileAcquisitionResult.LocalPath.FullPath;

                //activate this Vault's ipj temporarily
                projectManager = mInv.DesignProjectManager;
                mSaveProject   = projectManager.ActiveDesignProject;
                mProject       = projectManager.DesignProjects.AddExisting(mIpjLocalPath);
                mProject.Activate();

                //[Optionally:] get Inventor Design Data settings and download all related files ---------

                mTrace.WriteLine("Job successfully activated Inventor IPJ.");
            }
            catch (Exception ex)
            {
                throw new Exception("Job was not able to activate Inventor project file. - Note: The ipj must not be checked out by another user.", ex.InnerException);
            }
            #endregion VaultInventorServer IPJ activation

            #region download source file(s)
            mTrace.IndentLevel += 1;
            mTrace.WriteLine("Job downloads source file(s) for translation.");
            //download the source file iteration, enforcing overwrite if local files exist
            VDF.Vault.Settings.AcquireFilesSettings   mDownloadSettings2 = new VDF.Vault.Settings.AcquireFilesSettings(connection);
            VDF.Vault.Currency.Entities.FileIteration mFileIteration     = new VDF.Vault.Currency.Entities.FileIteration(connection, mFile);
            mDownloadSettings2.AddFileToAcquire(mFileIteration, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download);
            mDownloadSettings2.OrganizeFilesRelativeToCommonVaultRoot = true;
            mDownloadSettings2.OptionsRelationshipGathering.FileRelationshipSettings.IncludeChildren        = true;
            mDownloadSettings2.OptionsRelationshipGathering.FileRelationshipSettings.IncludeLibraryContents = true;
            mDownloadSettings2.OptionsRelationshipGathering.FileRelationshipSettings.ReleaseBiased          = true;
            VDF.Vault.Settings.AcquireFilesSettings.AcquireFileResolutionOptions mResOpt = new VDF.Vault.Settings.AcquireFilesSettings.AcquireFileResolutionOptions();
            mResOpt.OverwriteOption           = VDF.Vault.Settings.AcquireFilesSettings.AcquireFileResolutionOptions.OverwriteOptions.ForceOverwriteAll;
            mResOpt.SyncWithRemoteSiteSetting = VDF.Vault.Settings.AcquireFilesSettings.SyncWithRemoteSite.Always;

            //execute download
            VDF.Vault.Results.AcquireFilesResults mDownLoadResult2 = connection.FileManager.AcquireFiles(mDownloadSettings2);
            //pickup result details
            VDF.Vault.Results.FileAcquisitionResult fileAcquisitionResult2 = mDownLoadResult2.FileResults.Where(n => n.File.EntityName == mFileIteration.EntityName).FirstOrDefault();

            if (fileAcquisitionResult2 == null)
            {
                mSaveProject.Activate();
                throw new Exception("Job stopped execution as the source file to translate did not download");
            }
            string mDocPath = fileAcquisitionResult2.LocalPath.FullPath;
            string mExt     = System.IO.Path.GetExtension(mDocPath); //mDocPath.Split('.').Last();
            mTrace.WriteLine("Job successfully downloaded source file(s) for translation.");
            #endregion download source file(s)

            #region VaultInventorServer CAD Export

            mTrace.WriteLine("Job opens source file.");
            Document mDoc = null;
            mDoc = mInv.Documents.Open(mDocPath);

            foreach (string item in mExpFrmts)
            {
                switch (item)
                {
                case ("STP"):
                    //activate STEP Translator environment,
                    try
                    {
                        TranslatorAddIn mStepTrans = mInvSrvAddIns.ItemById["{90AF7F40-0C01-11D5-8E83-0010B541CD80}"] as TranslatorAddIn;
                        if (mStepTrans == null)
                        {
                            //switch temporarily used project file back to original one
                            mSaveProject.Activate();
                            throw new Exception("Job stopped execution, because indicated translator addin is not available.");
                        }
                        TranslationContext mTransContext = mInv.TransientObjects.CreateTranslationContext();
                        NameValueMap       mTransOptions = mInv.TransientObjects.CreateNameValueMap();
                        if (mStepTrans.HasSaveCopyAsOptions[mDoc, mTransContext, mTransOptions] == true)
                        {
                            //open, and translate the source file
                            mTrace.IndentLevel += 1;
                            mTrace.WriteLine("Job opens source file.");
                            mTransOptions.Value["ApplicationProtocolType"] = 3;     //AP 2014, Automotive Design
                            mTransOptions.Value["Description"]             = "Sample-Job Step Translator using VaultInventorServer";
                            mTransContext.Type = IOMechanismEnum.kFileBrowseIOMechanism;
                            //delete local file if exists, as the export wouldn't overwrite
                            if (System.IO.File.Exists(mDocPath.Replace(mExt, ".stp")))
                            {
                                System.IO.File.SetAttributes(mDocPath.Replace(mExt, ".stp"), System.IO.FileAttributes.Normal);
                                System.IO.File.Delete(mDocPath.Replace(mExt, ".stp"));
                            }
                            ;
                            DataMedium mData = mInv.TransientObjects.CreateDataMedium();
                            mData.FileName = mDocPath.Replace(mExt, ".stp");
                            mStepTrans.SaveCopyAs(mDoc, mTransContext, mTransOptions, mData);
                            //collect all export files for later upload
                            mUploadFiles.Add(mDocPath.Replace(mExt, ".stp"));
                            mTrace.WriteLine("STEP Translator created file: " + mUploadFiles.LastOrDefault());
                            mTrace.IndentLevel -= 1;
                        }
                    }
                    catch (Exception ex)
                    {
                        mTrace.WriteLine("STEP Export Failed: " + ex.Message);
                    }
                    break;

                case "JT":
                    //activate JT Translator environment,
                    try
                    {
                        TranslatorAddIn mJtTrans = mInvSrvAddIns.ItemById["{16625A0E-F58C-4488-A969-E7EC4F99CACD}"] as TranslatorAddIn;
                        if (mJtTrans == null)
                        {
                            //switch temporarily used project file back to original one
                            mTrace.WriteLine("JT Translator not found.");
                            break;
                        }
                        TranslationContext mTransContext = mInv.TransientObjects.CreateTranslationContext();
                        NameValueMap       mTransOptions = mInv.TransientObjects.CreateNameValueMap();
                        if (mJtTrans.HasSaveCopyAsOptions[mDoc, mTransContext, mTransOptions] == true)
                        {
                            //open, and translate the source file
                            mTrace.IndentLevel += 1;

                            mTransOptions.Value["Version"] = 102;     //default
                            mTransContext.Type             = IOMechanismEnum.kFileBrowseIOMechanism;
                            //delete local file if exists, as the export wouldn't overwrite
                            if (System.IO.File.Exists(mDocPath.Replace(mExt, ".jt")))
                            {
                                System.IO.File.SetAttributes(mDocPath.Replace(mExt, ".jt"), System.IO.FileAttributes.Normal);
                                System.IO.File.Delete(mDocPath.Replace(mExt, ".jt"));
                            }
                            ;
                            DataMedium mData = mInv.TransientObjects.CreateDataMedium();
                            mData.FileName = mDocPath.Replace(mExt, ".jt");
                            mJtTrans.SaveCopyAs(mDoc, mTransContext, mTransOptions, mData);
                            //collect all export files for later upload
                            mUploadFiles.Add(mDocPath.Replace(mExt, ".jt"));
                            mTrace.WriteLine("JT Translator created file: " + mUploadFiles.LastOrDefault());
                            mTrace.IndentLevel -= 1;
                        }
                    }
                    catch (Exception ex)
                    {
                        mTrace.WriteLine("JT Export Failed: " + ex.Message);
                    }
                    break;

                case "SMDXF":
                    try
                    {
                        TranslatorAddIn mDXFTrans = mInvSrvAddIns.ItemById["{C24E3AC4-122E-11D5-8E91-0010B541CD80}"] as TranslatorAddIn;
                        mDXFTrans.Activate();
                        if (mDXFTrans == null)
                        {
                            mTrace.WriteLine("DXF Translator not found.");
                            break;
                        }

                        if (System.IO.File.Exists(mDocPath.Replace(mExt, ".dxf")))
                        {
                            System.IO.FileInfo fileInfo = new FileInfo(mDocPath.Replace(mExt, ".dxf"));
                            fileInfo.IsReadOnly = false;
                            fileInfo.Delete();
                        }

                        PartDocument mPartDoc = (PartDocument)mDoc;
                        DataIO       mDataIO  = mPartDoc.ComponentDefinition.DataIO;
                        String       mOut     = "FLAT PATTERN DXF?AcadVersion=R12&OuterProfileLayer=Outer";
                        mDataIO.WriteDataToFile(mOut, mDocPath.Replace(mExt, ".dxf"));
                        //collect all export files for later upload
                        mUploadFiles.Add(mDocPath.Replace(mExt, ".dxf"));
                        mTrace.WriteLine("SheetMetal DXF Translator created file: " + mUploadFiles.LastOrDefault());
                        mTrace.IndentLevel -= 1;
                    }
                    catch (Exception ex)
                    {
                        mTrace.WriteLine("SMDXF Export Failed: " + ex.Message);
                    }
                    break;

                default:
                    break;
                }
            }
            mDoc.Close(true);
            mTrace.WriteLine("Source file closed");

            //switch temporarily used project file back to original one
            mSaveProject.Activate();

            mTrace.WriteLine("Job exported file(s); continues uploading.");
            mTrace.IndentLevel -= 1;

            #endregion VaultInventorServer CAD Export

            #region Vault File Management

            foreach (string file in mUploadFiles)
            {
                ACW.File           mExpFile        = null;
                System.IO.FileInfo mExportFileInfo = new System.IO.FileInfo(file);
                if (mExportFileInfo.Exists)
                {
                    //copy file to output location
                    if (settings.OutPutPath != "")
                    {
                        System.IO.FileInfo fileInfo = new FileInfo(settings.OutPutPath + "\\" + mExportFileInfo.Name);
                        if (fileInfo.Exists)
                        {
                            fileInfo.IsReadOnly = false;
                            fileInfo.Delete();
                        }
                        System.IO.File.Copy(mExportFileInfo.FullName, settings.OutPutPath + "\\" + mExportFileInfo.Name, true);
                    }

                    //add resulting export file to Vault if it doesn't exist, otherwise update the existing one

                    ACW.Folder mFolder       = mWsMgr.DocumentService.FindFoldersByIds(new long[] { mFile.FolderId }).FirstOrDefault();
                    string     vaultFilePath = System.IO.Path.Combine(mFolder.FullName, mExportFileInfo.Name).Replace("\\", "/");

                    ACW.File wsFile = mWsMgr.DocumentService.FindLatestFilesByPaths(new string[] { vaultFilePath }).First();
                    VDF.Currency.FilePathAbsolute             vdfPath       = new VDF.Currency.FilePathAbsolute(mExportFileInfo.FullName);
                    VDF.Vault.Currency.Entities.FileIteration vdfFile       = null;
                    VDF.Vault.Currency.Entities.FileIteration addedFile     = null;
                    VDF.Vault.Currency.Entities.FileIteration mUploadedFile = null;
                    if (wsFile == null || wsFile.Id < 0)
                    {
                        // add new file to Vault
                        mTrace.WriteLine("Job adds " + mExportFileInfo.Name + " as new file.");

                        if (mFolder == null || mFolder.Id == -1)
                        {
                            throw new Exception("Vault folder " + mFolder.FullName + " not found");
                        }

                        var folderEntity = new Autodesk.DataManagement.Client.Framework.Vault.Currency.Entities.Folder(connection, mFolder);
                        try
                        {
                            addedFile = connection.FileManager.AddFile(folderEntity, "Created by Job Processor", null, null, ACW.FileClassification.DesignRepresentation, false, vdfPath);
                            mExpFile  = addedFile;
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("Job could not add export file " + vdfPath + "Exception: ", ex);
                        }
                    }
                    else
                    {
                        // checkin new file version
                        mTrace.WriteLine("Job uploads " + mExportFileInfo.Name + " as new file version.");

                        VDF.Vault.Settings.AcquireFilesSettings aqSettings = new VDF.Vault.Settings.AcquireFilesSettings(connection)
                        {
                            DefaultAcquisitionOption = VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Checkout
                        };
                        vdfFile = new VDF.Vault.Currency.Entities.FileIteration(connection, wsFile);
                        aqSettings.AddEntityToAcquire(vdfFile);
                        var results = connection.FileManager.AcquireFiles(aqSettings);
                        try
                        {
                            mUploadedFile = connection.FileManager.CheckinFile(results.FileResults.First().File, "Created by Job Processor", false, null, null, false, null, ACW.FileClassification.DesignRepresentation, false, vdfPath);
                            mExpFile      = mUploadedFile;
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("Job could not update existing export file " + vdfFile + "Exception: ", ex);
                        }
                    }
                }
                else
                {
                    throw new Exception("Job could not find the export result file: " + mDocPath.Replace(mExt, ".stp"));
                }

                mTrace.IndentLevel += 1;

                //update the new file's revision
                try
                {
                    mTrace.WriteLine("Job tries synchronizing " + mExpFile.Name + "'s revision in Vault.");
                    mWsMgr.DocumentServiceExtensions.UpdateFileRevisionNumbers(new long[] { mExpFile.Id }, new string[] { mFile.FileRev.Label }, "Rev Index synchronized by Job Processor");
                }
                catch (Exception)
                {
                    //the job will not stop execution in this sample, if revision labels don't synchronize
                }

                //synchronize source file properties to export file properties for UDPs assigned to both
                try
                {
                    mTrace.WriteLine(mExpFile.Name + ": Job tries synchronizing properties in Vault.");
                    //get the design rep category's user properties
                    ACET.IExplorerUtil mExplUtil = Autodesk.Connectivity.Explorer.ExtensibilityTools.ExplorerLoader.LoadExplorerUtil(
                        connection.Server, connection.Vault, connection.UserID, connection.Ticket);
                    Dictionary <ACW.PropDef, object> mPropDictonary = new Dictionary <ACW.PropDef, object>();

                    //get property definitions filtered to UDPs
                    VDF.Vault.Currency.Properties.PropertyDefinitionDictionary mPropDefDic = connection.PropertyManager.GetPropertyDefinitions(
                        VDF.Vault.Currency.Entities.EntityClassIds.Files, null, VDF.Vault.Currency.Properties.PropertyDefinitionFilter.IncludeUserDefined);

                    VDF.Vault.Currency.Properties.PropertyDefinition mPropDef = new PropertyDefinition();
                    ACW.PropInst[] mSourcePropInsts = mWsMgr.PropertyService.GetProperties("FILE", new long[] { mFile.Id }, new long[] { mPropDef.Id });

                    //get property definitions assigned to Design Representation category
                    ACW.CatCfg  catCfg1       = mWsMgr.CategoryService.GetCategoryConfigurationById(mExpFile.Cat.CatId, new string[] { "UserDefinedProperty" });
                    List <long> mFilePropDefs = new List <long>();
                    foreach (ACW.Bhv bhv in catCfg1.BhvCfgArray.First().BhvArray)
                    {
                        mFilePropDefs.Add(bhv.Id);
                    }

                    //get properties assigned to source file and add definition/value pair to dictionary
                    mSourcePropInsts = mWsMgr.PropertyService.GetProperties("FILE", new long[] { mFile.Id }, mFilePropDefs.ToArray());
                    ACW.PropDef[] propDefs = connection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE");
                    foreach (ACW.PropInst item in mSourcePropInsts)
                    {
                        mPropDef = connection.PropertyManager.GetPropertyDefinitionById(item.PropDefId);
                        ACW.PropDef propDef = propDefs.SingleOrDefault(n => n.Id == item.PropDefId);
                        mPropDictonary.Add(propDef, item.Val);
                    }

                    //update export file using the property dictionary; note this the IExplorerUtil method bumps file iteration and requires no check out
                    mExplUtil.UpdateFileProperties(mExpFile, mPropDictonary);
                }
                catch (Exception ex)
                {
                    mTrace.WriteLine("Job failed copying properties from source file " + mFile.Name + " to export file: " + mExpFile.Name + " . Exception details: " + ex);
                    //you may uncomment the action below if the job should abort executing due to failures copying property values
                    //throw new Exception("Job failed copying properties from source file " + mFile.Name + " to export file: " + mExpFile.Name + " . Exception details: " + ex.ToString() + " ");
                }

                //align lifecycle states of export to source file's state name
                try
                {
                    mTrace.WriteLine(mExpFile.Name + ": Job tries synchronizing lifecycle state in Vault.");
                    Dictionary <string, long> mTargetStateNames = new Dictionary <string, long>();
                    ACW.LfCycDef mTargetLfcDef = (mWsMgr.LifeCycleService.GetLifeCycleDefinitionsByIds(new long[] { mExpFile.FileLfCyc.LfCycDefId })).FirstOrDefault();
                    foreach (var item in mTargetLfcDef.StateArray)
                    {
                        mTargetStateNames.Add(item.DispName, item.Id);
                    }
                    mTargetStateNames.TryGetValue(mFile.FileLfCyc.LfCycStateName, out long mTargetLfcStateId);
                    mWsMgr.DocumentServiceExtensions.UpdateFileLifeCycleStates(new long[] { mExpFile.MasterId }, new long[] { mTargetLfcStateId }, "Lifecycle state synchronized by Job Processor");
                }
                catch (Exception)
                { }

                //attach export file to source file leveraging design representation attachment type
                try
                {
                    mTrace.WriteLine(mExpFile.Name + ": Job tries to attach to its source in Vault.");
                    ACW.FileAssocParam mAssocParam = new ACW.FileAssocParam();
                    mAssocParam.CldFileId         = mExpFile.Id;
                    mAssocParam.ExpectedVaultPath = mWsMgr.DocumentService.FindFoldersByIds(new long[] { mFile.FolderId }).First().FullName;
                    mAssocParam.RefId             = null;
                    mAssocParam.Source            = null;
                    mAssocParam.Typ = ACW.AssociationType.Attachment;
                    mWsMgr.DocumentService.AddDesignRepresentationFileAttachment(mFile.Id, mAssocParam);
                }
                catch (Exception)
                { }

                mTrace.IndentLevel -= 1;
            }

            #endregion Vault File Management

            mTrace.IndentLevel = 1;
            mTrace.WriteLine("Job finished all steps.");
            mTrace.Flush();
            mTrace.Close();
        }
Beispiel #6
0
        public static List<ADSK.File> findByMatches(_DocumentService documentService, String sfind)
        {
            /* Faz a pesquisa */
            string bookmark = string.Empty;
            ADSK.SrchStatus status = null;

            ADSK.SrchCond[] conditions = new ADSK.SrchCond[1];
            conditions[0] = new ADSK.SrchCond();
            conditions[0].SrchOper = Condition.CONTAINS.Code; // (long)SrchOperator.Contains; // 1; // Contains
            conditions[0].SrchTxt = sfind;
            conditions[0].PropTyp = ADSK.PropertySearchType.SingleProperty;
            conditions[0].PropDefId = propid;
            conditions[0].SrchRule = ADSK.SearchRuleType.Must;

            //Console.WriteLine("Vai procurar os arquivos -------");
            List<ADSK.File> fileList = new List<ADSK.File>();
            while (status == null || fileList.Count < status.TotalHits)
            {
                ADSK.File[] files = documentService.FindFilesBySearchConditions(
                    conditions, /*SrchCond [] conditions*/
                    null, /*SrchSort [] sortConditions*/
                    folderIds, /*Long [] folderIds*/
                    true, /*Boolean recurseFolders*/
                    true, /*Boolean latestOnly*/
                    ref bookmark, /*[out] String bookmark*/
                    out status /*[out] SrchStatus searchstatus*/
                );

                if (files != null)
                    fileList.AddRange(files);
            }
            return fileList;
        }
Beispiel #7
0
        public static List<ADSK.File> findByEquals(_DocumentService documentService, string filename)
        {
            /* Faz a pesquisa */
            string bookmark = string.Empty;
            ADSK.SrchStatus status = null;

            ADSK.SrchCond[] conditions = new ADSK.SrchCond[1];
            conditions[0] = new ADSK.SrchCond();
            conditions[0].SrchOper = Condition.EQUALS.Code; // (long)SrchOperator.IsExactly; // 3; // Is exactly (or equals)
            conditions[0].SrchTxt = filename;
            conditions[0].PropTyp = ADSK.PropertySearchType.SingleProperty;
            conditions[0].PropDefId = propid;
            conditions[0].SrchRule = ADSK.SearchRuleType.Must;

            /*Console.WriteLine("Arquivos a procurar:");
            foreach (ADSK.SrchCond cond in conditions)
            {
                Console.WriteLine("   -> " + cond.SrchTxt);
            }*/

            //Console.WriteLine("Vai procurar os arquivos -------");
            List<ADSK.File> fileList = new List<ADSK.File>();
            while (status == null || fileList.Count < status.TotalHits)
            {
                ADSK.File[] files = documentService.FindFilesBySearchConditions(
                    conditions, /*SrchCond [] conditions*/
                    null, /*SrchSort [] sortConditions*/
                    folderIds, /*Long [] folderIds*/
                    true, /*Boolean recurseFolders*/
                    true, /*Boolean latestOnly*/
                    ref bookmark, /*[out] String bookmark*/
                    out status /*[out] SrchStatus searchstatus*/
                );

                if (files != null)
                    fileList.AddRange(files);
            }
            return fileList;
        }
Beispiel #8
0
        public static List<ADSK.File> findByCheckinDate(DocumentService documentService, String checkinDate)
        {
            LOG.imprimeLog(System.DateTime.Now + " ===== findByCheckinDate: [" + checkinDate + "]");
            List<ADSK.File> fileList = new List<ADSK.File>();
            List<ADSK.File> fileListTmp = new List<ADSK.File>();
            List<string> allf = new List<string>();

            ADSK.PropDef prop = GetPropertyDefinition("CheckoutUserName", documentService);
            if (prop != null)
            {
                propid = (int)prop.Id;
                /* Faz a pesquisa */
                string bookmark = string.Empty;
                ADSK.SrchStatus status = null;

                ADSK.SrchCond[] conditions = new ADSK.SrchCond[1];
                conditions[0] = new ADSK.SrchCond();
                conditions[0].SrchOper = Condition.IS_NOT_EMPTY.Code;
                conditions[0].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[0].PropDefId = propid;

                prop = GetPropertyDefinition("ClientFileName", documentService);
                propid = (int)prop.Id;

                /*conditions[1] = new ADSK.SrchCond();
                conditions[1].SrchOper = Condition.CONTAINS.Code;
                conditions[1].SrchTxt = ".idw";
                conditions[1].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[1].PropDefId = propid;
                conditions[1].SrchRule = ADSK.SearchRuleType.May;

                conditions[2] = new ADSK.SrchCond();
                conditions[2].SrchOper = Condition.CONTAINS.Code;
                conditions[2].SrchTxt = ".pdf";
                conditions[2].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[2].PropDefId = propid;
                conditions[2].SrchRule = ADSK.SearchRuleType.May;

                conditions[3] = new ADSK.SrchCond();
                conditions[3].SrchOper = Condition.CONTAINS.Code;
                conditions[3].SrchTxt = ".dwg";
                conditions[3].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[3].PropDefId = propid;
                conditions[3].SrchRule = ADSK.SearchRuleType.May;*/

                while (status == null || fileListTmp.Count < status.TotalHits)
                {
                    ADSK.File[] files = documentService.FindFilesBySearchConditions(
                        conditions, /*SrchCond [] conditions*/
                        null, /*SrchSort [] sortConditions*/
                        folderIds, /*Long [] folderIds*/
                        true, /*Boolean recurseFolders*/
                        true, /*Boolean latestOnly*/
                        ref bookmark, /*[out] String bookmark*/
                        out status /*[out] SrchStatus searchstatus*/
                    );
                    if (files != null)
                    {
                        foreach (ADSK.File f in files)
                        {
                            fileListTmp.Add(f);
                            if (f.Name.ToLower().EndsWith(".idw"))
                            {
                                string fcode = f.Name.Substring(0, f.Name.Length - 4);
                                if (!allf.Contains(fcode))
                                {
                                    allf.Add(fcode);
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via checkout =====-> " + f.Name + "(" + f.FileSize + ") - CkInDate: " + f.CkInDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                                    fileList.Add(f);
                                }
                            }
                        }
                        foreach (ADSK.File f in files)
                        {
                            if (f.Name.ToLower().EndsWith(".dwg"))
                            {
                                string fcode = f.Name.Substring(0, f.Name.Length - 4);
                                if (!allf.Contains(fcode))
                                {
                                    allf.Add(fcode);
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via checkout =====-> " + f.Name + "(" + f.FileSize + ") - CkInDate: " + f.CkInDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                                    fileList.Add(f);
                                }
                            }
                        }
                        foreach (ADSK.File f in files)
                        {
                            if (f.Name.ToLower().EndsWith(".pdf"))
                            {
                                string fcode = f.Name.Substring(0, f.Name.Length - 4);
                                if (!allf.Contains(fcode))
                                {
                                    allf.Add(fcode);
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via checkout =====-> " + f.Name + "(" + f.FileSize + ") - CkInDate: " + f.CkInDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                                    fileList.Add(f);
                                }
                            }
                        }
                        /*
                        foreach (ADSK.File f in files)
                        {
                            fileListTmp.Add(f);
                            if (f.Name.ToLower().EndsWith(".pdf") || f.Name.ToLower().EndsWith(".idw") || f.Name.ToLower().EndsWith(".dwg"))
                            {
                                LOG.imprimeLog(System.DateTime.Now + " Adicionado via checkout =====-> " + f.Name + "(" + f.FileSize + ")");
                                fileList.Add(f);
                            }
                        }
                        */
                    }
                }
            }

            /*ADSK.PropDef*/
            prop = GetPropertyDefinition("CheckInDate", documentService);
            if (prop != null)
            {
                fileListTmp = new List<ADSK.File>();
                propid = (int)prop.Id;
                /* Faz a pesquisa */
                string bookmark = string.Empty;
                ADSK.SrchStatus status = null;

                ADSK.SrchCond[] conditions = new ADSK.SrchCond[1];
                conditions[0] = new ADSK.SrchCond();
                conditions[0].SrchOper = Condition.GREATER_THAN_OR_EQUAL.Code /*(long)SrchOperator.GreatherThan*/;
                conditions[0].SrchTxt = checkinDate;
                conditions[0].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[0].PropDefId = propid;

                prop = GetPropertyDefinition("ClientFileName", documentService);
                propid = (int)prop.Id;

                /*conditions[1] = new ADSK.SrchCond();
                conditions[1].SrchOper = Condition.CONTAINS.Code;
                conditions[1].SrchTxt = ".idw";
                conditions[1].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[1].PropDefId = propid;
                conditions[1].SrchRule = ADSK.SearchRuleType.May;

                conditions[2] = new ADSK.SrchCond();
                conditions[2].SrchOper = Condition.CONTAINS.Code;
                conditions[2].SrchTxt = ".pdf";
                conditions[2].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[2].PropDefId = propid;
                conditions[2].SrchRule = ADSK.SearchRuleType.May;

                conditions[3] = new ADSK.SrchCond();
                conditions[3].SrchOper = Condition.CONTAINS.Code;
                conditions[3].SrchTxt = ".dwg";
                conditions[3].PropTyp = ADSK.PropertySearchType.SingleProperty;
                conditions[3].PropDefId = propid;
                conditions[3].SrchRule = ADSK.SearchRuleType.May;*/

                while (status == null || fileListTmp.Count < status.TotalHits)
                {
                    /*ADSK.FileFolder[] folders = documentService.FindFileFoldersBySearchConditions(
                        conditions,
                        null,
                        folderIds,
                        true,
                        true,
                        ref bookmark,
                        out status
                    );

                    if (folders != null)
                    {
                        foreach (ADSK.FileFolder f in folders)
                        {
                            //if (f.File != null)
                            //{
                            fileList.Add(f.File);
                            //}
                        }
                    }*/
                    ADSK.File[] files = documentService.FindFilesBySearchConditions(
                        conditions, /*SrchCond [] conditions*/
                        null, /*SrchSort [] sortConditions*/
                        folderIds, /*Long [] folderIds*/
                        true, /*Boolean recurseFolders*/
                        true, /*Boolean latestOnly*/
                        ref bookmark, /*[out] String bookmark*/
                        out status /*[out] SrchStatus searchstatus*/
                    );
                    if (files != null)
                    {
                        foreach (ADSK.File f in files)
                        {
                            fileListTmp.Add(f);
                            if (f.Name.ToLower().EndsWith(".idw"))
                            {
                                string fcode = f.Name.Substring(0, f.Name.Length - 4);
                                if (!allf.Contains(fcode))
                                {
                                    allf.Add(fcode);
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via normal =====-> " + f.Name + "(" + f.FileSize + ") - CkInDate: " + f.CkInDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                                    fileList.Add(f);
                                }
                            }
                        }
                        foreach (ADSK.File f in files)
                        {
                            if (f.Name.ToLower().EndsWith(".dwg"))
                            {
                                string fcode = f.Name.Substring(0, f.Name.Length - 4);
                                if (!allf.Contains(fcode))
                                {
                                    allf.Add(fcode);
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via normal =====-> " + f.Name + "(" + f.FileSize + ") - CkInDate: " + f.CkInDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                                    fileList.Add(f);
                                }
                            }
                        }
                        foreach (ADSK.File f in files)
                        {
                            if (f.Name.ToLower().EndsWith(".pdf"))
                            {
                                string fcode = f.Name.Substring(0, f.Name.Length - 4);
                                if (!allf.Contains(fcode))
                                {
                                    allf.Add(fcode);
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via normal =====-> " + f.Name + "(" + f.FileSize + ") - CkInDate: " + f.CkInDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss"));
                                    fileList.Add(f);
                                }
                            }
                        }
                        /*
                        foreach (ADSK.File f in files)
                        {
                            fileListTmp.Add(f);
                            if (f.Name.ToLower().EndsWith(".pdf") || f.Name.ToLower().EndsWith(".idw") || f.Name.ToLower().EndsWith(".dwg"))
                            {
                                if (!fileList.Contains(f))
                                {
                                    LOG.imprimeLog(System.DateTime.Now + " Adicionado via normal =====-> " + f.Name + "(" + f.FileSize + ")");
                                    fileList.Add(f);
                                }
                            }
                        }
                        */
                    }

                    //ADSK.File[] files = documentService.FindFilesBySearchConditions(
                    //    conditions, /*SrchCond [] conditions*/
                    //    null, /*SrchSort [] sortConditions*/
                    //    null, /*Long [] folderIds*/
                    //    true, /*Boolean recurseFolders*/
                    //    true, /*Boolean latestOnly*/
                    //    ref bookmark, /*[out] String bookmark*/
                    //    out status /*[out] SrchStatus searchstatus*/
                    //);

                    //if (files != null)
                    //    fileList.AddRange(files);
                }
            }
            return fileList;
        }