How to override supported file extensions?

Coordinator
Oct 24, 2011 at 4:30 PM

Please be aware of following. When WpWidgetLibrary framework is initialized, we start the copy process of all Web-content located in specified folder. This folder is defined by following call:

InstalHTMLContent(string htmlFolder, string[] htmlDirs) 

where htmlFolder is the folder in solution which contains all required web files. In other words this is the root of web-application which will be executed from isolated storage. Because you are free to use any kind of extension like “myfile.tiff” the framework can either copy any file in your project or specific files. We decided to copy specific files only.

Here is how we do it:

protected virtual bool IsWebExtension(string ext)       {

           bool res = false;
           switch (ext.ToLower())
           {
               case "htm":
               case "html":
                case "js":
               case "jpg":
               case "jpeg":
               case "png":
               case "css":

 

                   res = true;

                   break;
           }
           return res;
       }

If your application contains some media file like “abc.avi” you will have derive from WPWidgetLibrary and override this method.

public class MyWPWidgetLibrary: WPWidgetLibrary{

protected override bool IsWebExtension(string ext){

           bool res = false;
           switch (ext.ToLower())
           {
               case "avi":
                   return true;
                   break;
           }
           return base.IsWebExtension(ext);      
   }
}