Extending Unified File

Vote:
 

Hi,

I want to extend/inherit from the UnifiedFile class to add some extra properties and encapsulate the functionality in my project

However upon doing so e.g.

ImageItem : UnifiedFile

I get the error no constructor exists with 0 arguments. I do not really need all the extraneous info associated with the default constructor is there a way round using it?

Has anyone implemented something similiar and has some advice?

Thanks a lot

 

#25892
Nov 11, 2008 12:40
Vote:
 

That class have a lot of internal and private methods and constructors.Frown

I started on the same thing. I wanted a filsystem that didnt allow/automatic changed names with nordic characteres. Tried first the evenets, but they only returned error messages in the filmanager. not very pretty.

Think the best way of doing it is to make a new filmanager and add your logic there

#25893
Nov 11, 2008 12:51
Vote:
 

Can add that you have to extend the provider first, then make that provider return your new fil and directory class. The archive that you need to override some functiions  GetDirectory, GetFile. Those functions need some private variables and functions

I found them by using Reflection

this._rootVersioningDirectoryHandler2 = null;
Type type = base.GetType();
FieldInfo field = type.BaseType.GetField("_versionFileSystem", BindingFlags.NonPublic | BindingFlags.Instance);
if (field != null)
     _versionFileSystem2 = (VersioningFileSystem)field.GetValue(this);

 This aint pretty. So basicly the best way is to decompile 4-5 classes and add them as your own. But as I stated before think making a new FilManager is better

 

#25895
Nov 11, 2008 12:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.