Exemplo n.º 1
0
        private static ProjectItemBase LoadProjectFileElement([NotNull] ProjectBase project, [NotNull] XElement element)
        {
            Debug.ArgumentNotNull(project, nameof(project));
            Debug.ArgumentNotNull(element, nameof(element));

            var projectFileItem = new ProjectFileItem(project);

            projectFileItem.Load(element);

            return(projectFileItem);
        }
Exemplo n.º 2
0
        private static void ProjectItemMoved([NotNull] object sender, [NotNull] string newName, [NotNull] string oldName)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(newName, nameof(newName));
            Debug.ArgumentNotNull(oldName, nameof(oldName));

            ProjectFileItem projectFile = null;

            foreach (var project1 in Projects)
            {
                foreach (var projectItem in project1.ProjectItems)
                {
                    var file = projectItem as ProjectFileItem;
                    if (file == null)
                    {
                        continue;
                    }

                    if (string.Compare(file.AbsoluteFileName, oldName, StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        projectFile = file;
                        break;
                    }
                }
            }

            if (projectFile == null)
            {
                return;
            }

            var project  = projectFile.Project;
            var fileName = project.GetRelativeFileName(newName);

            projectFile.File = fileName;

            var fileItemHandler = FileItemManager.GetFileItemHandler(projectFile.Path);

            if (fileItemHandler != null)
            {
                foreach (var itemUri in projectFile.Items)
                {
                    fileItemHandler.UpdateItemPath(itemUri, projectFile.Path);
                }
            }

            project.Save();
        }
Exemplo n.º 3
0
        public static ProjectFileItem Load([NotNull] ProjectBase project, [NotNull] string fileName)
        {
            Assert.ArgumentNotNull(project, nameof(project));
            Assert.ArgumentNotNull(fileName, nameof(fileName));

            var result = new ProjectFileItem(project)
            {
                File               = project.GetRelativeFileName(fileName),
                FileSize           = 0,
                FileTimestamp      = 0,
                ServerTimestamp    = 0,
                ServerFileSize     = 0,
                ConflictResolution = ConflictResolution.None,
                HideFromToolbox    = false
            };

            return(result);
        }