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


C# Project.GetAbsolutePath方法代码示例

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


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

示例1: KeepUpdated

        public void KeepUpdated(Project project)
        {
            foreach (LibraryAsset asset in project.LibraryAssets)
                if (asset.UpdatePath != null)
                {
                    string assetName = Path.GetFileName(asset.Path);
                    string assetPath = project.GetAbsolutePath(asset.Path);
                    string updatePath = project.GetAbsolutePath(asset.UpdatePath);
                    if (File.Exists(updatePath))
                    {
                        // check size/modified
                        FileInfo source = new FileInfo(updatePath);
                        FileInfo dest = new FileInfo(assetPath);

                        if (source.LastWriteTime != dest.LastWriteTime ||
                            source.Length != dest.Length)
                        {
                            Console.WriteLine("Updating asset '" + assetName + "'");
                            File.Copy(updatePath, assetPath, true);
                        }
                    }
                    else
                    {
                        Console.Error.WriteLine("Warning: asset '" + assetName + "' could "
                            + " not be updated, as the source file could does not exist.");
                    }
                }
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:28,代码来源:SwfmillLibraryBuilder.cs

示例2: UpdateASCompletion

        public void UpdateASCompletion(IMainForm mainForm, Project project)
        {
            List<string> classPaths = new List<string>();
            List<string> hiddenPaths = new List<string>();
            string version;
            string platform = "";

            if (project != null)
            {
                BuildActions.GetCompilerPath(project); // refresh project's SDK
                project.UpdateVars(true);

                // platform/version
                platform = project.MovieOptions.Platform;
                version = project.MovieOptions.Version;
                if (platform != PlatformData.FLASHPLAYER_PLATFORM
                    && project.MovieOptions.HasPlatformSupport && project.MovieOptions.PlatformSupport.IsFlashPlatform)
                    version = PlatformData.ResolveFlashPlayerVersion(project.Language, platform, version);

                // add project classpaths
                foreach (string cp in project.AbsoluteClasspaths)
                    if (Directory.Exists(cp)) classPaths.Add(cp);

                // add AS3 libraries
                string absPath;
                if (project is AS3Project)
                {
                    MxmlcOptions options = (project as AS3Project).CompilerOptions;
                    foreach (string relPath in options.IntrinsicPaths)
                    {
                        absPath = PathHelper.ResolvePath(relPath);
                        if (absPath == null) absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (Directory.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.LibraryPaths)
                    {
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (File.Exists(absPath)) classPaths.Add(absPath);
                        else if (Directory.Exists(absPath))
                        {
                            string[] libs = Directory.GetFiles(absPath, "*.swc");
                            foreach (string lib in libs) classPaths.Add(lib);
                        }
                    }
                    foreach (string relPath in options.IncludeLibraries)
                    {
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (Directory.Exists(absPath) || File.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.ExternalLibraryPaths)
                    {
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (Directory.Exists(absPath) || File.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.RSLPaths)
                    {
                        string[] parts = relPath.Split(',');
                        if (parts.Length < 2) continue;
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (File.Exists(absPath)) classPaths.Add(absPath);
                    }
                }

                string dir = project.Directory;
                foreach (string hidPath in project.HiddenPaths)
                {
                    absPath = Path.Combine(dir, hidPath);
                    foreach (string cp in classPaths)
                        if (absPath.StartsWithOrdinal(cp))
                        {
                            hiddenPaths.Add(absPath);
                            break;
                        }
                }
            }
            else if (PlatformData.SupportedLanguages.ContainsKey("as3"))
            {
                var targets = PlatformData.SupportedLanguages["as3"].Platforms;
                var flashPlatform = targets[PlatformData.FLASHPLAYER_PLATFORM];
                version = flashPlatform.LastVersion.Value;
            }
            else version = "11.0";

            DataEvent de;
            Hashtable info = new Hashtable();
            // release old classpath
            if (currentLang != null && project == null)
            {
                info["lang"] = currentLang;
                info["platform"] = "";
                info["targetBuild"] = "";
                info["version"] = "0.0";
                info["classpath"] = null;
                info["hidden"] = null;

//.........这里部分代码省略.........
开发者ID:xeronith,项目名称:flashdevelop,代码行数:101,代码来源:ProjectActions.cs

示例3: ToggleAlwaysCompile

        public void ToggleAlwaysCompile(Project project, string[] paths)
        {
            foreach (string path in paths)
            {
                bool isTarget = project.IsCompileTarget(path);
                project.SetCompileTarget(path, !isTarget);
            }
            if (project.MaxTargetsCount > 0)
            {
                while (project.CompileTargets.Count > project.MaxTargetsCount)
                {
                    int len = project.CompileTargets.Count;
                    string relPath = project.CompileTargets[0];
                    project.SetCompileTarget(relPath, false);
                    if (project.CompileTargets.Count == len) // safety if path is not removed
                        project.CompileTargets.RemoveAt(0);

                    string path = project.GetAbsolutePath(relPath);
                    OnProjectModified(new string[] { path });
                }
            }
            project.Save();
            OnProjectModified(paths);
        }
开发者ID:xeronith,项目名称:flashdevelop,代码行数:24,代码来源:ProjectActions.cs

示例4: UpdateASCompletion

        public void UpdateASCompletion(IMainForm mainForm, Project project)
        {
            List<string> classPaths = new List<string>();
            List<string> hiddenPaths = new List<string>();
            int majorVersion = 0;
            int minorVersion = 0;
            string platform = "";

            if (project != null)
            {
                BuildActions.GetCompilerPath(project); // refresh project's SDK
                project.UpdateVars(true);

                // platform/version
                platform = project.MovieOptions.Platform;
                majorVersion = project.MovieOptions.MajorVersion;
                minorVersion = project.MovieOptions.MinorVersion;
                if (project.MovieOptions.Platform == AS3MovieOptions.AIR_PLATFORM
                    || project.MovieOptions.Platform == AS3MovieOptions.AIR_MOBILE_PLATFORM)
                    AS3Project.GuessFlashPlayerForAIR(ref majorVersion, ref minorVersion);

                // add project classpaths
                foreach (string cp in project.AbsoluteClasspaths)
                    if (Directory.Exists(cp)) classPaths.Add(cp);

                // add AS3 libraries
                string absPath;
                if (project is AS3Project)
                {
                    MxmlcOptions options = (project as AS3Project).CompilerOptions;
                    foreach (string relPath in options.IntrinsicPaths)
                    {
                        absPath = PathHelper.ResolvePath(relPath);
                        if (absPath == null) absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (Directory.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.LibraryPaths)
                    {
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (File.Exists(absPath)) classPaths.Add(absPath);
                        else if (Directory.Exists(absPath))
                        {
                            string[] libs = Directory.GetFiles(absPath, "*.swc");
                            foreach (string lib in libs) classPaths.Add(lib);
                        }
                    }
                    foreach (string relPath in options.IncludeLibraries)
                    {
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (Directory.Exists(absPath) || File.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.ExternalLibraryPaths)
                    {
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (Directory.Exists(absPath) || File.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.RSLPaths)
                    {
                        string[] parts = relPath.Split(',');
                        if (parts.Length < 2) continue;
                        absPath = project.GetAbsolutePath(relPath);
                        if (absPath == null) continue;
                        if (File.Exists(absPath)) classPaths.Add(absPath);
                    }
                }

                string dir = project.Directory;
                foreach (string hidPath in project.HiddenPaths)
                {
                    absPath = Path.Combine(dir, hidPath);
                    foreach (string cp in classPaths)
                        if (absPath.StartsWith(cp))
                        {
                            hiddenPaths.Add(absPath);
                            break;
                        }
                }
            }

            DataEvent de;
            Hashtable info = new Hashtable();
            // release old classpath
            if (currentLang != null && project == null)
            {
                info["lang"] = currentLang;
                info["platform"] = "";
                info["targetBuild"] = "";
                info["version"] = "0.0";
                info["classpath"] = null;
                info["hidden"] = null;

                de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info);
                EventManager.DispatchEvent(this, de);
            }

            // set new classpath
//.........这里部分代码省略.........
开发者ID:thecocce,项目名称:flashdevelop,代码行数:101,代码来源:ProjectActions.cs

示例5: RebuildProjectNode

        private void RebuildProjectNode(Project project)
        {
            activeProject = project;

            // create the top-level project node
            ProjectNode projectNode = new ProjectNode(project);
            Nodes.Add(projectNode);
            projectNode.Refresh(true);
            projectNode.Expand();

            ArrayList projectClasspaths = new ArrayList();
            ArrayList globalClasspaths = new ArrayList();

            if (PluginMain.Settings.ShowProjectClasspaths)
            {
                projectClasspaths.AddRange(project.Classpaths);
                if (project.AdditionalPaths != null) projectClasspaths.AddRange(project.AdditionalPaths);
            }

            if (PluginMain.Settings.ShowGlobalClasspaths)
                globalClasspaths.AddRange(PluginMain.Settings.GlobalClasspaths);

            ReferencesNode refs = new ReferencesNode(project.Directory, "References");
            projectNode.References = refs;
            ClasspathNode cpNode;

            foreach (string projectClasspath in projectClasspaths)
            {
                string absolute = projectClasspath;
                if (!Path.IsPathRooted(absolute))
                    absolute = project.GetAbsolutePath(projectClasspath);
                if ((absolute + "\\").StartsWith(project.Directory + "\\"))
                    continue;

                cpNode = new ProjectClasspathNode(project, absolute, projectClasspath);
                refs.Nodes.Add(cpNode);
                cpNode.Refresh(true);
            }

            foreach (string globalClasspath in globalClasspaths)
            {
                string absolute = globalClasspath;
                if (!Path.IsPathRooted(absolute))
                    absolute = project.GetAbsolutePath(globalClasspath);
                if (absolute.StartsWith(project.Directory + Path.DirectorySeparatorChar.ToString()))
                    continue;

                cpNode = new ClasspathNode(project, absolute, globalClasspath);
                refs.Nodes.Add(cpNode);
                cpNode.Refresh(true);
            }

            // add external libraries at the top level also
            if (project is AS3Project)
                foreach (LibraryAsset asset in (project as AS3Project).SwcLibraries)
                {
                    if (!asset.IsSwc) continue;
                    // check if SWC is inside the project or inside a classpath
                    string absolute = asset.Path;
                    if (!Path.IsPathRooted(absolute))
                        absolute = project.GetAbsolutePath(asset.Path);

                    bool showNode = true;
                    if (absolute.StartsWith(project.Directory))
                        showNode = false;
                    foreach (string path in project.AbsoluteClasspaths)
                        if (absolute.StartsWith(path))
                        {
                            showNode = false;
                            break;
                        }
                    foreach (string path in PluginMain.Settings.GlobalClasspaths)
                        if (absolute.StartsWith(path))
                        {
                            showNode = false;
                            break;
                        }

                    if (showNode && File.Exists(absolute))
                    {
                        SwfFileNode swcNode = new SwfFileNode(absolute);
                        refs.Nodes.Add(swcNode);
                        swcNode.Refresh(true);
                    }
                }
        }
开发者ID:vovkasm,项目名称:flashdevelop,代码行数:86,代码来源:ProjectTreeView.cs

示例6: ToggleAlwaysCompile

        public void ToggleAlwaysCompile(Project project, string[] paths)
		{
			foreach (string path in paths)
			{
				bool isTarget = project.IsCompileTarget(path);
				project.SetCompileTarget(path, !isTarget);
			}
            if (project.MaxTargetsCount > 0)
            {
                while (project.CompileTargets.Count > project.MaxTargetsCount)
                {
                    string relPath = project.CompileTargets[0];
                    string path = project.GetAbsolutePath(relPath);
                    project.SetCompileTarget(path, false);
                    OnProjectModified(new string[] { path });
                }
            }
			project.Save();
			OnProjectModified(paths);
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:20,代码来源:ProjectActions.cs

示例7: UpdateASCompletion

		public void UpdateASCompletion(IMainForm mainForm, Project project)
		{
            List<string> classPaths = new List<string>();
			
            if (project != null)
            {
                // add player version
                classPaths.Add(project.MovieOptions.Version.ToString());

                // add special features
                if (project is AS3Project)
                {
                    string[] additional = (project.CompilerOptions as MxmlcOptions).Additional;
                    if (additional != null)
                        foreach (string param in additional)
                        {
                            if (param.IndexOf("configname=air") >= 0)
                                classPaths.Add("AIR");
                        }
                }

                // add project classpaths
                foreach (string cp in project.AbsoluteClasspaths)
                    if (Directory.Exists(cp)) classPaths.Add(cp);

                // add AS3 libraries
                if (project is AS3Project)
                {
                    MxmlcOptions options = (project as AS3Project).CompilerOptions;
                    foreach (string relPath in options.IntrinsicPaths)
                    {
                        string absPath = PathHelper.ResolvePath(relPath, project.Directory);
                        if (Directory.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.LibraryPaths)
                    {
                        string absPath = project.GetAbsolutePath(relPath);
                        if (File.Exists(absPath)) classPaths.Add(absPath);
                        else if (Directory.Exists(absPath))
                        {
                            string[] libs = Directory.GetFiles(absPath, "*.swc");
                            foreach (string lib in libs) classPaths.Add(lib);
                        }
                    }
                    foreach (string relPath in options.IncludeLibraries)
                    {
                        string absPath = project.GetAbsolutePath(relPath);
                        if (Directory.Exists(absPath) || File.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.ExternalLibraryPaths)
                    {
                        string absPath = project.GetAbsolutePath(relPath);
                        if (Directory.Exists(absPath) || File.Exists(absPath)) classPaths.Add(absPath);
                    }
                    foreach (string relPath in options.RSLPaths)
                    {
                        string[] parts = relPath.Split(',');
                        if (parts.Length < 2) continue;
                        string absPath = project.GetAbsolutePath(parts[0]);
                        if (File.Exists(absPath)) classPaths.Add(absPath);
                    }
                }
            }

            // release old classpath
            DataEvent de;
            if (currentLang != null && (project == null || currentLang != project.Language))
            {
                de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", currentLang + ";");
                EventManager.DispatchEvent(this, de);
            }

            // set new classpath
            if (project != null)
            {
                currentLang = project.Language;
                string cps = currentLang + ";" + string.Join(";", classPaths.ToArray());

                de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", cps);
                EventManager.DispatchEvent(this, de);
            }
            else currentLang = null;
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:83,代码来源:ProjectActions.cs


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