Beispiel #1
0
        public bool UpdateGtkFolder()
        {
            if (!SupportsDesigner(project))
            {
                return(false);
            }

            // This method synchronizes the current gtk project configuration info
            // with the needed support files in the gtk-gui folder.

            FileService.CreateDirectory(GtkGuiFolder);
            bool projectModified   = false;
            bool initialGeneration = false;

            if (!File.Exists(SteticFile))
            {
                initialGeneration = true;
                StreamWriter sw = new StreamWriter(SteticFile);
                sw.WriteLine("<stetic-interface />");
                sw.Close();
                FileService.NotifyFileChanged(SteticFile);
            }

            if (!project.IsFileInProject(SteticFile))
            {
                ProjectFile pf = project.AddFile(SteticFile, BuildAction.EmbeddedResource);
                pf.ResourceId   = "gui.stetic";
                projectModified = true;
            }

            StringCollection files         = GuiBuilderProject.GenerateFiles(GtkGuiFolder);
            DateTime         generatedTime = File.GetLastWriteTime(SteticFile).Subtract(TimeSpan.FromSeconds(2));

            foreach (string filename in files)
            {
                if (initialGeneration)
                {
                    // Ensure that the generation date of this file is < the date of the .stetic file
                    // In this way the code will be properly regenerated when building the project.
                    File.SetLastWriteTime(filename, generatedTime);
                }
                if (!project.IsFileInProject(filename))
                {
                    project.AddFile(filename, BuildAction.Compile);
                    projectModified = true;
                }
            }

            UpdateObjectsFile();
            files.Add(ObjectsFile);
            files.Add(SteticFile);

            if (CleanGtkFolder(files))
            {
                projectModified = true;
            }

            return(ReferenceManager.Update() || projectModified);
        }
        static void OnReferenceAdded(object o, ProjectReferenceEventArgs args)
        {
            if (updating || !IsGtkReference(args.ProjectReference))
            {
                return;
            }

            string           sr      = args.ProjectReference.StoredReference;
            string           version = sr.Substring(sr.IndexOf(",") + 1).Trim();
            ReferenceManager rm      = new ReferenceManager(args.Project as DotNetProject);

            rm.Update(version);
        }
Beispiel #3
0
        public bool UpdateGtkFolder()
        {
            if (!SupportsDesigner(project))
            {
                return(false);
            }

            // This method synchronizes the current gtk project configuration info
            // with the needed support files in the gtk-gui folder.

            FileService.CreateDirectory(SteticFolder);
            bool projectModified = false;

            foreach (string filename in GetDesignerFiles())
            {
                ProjectFile pf = project.AddFile(filename, BuildAction.EmbeddedResource);
                pf.ResourceId = Path.GetFileName(filename);

                string componentFile = GetComponentFileFromDesigner(filename);

                if (componentFile != null && File.Exists(componentFile))
                {
                    pf.DependsOn = componentFile;

                    string buildFile = GetBuildFileFromComponent(componentFile);
                    if (buildFile != null && File.Exists(buildFile))
                    {
                        ProjectFile pf2 = project.AddFile(buildFile, BuildAction.Compile);
                        pf2.ResourceId = Path.GetFileName(buildFile);
                        pf2.DependsOn  = componentFile;
                    }
                }

                projectModified = true;
            }

            StringCollection files = GuiBuilderProject.GenerateFiles(SteticFolder);

            foreach (string filename in files)
            {
                if (!project.IsFileInProject(filename))
                {
                    project.AddFile(filename, BuildAction.Compile);
                    projectModified = true;
                }
            }

            UpdateObjectsFile();

            return(ReferenceManager.Update() || projectModified);
        }
		static void OnReferenceAdded (object o, ProjectReferenceEventArgs args)
		{
			if (updating || !IsGtkReference (args.ProjectReference))
				return;

			string sr = args.ProjectReference.StoredReference;
			string version = sr.Substring (sr.IndexOf (",") + 1).Trim ();
			ReferenceManager rm = new ReferenceManager (args.Project as DotNetProject);
			rm.Update (version);
		}