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


C# Projects.Project类代码示例

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


Project类属于ProjectManager.Projects命名空间,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: BuildLibrarySwf

        public void BuildLibrarySwf(Project project, bool verbose)
        {
            // compile into frame 1 unless you're using shared libraries or preloaders
            Frame = 1;

            string swfPath = project.LibrarySWFPath;

            // delete existing output file if it exists
            if (File.Exists(swfPath))
                File.Delete(swfPath);

            // if we have any resources, build our library file and run swfmill on it
            if (!project.UsesInjection && project.LibraryAssets.Count > 0)
            {
                // ensure obj directory exists
                if (!Directory.Exists("obj"))
                    Directory.CreateDirectory("obj");

                string projectName = project.Name.Replace(" ", "");
                string backupLibraryPath = Path.Combine("obj", projectName + "Library.old");
                string relLibraryPath = Path.Combine("obj", projectName + "Library.xml");
                string backupSwfPath = Path.Combine("obj", projectName + "Resources.old");
                string arguments = string.Format("simple \"{0}\" \"{1}\"",
                    relLibraryPath, swfPath);

                SwfmillLibraryWriter swfmill = new SwfmillLibraryWriter(relLibraryPath);
                swfmill.WriteProject(project);

                if (swfmill.NeedsMoreFrames) Frame = 3;

                // compare the Library.xml with the one we generated last time.
                // if they're identical, and we have a Resources.swf, then we can
                // just assume that Resources.swf is up to date.
                if (File.Exists(backupSwfPath) && File.Exists(backupLibraryPath) &&
                    FileComparer.IsEqual(relLibraryPath, backupLibraryPath))
                {
                    // just copy the old one over!
                    File.Copy(backupSwfPath, swfPath, true);
                }
                else
                {
                    // delete old resource SWF as it's not longer valid
                    if (File.Exists(backupSwfPath))
                        File.Delete(backupSwfPath);

                    Console.WriteLine("Compiling resources");

                    if (verbose)
                        Console.WriteLine("swfmill " + arguments);

                    if (!ProcessRunner.Run(ExecutablePath, arguments, true))
                        throw new BuildException("Build halted with errors (swfmill).");

                    // ok, we just generated a swf with all our resources ... save it for
                    // reuse if no resources changed next time we compile
                    File.Copy(swfPath, backupSwfPath, true);
                    File.Copy(relLibraryPath, backupLibraryPath, true);
                }
            }
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:60,代码来源:SwfmillLibraryBuilder.cs

示例3: ClasspathNode

		public ClasspathNode(Project project, string classpath, string text) : base(classpath)
		{
			isDraggable = false;
			isRenamable = false;

            this.classpath = classpath;

            // shorten text
            string[] excludes = PluginMain.Settings.FilteredDirectoryNames;
            char sep = Path.DirectorySeparatorChar;
            string[] parts = text.Split(sep);
            List<string> label = new List<string>();
            Regex reVersion = new Regex("^[0-9]+[.,-][0-9]+");

            if (parts.Length > 0)
            {
                for (int i = parts.Length - 1; i > 0; --i)
                {
                    String part = parts[i] as String;
                    if (part != "" && part != "." && part != ".." && Array.IndexOf(excludes, part.ToLower()) == -1)
                    {
                        if (Char.IsDigit(part[0]) && reVersion.IsMatch(part)) label.Add(part);
                        else
                        {
                            label.Add(part);
                            break;
                        }
                    }
                    else label.Add(part);
                }
            }
            label.Reverse();
            Text = String.Join("/", label.ToArray());
            ToolTipText = classpath;
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:35,代码来源:OtherNodes.cs

示例4: ClasspathNode

		public ClasspathNode(Project project, string classpath, string text) : base(classpath)
		{
			isDraggable = false;
			isRenamable = false;

            this.classpath = classpath;

            // shorten text
            string[] excludes = PluginMain.Settings.FilteredDirectoryNames;
            char sep = Path.DirectorySeparatorChar;
            string[] parts = text.Split(sep);
            string label = "";

            if (parts.Length > 0)
            {
                for (int i = parts.Length - 1; i > 0; --i)
                {
                    String part = parts[i] as String;
                    if (part != "" && part != "." && part != ".." && Array.IndexOf(excludes, part.ToLower()) == -1)
                    {
                        label = part;
                        break;
                    }
                }
                if (label == "")
                {
                    label = parts[parts.Length - 1];
                }
            }

            Text = label;
            ToolTipText = classpath;
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:33,代码来源:OtherNodes.cs

示例5: WriteProject

        public void WriteProject(Project project)
        {
            this.project = project;

            try { InternalWriteProject(); }
            finally { Close(); }
        }
开发者ID:ImaginationSydney,项目名称:flashdevelop,代码行数:7,代码来源:SwfmillLibraryWriter.cs

示例6: CheckCurrent

        /// <summary>
        /// 
        /// </summary>
        private bool CheckCurrent()
        {
            try
            {
                IProject project = PluginBase.CurrentProject;
                if (project == null || !project.EnableInteractiveDebugger) return false;
                currentProject = project as Project;

                // ignore non-flash haxe targets
                if (project is HaxeProject)
                {
                    HaxeProject hproj = project as HaxeProject;
                    if (hproj.MovieOptions.Platform == HaxeMovieOptions.NME_PLATFORM
                        && (hproj.TargetBuild != null && !hproj.TargetBuild.StartsWith("flash")))
                        return false;
                }
                // Give a console warning for non external player...
                if (currentProject.TestMovieBehavior == TestMovieBehavior.NewTab || currentProject.TestMovieBehavior == TestMovieBehavior.NewWindow)
                {
                    TraceManager.Add(TextHelper.GetString("Info.CannotDebugActiveXPlayer"));
					return false;
                }
            }
            catch (Exception e) 
            { 
                ErrorManager.ShowError(e);
                return false;
            }
			return true;
        }
开发者ID:Gr33z00,项目名称:flashdevelop,代码行数:33,代码来源:DebuggerManager.cs

示例7: SetProject

        internal static void SetProject(Project project)
        {
            currentProject = project;

            fsWatchers.SetProject(project);
            ovManager.Reset();
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:7,代码来源:ProjectWatcher.cs

示例8: Build

        public bool Build(Project project, bool runOutput)
        {
            ipcName = Globals.MainForm.ProcessArgString("$(BuildIPC)");

            string compiler = null;
            if (project.NoOutput)
            {
                // get the compiler for as3 projects, or else the FDBuildCommand pre/post command in FDBuild will fail on "No Output" projects
                if (project.Language == "as3")
                    compiler = ProjectManager.Actions.BuildActions.GetCompilerPath(project);

                if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0)
                {
                    // no output and no build commands
                    if (project is AS2Project || project is AS3Project)
                    {
                        //RunFlashIDE(runOutput);
                        //ErrorManager.ShowInfo(TextHelper.GetString("ProjectManager.Info.NoOutputAndNoBuild"));
                    }
                    else
                    {
                        //ErrorManager.ShowInfo("Info.InvalidProject");
                        ErrorManager.ShowInfo(TextHelper.GetString("ProjectManager.Info.NoOutputAndNoBuild"));
                    }
                    return false;
                }
            }
            else
            {
                // Ask the project to validate itself
                string error;
                project.ValidateBuild(out error);

                if (error != null)
                {
                    ErrorManager.ShowInfo(TextHelper.GetString(error));
                    return false;
                }

                // 出力先が空だったとき
                if (project.OutputPath.Length < 1)
                {
                    ErrorManager.ShowInfo(TextHelper.GetString("ProjectManager.Info.SpecifyValidOutputSWF"));
                    return false;
                }

                compiler = BuildActions.GetCompilerPath(project);
                if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler)))
                {
                    string info = TextHelper.GetString("ProjectManager.Info.InvalidCustomCompiler");
                    MessageBox.Show(info, TextHelper.GetString("ProjectManager.Title.ConfigurationRequired"), MessageBoxButtons.OK);
                    return false;
                }
            }

            return FDBuild(project, runOutput, compiler);
        }
开发者ID:Dsnoi,项目名称:flashdevelopjp,代码行数:57,代码来源:BuildAction.cs

示例9: ProcessArgs

        public static string ProcessArgs(Project project, string args)
        {
            lastFileFromTemplate = QuickGenerator.QuickSettings.GenerateClass.LastFileFromTemplate;
            lastFileOptions = QuickGenerator.QuickSettings.GenerateClass.LastFileOptions;

            if (lastFileFromTemplate != null)
            {
                string fileName = Path.GetFileNameWithoutExtension(lastFileFromTemplate);

                args = args.Replace("$(FileName)", fileName);

                if (args.Contains("$(FileNameWithPackage)") || args.Contains("$(Package)"))
                {
                    string package = "";
                    string path = lastFileFromTemplate;

                    // Find closest parent

                    string classpath="";
                    if(project!=null)
                    classpath = project.AbsoluteClasspaths.GetClosestParent(path);

                    // Can't find parent, look in global classpaths
                    if (classpath == null)
                    {
                        PathCollection globalPaths = new PathCollection();
                        foreach (string cp in ProjectManager.PluginMain.Settings.GlobalClasspaths)
                            globalPaths.Add(cp);
                        classpath = globalPaths.GetClosestParent(path);
                    }
                    if (classpath != null)
                    {
                        if (project != null)
                        {
                            // Parse package name from path
                            package = Path.GetDirectoryName(ProjectPaths.GetRelativePath(classpath, path));
                            package = package.Replace(Path.DirectorySeparatorChar, '.');
                        }
                    }

                    args = args.Replace("$(Package)", package);

                    if (package.Length!=0)
                        args = args.Replace("$(FileNameWithPackage)", package + "." + fileName);
                    else
                        args = args.Replace("$(FileNameWithPackage)", fileName);

                    if (lastFileOptions != null)
                    {
                        args = ProcessFileTemplate(args);
                        if (processOnSwitch == null) lastFileOptions = null;
                    }
                }
                lastFileFromTemplate = null;
            }
            return args;
        }
开发者ID:fordream,项目名称:wanghe-project,代码行数:57,代码来源:ProcessArgsTemplateClass.cs

示例10: AddFileFromTemplate

        public void AddFileFromTemplate(Project project, string inDirectory, string templatePath)
        {
            try
            {
                // the template could be named something like "MXML.fdt", or maybe "Class.as.fdt"
                string fileName = Path.GetFileNameWithoutExtension(templatePath);
                string extension = "";
                string caption = TextHelper.GetString("Label.AddNew") + " ";

                if (fileName.IndexOf('.') > -1)
                {
                    // it's something like Class.as.fdt
                    extension = Path.GetExtension(fileName); // .as
                    caption += Path.GetFileNameWithoutExtension(fileName);
                    fileName = TextHelper.GetString("Label.New") + Path.GetFileNameWithoutExtension(fileName).Replace(" ", ""); // just Class
                }
                else
                {
                    // something like MXML.fdt
                    extension = "." + fileName.ToLower();
                    caption += fileName + " " + TextHelper.GetString("Label.File");
                    fileName = TextHelper.GetString("Label.NewFile");
                }

                // let plugins handle the file creation
                Hashtable info = new Hashtable();
                info["templatePath"] = templatePath;
                info["inDirectory"] = inDirectory;
                DataEvent de = new DataEvent(EventType.Command, "ProjectManager.CreateNewFile", info);
                EventManager.DispatchEvent(this, de);
                if (de.Handled) return;

                LineEntryDialog dialog = new LineEntryDialog(caption, TextHelper.GetString("Label.FileName"), fileName + extension);
                dialog.SelectRange(0, fileName.Length);

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    FlashDevelopActions.CheckAuthorName();

                    string newFilePath = Path.Combine(inDirectory, dialog.Line);
                    if (!Path.HasExtension(newFilePath) && extension != ".ext")
                        newFilePath = Path.ChangeExtension(newFilePath, extension);

                    if (!ConfirmOverwrite(newFilePath)) return;

                    // save this so when we are asked to process args, we know what file it's talking about
                    lastFileFromTemplate = newFilePath;

                    mainForm.FileFromTemplate(templatePath, newFilePath);
                }
            }
            catch (UserCancelException) { }
            catch (Exception exception)
            {
                ErrorManager.ShowError(exception);
            }
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:57,代码来源:FileActions.cs

示例11: SetProject

        internal static void SetProject(Project project)
        {
            currentProject = project;

            fsWatchers.SetProject(project);
            ovManager.Reset();

            foreach (ITabbedDocument document in PluginBase.MainForm.Documents)
                if (document.IsEditable) HandleFileReload(document.FileName);
        }
开发者ID:zpLin,项目名称:flashdevelop,代码行数:10,代码来源:ProjectWatcher.cs

示例12: Dispose

 internal static void Dispose()
 {
     if (vcManager != null)
     {
         vcManager.Dispose();
         fsWatchers.Dispose();
         ovManager.Dispose();
         currentProject = null;
     }
 }
开发者ID:zpLin,项目名称:flashdevelop,代码行数:10,代码来源:ProjectWatcher.cs

示例13: Create

 public static ProjectBuilder Create(Project project, string ipcName, string compilerPath)
 {
     if (project is AS2Project)
         return new AS2ProjectBuilder(project as AS2Project, compilerPath);
     else if (project is AS3Project)
         return new AS3ProjectBuilder(project as AS3Project, compilerPath, ipcName);
     else if (project is HaxeProject)
         return new HaxeProjectBuilder(project as HaxeProject, compilerPath);
     else
         throw new Exception("FDBuild doesn't know how to build " + project.GetType().Name);
 }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:11,代码来源:ProjectBuilder.cs

示例14: BuildEventDialog

        public BuildEventDialog(Project project)
        {
            InitializeComponent();
            InitializeLocalization();
            this.FormGuid = "ada69d37-2ec0-4484-b113-72bfeab2f239";
            this.Font = PluginCore.PluginBase.Settings.DefaultFont;

            this.project = project;
            this.vars = new BuildEventVars(project);
            foreach (BuildEventInfo info in vars.GetVars()) Add(info);
        }
开发者ID:Neverbirth,项目名称:flashdevelop,代码行数:11,代码来源:BuildEventDialog.cs

示例15: LibraryAsset

		public LibraryAsset(Project project, string path)
		{
			Project = project;
			Path = path;
			ManualID = null;
			UpdatePath = null;
			FontGlyphs = null;
			Sharepoint = null;
            BitmapLinkage = false;
			SwfMode = SwfAssetMode.Library;
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:11,代码来源:LibraryAsset.cs


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