Rev 1493 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.ComponentModel;
using System.Windows.Forms;
using BauzoidNET.parser;
namespace BurutaruEditor
.file.elements
{
public class StaticElement
: BackgroundElement
{
private string mShapeFile
= null;
[System.ComponentModel.Editor(typeof(Document
.ShapeFileNameEditor),
typeof(System.Drawing.Design.UITypeEditor))]
[Category
("Basic Parameters")]
public string ShapeFile
{
get
{
return mShapeFile
;
}
set
{
LoadShape
(value
);
}
}
//=================================================================================================================================
public StaticElement
(Document doc,
string name
)
: base(doc, name
)
{
}
public void LoadShape
(string shapeFile
)
{
string path
= Path
.GetFullPath(Path
.Combine(Application
.StartupPath,
@"..\\..\\..\\..\\..\\BauzoidApps\\BurutaruZ_v2\\burutaru-android\\assets\\"));
System.Uri uri1
= new Uri
(path, UriKind
.Absolute);
System.Uri uri2
= new Uri
(shapeFile, UriKind
.Absolute);
mShapeFile
= uri1
.MakeRelativeUri(uri2
).ToString();
}
public override string GetPropertiesType
()
{
return "StaticElement";
}
public override void WriteData
(TextWriter tw
)
{
base.WriteData(tw
);
tw
.WriteLine("\tshape \"" + mShapeFile
+ "\";");
}
public override bool ReadParameter
(Tokenizer t,
string id
)
{
// shape
if (id
.Equals("shape", StringComparison
.OrdinalIgnoreCase))
{
mShapeFile
= t
.readString();
}
// read other parameter types
else
{
// no other parameter type, so check super-class
return base.ReadParameter(t, id
);
}
t
.readToken(";");
return true;
}
}
}