本文整理汇总了C#中HaloMap.Meta.Meta.LoadMetaFromFile方法的典型用法代码示例。如果您正苦于以下问题:C# Meta.LoadMetaFromFile方法的具体用法?C# Meta.LoadMetaFromFile怎么用?C# Meta.LoadMetaFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HaloMap.Meta.Meta
的用法示例。
在下文中一共展示了Meta.LoadMetaFromFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildMapFromInfoFile
/// <summary>
/// The build map from info file.
/// </summary>
/// <param name="inputFile">The input file.</param>
/// <param name="layout">The layout.</param>
/// <param name="map">The map.</param>
/// <param name="addsounds">The addsounds.</param>
/// <remarks></remarks>
public void BuildMapFromInfoFile(string inputFile, ref MapLayout layout, Map map, bool addsounds)
{
ArrayList metas = new ArrayList(0);
string[] split = inputFile.Split('.');
if (split[split.Length - 1] == "info")
{
FileStream FS = new FileStream(inputFile, FileMode.Open);
StreamReader SR = new StreamReader(FS);
string temps = string.Empty;
do
{
temps = SR.ReadLine();
if (temps == null)
{
break;
}
Meta m = new Meta(map);
m.LoadMetaFromFile(temps);
if (addsounds == false)
{
if (m.type == "snd!")
{
continue;
}
}
bool exists = false;
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
if (map.FileNames.Name[x] == m.name && map.MetaInfo.TagType[x] == m.type)
{
exists = true;
break;
}
}
if (exists == false)
{
for (int x = 0; x < metas.Count; x++)
{
if (((Meta)metas[x]).name == m.name && ((Meta)metas[x]).type == m.type)
{
exists = true;
break;
}
}
}
if (exists == false)
{
metas.Add(m);
}
}
while (temps != null);
SR.Close();
FS.Close();
}
else
{
Meta m = new Meta(map);
m.LoadMetaFromFile(inputFile);
bool exists = false;
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
if (map.FileNames.Name[x] == m.name && map.MetaInfo.TagType[x] == m.type)
{
exists = true;
break;
}
}
if (exists == false)
{
metas.Add(m);
}
}
MapBuilder(metas, ref layout, map, addsounds);
}
示例2: loadMetaButton_Click_1
/// <summary>
/// The load meta button_ click_1.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <remarks></remarks>
private void loadMetaButton_Click_1(object sender, EventArgs e)
{
loadMetaDialog.Filter = "XML Files (*.xml) | *.xml";
loadMetaDialog.InitialDirectory = Prefs.pathExtractsFolder;
if (loadMetaDialog.ShowDialog() == DialogResult.Cancel)
{
return;
}
Prefs.pathExtractsFolder = loadMetaDialog.InitialDirectory;
Meta newm = new Meta(map);
// remove the xml extension now that we are forcing loading of XML files
loadMetaDialog.FileName = loadMetaDialog.FileName.Substring(0, loadMetaDialog.FileName.Length - 4);
if (loadMetaDialog.FileName.EndsWith("raw"))
{
MessageBox.Show("Do not inject raw files, they are injected with the parent tags!");
return;
}
newm.LoadMetaFromFile(loadMetaDialog.FileName);
if (newm.size >= 0 && newm.size <= map.SelectedMeta.size)
{
map.OpenMap(MapTypes.Internal);
map.BW.BaseStream.Position = map.SelectedMeta.offset;
map.BW.BaseStream.Write(newm.MS.ToArray(), 0, newm.size);
map.CloseMap();
formFuncs.AddReferencesToListView(map.SelectedMeta, references, map.DisplayType);
MessageBox.Show("Done");
}
else
{
MessageBox.Show("Meta Won't Fit");
return;
}
}
示例3: overwriteMetaToolStripMenuItem_Click
/// <summary>
/// The overwrite meta tool strip menu item_ click.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <remarks></remarks>
private void overwriteMetaToolStripMenuItem_Click(object sender, EventArgs e)
{
loadMetaDialog.Filter = "XML Files (*.xml) | *.xml";
if (loadMetaDialog.ShowDialog() == DialogResult.Cancel)
{
return;
}
Meta newm = new Meta(map);
// remove the xml extension now that we are forcing loading of XML files
loadMetaDialog.FileName = loadMetaDialog.FileName.Substring(0, loadMetaDialog.FileName.Length - 4);
if (loadMetaDialog.FileName.EndsWith("raw"))
{
MessageBox.Show("Do not inject raw files, they are injected with the parent tags!");
return;
}
newm.LoadMetaFromFile(loadMetaDialog.FileName);
MetaOverWriter.OverWrite(map, map.SelectedMeta.TagIndex, ref newm);
int i = map.SelectedMeta.TagIndex;
Meta.ItemType me = map.DisplayType;
map = Map.Refresh(map);
LoadMeta(i);
formFuncs.AddReferencesToListView(map.SelectedMeta, references, me);
MessageBox.Show("Done");
}
示例4: extractMapButton_Click
/// <summary>
/// The extract map button_ click.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
/// <remarks></remarks>
private void extractMapButton_Click(object sender, EventArgs e)
{
this.Enabled = false;
count = 4 + map.BSP.sbsp.Length;
// MetaList.Capacity = 10000;
StatusLabel1.Text = "Processing Map Metas...";
Application.DoEvents();
if (treeView1.Nodes[0].Checked)
{
RecursivelyCheckMetas(treeView1.Nodes[0]);
}
StatusLabel1.Text = "Processing Imported Metas...";
Application.DoEvents();
foreach (ListViewItem l in listView2.Items)
{
if (l.Checked == false)
{
continue;
}
StatusLabel1.Text = "Processing: " + l.Text + "...";
Application.DoEvents();
string[] split = l.Text.Split('.');
if (split[split.Length - 1] != "info")
{
Meta m = new Meta(map);
m.LoadMetaFromFile(l.Text);
MetaList.Add(m);
}
else
{
FileStream FS = new FileStream(l.Text, FileMode.Open);
StreamReader SR = new StreamReader(FS);
string temps = string.Empty;
do
{
temps = SR.ReadLine();
if (temps == null)
{
break;
}
Meta m = new Meta(map);
m.LoadMetaFromFile(temps);
bool exists = false;
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
if (map.FileNames.Name[x] == m.name && map.MetaInfo.TagType[x] == m.type)
{
exists = true;
break;
}
}
if (exists == false)
{
for (int x = 0; x < MetaList.Count; x++)
{
if (((Meta)MetaList[x]).name == m.name && ((Meta)MetaList[x]).type == m.type)
{
exists = true;
break;
}
}
}
if (exists == false)
{
switch (m.type.Trim())
{
case "matg":
matg = m;
break;
case "sncl":
sncl = m;
break;
case "spk!":
spk = m;
break;
case "scnr":
scnr = m;
break;
case "sky":
this.Skies.Add(m);
skycount++;
break;
default:
//.........这里部分代码省略.........