Example #1
0
        private void ProcessBasicFileInfo(string rawBasicInfo)
        {
            bool workSharedFound        = false;
            bool lastPathFound          = false;
            bool centralPathFound       = false;
            bool openWorksetFound       = false;
            bool documentIncrementFound = false;
            bool guidFound = false;

            foreach (string line in rawBasicInfo.Split(new string[] { "\0", "\r\n" },
                                                       StringSplitOptions.RemoveEmptyEntries))
            {
                // find build number
                logger.Debug("Parsing info from BasicFileInfo: \"{0}\"", line);
                var revitProduct = RevitProduct.LookupRevitProduct(line);
                if (revitProduct != null)
                {
                    RevitProduct = revitProduct;
                }

                // find workshared
                if (!workSharedFound)
                {
                    var match = IsWorksharedFinder.Match(line);
                    if (match.Success)
                    {
                        var workshared = match.Groups["workshared"].Value;
                        logger.Debug("IsWorkshared: {0}", workshared);
                        if (!workshared.Contains("Not"))
                        {
                            IsWorkshared = true;
                        }
                        workSharedFound = true;
                    }
                }

                // find last saved path
                if (!lastPathFound)
                {
                    var match = LastSavedPathFinder.Match(line);
                    if (match.Success)
                    {
                        var path = match.Groups["path"].Value;
                        logger.Debug("Last Saved Path: {0}", path);
                        LastSavedPath = path;
                        lastPathFound = true;
                    }
                }

                // find central model path
                if (!centralPathFound)
                {
                    var match = CentralPathFinder.Match(line);
                    if (match.Success)
                    {
                        var path = match.Groups["path"].Value;
                        logger.Debug("Central Model Path: {0}", path);
                        CentralModelPath = path;
                        centralPathFound = true;
                    }
                }

                // find central model path
                if (!openWorksetFound)
                {
                    var match = OpenWorksetFinder.Match(line);
                    if (match.Success)
                    {
                        var owconfig = match.Groups["type"].Value;
                        logger.Debug("Open Workset Default: {0}", owconfig);
                        OpenWorksetConfig = (RevitModelFileOpenWorksetConfig)Enum.ToObject(typeof(RevitModelFileOpenWorksetConfig), int.Parse(owconfig));
                        openWorksetFound  = true;
                    }
                }

                // find central model path
                if (!documentIncrementFound)
                {
                    var match = DocumentIncrementFinder.Match(line);
                    if (match.Success)
                    {
                        var docincrement = match.Groups["type"].Value;
                        logger.Debug("Unique Document Increments: {0}", docincrement);
                        DocumentIncrement      = int.Parse(docincrement);
                        documentIncrementFound = true;
                    }
                }

                // find document guid
                if (!guidFound && line.Contains("Unique Document GUID: "))
                {
                    var guid = line.ExtractGuid();
                    logger.Debug("Extracted GUID: {0}", guid);
                    UniqueId  = guid;
                    guidFound = true;
                }
            }
        }
Example #2
0
        private void ProcessBasicFileInfo(IEnumerable <string> basicInfoDataLines)
        {
            foreach (string line in basicInfoDataLines)
            {
                logger.Debug("Parsing info from BasicFileInfo: \"{0}\"", line);
                // Worksharing: Not enabled
                var match = buildFieldRegex("Worksharing: ", "workshared").Match(line);
                if (match.Success)
                {
                    var workshared = match.Groups["workshared"].Value;
                    logger.Debug("IsWorkshared: {0}", workshared);
                    if (!workshared.Contains("Not"))
                    {
                        IsWorkshared = true;
                    }
                }

                // Username:

                // Central Model Path:
                match = buildFieldRegex("Central Model Path: ", "centralpath").Match(line);
                if (match.Success)
                {
                    var path = match.Groups["centralpath"].Value;
                    logger.Debug("Central Model Path: {0}", path);
                    CentralModelPath = path;
                }

                // Format: 2019

                // Build: 20180806_1515(x64)
                match = buildFieldRegex("Build: ", "build").Match(line);
                if (match.Success)
                {
                    var revitProduct = RevitProduct.LookupRevitProduct(line);
                    if (revitProduct != null)
                    {
                        RevitProduct = revitProduct;
                    }
                }

                // Last Save Path: C:\Users\eirannejad\Desktop\Project1.rvt
                match = buildFieldRegex("Last Save Path: ", "lastpath").Match(line);
                if (match.Success)
                {
                    var path = match.Groups["lastpath"].Value;
                    logger.Debug("Last Saved Path: {0}", path);
                    LastSavedPath = path;
                }

                // Open Workset Default: 3
                match = buildFieldRegex("Open Workset Default: ", "openws").Match(line);
                if (match.Success)
                {
                    var owconfig = match.Groups["openws"].Value;
                    logger.Debug("Open Workset Default: {0}", owconfig);
                    OpenWorksetConfig = (RevitModelFileOpenWorksetConfig)Enum.ToObject(
                        typeof(RevitModelFileOpenWorksetConfig), int.Parse(owconfig)
                        );
                }

                // Project Spark File: 0

                // Central Model Identity: 00000000-0000-0000-0000-000000000000

                // Locale when saved: ENU

                // All Local Changes Saved To Central: 0

                // Central model's version number corresponding to the last reload latest: 4

                // Central model's episode GUID corresponding to the last reload latest: 2ecc6fa1-2960-4473-9fd9-0abce22022fc
                if (line.Contains("Central model's episode GUID corresponding to the last reload latest: "))
                {
                    var guid = line.ExtractGuid();
                    logger.Debug("Extracted Last Reload Latest GUID: {0}", guid);
                    LastReloadLatestUniqueId = guid;
                }

                // Unique Document GUID: 2ecc6fa1-2960-4473-9fd9-0abce22022fc
                if (line.Contains("Unique Document GUID: "))
                {
                    var guid = line.ExtractGuid();
                    logger.Debug("Extracted GUID: {0}", guid);
                    UniqueId = guid;
                }

                // Unique Document Increments: 4
                match = buildFieldRegex("Unique Document Increments: ", "increment").Match(line);
                if (match.Success)
                {
                    var docincrement = match.Groups["increment"].Value;
                    logger.Debug("Unique Document Increments: {0}", docincrement);
                    DocumentIncrement = int.Parse(docincrement);
                }

                // Model Identity: 00000000-0000-0000-0000-000000000000

                // IsSingleUserCloudModel: 慆獬e

                // Author: Autodesk Revit
            }
        }