private void AddApp_GlobalResourceFileDefinition(DirectoryInfo parentDir, int baseIndex, Dictionary <string, object> items)
        {
            foreach (FileInfo file in parentDir.GetFiles())
            {
                if (FileProvider.IncludeFile(file))
                {
                    string locationPath = file.FullName.Substring(baseIndex);

                    if (!items.ContainsKey(locationPath))
                    {
                        App_GlobalResourceFileDefinition app_GlobalResourceFileDefinition = new App_GlobalResourceFileDefinition();

                        app_GlobalResourceFileDefinition.Location = locationPath;

                        items.Add(locationPath, app_GlobalResourceFileDefinition);

                        Log.Verbose("App_Global Resource File: " + locationPath);

                        this.AddToCab(file.FullName, locationPath);
                    }
                }
            }

            foreach (DirectoryInfo childDir in FileProvider.GetDirectories(parentDir))
            {
                AddApp_GlobalResourceFileDefinition(childDir, baseIndex, items);
            }
        }
Exemplo n.º 2
0
        public void Build()
        {
            // Setup
            WSPBuilderHandler wspBuilder = new WSPBuilderHandler(PROJECTNAME);

            // Run
            wspBuilder.Build();

            // Test
            string filename = wspBuilder.ProjectPath + @"\manifest.xml";

            Assert.IsTrue(File.Exists(filename));
            ManifestHandler manifestHandler = new ManifestHandler(filename);


            Assert.IsNotNull(manifestHandler.Manifest.ApplicationResourceFiles);
            Assert.IsNotNull(manifestHandler.Manifest.ApplicationResourceFiles.Items);
            Assert.AreEqual(manifestHandler.Manifest.ApplicationResourceFiles.Items.Length, 4);

            int countWPResources    = 0;
            int countGlobalResouces = 0;
            ApplicationResourceFileDefinitions defs = manifestHandler.Manifest.ApplicationResourceFiles;

            foreach (object item in defs.Items)
            {
                if (item is App_GlobalResourceFileDefinition)
                {
                    App_GlobalResourceFileDefinition globalItem = item as App_GlobalResourceFileDefinition;
                    countGlobalResouces++;
                }
                else
                {
                    ApplicationResourceFileDefinition appResourceFileDef = item as ApplicationResourceFileDefinition;
                    countWPResources++;
                }
            }

            Assert.AreEqual(countGlobalResouces, 3);
            Assert.AreEqual(countWPResources, 1);
        }
        private Dictionary <string, object> GetApplicationResourceFileDefinitionItems(ApplicationResourceFileDefinitions applicationResourceFiles)
        {
            Dictionary <string, object> items = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

            if (applicationResourceFiles != null && applicationResourceFiles.Items != null)
            {
                foreach (object item in applicationResourceFiles.Items)
                {
                    if (item is App_GlobalResourceFileDefinition)
                    {
                        App_GlobalResourceFileDefinition globalItem = item as App_GlobalResourceFileDefinition;
                        items.Add(globalItem.Location, item);
                    }
                    else
                    {
                        ApplicationResourceFileDefinition appResourceFileDef = item as ApplicationResourceFileDefinition;
                        items.Add(appResourceFileDef.Location, item);
                    }
                }
            }
            return(items);
        }
Exemplo n.º 4
0
    public void Move(Extractwsp handler)
    {
        if (this.FeatureManifests != null)
        {
            foreach (FeatureManifestReference featureRef in this.FeatureManifests)
            {
                featureRef.Move(handler);
            }
        }


        if (this.TemplateFiles != null)
        {
            foreach (TemplateFileReference templateFileRef in this.TemplateFiles)
            {
                templateFileRef.Move(handler);
            }
        }


        if (this.SiteDefinitionManifests != null)
        {
            foreach (SiteDefinitionManifestFileReference siteDefManifestFileRef in this.SiteDefinitionManifests)
            {
                siteDefManifestFileRef.Move(handler);
            }
        }


        // Move the wpresources and App_GlobalResources files
        if (this.ApplicationResourceFiles != null && this.ApplicationResourceFiles.Items != null)
        {
            foreach (object item in this.ApplicationResourceFiles.Items)
            {
                if (item is App_GlobalResourceFileDefinition)
                {
                    App_GlobalResourceFileDefinition globalItem = item as App_GlobalResourceFileDefinition;
                }
                else
                {
                    ApplicationResourceFileDefinition appResourceFileDef = item as ApplicationResourceFileDefinition;
                    appResourceFileDef.Move(handler);
                }
            }
        }

        if (this.DwpFiles != null)
        {
            foreach (DwpFileDefinition dwpFileDef in this.DwpFiles)
            {
                dwpFileDef.Move(handler);
            }
        }

        if (this.Resources != null)
        {
            foreach (ResourceDefinition resouceDef in this.Resources)
            {
                resouceDef.Move(handler);
            }
        }

        if (this.RootFiles != null)
        {
            foreach (RootFileReference rootFileRef in this.RootFiles)
            {
                rootFileRef.Move(handler);
            }
        }

        if (this.Assemblies != null)
        {
            foreach (AssemblyFileReference assemblyFileRef in this.Assemblies)
            {
                assemblyFileRef.Move(handler);
            }
        }

        // Move the manifest.xml
        MoveManifest(handler);

        // Create Solution ID file
        CreateSolutionIdFile(handler);
    }