Example #1
0
        public IndexedFS(Filesystem msys)
        {
            _msys = msys;
            if (!msys.EnumFiles().GetEnumerator().MoveNext())
            {
            //Create index
                msys.AllocSpace(0,512);
                Stream mstream = new ObservableStream(0, msys);
                BinaryWriter mwriter = new BinaryWriter(mstream);

                mwriter.Write(filemappings.Count);
                cval++;
            }
            ObservableStream fstr = new ObservableStream(0, msys);
            BinaryReader mreader = new BinaryReader(fstr);
            int count = mreader.ReadInt32();

            for (int i = 0; i < count; i++)
            {

                if (mreader.ReadBoolean())
                {
                    filemappings.Add(mreader.ReadString(), mreader.ReadInt64());
                }
                else
                {
                    dirmappings.Add(mreader.ReadString(), mreader.ReadInt64());

                }

                cval++;
            }
        }
Example #2
0
 public FStream(long file, Filesystem _msys)
 {
     msys = _msys;
     filehandle = msys.OpenFile(file);
     filename = file;
 }
Example #3
0
 public ObservableStream(long fid, Filesystem msys)
 {
     _msys = msys;
     _fid = fid;
     lock (msys)
     {
         _basestream = new FStream(fid, msys);
     }
 }
Example #4
0
        public string loginstatus(ClientWebRequest request)
        {
            if (request.QueryString.ContainsKey("sessionID"))
            {
                string sesid = request.QueryString["sessionID"];
                if (!sessions.ContainsKey(request.QueryString["sessionID"]))
                {
                    sessions.Add(sesid, new SessionInformation());
                }
                SessionInformation session = sessions[sesid];

                if(request.Method == "POST") {
                Dictionary<string,string> formdata = request.Form;
                try {
                        using(Stream fstr = File.Open(Environment.CurrentDirectory+"\\admin",FileMode.OpenOrCreate,FileAccess.ReadWrite,FileShare.ReadWrite)) {
                        Filesystem msys = new Filesystem(fstr,formdata["pswd"],16384,1024*1024*5);
                            msys.Dispose();
                        session.isAdminAuthenticated = true;
                        }

                    }catch(Exception er) {
                        return "Login failure";
                    }
                }
                if(session.isAdminAuthenticated) {
                ClientHttpResponse response = new ClientHttpResponse();
                response.Redirect("serverAdmin.htm?sessionID="+request.QueryString["sessionID"],false,request.stream);
                request.ContinueProcessing = false;
                }
                return "";
            }
            else
            {
                return "";
            }
        }