当前位置: 首页>>代码示例>>C#>>正文


C# IController.GetTempFilePathForComponent方法代码示例

本文整理汇总了C#中IController.GetTempFilePathForComponent方法的典型用法代码示例。如果您正苦于以下问题:C# IController.GetTempFilePathForComponent方法的具体用法?C# IController.GetTempFilePathForComponent怎么用?C# IController.GetTempFilePathForComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IController的用法示例。


在下文中一共展示了IController.GetTempFilePathForComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteAllFiles

        /// <summary>
        /// The write out process involves the following steps:
        /// 1. Back up the files currently in the user's project directory.
        /// 2. Write the template files that are being used to the temporary prevgen directory.
        /// 3. Write the merged files to the user's project directory.
        /// 4. Copy those temporary prevgen files over to the user's prevgen directory.
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="tempController"></param>
        /// <param name="files"></param>
        /// <param name="projectTree"></param>
        public void WriteAllFiles(TaskProgressHelper helper, IController tempController, List<IFileInformation> files, ProjectFileTree projectTree, bool overwriteExistingFiles)
        {
            controller = tempController;

            // Calculate which folders need backing up.
            List<string> directories = new List<string>();
            directories.Add(""); // The root folder.
            foreach (ProjectFileTreeNode node in projectTree.AllNodes)
            {
                if (node.IsFolder == false)
                    continue;
                string path = node.Path;
                if (directories.Contains(path) == false)
                    directories.Add(path);
            }

            //BackupUtility backupUtility = new BackupUtility();
            //string timeString = BackupUtility.GetTimeString();
            //foreach(string dir in directories)
            //{
            //    backupUtility.CreateBackup(
            //    Path.Combine(controller.CurrentProject.ProjectSettings.ProjectPath, dir),
            //    tempController.CurrentProject.ProjectSettings.ProjectGuid,
            //    Path.GetFileNameWithoutExtension(tempController.CurrentProject.ProjectSettings.TemplateFileName),
            //    Path.Combine(controller.CurrentProject.ProjectSettings.ProjectPath, dir),
            //    timeString);
            //}

            foreach (IFileInformation file in files)
            {
                if (file.CurrentDiffResult.DiffType == TypeOfDiff.Conflict)
                {
                    throw new WriteOutException(string.Format("Cannot write out files where a conflict exists! The file {0} has a conflict.", file.RelativeFilePath));
                }
            }

            foreach (IFileInformation file in files)
            {
                WriteSingleFile(file, overwriteExistingFiles);
                // Write the newly generated file to the temporary directory so we can copy it to the prevgen directory in the
                // user's project directory. We do this instead of copying the whole newgen directory so we avoid changing the
                // timestamps on the prevgen files.
                string prevgenPath = controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGeneratorOutput);
                file.WriteNewGenFile(prevgenPath);

                // TODO: Need to copy the Manifest file over from the temporary prevgen folder to the new one.
                //CopyAllManifestFiles(controller.GetTempFilePathForComponent(ComponentKey.SlyceMerge_PrevGen),
                //                     controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGeneratorOutput));

                if (file.CodeRootMap != null)
                {
                    CodeRootMapMatchProcessor processor = new CodeRootMapMatchProcessor();
                    string manifestFilename = Path.Combine(prevgenPath, ManifestConstants.MANIFEST_FILENAME);
                    XmlDocument doc = ManifestConstants.LoadManifestDocument(manifestFilename);
                    processor.SaveCustomMappings(doc, file.CodeRootMap, Path.GetFileName(file.RelativeFilePath));
                }
            }
            // Copy the temporary files we just created to the user's prevgen directory.
            CreatePrevGenFiles();
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:71,代码来源:WriteOutHelper.cs

示例2: GenerateAllFiles

        /// <summary>
        /// Runs through a project and generates the files in it.
        /// </summary>
        /// <param name="progressHelper">The TaskProgressHelper to use to report progress and cancel the operation.</param>
        /// <param name="projectInfo">The Project we are generating files from.</param>
        /// <param name="folderName">The name of the root folder to generate into. Not the full path, just the relative path to the 
        /// current folder.</param>
        /// <param name="folder"></param>
        /// <param name="parentNode"></param>
        /// <param name="thisLevelRootObject"></param>
        /// <returns></returns>
        /// <param name="loader"></param>
        /// <param name="controller"></param>
        public int GenerateAllFiles(ITaskProgressHelper<GenerateFilesProgress> progressHelper, IProjectHelper projectInfo, string folderName, IFolder folder, ProjectFileTreeNode parentNode, IScriptBaseObject thisLevelRootObject, ILoader loader, IController controller)
        {
            if (parentNode is ProjectFileTree)
            {
                ((ProjectFileTree)parentNode).TreeRestructuring = true;
                ((ProjectFileTree)parentNode).Clear();
            }
            int fileCount = 0;

            try
            {
                _Controller = controller;
                _Loader = loader;
                _ProgressHelper = progressHelper;
                project = projectInfo;
                CurrentRootObject = thisLevelRootObject;
                absoluteBasePath = controller.GetTempFilePathForComponent(ComponentKey.WorkbenchFileGenerator);

                {
                    Version version = new Version(loader.GetAssemblyVersionNumber());
                    Version expectedVersion = new Version(1, 1, 9, 49);
                    if (version < expectedVersion)
                    {
                        throw new OldVersionException("The template was compiled with an old version of ArchAngel, and cannot be used in this version of Workbench");
                    }
                }

                foreach (IFolder subFolder in folder.SubFolders)
                {
                    if (progressHelper.IsCancellationPending())
                    {
                        progressHelper.Cancel();
                        return fileCount;
                    }

                    ProjectFileTreeNode folderNode = null;

                    if (parentNode != null && subFolder.Name != "ROOT")
                    {
                        folderNode = parentNode.AddChildNode(subFolder.Name);
                        folderNode.IsFolder = true;
                    }

                    if (!string.IsNullOrEmpty(subFolder.IteratorName))
                    {
                        // The folder has an iterator
                        ProviderInfo provider;
                        Type iteratorType = project.GetTypeFromProviders(subFolder.IteratorName, out provider);

                        if (progressHelper.IsCancellationPending())
                        {
                            progressHelper.Cancel();
                            return fileCount;
                        }

                        if (iteratorType != null)
                        {
                            IEnumerable<IScriptBaseObject> iteratorObjects;

                            if (thisLevelRootObject == null)
                            {
                                iteratorObjects = provider.GetAllObjectsOfType(iteratorType.FullName);
                            }
                            else if (iteratorType.IsInstanceOfType(thisLevelRootObject))
                            {
                                iteratorObjects = new[] { thisLevelRootObject };
                            }
                            else
                            {
                                iteratorObjects = provider.GetAllObjectsOfType(iteratorType.FullName, thisLevelRootObject);
                            }
                            if (iteratorObjects != null)
                            {
                                foreach (IScriptBaseObject iteratorObject in iteratorObjects)
                                {
                                    if (progressHelper.IsCancellationPending())
                                    {
                                        progressHelper.Cancel();
                                        return fileCount;
                                    }

                                    CurrentRootObject = iteratorObject;

                                    string subFolderName = UpdateScriptName(iteratorObject, subFolder);

                                    if (folderNode != null)
                                    {
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:101,代码来源:GenerationHelper.cs

示例3: LoadPrevGenFiles

        ///<summary>
        /// Load the prevgen files, using the given controller to get the path to load them from.
        ///</summary>
        ///<param name="controller"></param>
        public void LoadPrevGenFiles(IController controller)
        {
            PrevGenUtility utility = new PrevGenUtility();
            string stagingFolder = controller.GetTempFilePathForComponent(ComponentKey.SlyceMergePrevGen);
            if (Directory.Exists(stagingFolder))
            {
                Utility.DeleteDirectoryBrute(stagingFolder);
            }
            if(Directory.GetDirectories(controller.ProjectSettings.ProjectPath, ".ArchAngel", SearchOption.AllDirectories).Length != 0)
            {
                // New Way
                utility.CopyUserPrevGenFiles(controller.ProjectSettings.ProjectPath,
                                             stagingFolder,
                                             controller.ProjectSettings.ProjectGuid);
                LoadPreviousVersionMD5s(controller);
            }
            else if(Directory.GetFiles(controller.ProjectSettings.ProjectPath, "*.aaz", SearchOption.AllDirectories).Length != 0)
            {
                // Old way
                utility.CopyPrevGenFiles_AAZ(controller.ProjectSettings.ProjectPath, stagingFolder);
                controller.AAZFound = true;
            }

            foreach (ProjectFileTreeNode node in allNodes)
            {
                if(node.IsFolder == false)
                {
                    node.AssociatedFile.LoadPrevGenFile(controller.GetTempFilePathForComponent(ComponentKey.SlyceMergePrevGen));
                }
            }
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:35,代码来源:ProjectFileTree.cs

示例4: LoadPreviousVersionMD5s

 public void LoadPreviousVersionMD5s(IController controller)
 {
     string rootDir = controller.GetTempFilePathForComponent(ComponentKey.SlyceMergePrevGen);
     LoadMD5sForNode(this, rootDir);
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:5,代码来源:ProjectFileTree.cs

示例5: SetupController

 private void SetupController()
 {
     controller = mocks.DynamicMock<IController>();
     Expect.Call(controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGenerator)).IgnoreArguments().Return("C:/Temp").Repeat.Any();
     Settings.Default.PerformMergeAnalysis = true;
     //Expect.Call(controller.SettingGet(Controller.SettingNames.PerformMergeAnalysis)).Return(true).Repeat.Any();
     ProjectSettings settings = new ProjectSettings();
     settings.OutputPath = "C:\\doesnotexist";
     WorkbenchProject project = new WorkbenchProject();
     project.ProjectSettings = settings;
     Expect.Call(controller.CurrentProject).Return(project);
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:12,代码来源:TestAnalysisHelper.cs


注:本文中的IController.GetTempFilePathForComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。