Content packages & MD5 hash comparison between client and server

This commit is contained in:
Regalis
2015-07-20 21:27:44 +03:00
parent 4aa3d9d7ee
commit 326b46cf18
45 changed files with 1217 additions and 158 deletions

View File

@@ -34,30 +34,36 @@
this.resolutionBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.fullscreenBox = new System.Windows.Forms.CheckBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.contentPackageBox = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.packageManagerButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.OrangeRed;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(57, 25);
this.pictureBox1.Location = new System.Drawing.Point(-11, 33);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(508, 69);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.Size = new System.Drawing.Size(650, 42);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// launchButton
//
this.launchButton.BackColor = System.Drawing.Color.OrangeRed;
this.launchButton.FlatAppearance.BorderColor = System.Drawing.Color.OrangeRed;
this.launchButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.launchButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.launchButton.ForeColor = System.Drawing.SystemColors.ControlText;
this.launchButton.Location = new System.Drawing.Point(455, 399);
this.launchButton.Name = "launchButton";
this.launchButton.Size = new System.Drawing.Size(161, 42);
this.launchButton.TabIndex = 1;
this.launchButton.Text = "LAUNCH";
this.launchButton.UseVisualStyleBackColor = true;
this.launchButton.UseVisualStyleBackColor = false;
this.launchButton.Click += new System.EventHandler(this.launchButton_Click);
//
// resolutionBox
@@ -72,6 +78,8 @@
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.Window;
this.label1.Location = new System.Drawing.Point(54, 191);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
@@ -81,52 +89,65 @@
// fullscreenBox
//
this.fullscreenBox.AutoSize = true;
this.fullscreenBox.BackColor = System.Drawing.Color.Transparent;
this.fullscreenBox.ForeColor = System.Drawing.SystemColors.Window;
this.fullscreenBox.Location = new System.Drawing.Point(57, 252);
this.fullscreenBox.Name = "fullscreenBox";
this.fullscreenBox.Size = new System.Drawing.Size(74, 17);
this.fullscreenBox.TabIndex = 4;
this.fullscreenBox.Text = "Fullscreen";
this.fullscreenBox.UseVisualStyleBackColor = true;
this.fullscreenBox.UseVisualStyleBackColor = false;
//
// comboBox2
// contentPackageBox
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(368, 207);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(212, 21);
this.comboBox2.TabIndex = 5;
this.contentPackageBox.FormattingEnabled = true;
this.contentPackageBox.Location = new System.Drawing.Point(368, 207);
this.contentPackageBox.Name = "contentPackageBox";
this.contentPackageBox.Size = new System.Drawing.Size(212, 21);
this.contentPackageBox.TabIndex = 5;
this.contentPackageBox.SelectedIndexChanged += new System.EventHandler(this.contentPackageBox_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.Window;
this.label2.Location = new System.Drawing.Point(365, 191);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Content package:";
//
// button2
// packageManagerButton
//
this.button2.Location = new System.Drawing.Point(368, 234);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(130, 35);
this.button2.TabIndex = 7;
this.button2.Text = "Package manager";
this.button2.UseVisualStyleBackColor = true;
this.packageManagerButton.BackColor = System.Drawing.Color.OrangeRed;
this.packageManagerButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.packageManagerButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.packageManagerButton.Location = new System.Drawing.Point(368, 234);
this.packageManagerButton.Name = "packageManagerButton";
this.packageManagerButton.Size = new System.Drawing.Size(120, 35);
this.packageManagerButton.TabIndex = 7;
this.packageManagerButton.Text = "Package manager";
this.packageManagerButton.UseVisualStyleBackColor = false;
this.packageManagerButton.Click += new System.EventHandler(this.packageManagerButton_Click);
//
// LauncherMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(628, 453);
this.Controls.Add(this.button2);
this.Controls.Add(this.packageManagerButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.contentPackageBox);
this.Controls.Add(this.fullscreenBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.resolutionBox);
this.Controls.Add(this.launchButton);
this.Controls.Add(this.resolutionBox);
this.Controls.Add(this.pictureBox1);
this.DoubleBuffered = true;
this.Name = "LauncherMain";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
@@ -142,9 +163,9 @@
private System.Windows.Forms.ComboBox resolutionBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox fullscreenBox;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.ComboBox contentPackageBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button packageManagerButton;
}
}

View File

@@ -17,6 +17,7 @@ namespace Launcher
{
public partial class LauncherMain : Form
{
public static string ContentPackageFolder = "Data/ContentPackages/";
private const string configPath = "config.xml";
private Subsurface.GameSettings settings;
@@ -41,6 +42,9 @@ namespace Launcher
{
InitializeComponent();
ContentPackage.LoadAll(LauncherMain.ContentPackageFolder);
contentPackageBox.DataSource = ContentPackage.list;
supportedModes = new List<GraphicsMode>();
DEVMODE vDevMode = new DEVMODE();
@@ -77,6 +81,15 @@ namespace Launcher
fullscreenBox.DataBindings.Add("Checked", this, "FullscreenEnabled");
if (settings.SelectedContentPackage == null)
{
if (contentPackageBox.Items.Count > 0) contentPackageBox.SelectedItem = contentPackageBox.Items[0];
}
else
{
contentPackageBox.SelectedItem = settings.SelectedContentPackage;
}
//resolutionBox.SelectedItem = selectedMode;
}
@@ -95,6 +108,21 @@ namespace Launcher
Process.Start(Directory.GetCurrentDirectory() + "/Subsurface.exe");
Application.Exit();
}
private void packageManagerButton_Click(object sender, EventArgs e)
{
var packageManager = new PackageManager(settings.SelectedContentPackage);
packageManager.Show();
}
private void contentPackageBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (settings == null) return;
ComboBox comboBox = sender as ComboBox;
settings.SelectedContentPackage = comboBox.SelectedItem as ContentPackage;
}
}
public class GraphicsMode

View File

@@ -121,7 +121,7 @@
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAABpQAAAD4CAYAAADivwW2AAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAACxAAAAsQAa0jvXUAAP+WSURBVHhe7P35u67XWR94VizF
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAACwwAAAsMAT9AIsgAAP+WSURBVHhe7P35u67XWR94VizF
tiyUYx0UqStd1dVDdVe6OnO6M1QlDAFCKDBUIHTTFZKqQBLsDAbiGALYhhCwfZwUIInRkmwfa5Y1WbYG
azBKDD+k+7J+7T8nvT6vnu/2fdZZ7x7O2Xu/w17Pdd3SPnu/7/Os4V7f+3sPaz3/2X/6T/9pypQpU6ZM
mTJlypQpU6ZMmTJlyiHyn//H/9+U3Zc/ckx5xzFk9L11MmrLlClTzklGmD5lypQbk+Eim3KojIhBLyOi
@@ -2886,6 +2886,63 @@
WyP8ncXqNfvPG90TG41htdVWW2211VZbbbXLs5Emq9bruGpV7/U2en9s9DnVRvd5Kfbnf/7nq6222gXZ
cJGtdiobEeJF2+hzV1vtNDbC1WXa6B5WW2211a6jjTjwom30uautdhob4eoybXQPq6222mqrrbbaaqsd
p430Hhu9d5E2KoqvttpqZ7E//8/+fzvjQ0uhlEjNAAAAAElFTkSuQmCC
</value>
</data>
<data name="$this.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAACw4AAAsOAUC+4UEAAAveSURBVHhe7d3vch23DcbhvZz4
v2Q7tmQnjpO2Se//hrYEQ7AvcbiS26/v78MTkgCI3XMyg3FmpPh48eLhBODpePny8QTgiQEAGDtevfpy
AvB0vH799QTg6Xjz5usJwFMbAL+0DQBHx9u3v54APB3v3n07AXg67u6+nQA8Hff3v50APB3377+f7++/
n7HelzXjsc6apLFYh6xVmr+5r/G6l9isbbH3QWNDniOfdVqf99PlfYl1US/n7DvPsUps9skardf9heX5
rfbmfUSt1VyYeX1+xGOt9Zv7EYsey3c44rE+F8vvYInFuuk3vy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DEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAtj6f/wEIzWam3AHpbQAAAABJRU5ErkJggg==
</value>
</data>
</root>

View File

@@ -37,6 +37,7 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -53,11 +54,20 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="PackageManager.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PackageManager.Designer.cs">
<DependentUpon>PackageManager.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PackageManager.resx">
<DependentUpon>PackageManager.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

307
Launcher/PackageManager.Designer.cs generated Normal file
View File

@@ -0,0 +1,307 @@
namespace Launcher
{
partial class PackageManager
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PackageManager));
this.packageList = new System.Windows.Forms.ListBox();
this.newPackageName = new System.Windows.Forms.TextBox();
this.newPackage = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.itemList = new System.Windows.Forms.ListBox();
this.itemButton = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.characterList = new System.Windows.Forms.ListBox();
this.characterButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.structureList = new System.Windows.Forms.ListBox();
this.structureButton = new System.Windows.Forms.Button();
this.jobButton = new System.Windows.Forms.Button();
this.jobList = new System.Windows.Forms.ListBox();
this.label4 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.characterFolder = new System.Windows.Forms.Button();
this.itemFolder = new System.Windows.Forms.Button();
this.structureFolder = new System.Windows.Forms.Button();
this.jobFolder = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// packageList
//
this.packageList.FormattingEnabled = true;
this.packageList.Location = new System.Drawing.Point(12, 73);
this.packageList.Name = "packageList";
this.packageList.Size = new System.Drawing.Size(180, 342);
this.packageList.TabIndex = 3;
this.packageList.SelectedIndexChanged += new System.EventHandler(this.packageList_SelectedIndexChanged);
//
// newPackageName
//
this.newPackageName.Location = new System.Drawing.Point(12, 421);
this.newPackageName.Name = "newPackageName";
this.newPackageName.Size = new System.Drawing.Size(129, 20);
this.newPackageName.TabIndex = 4;
this.newPackageName.TextChanged += new System.EventHandler(this.newPackageName_TextChanged);
//
// newPackage
//
this.newPackage.Enabled = false;
this.newPackage.Location = new System.Drawing.Point(147, 421);
this.newPackage.Name = "newPackage";
this.newPackage.Size = new System.Drawing.Size(45, 20);
this.newPackage.TabIndex = 5;
this.newPackage.Text = "New";
this.newPackage.UseVisualStyleBackColor = true;
this.newPackage.Click += new System.EventHandler(this.newPackage_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.Control;
this.label1.Location = new System.Drawing.Point(215, 285);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Item files:";
//
// itemList
//
this.itemList.FormattingEnabled = true;
this.itemList.Location = new System.Drawing.Point(218, 307);
this.itemList.Name = "itemList";
this.itemList.Size = new System.Drawing.Size(255, 134);
this.itemList.TabIndex = 8;
//
// itemButton
//
this.itemButton.Location = new System.Drawing.Point(301, 281);
this.itemButton.Name = "itemButton";
this.itemButton.Size = new System.Drawing.Size(75, 23);
this.itemButton.TabIndex = 9;
this.itemButton.Text = "Add file";
this.itemButton.UseVisualStyleBackColor = true;
this.itemButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.Control;
this.label2.Location = new System.Drawing.Point(215, 120);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(77, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Character files:";
//
// characterList
//
this.characterList.FormattingEnabled = true;
this.characterList.Location = new System.Drawing.Point(218, 145);
this.characterList.Name = "characterList";
this.characterList.Size = new System.Drawing.Size(255, 121);
this.characterList.TabIndex = 8;
//
// characterButton
//
this.characterButton.Location = new System.Drawing.Point(301, 116);
this.characterButton.Name = "characterButton";
this.characterButton.Size = new System.Drawing.Size(75, 23);
this.characterButton.TabIndex = 9;
this.characterButton.Text = "Add file";
this.characterButton.UseVisualStyleBackColor = true;
this.characterButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.ForeColor = System.Drawing.SystemColors.Control;
this.label3.Location = new System.Drawing.Point(489, 121);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(96, 13);
this.label3.TabIndex = 7;
this.label3.Text = "Map structure files:";
//
// structureList
//
this.structureList.FormattingEnabled = true;
this.structureList.Location = new System.Drawing.Point(492, 145);
this.structureList.Name = "structureList";
this.structureList.Size = new System.Drawing.Size(255, 121);
this.structureList.TabIndex = 8;
//
// structureButton
//
this.structureButton.Location = new System.Drawing.Point(603, 116);
this.structureButton.Name = "structureButton";
this.structureButton.Size = new System.Drawing.Size(75, 23);
this.structureButton.TabIndex = 9;
this.structureButton.Text = "Add file";
this.structureButton.UseVisualStyleBackColor = true;
this.structureButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// jobButton
//
this.jobButton.Location = new System.Drawing.Point(603, 281);
this.jobButton.Name = "jobButton";
this.jobButton.Size = new System.Drawing.Size(75, 23);
this.jobButton.TabIndex = 12;
this.jobButton.Text = "Add file";
this.jobButton.UseVisualStyleBackColor = true;
this.jobButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// jobList
//
this.jobList.FormattingEnabled = true;
this.jobList.Location = new System.Drawing.Point(492, 307);
this.jobList.Name = "jobList";
this.jobList.Size = new System.Drawing.Size(255, 134);
this.jobList.TabIndex = 11;
//
// label4
//
this.label4.AutoSize = true;
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.ForeColor = System.Drawing.SystemColors.Control;
this.label4.Location = new System.Drawing.Point(489, 286);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Job files:";
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(623, 503);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(124, 37);
this.okButton.TabIndex = 13;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// characterFolder
//
this.characterFolder.Location = new System.Drawing.Point(398, 116);
this.characterFolder.Name = "characterFolder";
this.characterFolder.Size = new System.Drawing.Size(75, 23);
this.characterFolder.TabIndex = 9;
this.characterFolder.Text = "Add folder";
this.characterFolder.UseVisualStyleBackColor = true;
this.characterFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// itemFolder
//
this.itemFolder.Location = new System.Drawing.Point(398, 280);
this.itemFolder.Name = "itemFolder";
this.itemFolder.Size = new System.Drawing.Size(75, 23);
this.itemFolder.TabIndex = 14;
this.itemFolder.Text = "Add folder";
this.itemFolder.UseVisualStyleBackColor = true;
this.itemFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// structureFolder
//
this.structureFolder.Location = new System.Drawing.Point(672, 116);
this.structureFolder.Name = "structureFolder";
this.structureFolder.Size = new System.Drawing.Size(75, 23);
this.structureFolder.TabIndex = 15;
this.structureFolder.Text = "Add folder";
this.structureFolder.UseVisualStyleBackColor = true;
this.structureFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// jobFolder
//
this.jobFolder.Location = new System.Drawing.Point(672, 281);
this.jobFolder.Name = "jobFolder";
this.jobFolder.Size = new System.Drawing.Size(75, 23);
this.jobFolder.TabIndex = 16;
this.jobFolder.Text = "Add folder";
this.jobFolder.UseVisualStyleBackColor = true;
this.jobFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// PackageManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(784, 562);
this.Controls.Add(this.jobFolder);
this.Controls.Add(this.structureFolder);
this.Controls.Add(this.itemFolder);
this.Controls.Add(this.okButton);
this.Controls.Add(this.jobButton);
this.Controls.Add(this.jobList);
this.Controls.Add(this.label4);
this.Controls.Add(this.structureButton);
this.Controls.Add(this.characterFolder);
this.Controls.Add(this.characterButton);
this.Controls.Add(this.itemButton);
this.Controls.Add(this.structureList);
this.Controls.Add(this.label3);
this.Controls.Add(this.characterList);
this.Controls.Add(this.label2);
this.Controls.Add(this.itemList);
this.Controls.Add(this.label1);
this.Controls.Add(this.newPackage);
this.Controls.Add(this.newPackageName);
this.Controls.Add(this.packageList);
this.DoubleBuffered = true;
this.Name = "PackageManager";
this.Text = "PackageManager";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListBox packageList;
private System.Windows.Forms.TextBox newPackageName;
private System.Windows.Forms.Button newPackage;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox itemList;
private System.Windows.Forms.Button itemButton;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ListBox characterList;
private System.Windows.Forms.Button characterButton;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ListBox structureList;
private System.Windows.Forms.Button structureButton;
private System.Windows.Forms.Button jobButton;
private System.Windows.Forms.ListBox jobList;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button characterFolder;
private System.Windows.Forms.Button itemFolder;
private System.Windows.Forms.Button structureFolder;
private System.Windows.Forms.Button jobFolder;
}
}

228
Launcher/PackageManager.cs Normal file
View File

@@ -0,0 +1,228 @@
using Subsurface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Launcher
{
public partial class PackageManager : Form
{
private ContentPackage selectedPackage;
private List<ListBox> fileBoxes;
private List<Button> fileButtons;
public PackageManager(ContentPackage _selectedPackage)
{
InitializeComponent();
packageList.DisplayMember = "Name";
packageList.ValueMember = "MD5hash";
foreach (ContentPackage package in ContentPackage.list)
{
packageList.Items.Add(package);
}
fileBoxes = new List<ListBox>();
fileButtons = new List<Button>();
fileBoxes.Add(itemList);
itemList.Tag = ContentType.Item;
itemButton.Tag = ContentType.Item;
itemFolder.Tag = ContentType.Item;
fileButtons.Add(itemButton);
fileButtons.Add(itemFolder);
fileBoxes.Add(characterList);
characterList.Tag = ContentType.Character;
characterButton.Tag = ContentType.Character;
characterFolder.Tag = ContentType.Character;
fileButtons.Add(characterButton);
fileButtons.Add(characterFolder);
fileBoxes.Add(structureList);
structureList.Tag = ContentType.Structure;
structureButton.Tag = ContentType.Structure;
structureFolder.Tag = ContentType.Structure;
fileButtons.Add(structureButton);
fileButtons.Add(structureFolder);
fileBoxes.Add(jobList);
jobList.Tag = ContentType.Jobs;
jobButton.Tag = ContentType.Jobs;
jobFolder.Tag = ContentType.Jobs;
fileButtons.Add(jobButton);
fileButtons.Add(jobFolder);
foreach (Button fileButton in fileButtons)
{
fileButton.Enabled = false;
}
selectedPackage = _selectedPackage;
SelectPackage(selectedPackage);
}
private void packageList_SelectedIndexChanged(object sender, EventArgs e)
{
ListBox listBox = sender as ListBox;
SelectPackage(listBox.SelectedItem as ContentPackage);
}
private void SelectPackage(ContentPackage package)
{
selectedPackage = package;
foreach (Button fileButton in fileButtons)
{
fileButton.Enabled = (selectedPackage != null);
}
if (selectedPackage == null)
{
foreach (ListBox fileBox in fileBoxes)
{
fileBox.Items.Clear();
}
}
else
{
foreach (ListBox fileBox in fileBoxes)
{
ContentType type = (fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None;
foreach (ContentFile file in selectedPackage.files)
{
if (file.type != type) continue;
fileBox.Items.Add(file);
}
}
}
}
private void newPackage_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(newPackageName.Text)) return;
ContentPackage newPackage = ContentPackage.CreatePackage(newPackageName.Text);
packageList.Items.Add(newPackage);
packageList.SelectedItem = newPackage;
newPackageName.Text = "";
}
private void newPackageName_TextChanged(object sender, EventArgs e)
{
newPackage.Enabled = !string.IsNullOrEmpty(newPackageName.Text);
}
private void addFileButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
ContentType type = (button.Tag is ContentType) ? (ContentType)button.Tag : ContentType.None;
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "XML files (*.xml)|*.xml;*.XML";
//ofd.RestoreDirectory?
if (ofd.ShowDialog() == DialogResult.OK)
{
string[] fileNames = ofd.FileNames;
foreach (string file in fileNames)
{
AddFile(type, file);
}
}
}
private void AddFile(ContentType type, string path)
{
ListBox selectedBox = null;
foreach (ListBox fileBox in fileBoxes)
{
if (type != ((fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None)) continue;
selectedBox = fileBox;
break;
}
ContentFile newPackage = selectedPackage.AddFile(GetRelativePath(path, Directory.GetCurrentDirectory()), type);
if (newPackage!=null) selectedBox.Items.Add(newPackage);
}
private void addFolderButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
ContentType type = (button.Tag is ContentType) ? (ContentType)button.Tag : ContentType.None;
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
FolderBrowserDialog fbd = new FolderBrowserDialog();
//OpenFileDialog ofd = new OpenFileDialog();
//ofd.Filter = "XML files (*.xml)|*.xml;*.XML";
//ofd.RestoreDirectory?
if (fbd.ShowDialog() == DialogResult.OK)
{
AddFilesInFolder(type, fbd.SelectedPath);
}
}
private void AddFilesInFolder(ContentType type, string folder, string searchPattern ="*xml")
{
if (!Directory.Exists(folder)) return;
string[] files = Directory.GetFiles(folder, "*.xml");
foreach (string filePath in files)
{
AddFile(type, filePath);
}
string[] subDirectories = Directory.GetDirectories(folder, "*");
foreach (string subDir in subDirectories)
{
AddFilesInFolder(type, subDir, searchPattern);
}
}
string GetRelativePath(string filespec, string folder)
{
Uri pathUri = new Uri(filespec);
// Folders must end in a slash
if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
folder += Path.DirectorySeparatorChar;
}
Uri folderUri = new Uri(folder);
return Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar));
}
private void okButton_Click(object sender, EventArgs e)
{
if (selectedPackage!=null) selectedPackage.Save(LauncherMain.ContentPackageFolder);
this.Close();
}
}
}

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1
MAAA6mAAADqYAAAXb5JfxUYAAAAJcEhZcwAACxAAAAsQAa0jvXUAAAveSURBVHhe7d3vch23DcbhvZz4
v2Q7tmQnjpO2Se//hrYEQ7AvcbiS26/v78MTkgCI3XMyg3FmpPh48eLhBODpePny8QTgiQEAGDtevfpy
AvB0vH799QTg6Xjz5usJwFMbAL+0DQBHx9u3v54APB3v3n07AXg67u6+nQA8Hff3v50APB3377+f7++/
n7HelzXjsc6apLFYh6xVmr+5r/G6l9isbbH3QWNDniOfdVqf99PlfYl1US/n7DvPsUps9skardf9heX5
rfbmfUSt1VyYeX1+xGOt9Zv7EYsey3c44rE+F8vvYInFuuk3vy+J1fP2vZXkar94Xj57iljWtXX7binr
hvr+mpvnH7lT75ZY3Jnv9VRtrLuacb55dnO8//D7+eH97+3StQ+tpq8l3o1c7qMm63tO81lT63Y0J/sn
74QfyC89Yl/vRE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AAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAAxhgAgDEGAGCMAQAYYwAA
xhgAgDEGAGCMAQAYYwAAtj6f/wEIzWam3AHpbQAAAABJRU5ErkJggg==
</value>
</data>
</root>

View File

@@ -400,6 +400,27 @@ namespace Subsurface
CharacterList.Add(this);
}
private static string humanConfigFile;
public static string HumanConfigFile
{
get
{
if (string.IsNullOrEmpty(humanConfigFile))
{
var characterFiles = Game1.SelectedPackage.GetFilesOfType(ContentType.Character);
humanConfigFile = characterFiles.Find(c => c.EndsWith("human.xml"));
if (humanConfigFile == null)
{
DebugConsole.ThrowError("Couldn't find a config file for humans from the selected content package!");
DebugConsole.ThrowError("(The config file must end with ''human.xml'')");
return "";
}
}
return humanConfigFile;
}
}
public void GiveJobItems(WayPoint spawnPoint)
{
if (Info == null || Info.Job == null) return;

View File

@@ -104,17 +104,20 @@ namespace Subsurface
}
public static void LoadAll(string filePath)
public static void LoadAll(List<string> filePaths)
{
List = new List<JobPrefab>();
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
foreach (XElement element in doc.Root.Elements())
foreach (string filePath in filePaths)
{
JobPrefab job = new JobPrefab(element);
List.Add(job);
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
foreach (XElement element in doc.Root.Elements())
{
JobPrefab job = new JobPrefab(element);
List.Add(job);
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<character name ="shrimp" humanoid="false" waveamplitude="0.5" wavelength="80">
<ragdoll texture ="Content/Characters/panzershrimp.png">
<!-- head -->
<limb id = "0" radius="50" length = "300" mass = "6" type="Head">
<sprite sourcex="6" sourcey="30" sourcewidth="251" sourceheight="242" depth="0.1"/>
</limb>
<!-- body -->
<limb id = "1" radius="50" mass = "40" type="Torso">
<sprite sourcex="373" sourcey="6" sourcewidth="122" sourceheight="208" depth="0.05"/>
</limb>
<!-- left arm -->
<limb id = "2" radius="45" height="153" mass="2">
<sprite sourcex="252" sourcey="22" sourcewidth="115" sourceheight="227" depth="0.06"/>
</limb>
<limb id = "3" radius="45" height="205" mass="3">
<sprite sourcex="359" sourcey="265" sourcewidth="109" sourceheight="216" depth="0.07"/>
</limb>
<!-- right arm -->
<limb id = "4" radius="40" height="175" mass="3" type="Torso">
<sprite sourcex="237" sourcey="302" sourcewidth="92" sourceheight="175" depth="0.1"/>
</limb>
<!-- head to body -->
<joint limb1="0" limb1y="80" limb2="1" limb2x="-30" limb2y="-20" lowerlimit="0" upperlimit="40"/>
<joint limb1="1" limb1y="16" limb2="2" limb2y="-50" lowerlimit="5" upperlimit="60"/>
<joint limb1="2" limb1y="20" limb2="3" limb2y="-70" lowerlimit="10" upperlimit="60"/>
<joint limb1="3" limb1y="60" limb2="4" limb2y="-50" lowerlimit="20" upperlimit="60"/>
</ragdoll>
<ai attackhumans="100" attackrooms="50.0" attackweaker="50" attackstronger="-30" sight="0.5" hearing="1.0"/>
</character>

View File

@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<Items>
<Item
name="Oxygen Tank"
Tags="smallitem"
pickdistance="150">
<Sprite texture ="oxygentank.png" depth="0.05"/>
<Body radius="6" height="22" density="5"/>
<Holdable holdpos="30,-15" handle1="0,5" handle2="0,-5"/>
<Pickable slots="RightHand,Any"/>
</Item>
<Item
name="Diving Mask"
Tags="smallitem"

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Item
name="Oxygen Tank"
Tags="smallitem"
pickdistance="150">
<Sprite texture ="oxygentank.png" depth="0.05"/>
<Body radius="6" height="22" density="5"/>
<Holdable holdpos="30,-15" handle1="0,5" handle2="0,-5"/>
<Pickable slots="RightHand,Any"/>
</Item>

View File

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 498 B

View File

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

@@ -108,7 +108,7 @@
<Sprite texture ="light.png" depth="0.8"/>
<LightComponent canbeselected = "true" color="1.0,0.0,0.0,1.0">
<sprite texture="Content/Items/Signal/lightsprite.png" origin="0.5,0.5"/>
<sprite texture="Content/Items/Electricity/lightsprite.png" origin="0.5,0.5"/>
</LightComponent>
<Body width="16" height="16"/>

View File

Before

Width:  |  Height:  |  Size: 934 B

After

Width:  |  Height:  |  Size: 934 B

View File

@@ -7,26 +7,36 @@
<Sprite texture ="weldingtool.png" depth="0.04"/>
<!-- physics body -->
<Body width="39" height="18" density="5"/>
<!-- the character will hold the item 50 pixels in front of him, with his hands at the handle1 and handle2 positions -->
<Holdable aimpos="50,0" handle1="-17,0" handle2="8,0"/>
<RepairTool structurefixamount="50.0" range="80" barrelpos="19,8">
<!-- the item must contain a welding fuel tank for it to work -->
<RequiredItems name="Welding Fuel Tank" type="Contained" msg="Welding fuel required"/>
<!-- when using, the contained welding fuel tank will detoriate (= lose fuel) -->
<StatusEffect type="OnUse" target="Contained" targetnames="Welding Fuel Tank" Condition="-0.7"/>
<!-- welding a door, it will get stuck after a while -->
<StatusEffect type="OnUse" target="UseTarget" targetnames="Door,Windowed Door" Stuck="10.0"/>
<Fixable name="structure"/>
<!-- construction skill 20 required to use the item -->
<RequiredSkill name="Construction" level="20"/>
<!-- if using the item fails (due to a insufficient skill level for example), the contained tank will break and an explosion will occurr -->
<StatusEffect type="OnFailure" target="Contained" targetnames="Welding Fuel Tank,Oxygen Tank" Condition="-100.0" sound="Content/Items/Weapons/stunGrenade.ogg">
<Explosion range="5" damage="20" stun="10" force="5.0"/>
</StatusEffect>
</RepairTool>
<Pickable slots="Any,BothHands"/>
<!-- one welding fuel or oxygen tank can be contained inside the welding tool -->
<ItemContainer capacity="1" hideitems="false" itempos="-17,-21">
<Containable name="Welding Fuel Tank"/>
<Containable name="Oxygen Tank"/>

View File

@@ -0,0 +1,185 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Subsurface
{
public enum ContentType
{
None, Jobs, Item, Character, Structure
}
public class ContentPackage
{
public static List<ContentPackage> list = new List<ContentPackage>();
string name;
public string Name
{
get { return name; }
}
public string Path
{
get;
private set;
}
private Md5Hash md5Hash;
public Md5Hash MD5hash
{
get
{
if (md5Hash == null) CalculateHash();
return md5Hash;
}
}
public List<ContentFile> files;
private ContentPackage()
{
files = new List<ContentFile>();
}
public ContentPackage(string filePath)
: this()
{
XDocument doc = ToolBox.TryLoadXml(filePath);
Path = filePath;
name = ToolBox.GetAttributeString(doc.Root, "name", "");
foreach (XElement subElement in doc.Root.Elements())
{
ContentType type = (ContentType)Enum.Parse(typeof(ContentType), subElement.Name.ToString(), true);
files.Add(new ContentFile(ToolBox.GetAttributeString(subElement, "file", ""), type));
}
}
public override string ToString()
{
return name;
}
public static ContentPackage CreatePackage(string name)
{
ContentPackage newPackage = new ContentPackage();
newPackage.name = name;
list.Add(newPackage);
return newPackage;
}
public ContentFile AddFile(string path, ContentType type)
{
if (files.Find(file => file.path == path && file.type == type) != null) return null;
ContentFile cf = new ContentFile(path, type);
files.Add(cf);
return cf;
}
public void Save(string filePath)
{
XDocument doc = new XDocument();
doc.Add(new XElement("contentpackage",
new XAttribute("name", name),
new XAttribute("path", Path)));
//doc.Root.Add(
// new XElement("jobs", new XAttribute("file", JobFile)),
// new XElement("structures", new XAttribute("file", StructureFile)));
foreach (ContentFile file in files)
{
doc.Root.Add(new XElement(file.type.ToString(), new XAttribute("file", file.path)));
}
//foreach (string itemFile in itemFiles)
//{
// doc.Root.Add(new XElement("item", new XAttribute("file", itemFile)));
//}
doc.Save(filePath+"//"+name+".xml");
}
private void CalculateHash()
{
StringBuilder sb = new StringBuilder();
foreach (ContentFile file in files)
{
XDocument doc = ToolBox.TryLoadXml(file.path);
sb.Append(doc.ToString());
}
string str = sb.ToString();
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
md5Hash = new Md5Hash(bytes);
}
public List<string> GetFilesOfType(ContentType type)
{
List<ContentFile> contentFiles = files.FindAll(f => f.type == type);
List<string> filePaths = new List<string>();
foreach (ContentFile contentFile in contentFiles)
{
filePaths.Add(contentFile.path);
}
return filePaths;
}
public static void LoadAll(string folder)
{
if (!Directory.Exists(folder))
{
try
{
Directory.CreateDirectory(folder);
}
catch
{
return;
}
}
string[] files = Directory.GetFiles(folder, "*.xml");
foreach (string filePath in files)
{
ContentPackage package = new ContentPackage(filePath);
list.Add(package);
}
}
}
public class ContentFile
{
public string path;
public ContentType type;
public ContentFile(string path, ContentType type)
{
Directory.GetCurrentDirectory();
//Path.get
this.path = path;
this.type = type;
}
public override string ToString()
{
return path;
}
}
}

View File

@@ -147,7 +147,7 @@ namespace Subsurface
if (commands[1].ToLower()=="human")
{
WayPoint spawnPoint = WayPoint.GetRandom(SpawnType.Human);
Character.Controlled = new Character("Content/Characters/Human/human.xml", (spawnPoint == null) ? Vector2.Zero : spawnPoint.SimPosition);
Character.Controlled = new Character(Character.HumanConfigFile, (spawnPoint == null) ? Vector2.Zero : spawnPoint.SimPosition);
if (Game1.GameSession != null)
{
SinglePlayerMode mode = Game1.GameSession.gameMode as SinglePlayerMode;

View File

@@ -33,6 +33,11 @@ namespace Subsurface
public static EditMapScreen EditMapScreen;
public static EditCharacterScreen EditCharacterScreen;
public static ContentPackage SelectedPackage
{
get { return Config.SelectedContentPackage; }
}
public static Level Level;
public static GameSession GameSession;
@@ -167,15 +172,15 @@ namespace Subsurface
loadState = 10.0f;
yield return Status.Running;
JobPrefab.LoadAll("Content/Characters/Jobs.xml");
JobPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Jobs));
loadState = 15.0f;
yield return Status.Running;
StructurePrefab.LoadAll("Content/Map/StructurePrefabs.xml");
StructurePrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Structure));
loadState = 25.0f;
yield return Status.Running;
ItemPrefab.LoadAll();
ItemPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Item));
loadState = 40.0f;
yield return Status.Running;

View File

@@ -38,7 +38,7 @@ namespace Subsurface
endShiftButton = new GUIButton(new Rectangle(Game1.GraphicsWidth - 220, 20, 200, 25), "End shift", Alignment.TopLeft, GUI.style);
endShiftButton.OnClicked = EndShift;
hireManager.GenerateCharacters("Content/Characters/Human/human.xml", 10);
hireManager.GenerateCharacters(Character.HumanConfigFile, 10);
//day = 1;

View File

@@ -108,11 +108,11 @@ namespace Subsurface
}
public static void LoadAll()
public static void LoadAll(List<string> filePaths)
{
string[] files = Directory.GetFiles(contentFolder, "*.xml", SearchOption.AllDirectories);
//string[] files = Directory.GetFiles(contentFolder, "*.xml", SearchOption.AllDirectories);
foreach (string filePath in files)
foreach (string filePath in filePaths)
{
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;

View File

@@ -5,16 +5,16 @@ using System.Xml.Linq;
namespace Subsurface
{
class Md5Hash
public class Md5Hash
{
private string md5Hash;
private string hash;
private string shortHash;
public string MD5Hash
public string Hash
{
get
{
return md5Hash;
return hash;
}
}
@@ -28,30 +28,41 @@ namespace Subsurface
public Md5Hash(string md5Hash)
{
this.md5Hash = md5Hash;
this.hash = md5Hash;
shortHash = GetShortHash(md5Hash);
}
public Md5Hash(byte[] bytes)
{
hash = CalculateHash(bytes);
shortHash = GetShortHash(hash);
}
public Md5Hash(XDocument doc)
{
string docString = Regex.Replace(doc.ToString(), @"\s+", "");
// step 1, calculate MD5 hash from input
MD5 md5 = MD5.Create();
byte[] inputBytes = Encoding.ASCII.GetBytes(docString);
byte[] hash = md5.ComputeHash(inputBytes);
hash = CalculateHash(inputBytes);
shortHash = GetShortHash(hash);
}
private string CalculateHash(byte[] bytes)
{
MD5 md5 = MD5.Create();
byte[] byteHash = md5.ComputeHash(bytes);
// step 2, convert byte array to hex string
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
for (int i = 0; i < byteHash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
sb.Append(byteHash[i].ToString("X2"));
}
md5Hash = sb.ToString();
shortHash = GetShortHash(md5Hash);
return sb.ToString();
}
private string GetShortHash(string fullHash)

View File

@@ -4,6 +4,7 @@ using System.Xml.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace Subsurface
{
@@ -49,18 +50,21 @@ namespace Subsurface
get { return stairDirection; }
}
public static void LoadAll(string filePath)
{
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
public static void LoadAll(List<string> filePaths)
{
foreach (string filePath in filePaths)
{
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
foreach (XElement el in doc.Root.Elements())
{
StructurePrefab sp = Load(el);
foreach (XElement el in doc.Root.Elements())
{
StructurePrefab sp = Load(el);
Debug.WriteLine(sp.name);
Debug.WriteLine(sp.name);
list.Add(sp);
list.Add(sp);
}
}
}

View File

@@ -616,7 +616,7 @@ namespace Subsurface
}
hash = new Md5Hash(doc);
doc.Root.Add(new XAttribute("md5hash", hash.MD5Hash));
doc.Root.Add(new XAttribute("md5hash", hash.Hash));
try
{

View File

@@ -43,7 +43,7 @@ namespace Subsurface.Networking
{
name = newName;
characterInfo = new CharacterInfo("Content/Characters/Human/human.xml", name);
characterInfo = new CharacterInfo(Character.HumanConfigFile, name);
otherClients = new List<Client>();
@@ -85,6 +85,8 @@ namespace Subsurface.Networking
outmsg.Write((byte)PacketTypes.Login);
outmsg.Write(Game1.Version.ToString());
outmsg.Write(Game1.SelectedPackage.Name);
outmsg.Write(Game1.SelectedPackage.MD5hash.Hash);
outmsg.Write(name);
// Connect client, to ip previously requested from user
@@ -468,7 +470,7 @@ namespace Subsurface.Networking
return null;
}
CharacterInfo ch = new CharacterInfo("Content/Characters/Human/human.xml", newName, isFemale ? Gender.Female : Gender.Male, jobPrefab);
CharacterInfo ch = new CharacterInfo(Character.HumanConfigFile, newName, isFemale ? Gender.Female : Gender.Male, jobPrefab);
ch.HeadSpriteId = headSpriteID;
WayPoint closestWaypoint = null;

View File

@@ -124,11 +124,13 @@ namespace Subsurface.Networking
Client existingClient = connectedClients.Find(c=> c.Connection == inc.SenderConnection);
if (existingClient==null)
{
string version = "", name = "";
string version = "", packageName="", packageHash="", name = "";
try
{
version = inc.ReadString();
name = inc.ReadString();
version = inc.ReadString();
packageName = inc.ReadString();
packageHash = inc.ReadString();
name = inc.ReadString();
}
catch
{
@@ -141,6 +143,16 @@ namespace Subsurface.Networking
inc.SenderConnection.Deny("Subsurface version " + Game1.Version + " required to connect to the server (Your version: " + version + ")");
break;
}
else if (packageName != Game1.SelectedPackage.Name)
{
inc.SenderConnection.Deny("Your content package ("+packageName+") doesn't match the server's version (" + Game1.SelectedPackage.Name + ")");
break;
}
else if (packageHash != Game1.SelectedPackage.MD5hash.Hash)
{
inc.SenderConnection.Deny("Your content package (MD5: " + packageHash + ") doesn't match the server's version (MD5: " + Game1.SelectedPackage.MD5hash.Hash + ")");
break;
}
else if (connectedClients.Find(c => c.name.ToLower() == name.ToLower())!=null)
{
inc.SenderConnection.Deny("The name ''" + name + "'' is already in use. Please choose another name.");
@@ -342,7 +354,7 @@ namespace Subsurface.Networking
if (client.characterInfo==null)
{
client.characterInfo = new CharacterInfo("Content/Characters/Human/human.xml", client.name);
client.characterInfo = new CharacterInfo(Character.HumanConfigFile, client.name);
}
characterInfos.Add(client.characterInfo);
@@ -362,7 +374,7 @@ namespace Subsurface.Networking
if (myClient != null)
{
WayPoint spawnPoint = WayPoint.GetRandom(SpawnType.Human);
CharacterInfo ch = new CharacterInfo("Content/Characters/Human/human.xml", myClient.name);
CharacterInfo ch = new CharacterInfo(Character.HumanConfigFile, myClient.name);
myClient.character = new Character(ch, (spawnPoint == null) ? Vector2.Zero : spawnPoint.SimPosition);
}
@@ -376,7 +388,7 @@ namespace Subsurface.Networking
msg.Write(Game1.NetLobbyScreen.LevelSeed);
msg.Write(Game1.NetLobbyScreen.SelectedMap.Name);
msg.Write(Game1.NetLobbyScreen.SelectedMap.Hash.MD5Hash);
msg.Write(Game1.NetLobbyScreen.SelectedMap.Hash.Hash);
msg.Write(Game1.NetLobbyScreen.GameDuration.TotalMinutes);
@@ -587,7 +599,7 @@ namespace Subsurface.Networking
{
if (c.Connection != message.SenderConnection) continue;
c.characterInfo = new CharacterInfo("Content/Characters/Human/human.xml", name, gender);
c.characterInfo = new CharacterInfo(Character.HumanConfigFile, name, gender);
c.characterInfo.HeadSpriteId = headSpriteId;
c.jobPreferences = jobPreferences;
break;

View File

@@ -117,7 +117,7 @@ namespace Subsurface
{
if (dummyCharacter != null) dummyCharacter.Remove();
dummyCharacter = new Character("Content/Characters/Human/human.xml", Vector2.Zero);
dummyCharacter = new Character(Character.HumanConfigFile, Vector2.Zero);
Character.Controlled = dummyCharacter;
Game1.World.ProcessChanges();
}

View File

@@ -486,10 +486,10 @@ namespace Subsurface
}
else
{
if (map.Hash.MD5Hash != md5Hash)
if (map.Hash.Hash != md5Hash)
{
DebugConsole.ThrowError("Your version of the map file ''" + map.Name + "'' doesn't match the server's version!");
DebugConsole.ThrowError("Your file: " + map.Name + "(MD5 hash : " + map.Hash.MD5Hash + ")");
DebugConsole.ThrowError("Your file: " + map.Name + "(MD5 hash : " + map.Hash.Hash + ")");
DebugConsole.ThrowError("Server's file: " + mapName + "(MD5 hash : " + md5Hash + ")");
return false;
}
@@ -514,7 +514,7 @@ namespace Subsurface
else
{
msg.Write(Path.GetFileName(selectedMap.Name));
msg.Write(selectedMap.Hash.MD5Hash);
msg.Write(selectedMap.Hash.Hash);
}
msg.Write(modeList.SelectedIndex-1);

View File

@@ -25,6 +25,12 @@ namespace Subsurface
set;
}
public ContentPackage SelectedContentPackage
{
get;
set;
}
public GameSettings(string filePath)
{
Load(filePath);
@@ -45,7 +51,19 @@ namespace Subsurface
{
GraphicsWidth = 1024;
GraphicsHeight = 768;
return;
}
foreach (XElement subElement in doc.Root.Elements())
{
switch (subElement.Name.ToString().ToLower())
{
case "contentpackage":
string path = ToolBox.GetAttributeString(subElement, "path", "");
SelectedContentPackage = ContentPackage.list.Find(cp => cp.Path == path);
if (SelectedContentPackage == null) SelectedContentPackage = new ContentPackage(path);
break;
}
}
}
@@ -79,6 +97,13 @@ namespace Subsurface
new XAttribute("height", GraphicsHeight),
new XAttribute("fullscreen", FullScreenEnabled ? "true" : "false"));
if (SelectedContentPackage != null)
{
doc.Root.Add(new XElement("contentpackage",
new XAttribute("path", SelectedContentPackage.Path)));
}
doc.Save(filePath);
}
}

View File

@@ -64,11 +64,12 @@
<Compile Include="Characters\Jobs\JobPrefab.cs" />
<Compile Include="Characters\AI\SteeringManager.cs" />
<Compile Include="Characters\AI\SteeringPath.cs" />
<Compile Include="ContentPackage.cs" />
<Compile Include="CoroutineManager.cs" />
<Compile Include="GUI\TitleScreen.cs" />
<Compile Include="Items\FixRequirement.cs" />
<Compile Include="Map\LocationType.cs" />
<Compile Include="Rand.cs" />
<Compile Include="Utils\Rand.cs" />
<Compile Include="Events\PropertyTask.cs" />
<Compile Include="Events\RepairTask.cs" />
<Compile Include="GameSession\CrewManager.cs" />
@@ -142,7 +143,7 @@
<Compile Include="Map\Md5Hash.cs" />
<Compile Include="Map\Levels\Voronoi.cs" />
<Compile Include="Map\Levels\VoronoiElements.cs" />
<Compile Include="MathUtils.cs" />
<Compile Include="Utils\MathUtils.cs" />
<Compile Include="Physics\PhysicsBody.cs" />
<Compile Include="Networking\NetworkEvent.cs" />
<Compile Include="Networking\NetworkMember.cs" />
@@ -151,7 +152,7 @@
<Compile Include="Particles\ParticlePrefab.cs" />
<Compile Include="Physics\Physics.cs" />
<Compile Include="Properties.cs" />
<Compile Include="SaveUtil.cs" />
<Compile Include="Utils\SaveUtil.cs" />
<Compile Include="Screens\EditCharacterScreen.cs" />
<Compile Include="EventInput\EventInput.cs" />
<Compile Include="EventInput\KeyboardDispatcher.cs" />
@@ -199,8 +200,8 @@
<Compile Include="Sounds\Sound.cs" />
<Compile Include="Sounds\AmbientSoundManager.cs" />
<Compile Include="Sprite.cs" />
<Compile Include="TextureLoader.cs" />
<Compile Include="ToolBox.cs" />
<Compile Include="Utils\TextureLoader.cs" />
<Compile Include="Utils\ToolBox.cs" />
<Compile Include="Map\Hull.cs" />
</ItemGroup>
<ItemGroup>
@@ -271,7 +272,7 @@
<Content Include="Content\Characters\Human\torso.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\Jobs.xml">
<Content Include="Content\Jobs.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
@@ -289,13 +290,6 @@
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\shrimp.xml">
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\panzershrimp.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\Scorpion\scorpion.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -357,26 +351,26 @@
<Content Include="Content\Items\Lockers\lockers.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Signal\and.png">
<Content Include="Content\Items\Electricity\and.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Signal\light.png">
<Content Include="Content\Items\Electricity\light.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Signal\lightsprite.png">
<Content Include="Content\Items\Electricity\lightsprite.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Signal\not.png">
<Content Include="Content\Items\Electricity\not.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Signal\or.png">
<Content Include="Content\Items\Electricity\or.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Signal\signalitems.xml">
<Content Include="Content\Items\Electricity\signalitems.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Content\Items\Signal\wire.png">
<Content Include="Content\Items\Electricity\wire.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Pump\pump.xml">
@@ -417,7 +411,7 @@
<Content Include="Content\UI\textboxTexture.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\battery.png">
<Content Include="Content\Items\Electricity\battery.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Button\button.png">
@@ -471,7 +465,7 @@
<Content Include="Content\Items\idcard.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\junctionbox.png">
<Content Include="Content\Items\Electricity\junctionbox.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Ladder\item.xml">
@@ -492,13 +486,10 @@
<Content Include="Content\Items\OxygenGenerator\item.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Diving\item.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Diving\oxygentank.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\poweritems.xml">
<Content Include="Content\Items\Electricity\poweritems.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Weapons\railgun.xml">

Binary file not shown.