LogActivity() public method

Generate a standard log entry line
public LogActivity ( LogAction, action, string username, string target = "", string msg = "" ) : void
action LogAction, action identifier
username string user
target string target informatio for action
msg string
return void
Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        activityLog = ActivityLog.Setup();

        //create directory if it doesn't exist
        if (!Directory.Exists(Application.persistentDataPath + @"/Saves"))
        {
            Directory.CreateDirectory(Application.persistentDataPath + @"/Saves");
        }

        filePath   = Application.persistentDataPath + @"/Saves/" + SceneManager.GetActiveScene().name + "-" + gameObject.name;
        transforms = gameObject.GetComponentsInChildren <Transform> ();

        //Saves a file of the original location for resets
        originalPosition = transform.position;
        originalRotation = transform.eulerAngles.y;
        SaveFineTuning(filePath + "-Original");

        //Check for saved file and if it exists, use it to load previous positions.
        if (File.Exists(filePath))
        {
            activityLog.LogActivity("Initializing with position data");
            LoadFineTuning();
        }
        else
        {
            activityLog.LogActivity("No FineTuning save file found for initialization.");
            Debug.LogWarning("No FineTuning save file found for initialization.");
        }
    }
Esempio n. 2
0
	void LoginButton_Click(object sender, EventArgs e)
	{
		string user = AccAccountTextBox.Text.Trim().ToLower();
		string password = AccPasswordTextBox.Text;

		ActivityLog log = new ActivityLog();

		// create a filezilla object using the active configuration
		Filezilla fz = new Filezilla(settings.Lookup("ConfigurationFile"));
		if (!fz.Authenticate(user, password))
		{
			log.LogActivity(LogAction.Login, user, "authentication failed");

			LoginValidator.IsValid = false;
			return;
		}

		log.LogActivity(LogAction.Login, user);

		// Set the session vars
		Session["FZNET_USER"] = user;
		Session["FZNET_SILVERLIGHT"] = IsSilverlightHidden.Value;

		// Redirect to the home page
		Response.Redirect("Default.aspx");
	}
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
		ActivityLog log = new ActivityLog();
		log.LogActivity(LogAction.Logout, Master.UserName);

		// clear the user out of the session
		Session.Remove("FZNET_USER");
		// clear the silverlight flag
		Session.Remove("FZNET_SILVERLIGHT");
		// clear the administration flag
		Session.Remove("FZNET_ADMIN");

		Response.Redirect("~/Login.aspx");
    }
Esempio n. 4
0
	void LoginButton_Click(object sender, EventArgs e)
	{
		string password = AccPasswordTextBox.Text;

		ActivityLog log = new ActivityLog();

		// create a filezilla object using the active configuration
		Filezilla fz = new Filezilla(settings.Lookup("ConfigurationFile"));
		if (!fz.AuthenticateAdministration(password))
		{
			log.LogActivity(LogAction.Login, "REMOTEADMIN", "authentication failed");

			LoginValidator.IsValid = false;
			return;
		}

		log.LogActivity(LogAction.Login, "REMOTEADMIN");

		// Set the session vars
		Session["FZNET_ADMIN"] = true;

		// Redirect to the administration home page
		Response.Redirect("Admin.aspx");
	}
Esempio n. 5
0
 public void ShowStep(int stepNumber)
 {
     try
     {
         for (int i = 0; i < StepObjects.Length; i++)
         {
             StepObjects[i].SetActive(false);
         }
         StepObjects[stepNumber].SetActive(true);
         //stepLabel.text = string.Format("Object {0}", stepNumber + 1);
         stepLabel.text = stepNames[stepNumber];
     }
     catch (System.IndexOutOfRangeException e)
     {
         activityLog.LogActivity(string.Format("Oh shit! Out of range. Step number {0} is outside of size {1}. System Expection: {2}", stepNumber, StepObjects.Length, e));
     }
 }
Esempio n. 6
0
    public void PlacePrefab()
    {
        Vector3 center = new Vector3(Screen.width / 2, Screen.height / 2, .5f);
        //pull piece from here:
        Ray        ray = Camera.main.ScreenPointToRay(center);
        RaycastHit hit;

        //we'll try to hit one of the plane collider gameobjects that were generated by the plugin
        //effectively similar to calling HitTest with ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent
        if (Physics.Raycast(ray, out hit, maxRayDistance, collisionLayerMask))
        {
            for (int i = 0; i < objectsToPlace.Length; i++)
            {
                GameObject placedThing = Instantiate <GameObject>(objectsToPlace[i], hit.point, Quaternion.identity, this.transform);
                objects.Add(placedThing);
            }
        }
        else
        {
            Debug.LogWarning("Could not find plane. Did not place.");
            activityLog.LogActivity("Could not find plane. Did not place.");
        }
    }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
		// this page requires an authenticated user
		Master.ForceAuthentication();

		// wire the file manager events
		FileManager.CustomThumbnail += new FileManagerThumbnailCreateEventHandler(FileManager_CustomThumbnail);
		FileManager.FileDownloading += new FileManagerFileDownloadingEventHandler(FileManager_FileDownloading);
		FileManager.FileUploading += new FileManagerFileUploadEventHandler(FileManager_FileUploading);
		FileManager.FolderCreating += new FileManagerFolderCreateEventHandler(FileManager_FolderCreating);
		FileManager.ItemDeleting += new FileManagerItemDeleteEventHandler(FileManager_ItemDeleting);
		FileManager.ItemMoving += new FileManagerItemMoveEventHandler(FileManager_ItemMoving);
		FileManager.ItemRenaming += new FileManagerItemRenameEventHandler(FileManager_ItemRenaming);

		// create the configuration related objects
		webSettings = new WebSettings();
		fz = new Filezilla(webSettings.Lookup("ConfigurationFile"));

		// create the activity related objects
		log = new ActivityLog();

		// get the root folder based on the authenticated user
		rootFolder = fz.HomeDirectory(Master.UserName);

		if (!Page.IsPostBack)
		{
			// configure the general settings of the file manager 
			FileManager.SettingsEditing.AllowCreate = WebConvert.ToBoolean(webSettings.Lookup("AllowCreate", "0"), false);
			FileManager.SettingsEditing.AllowDelete = WebConvert.ToBoolean(webSettings.Lookup("AllowDelete", "0"), false);
			FileManager.SettingsEditing.AllowMove = WebConvert.ToBoolean(webSettings.Lookup("AllowMove", "0"), false);
			FileManager.SettingsEditing.AllowRename = WebConvert.ToBoolean(webSettings.Lookup("AllowRename", "0"), false);
			FileManager.SettingsFolders.ShowFolderIcons = WebConvert.ToBoolean(webSettings.Lookup("ShowFolderIcons", "0"), false);
			FileManager.SettingsToolbar.ShowDownloadButton = WebConvert.ToBoolean(webSettings.Lookup("ShowDownloadButton", "0"), false);
			FileManager.Settings.ThumbnailFolder = webSettings.Lookup("ThumbnailFolder");
			// advanced upload mode requires Microsoft Silverlight ... really?
			if (Master.IsSilverlightAvailable)
			{
				// silverlight is available - check the system configuration to see if we want to utilize it
				FileManager.SettingsUpload.UseAdvancedUploadMode = WebConvert.ToBoolean(webSettings.Lookup("UseAdvancedUploadMode", "0"), false);
				FileManager.SettingsUpload.AdvancedModeSettings.EnableMultiSelect = WebConvert.ToBoolean(webSettings.Lookup("EnableMultiSelect", "0"), false);
			}
			else
			{
				// no silverlight - no advanced upload mode
				FileManager.SettingsUpload.UseAdvancedUploadMode = false;
				FileManager.SettingsUpload.AdvancedModeSettings.EnableMultiSelect = false;

				// if the user could be utilizing silverlight, let them know
				if (WebConvert.ToBoolean(webSettings.Lookup("UseAdvancedUploadMode", "0"), false))
				{
					SilverlightPanel.Visible = true;
				}
			}
			// set the max file size from the settings, default to 1MB
			FileManager.SettingsUpload.ValidationSettings.MaxFileSize = WebConvert.ToInt32(webSettings.Lookup("MaxFileSize","1000000"),1000000);
 
			// limit permissions based on the settings for the ftp share

			// disable creating folders if its not enabled in the configuration
			if (!fz.AllowDirCreate(Master.UserName, rootFolder))
			{
				FileManager.SettingsEditing.AllowCreate = false;
			}

			// disable deleting, moving items if its not enabled in the configuration
			if (!fz.AllowFileDelete(Master.UserName, rootFolder))
			{
				FileManager.SettingsEditing.AllowDelete = false;
				FileManager.SettingsEditing.AllowMove = false;
			}
			
			// disable upload, move, rename, delete if write is not enabled
			if (!fz.AllowFileWrite(Master.UserName, rootFolder))
			{
				FileManager.SettingsUpload.Enabled = false;
				FileManager.SettingsEditing.AllowMove = false;
				FileManager.SettingsEditing.AllowRename = false;
				FileManager.SettingsEditing.AllowDelete = false;
			}

			// assign the root folder to the user's normalized home directory
			FileManager.Settings.RootFolder = fz.NormalizeFolderName(rootFolder);


			// log the browse action
			log.LogActivity(LogAction.Browse, Master.UserName, FileManager.Settings.RootFolder, "Silverlight=" + WebConvert.ToString( Session["FZNET_SILVERLIGHT"], "false") );
		}
    }
Esempio n. 8
0
	/// <summary>
	/// Check to see if an item can be deleted; this is used to differentiate between deleting
	/// files and deleting folders, which are separate permissions in FileZilla
	/// </summary>
	/// <param name="source">event source</param>
	/// <param name="e">event args - used to identify target for deletion</param>
	void FileManager_ItemDeleting(object source, FileManagerItemDeleteEventArgs e)
	{
		// if the item is a folder, check for permission to delete folders
		if (e.Item is FileManagerFolder)
		{
			if (!fz.AllowDirDelete(Master.UserName, rootFolder))
			{
				e.Cancel = true;
				e.ErrorText = "Folders may not be deleted.";
			}
		}
		ActivityLog log = new ActivityLog();
		log.LogActivity(LogAction.Delete, Master.UserName, e.Item.FullName, e.ErrorText);
	}
Esempio n. 9
0
	/// <summary>
	/// A file is being downloaded, check to see if the user has read access
	/// Also overrides the download function to cut the file into 64k blocks to preserve memory
	/// </summary>
	/// <param name="source">event source</param>
	/// <param name="e">event args - used to identify target for read</param>
	void FileManager_FileDownloading(object source, FileManagerFileDownloadingEventArgs e)
	{
		if (!fz.AllowFileRead(Master.UserName, rootFolder))
		{
			e.Cancel = true;
			// track the download action
			ActivityLog log = new ActivityLog();
			log.LogActivity(LogAction.Download, Master.UserName, e.File.FullName, (e.Cancel) ? "Access denied" : "");
		}
		else
		{
			// download the file a block at a time to preserve memory
			byte[] buffer = new byte[1024*1024];
			HttpResponse response = Response;
			response.Clear();
			response.AddHeader("ContentType", string.Format("application/{0}", Path.GetExtension(e.File.Name).TrimStart('.')));
			response.AddHeader("Content-Transfer-Encoding", "binary");
			response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}",Server.UrlEncode(e.File.Name)));
			long dataToRead = e.InputStream.Length;
			response.AddHeader("Content-Length", string.Format("{0}",dataToRead));
			while (dataToRead > 0)
			{
				if ( response.IsClientConnected)
				{
					int length = e.InputStream.Read(buffer, 0, 1024 * 1024);
					response.OutputStream.Write(buffer, 0, length);
					response.Flush();
					dataToRead -= length;
				}
				else
				{
					dataToRead = -1;
				}
			}
			// clean up at end of response
			response.Flush();
			// track the download action
			ActivityLog log = new ActivityLog();
			log.LogActivity(LogAction.Download, Master.UserName, e.File.FullName, (e.Cancel) ? "Access denied" : "");
			// terminate the response - we passed back the file
			response.End();
		}
		e.Cancel = true;
	}