Exemplo n.º 1
0
    public static void SaveSession(string path_inp)
    {
        SessionSave saveFile = new SessionSave();

        //labelsession
        SessionHandler sessionHandler = ReferenceHandler.Instance.GetSessionHandler();

        SessionSave_LabelSession    labelSession  = new SessionSave_LabelSession();
        Sessionsave_MovementOptions ingameOptions = new Sessionsave_MovementOptions();

        labelSession.AssignLabelSessionValues();
        ingameOptions.AssignInGameOptionValues();

        saveFile._labelsession  = labelSession;
        saveFile._ingameOptions = ingameOptions;

        //metadata
        if (Util.DataLoadInfo._dataType == Util.Datatype.hdf5_DaimlerLidar)
        {
            SessionSave_MetaData.SessionSave_MetaData_HDF5DaimlerLidar hdf5DL = new SessionSave_MetaData.SessionSave_MetaData_HDF5DaimlerLidar();
            hdf5DL.AssignMetaDataValues();

            saveFile._exportMetaData._hdf5_DaimlerLidar = hdf5DL;
        }

        string dataPath = path_inp + "/" + sessionHandler.Session._sessionName + "SaveFile.dat";

        using (Stream stream = File.Open(dataPath, FileMode.Create))
        {
            var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            binaryFormatter.Serialize(stream, saveFile);
        }

        Debug.Log("Session Saved At: " + dataPath);
    }
Exemplo n.º 2
0
    public LabelSession(SessionSave saveFile_inp)
    {
        Labeling.SetSavedLabelClasses(saveFile_inp._labelsession.GetLabelWorkingSet());
        _sessionName  = saveFile_inp._labelsession.GetSessionName();
        _currentCLoud = saveFile_inp._labelsession.GetCurrentCloudID();
        _pointClouds  = saveFile_inp._labelsession.GetPointClouds();

        Util.DataLoadInfo._accessMode        = Util.AccesMode.Load;
        Util.DataLoadInfo._dataType          = saveFile_inp._labelsession.GetSessionDataType();
        Util.DataLoadInfo._sourceDataPath    = saveFile_inp._labelsession.GetSessionSourcePath();
        Util.DataLoadInfo._sessionName       = saveFile_inp._labelsession.GetSessionName();
        Util.DataLoadInfo._sessionFolderPath = Application.persistentDataPath + "/" + Util.DataLoadInfo._sessionName;

        MovementOptions.ReducePoints      = saveFile_inp._ingameOptions._bDecreasePointsWhenMoving;
        MovementOptions.Twinkle           = saveFile_inp._ingameOptions._bSicknessPrevention_TeleportWithBlink;
        MovementOptions.RotAcceleration   = saveFile_inp._ingameOptions._fFreeFly_AccelerationRot;
        MovementOptions.TransAcceleration = saveFile_inp._ingameOptions._fFreeFly_AccelerationTrans;
        MovementOptions.RotSpeed          = saveFile_inp._ingameOptions._fFreeFly_MaxSpeedRot;
        MovementOptions.TransSpeed        = saveFile_inp._ingameOptions._fFreeFly_MaxSpeedTrans;
        MovementOptions.TeleportDistance  = saveFile_inp._ingameOptions._fSicknessPrevention_TeleportDistance;
        MovementOptions.TeleportAngle     = saveFile_inp._ingameOptions._fSicknessPrevention_TurnAngle;
        MovementOptions.MoveMode          = saveFile_inp._ingameOptions._movementMode;
        MovementOptions.SaveOptions();

        if (Util.DataLoadInfo._dataType == Util.Datatype.hdf5_DaimlerLidar)
        {
            MetaData.Hdf5_DaimlerLidar._tableIndexToID     = saveFile_inp._exportMetaData._hdf5_DaimlerLidar.GetTableIndexToID();
            MetaData.Hdf5_DaimlerLidar._importedContainers = saveFile_inp._exportMetaData._hdf5_DaimlerLidar.GetImportedContainers();
        }
    }
Exemplo n.º 3
0
    public void OnMainMenuClick()
    {
        LoadingScreen.Show();
        MovementOptions.SaveOptions();
        SessionSave.SaveSession(Util.DataLoadInfo._sessionFolderPath);
        Labeling.Reset();
        MetaData.Reset();

        SceneManager.LoadScene(0);
    }
Exemplo n.º 4
0
        public ActionResult Login(UserAccount user, [Bind(Include = "ID,NameOfSession")] SessionSave Sessions)
        {
            using (QuestionsDBContext db = new QuestionsDBContext())
            {
                var usr = db.userAccount.Single(u => u.UserName == user.UserName && u.Password == user.Password);
                Session["UserID"]   = usr.UserID.ToString();
                Session["Username"] = usr.UserName.ToString();
                if (user != null)
                {
                    //authorization code starts here
                    bool userAutherised = true;
                    if (userAutherised)
                    {
                        //create the authentication ticket
                        var    serializer = new JavaScriptSerializer();
                        string userData   = serializer.Serialize(usr.UserName.ToString());

                        var authTicket = new FormsAuthenticationTicket(
                            1,
                            usr.UserName.ToString(),     //user id
                            DateTime.Now,
                            DateTime.Now.AddMinutes(20), // expiry
                            true,                        //true to remember
                            userData,                    //roles
                            FormsAuthentication.FormsCookiePath
                            );
                        HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket));
                        Response.Cookies.Add(cookie);

                        HttpCookie chkUsername = new HttpCookie("Username");
                        chkUsername.Expires = DateTime.Now.AddSeconds(3600);
                        chkUsername.Value   = Session["Username"].ToString();
                        Request.Cookies.Add(chkUsername);
                    }

                    //authorization code ends here



                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Username or Password is wrong");
                }
            }
            return(View());
        }