73 lines
2 KiB
C#
73 lines
2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Engine.Core
|
|
{
|
|
public abstract class BaseObject
|
|
{
|
|
private string _Name;
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return _Name;
|
|
}
|
|
set
|
|
{
|
|
_Name = value;
|
|
if (this.GetType().Name.StartsWith("Base"))
|
|
Filename = value + "." + this.GetType().Name.Substring("Base".Length);
|
|
else
|
|
Filename = value + "." + this.GetType().Name;
|
|
}
|
|
}
|
|
|
|
private string _Filename;
|
|
public string Filename
|
|
{
|
|
//Returns the name of the object + the objects Type as it's extension.
|
|
//Filenames are generated by the class itself, users can not assign it.
|
|
get
|
|
{
|
|
return _Filename;
|
|
}
|
|
set
|
|
{
|
|
if (this.GetType().Name.StartsWith("Base"))
|
|
{
|
|
if (value.EndsWith("." + this.GetType().Name.Substring("Base".Length)))
|
|
{
|
|
_Filename = value;
|
|
}
|
|
else
|
|
_Filename = value + "." + this.GetType().Name.Substring("Base".Length);
|
|
}
|
|
else
|
|
{
|
|
if (value.EndsWith("." + this.GetType().Name))
|
|
{
|
|
_Filename = value;
|
|
}
|
|
else
|
|
_Filename = value + "." + this.GetType().Name;
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Description { get; set; }
|
|
|
|
|
|
public BaseObject()
|
|
{
|
|
this.Name = DefaultName();
|
|
}
|
|
|
|
private String DefaultName()
|
|
{
|
|
return "New " + this.GetType().Name;
|
|
}
|
|
|
|
}
|
|
}
|