Beispiel #1
0
        public void Save(iFileSystem filesystem)
        {
            if (_filePath == null)
            {
                return;
            }

            List <StoppingPlace> yourlist   = _stopsList;
            XmlSerializer        serializer = new XmlSerializer(typeof(List <StoppingPlace>));

            filesystem.serilaze(serializer, _filePath, yourlist);
        }
Beispiel #2
0
    static void copyWithNative(iFileSystem nativeFs, string pathFrom, string pathTo)
    {
        Stream from, to;

        nativeFs.openFile(pathFrom, out from);
        using ( from )
        {
            nativeFs.createFile(pathTo, out to);
            using (to)
                from.CopyTo(to);
        }
    }
Beispiel #3
0
        //Explore
        //---------------------------------------------------------------------------------------------
        public JsonResult Explore(string path, bool isVirtual = true, bool goThroughSubDirectories = false, bool getFiles = true, bool getDirectories = true)
        {
            string root  = Server.MapPath("~/");
            string route = (String.IsNullOrEmpty(path)) ? root : ((isVirtual) ? Server.MapPath(path) : path);

            DirectoryInfo directory = new DirectoryInfo(route);
            Array         array     = null;

            if (getFiles && getDirectories)
            {
                array = directory.GetFileSystemInfos();
            }
            else if (getFiles)
            {
                array = directory.GetFiles();
            }
            else if (getDirectories)
            {
                array = directory.GetDirectories();
            }

            foreach (FileSystemInfo item in array)
            {
                iFileSystem ifs = new iFileSystem();
                ifs.name            = item.Name;
                ifs.extension       = item.Extension.ToLower();
                ifs.path            = "/" + item.FullName.Remove(0, root.Length).Replace("\\", "/");
                ifs.creation        = item.CreationTime.ToShortDateString();
                ifs.lastAccess      = item.LastAccessTime.ToShortDateString();
                ifs.lastWrite       = item.LastWriteTime.ToShortDateString();
                ifs.imageDimensions = getImageDimensions(ifs.extension, item.FullName);
                if (item is FileInfo)
                {
                    FileInfo file = (FileInfo)item;
                    ifs.length      = file.Length;
                    ifs.isDirectory = false;
                }
                else if (item is DirectoryInfo)
                {
                    ifs.length      = 0;
                    ifs.isDirectory = true;
                    if (goThroughSubDirectories)
                    {
                        Explore(item.FullName, false, true);
                    }
                }

                iFileSystemList.Add(ifs);
            }

            return(Json(iFileSystemList, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public List <StoppingPlace> Load(iFileSystem filesystem)
        {
            if (_filePath == null)
            {
                return(null);
            }

            XmlSerializer        serializer = new XmlSerializer(typeof(List <StoppingPlace>));
            List <StoppingPlace> items      = (List <StoppingPlace>)filesystem.deserilaze(serializer, _filePath);

            if (items != null)
            {
                _stopsList = items;
                return(_stopsList);
            }
            return(null);
        }
Beispiel #5
0
 /// <summary> Initializes the specified file system and sets the uris for the
 /// necessary access for the file system </summary>
 /// <param name="RootNetworkUri">The root network URI.</param>
 /// <param name="RootWebUri">The root web URI.</param>
 public static void Initialize(string RootNetworkUri, string RootWebUri)
 {
     fileSystem = new PairTreeStructure(RootNetworkUri, RootWebUri);
 }
 /// <summary> Initializes the specified file system and sets the uris for the
 /// necessary access for the file system </summary>
 /// <param name="RootNetworkUri">The root network URI.</param>
 /// <param name="RootWebUri">The root web URI.</param>
 public static void Initialize(string RootNetworkUri, string RootWebUri)
 {
     fileSystem = new PairTreeStructure(RootNetworkUri, RootWebUri);
 }
 public StoppingPlacesViewModel(IPlatform uniqId, iFileSystem filesystem)
 {
     _uniqId     = uniqId;
     _filesystem = filesystem;
 }
 public SearchViewModel(IPlatform uniqId, iFileSystem filesystem)
 {
     _uniqId     = uniqId;
     _filesystem = filesystem;
 }
Beispiel #9
0
 public FavoriteViewModel(iFileSystem fileSystem, iToast toast, IPlatform platform)
 {
     _platform = platform;
     Core.Resor.StoppingManager.SetFileSystem(fileSystem, toast);
 }
 public InitViewModel(iFileSystem fileSystem, IPlatform platform)
 {
     Injected.Instance.Filesystem = fileSystem;
     Injected.Instance.Platform   = platform;
     _platform = platform;
 }