Ejemplo n.º 1
0
		public MainPresenter(
			IWindowManager windowManager,
			IMainView view,
			IConfiguration config,
			IIoRepository repository,
			IconCacheQueue iconCacheQueue)
		{
			_WindowManager = windowManager;
			_View = view;
			_Config = config;
			_Repo = repository;
			_IconCacheQueue = iconCacheQueue;
			string currentDirectory = _Config.StartupDirectory ?? Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
			_CurrentDirectory = _Repo.GetDirectory(currentDirectory);
			SetupView(currentDirectory);
		}
Ejemplo n.º 2
0
 public RenameDirectoryOperation(IDirectoryObject directory, string newName, IFileSystem fileSystem, IExecutionContext context) : base(fileSystem, context)
 {
     Directory = directory;
     NewName   = newName;
 }
Ejemplo n.º 3
0
 public ImageDirectory(IDirectoryObject directory)
 {
     Directory = directory;
     Files     = directory.GetFiles().Where(c => IsImage(c)).Cast <IFileObject>().ToArray();
     FileIndex = 0;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a usual Response Element for an directory
        /// </summary>
        /// <param name="xmlDocument"></param>
        /// <param name="hRef"></param>
        /// <param name="displayname"></param>
        /// <returns></returns>
        private XmlElement CreateResponseElement_Dir(HTTPHeader header, XmlDocument xmlDocument, String hRef, String displayname, IDirectoryObject directoryObject, PropfindProperties propfindProperties)
        {
            String CreationDate = "";
            String LastModificationDate = "";

            //if (DirectoryObject != null && DirectoryObject.INodeReference != null)
            //{
            //    CreationDate = GetConvertedDateTime(DirectoryObject.INodeReference.CreationTime).ToString(S_DATETIME_FORMAT);
            //    LastModificationDate = GetConvertedDateTime(DirectoryObject.INodeReference.LastModificationTime).ToString(S_DATETIME_FORMAT);
            //}

            XmlElement ElemResponse = xmlDocument.CreateElement(S_DAV_PREFIX, "response", S_DAV_NAMESPACE_URI);
            #region response elements

            XmlElement ElemHref = xmlDocument.CreateElement(S_DAV_PREFIX, "href", S_DAV_NAMESPACE_URI);
            ElemHref.InnerText = hRef;

            Dictionary<String, String> Props = new Dictionary<String, String>();
            /*
            if (myPropfindProperties == PropfindProperties.NONE)
            {
                // Should return ALL props

                Props.Add(PropfindProperties.Creationdate.ToString(), CreationDate);//, "2008-12-29T15:28:29Z");
                Props.Add(PropfindProperties.Displayname.ToString(), Displayname);
                Props.Add(PropfindProperties.Getcontentlanguage.ToString(), ""); // If no Content-Language is specified, the default is that the content is intended for all language audiences.
                Props.Add(PropfindProperties.Getcontentlength.ToString(), "0");
                Props.Add(PropfindProperties.Getcontenttype.ToString(), System.Net.Mime.MediaTypeNames.Application.Octet);
                Props.Add(PropfindProperties.Getetag.ToString(), CacheUUID.NewGuid().ToString()); // to identify a single ressource for update purposes (see If-Match)
                Props.Add(PropfindProperties.Getlastmodified.ToString(), LastModificationDate);//"2009-02-09T08:11:12Z");
                Props.Add(PropfindProperties.Lockdiscovery.ToString(), "");
                Props.Add(PropfindProperties.Resourcetype.ToString(), "collection");
                Props.Add(PropfindProperties.Supportedlock.ToString(), "");

                // Do we want to add some MS specific data?
                if (Header.ClientType == ClientTypes.MicrosoftWebDAVMiniRedir)
                {
                    //Props.Add("isFolder", "f");
                    //If the element contains the 'collection' child element plus additional unrecognized elements, it should generally be treated as a collection. If the element contains no recognized child elements, it should be treated as a non-collection resource
                    //Props.Add("isCollection", "1");
                    //Props.Add("ishidden", "0");
                }

            }else{
                */
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Creationdate)       == PropfindProperties.Creationdate))
                Props.Add(PropfindProperties.Creationdate.ToString(), CreationDate);
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Displayname)        == PropfindProperties.Displayname))
                Props.Add(PropfindProperties.Displayname.ToString(), displayname);
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontentlanguage) == PropfindProperties.Getcontentlanguage))
                Props.Add(PropfindProperties.Getcontentlanguage.ToString(), "");
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontentlength)   == PropfindProperties.Getcontentlength))
                Props.Add(PropfindProperties.Getcontentlength.ToString(), "0");
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getcontenttype)     == PropfindProperties.Getcontenttype))
                Props.Add(PropfindProperties.Getcontenttype.ToString(), System.Net.Mime.MediaTypeNames.Application.Octet);
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getetag)            == PropfindProperties.Getetag))
                Props.Add(PropfindProperties.Getetag.ToString(), Guid.NewGuid().ToString());
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Getlastmodified)    == PropfindProperties.Getlastmodified))
                Props.Add(PropfindProperties.Getlastmodified.ToString(), LastModificationDate);
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Lockdiscovery)      == PropfindProperties.Lockdiscovery))
                Props.Add(PropfindProperties.Lockdiscovery.ToString(), "");
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Resourcetype)       == PropfindProperties.Resourcetype))
                Props.Add(PropfindProperties.Resourcetype.ToString(), "collection");
            if ((propfindProperties == PropfindProperties.NONE) || ((propfindProperties & PropfindProperties.Supportedlock)      == PropfindProperties.Supportedlock))
                Props.Add(PropfindProperties.Supportedlock.ToString(), "");
            //}

            XmlElement ElemPropstat = CreatePropstatElement(header, xmlDocument, Props, hRef.Replace(header.GetFullHTTPHost(), ""));

            #endregion
            ElemResponse.AppendChild(ElemHref);
            ElemResponse.AppendChild(ElemPropstat);

            return ElemResponse;
        }
Ejemplo n.º 5
0
		private void MoveToParent()
		{
			var currentDirectory = _CurrentDirectory.ParentDirectory;
			if (currentDirectory != null)
			{
				var prevDirectory = _CurrentDirectory;
				_CurrentDirectory = currentDirectory;
				UpdateFileList();
				//SetSelectedItemInList(prevDirectory);
			}
		}
Ejemplo n.º 6
0
		private void CurrentDirectoryEnter()
		{
			_CurrentDirectory = _Repo.GetDirectory(_View.CurrentDirectory);
			UpdateFileList();
		}
Ejemplo n.º 7
0
 public IEnumerable<IDirectoryObject> GetSubDirectories(IDirectoryObject directory)
 {
     return Objects.OfType<IDirectoryObject>().Where(obj => obj.Parent != null && obj.Parent.Equals(directory));
 }
Ejemplo n.º 8
0
		private void GotoSelectedItem(object selectedItem)
		{
			MainWindowFile selected = selectedItem as MainWindowFile;
			if (selected == null) return;
			IFileSystemObject selectedSystemObject = selected.SystemObject;
			if (selectedSystemObject is IDirectoryObject)
			{
				_CurrentDirectory = selectedSystemObject as IDirectoryObject;
				UpdateFileList();
			}
			else
			{
				IFileObject file = selectedSystemObject as IFileObject;
				IDirectoryObject dir = file.ParentDirectory;
				_WindowManager.ShowImageWindow(new ImageDirectory(dir), file.Name);
			}
		}
		public MainWindowDirectoryWrapper(IDirectoryObject directoryObject, Dispatcher uiDispatcher, IconCacheQueue iconCacheQueue)
		{
			IconCache = iconCacheQueue;
			_DirectoryObject = directoryObject;
			UiDispatcher = uiDispatcher;
		}
Ejemplo n.º 10
0
		public ImageDirectory(IDirectoryObject directory)
		{
			Directory = directory;
			Files = directory.GetFiles().Where(c => IsImage(c)).Cast<IFileObject>().ToArray();
			FileIndex = 0;
		}
Ejemplo n.º 11
0
 private void CurrentDirectoryEnter()
 {
     _CurrentDirectory = _Repo.GetDirectory(_View.CurrentDirectory);
     UpdateFileList();
 }
Ejemplo n.º 12
0
 private Exceptional<Boolean> Contains_private(IDirectoryObject myIDirectoryObject, string myUUIDAsString)
 {
     return new Exceptional<Boolean>((bool)myIDirectoryObject.ObjectExists(myUUIDAsString) && myIDirectoryObject.GetDirectoryEntry(myUUIDAsString).ObjectStreamsList.Contains(DBConstants.DBOBJECTSTREAM));
 }
Ejemplo n.º 13
0
 public RenameDirectoryTask(IDirectoryObject directory, string newName)
 {
     Directory = directory;
     NewName   = newName;
 }
Ejemplo n.º 14
0
 public DeleteDirectoryOperation(IDirectoryObject directory, IFileSystem fileSystem, IExecutionContext context) : base(fileSystem, context)
 {
     Directory = directory;
 }
Ejemplo n.º 15
0
 public IEnumerable <IOperation> Store(IDirectoryObject directory, IFileSystem fileSystem, IExecutionContext context)
 {
     yield return(new BackupDatabaseToFileOperation(this, directory, fileSystem, context));
 }