Browse Source

in develop

Dmitry Didenko 1 year ago
parent
commit
1d9c93a394

+ 7 - 6
FactorioModManager/FactorioModManager.csproj

@@ -65,6 +65,11 @@
     <Compile Include="ModWorker.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
     <Compile Include="Settings.cs" />
     <Compile Include="Settings_Form.cs">
       <SubType>Form</SubType>
@@ -77,17 +82,13 @@
     </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
-      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
       <SubType>Designer</SubType>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
-    <Compile Include="Properties\Resources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Resources.resx</DependentUpon>
-      <DesignTime>True</DesignTime>
-    </Compile>
     <EmbeddedResource Include="Settings_Form.resx">
       <DependentUpon>Settings_Form.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="en.lang" />
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>

+ 76 - 75
FactorioModManager/Form1.Designer.cs

@@ -40,9 +40,16 @@ namespace FactorioModManager
             this.statusStrip1 = new System.Windows.Forms.StatusStrip();
             this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
             this.tabPage2 = new System.Windows.Forms.TabPage();
+            this.button1 = new System.Windows.Forms.Button();
+            this.listView3 = new System.Windows.Forms.ListView();
+            this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+            this.textBox2 = new System.Windows.Forms.TextBox();
             this.tabControl1 = new System.Windows.Forms.TabControl();
             this.tabPage1 = new System.Windows.Forms.TabPage();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
             this.button5 = new System.Windows.Forms.Button();
             this.button3 = new System.Windows.Forms.Button();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
@@ -73,13 +80,6 @@ namespace FactorioModManager
             this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.tabPage3 = new System.Windows.Forms.TabPage();
-            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
-            this.textBox2 = new System.Windows.Forms.TextBox();
-            this.listView3 = new System.Windows.Forms.ListView();
-            this.button1 = new System.Windows.Forms.Button();
-            this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.menuStrip1.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.tabPage2.SuspendLayout();
@@ -106,16 +106,17 @@ namespace FactorioModManager
             this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.exportModPackToolStripMenuItem});
             this.toolStripMenuItem1.Name = "toolStripMenuItem1";
-            this.toolStripMenuItem1.Size = new System.Drawing.Size(113, 20);
+            this.toolStripMenuItem1.Size = new System.Drawing.Size(125, 20);
             this.toolStripMenuItem1.Tag = "$File";
             this.toolStripMenuItem1.Text = "toolStripMenuItem1";
             // 
             // exportModPackToolStripMenuItem
             // 
             this.exportModPackToolStripMenuItem.Name = "exportModPackToolStripMenuItem";
-            this.exportModPackToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
+            this.exportModPackToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
             this.exportModPackToolStripMenuItem.Tag = "$ExportModPack";
             this.exportModPackToolStripMenuItem.Text = "ExportModPack";
+            this.exportModPackToolStripMenuItem.Click += new System.EventHandler(this.exportModPackToolStripMenuItem_Click);
             // 
             // toolStripMenuItem2
             // 
@@ -125,14 +126,14 @@ namespace FactorioModManager
             this.exportSettingsToolStripMenuItem,
             this.importSettingsToolStripMenuItem});
             this.toolStripMenuItem2.Name = "toolStripMenuItem2";
-            this.toolStripMenuItem2.Size = new System.Drawing.Size(113, 20);
+            this.toolStripMenuItem2.Size = new System.Drawing.Size(125, 20);
             this.toolStripMenuItem2.Tag = "$Settings";
             this.toolStripMenuItem2.Text = "toolStripMenuItem2";
             // 
             // changeSettingsToolStripMenuItem
             // 
             this.changeSettingsToolStripMenuItem.Name = "changeSettingsToolStripMenuItem";
-            this.changeSettingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.changeSettingsToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
             this.changeSettingsToolStripMenuItem.Tag = "$ChangeSettings";
             this.changeSettingsToolStripMenuItem.Text = "Change settings";
             this.changeSettingsToolStripMenuItem.Click += new System.EventHandler(this.changeSettingsToolStripMenuItem_Click);
@@ -140,19 +141,19 @@ namespace FactorioModManager
             // toolStripSeparator1
             // 
             this.toolStripSeparator1.Name = "toolStripSeparator1";
-            this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
+            this.toolStripSeparator1.Size = new System.Drawing.Size(156, 6);
             // 
             // exportSettingsToolStripMenuItem
             // 
             this.exportSettingsToolStripMenuItem.Name = "exportSettingsToolStripMenuItem";
-            this.exportSettingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.exportSettingsToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
             this.exportSettingsToolStripMenuItem.Tag = "$ExportSettings";
             this.exportSettingsToolStripMenuItem.Text = "Export settings";
             // 
             // importSettingsToolStripMenuItem
             // 
             this.importSettingsToolStripMenuItem.Name = "importSettingsToolStripMenuItem";
-            this.importSettingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.importSettingsToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
             this.importSettingsToolStripMenuItem.Tag = "$ImportSettings";
             this.importSettingsToolStripMenuItem.Text = "ImportSettings";
             // 
@@ -160,9 +161,9 @@ namespace FactorioModManager
             // 
             this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripStatusLabel1});
-            this.statusStrip1.Location = new System.Drawing.Point(0, 618);
+            this.statusStrip1.Location = new System.Drawing.Point(0, 616);
             this.statusStrip1.Name = "statusStrip1";
-            this.statusStrip1.Size = new System.Drawing.Size(940, 22);
+            this.statusStrip1.Size = new System.Drawing.Size(940, 24);
             this.statusStrip1.TabIndex = 1;
             this.statusStrip1.Text = "statusStrip1";
             // 
@@ -170,7 +171,7 @@ namespace FactorioModManager
             // 
             this.toolStripStatusLabel1.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
             this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
-            this.toolStripStatusLabel1.Size = new System.Drawing.Size(113, 17);
+            this.toolStripStatusLabel1.Size = new System.Drawing.Size(122, 19);
             this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
             // 
             // tabPage2
@@ -187,6 +188,53 @@ namespace FactorioModManager
             this.tabPage2.Text = "tabPage2";
             this.tabPage2.UseVisualStyleBackColor = true;
             // 
+            // button1
+            // 
+            this.button1.ForeColor = System.Drawing.Color.DarkBlue;
+            this.button1.Location = new System.Drawing.Point(275, 4);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(113, 23);
+            this.button1.TabIndex = 2;
+            this.button1.Tag = "$Search";
+            this.button1.Text = "button1";
+            this.button1.UseVisualStyleBackColor = true;
+            // 
+            // listView3
+            // 
+            this.listView3.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+            this.columnHeader4,
+            this.columnHeader5,
+            this.columnHeader6});
+            this.listView3.HideSelection = false;
+            this.listView3.Location = new System.Drawing.Point(6, 32);
+            this.listView3.Name = "listView3";
+            this.listView3.Size = new System.Drawing.Size(382, 524);
+            this.listView3.TabIndex = 1;
+            this.listView3.UseCompatibleStateImageBehavior = false;
+            this.listView3.View = System.Windows.Forms.View.Details;
+            // 
+            // columnHeader4
+            // 
+            this.columnHeader4.Tag = "$ModName";
+            this.columnHeader4.Width = 252;
+            // 
+            // columnHeader5
+            // 
+            this.columnHeader5.Tag = "$ModVersion";
+            this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // columnHeader6
+            // 
+            this.columnHeader6.Tag = "$ModDownloads";
+            this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // textBox2
+            // 
+            this.textBox2.Location = new System.Drawing.Point(6, 6);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.Size = new System.Drawing.Size(263, 20);
+            this.textBox2.TabIndex = 0;
+            // 
             // tabControl1
             // 
             this.tabControl1.Controls.Add(this.tabPage1);
@@ -230,6 +278,17 @@ namespace FactorioModManager
             this.panel1.Size = new System.Drawing.Size(508, 550);
             this.panel1.TabIndex = 4;
             // 
+            // richTextBox1
+            // 
+            this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
+            this.richTextBox1.Location = new System.Drawing.Point(12, 48);
+            this.richTextBox1.Name = "richTextBox1";
+            this.richTextBox1.Size = new System.Drawing.Size(390, 87);
+            this.richTextBox1.TabIndex = 7;
+            this.richTextBox1.Tag = "$ModDesc";
+            this.richTextBox1.Text = "rtBox1";
+            this.richTextBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.richTextBox1_KeyDown);
+            // 
             // button5
             // 
             this.button5.BackColor = System.Drawing.Color.DarkRed;
@@ -548,64 +607,6 @@ namespace FactorioModManager
             this.tabPage3.Text = "tabPage3";
             this.tabPage3.UseVisualStyleBackColor = true;
             // 
-            // richTextBox1
-            // 
-            this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
-            this.richTextBox1.Location = new System.Drawing.Point(12, 48);
-            this.richTextBox1.Name = "richTextBox1";
-            this.richTextBox1.Size = new System.Drawing.Size(390, 87);
-            this.richTextBox1.TabIndex = 7;
-            this.richTextBox1.Tag = "$ModDesc";
-            this.richTextBox1.Text = "rtBox1";
-            this.richTextBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.richTextBox1_KeyDown);
-            // 
-            // textBox2
-            // 
-            this.textBox2.Location = new System.Drawing.Point(6, 6);
-            this.textBox2.Name = "textBox2";
-            this.textBox2.Size = new System.Drawing.Size(263, 20);
-            this.textBox2.TabIndex = 0;
-            // 
-            // listView3
-            // 
-            this.listView3.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader4,
-            this.columnHeader5,
-            this.columnHeader6});
-            this.listView3.HideSelection = false;
-            this.listView3.Location = new System.Drawing.Point(6, 32);
-            this.listView3.Name = "listView3";
-            this.listView3.Size = new System.Drawing.Size(382, 524);
-            this.listView3.TabIndex = 1;
-            this.listView3.UseCompatibleStateImageBehavior = false;
-            this.listView3.View = System.Windows.Forms.View.Details;
-            // 
-            // button1
-            // 
-            this.button1.ForeColor = System.Drawing.Color.DarkBlue;
-            this.button1.Location = new System.Drawing.Point(275, 4);
-            this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(113, 23);
-            this.button1.TabIndex = 2;
-            this.button1.Tag = "$Search";
-            this.button1.Text = "button1";
-            this.button1.UseVisualStyleBackColor = true;
-            // 
-            // columnHeader4
-            // 
-            this.columnHeader4.Tag = "$ModName";
-            this.columnHeader4.Width = 252;
-            // 
-            // columnHeader5
-            // 
-            this.columnHeader5.Tag = "$ModVersion";
-            this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // columnHeader6
-            // 
-            this.columnHeader6.Tag = "$ModDownloads";
-            this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

+ 26 - 10
FactorioModManager/Form1.cs

@@ -131,17 +131,17 @@ namespace FactorioModManager
        
         private void UpdateLang()
         {
-            connection_str = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Connection");
-            is_connected_str = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Connected");
-            is_not_connected_str = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$NotConnected");
+            connection_str = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Connection");
+            is_connected_str = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Connected");
+            is_not_connected_str = LanguageManager.GetStringByTag(Settings.LastLanguage, "$NotConnected");
 
-            On = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$On");
-            Off = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Off");
+            On = LanguageManager.GetStringByTag(Settings.LastLanguage, "$On");
+            Off = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Off");
 
-            Updates = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Updates");
+            Updates = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Updates");
 
-            Warning = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Warning");
-            SureDeleteMod = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$SureDeleteMod");
+            Warning = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Warning");
+            SureDeleteMod = LanguageManager.GetStringByTag(Settings.LastLanguage, "$SureDeleteMod");
 
             LanguageManager.ApplyLanguage(Settings.LastLanguage, this);
 
@@ -172,6 +172,14 @@ namespace FactorioModManager
 
         private void Form1_FormClosing(object sender, FormClosingEventArgs e)
         {
+            try
+            {
+                using (StreamWriter sw = new StreamWriter(Path.Combine(Settings.GamePath,"mod-list.json")))
+                {
+                    sw.Write(Worker.GetModList());
+                }
+            }
+            catch { }
             Settings.Save(SettingsFile);
         }
 
@@ -276,9 +284,10 @@ namespace FactorioModManager
             /*bool flag = true;
             foreach(ListViewItem item in listView1.Items)
             {
-                flag = item.Checked && flag;
+                flag = flag && item.Checked;
             }
-            checkBox1.Checked = flag;*/
+            checkBox1.Checked = flag;
+            Worker.InstalledMods[e.Item.Index].Enabled = e.Item.Checked;*/
         }
 
         private void button2_Click(object sender, EventArgs e)
@@ -332,6 +341,11 @@ namespace FactorioModManager
             }
         }
 
+        private void exportModPackToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+
+        }
+
         private void listView1_SelectedIndexChanged(object sender, EventArgs e)
         {
             button5.Enabled = panel1.Visible = listView1.SelectedIndices.Count != 0;
@@ -356,6 +370,8 @@ namespace FactorioModManager
                     item.ForeColor = fcolor;
                 }
                 button2.Enabled = false;
+
+                button5.Enabled = displayedMods[listView1.SelectedIndices[0]].Deletable;
             }
         }
     }

+ 34 - 19
FactorioModManager/LanguageManager.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -37,7 +38,7 @@ namespace FactorioModManager
             bool result = true;
             if (form.Tag != null)
             {
-                string text = GetStrinByTag(lang, (string)form.Tag);
+                string text = GetStringByTag(lang, (string)form.Tag);
                 if (text == (string)form.Tag) result = false;
                 form.Text = text;
             }
@@ -64,7 +65,7 @@ namespace FactorioModManager
                 if ((string)control.Tag == "$Empty") control.Text = String.Empty;
                 else
                 {
-                    string text = GetStrinByTag(lang, (string)control.Tag);
+                    string text = GetStringByTag(lang, (string)control.Tag);
                     if (text == (string)control.Tag) result = false;
                     control.Text = text;
                 }
@@ -103,7 +104,7 @@ namespace FactorioModManager
             if (control.Tag != null)
             {
                 if (control.Tag.ToString().StartsWith("$")) {
-                    string text = GetStrinByTag(lang, (string)control.Tag);
+                    string text = GetStringByTag(lang, (string)control.Tag);
                     if (text == (string)control.Tag) result = false;
                     control.Text = text;
                 }
@@ -124,7 +125,7 @@ namespace FactorioModManager
                 if ((string)control.Tag == "$Empty") control.Text = String.Empty;
                 else
                 {
-                    string text = GetStrinByTag(lang, (string)control.Tag);
+                    string text = GetStringByTag(lang, (string)control.Tag);
                     if (text == (string)control.Tag) result = false;
                     control.Text = text;
                 }
@@ -149,7 +150,7 @@ namespace FactorioModManager
         /// <param name="lang">Language</param>
         /// <param name="tag">Tag</param>
         /// <returns></returns>
-        public static string GetStrinByTag(string lang,string tag)
+        public static string GetStringByTag(string lang,string tag)
         {
             if (LanguageFounded)
             {
@@ -183,25 +184,39 @@ namespace FactorioModManager
         /// <summary>
         /// Scans the folder for language files
         /// </summary>
-        /// <returns>Returns true if at least one language file was found</returns>
-        public static void ScanForLanguages()
+        /// <param name="recursivly">DO NOT SET TO TRUE!!!</param>
+        public static void ScanForLanguages(bool recursivly = false)
         {
-            if (Directory.Exists(LanguageDir))
+            Directory.CreateDirectory(LanguageDir);
+            List<string> files = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), LanguageDir)).ToList();
+            for (int i = 0; i < files.Count; i++)
             {
-                List<string> files = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), LanguageDir)).ToList();
-                for (int i = 0; i < files.Count; i++)
-                {
 
-                    if (files[i].EndsWith(".lang"))
-                    {
-                        files[i] = files[i].Substring(files[i].LastIndexOf('\\') + 1);
-                        files[i] = files[i].Substring(0, files[i].LastIndexOf('.'));
-                    }
+                if (files[i].EndsWith(".lang"))
+                {
+                    files[i] = files[i].Substring(files[i].LastIndexOf('\\') + 1);
+                    files[i] = files[i].Substring(0, files[i].LastIndexOf('.'));
                 }
-                _langs = files;
-                LanguageFounded = files.Count > 0;
             }
-            else LanguageFounded = false;
+            _langs = files;
+            LanguageFounded = files.Count > 0;
+
+            if (!LanguageFounded && !recursivly)
+            {
+                Stream default_language = Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + "." + "en.lang");
+                if (default_language == null) return;
+                FileStream file = new FileStream(Path.Combine(LanguageDir, "en.lang"), FileMode.CreateNew, FileAccess.Write);
+                default_language.CopyTo(file);
+                file.Dispose();
+                default_language.Dispose();
+
+                ScanForLanguages(true);
+            }
+        }
+
+        public static string Get(string tag)
+        {
+            return GetStringByTag(_current_lang, tag);
         }
     }
 }

+ 49 - 9
FactorioModManager/ModWorker.cs

@@ -4,6 +4,7 @@ using System.Drawing;
 using System.IO;
 using System.IO.Compression;
 using System.Linq;
+using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
 using Newtonsoft.Json.Linq;
@@ -35,6 +36,8 @@ namespace FactorioModManager
 
             public Image Thumbnail { get; set; }
 
+            public bool Deletable { get; private set; } = true;
+
             public List<string> DependenciesModNames { get
                 {
                     List<string> val = new List<string>();
@@ -58,8 +61,23 @@ namespace FactorioModManager
 
             public Dictionary<string, Availability> Dependencies { get; } = new Dictionary<string, Availability>();
 
+            public static Mod CreateSimple(string name, string title,bool enabled)
+            {
+                JObject json = new JObject()
+                {
+                    {"name", name},
+                    {"title", title},
+                    {"version", "0.0.1" },
+                    {"factorio_version", "2.0" }
+                };
+                Mod mod = new Mod(json);
+                mod.Enabled = enabled;
+                mod.Deletable = false;
+                return mod;
+            }
             public Mod(JObject json)
             {
+                if (json == null) return;
                 if (json.ContainsKey("name")) Name = (string)json["name"];
                 if (json.ContainsKey("version")) Version = new Version((string)json["version"]);
                 if (json.ContainsKey("factorio_version")) FactorioVersion = new Version((string)json["factorio_version"]);
@@ -76,16 +94,13 @@ namespace FactorioModManager
                         if (!data.Contains("base"))
                         {
                             Availability availability = Availability.Required;
-                            bool notReq = false;
                             if (data.Contains("?"))
                             {
                                 availability = Availability.Optional;
-                                notReq = true;
                             }
                             else if(data.Contains("!"))
                             {
                                 availability = Availability.Banned;
-                                notReq = true;
                             }
                             Dependencies.Add(data, availability);
                         }
@@ -116,6 +131,13 @@ namespace FactorioModManager
 
         public List<Mod> UpdatebleMods { get; } = new List<Mod>();
 
+        public static readonly string[] DLC_MODS =
+        {
+            "space-age",
+            "elevated-rails",
+            "quality"
+        };
+
         public ModWorker()
         {
             CheckDirSize();
@@ -205,22 +227,23 @@ namespace FactorioModManager
                 {
                     string name = (string)((JObject)list[i])["name"];
                     bool enabled = (bool)((JObject)list[i])["enabled"];
+                    if (DLC_MODS.Contains(name))
+                    {
+                        InstalledMods.Insert(0, Mod.CreateSimple(name,name,enabled));
+                    }
                     int id = InstalledMods.FindIndex(x => x.Name == name);
                     if (id != -1) InstalledMods[id].Enabled = enabled;
                 }
             }
-            InstalledMods.Sort((x, y) => x.Title.CompareTo(y.Title));
+            //InstalledMods.Sort((x, y) => x.Title.CompareTo(y.Title));
             ModsLoaded?.Invoke();
         }
 
-        public bool CheckForUpdates()
-        {
-            return false;
-        }
-
         public void CheckDirSize()
         {
+
             string dir = Path.Combine(Directory.GetCurrentDirectory(), WorkDir);
+            Directory.CreateDirectory(dir);
             long size = new DirectoryInfo(dir).EnumerateFiles().Sum(file => file.Length);
             double sizeInMb = size / 1024 / 1024;
             if (sizeInMb > 500)
@@ -233,6 +256,23 @@ namespace FactorioModManager
             
         }
 
+        public string GetModList(bool enabledOnly = false)
+        {
+            JObject json = new JObject();
+            JArray list = new JArray();
 
+            List<Mod> mods = (enabledOnly) ? InstalledMods.Where(x=>x.Enabled).ToList() : InstalledMods;
+            foreach (Mod mod in mods)
+            {
+                list.Add(new JObject()
+                {
+                    {"name",  mod.Name},
+                    {"enabled", mod.Enabled}
+                });
+            }
+
+            json.Add("mods", list);
+            return json.ToString();
+        }
     }
 }

+ 8 - 5
FactorioModManager/Properties/Resources.resx

@@ -46,7 +46,7 @@
     
     mimetype: application/x-microsoft.net.object.binary.base64
     value   : The object must be serialized with 
-            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
     
     mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
             : 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">
@@ -68,9 +69,10 @@
               <xsd:sequence>
                 <xsd:element name="value" type="xsd:string" minOccurs="0" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" />
+              <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">
@@ -85,9 +87,10 @@
                 <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" msdata:Ordinal="1" />
+              <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">
@@ -109,9 +112,9 @@
     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
 </root>

+ 34 - 0
FactorioModManager/Resources/en.lang

@@ -0,0 +1,34 @@
+$File=File
+$ExportModPack=Exporting a mod set
+$Settings=Settings
+$ChangeSettings=Change settings
+$ExportSettings=Export settings
+$ImportSettings=Import settings
+$Installed=Installed
+$Download=Download
+$Updates=Updates
+$Delete=Delete
+$ModDesc=Description of mod
+$ModName=Mod name
+$ModVersion=Version
+$ModState=State
+$ModAuthor=Author
+$ModContact=Contacts
+$ModWebsite=Homepage
+$ModFactorioVersion=Factorio version
+$ModDep=Dependencies
+$ModDowlnloadAllDepMods=Download all dependencies
+$ModDownloadReqMods=Download required dependencies
+$SettingsGamePath=The path to the folder with mods
+$SettingsAutoConnect=Connect on start
+$SettingsLanguage=Language
+$AccountUsername=Login (Nickname)
+$AccountPassword=Password
+$AccountTestConnection=Check the connection
+$SettingsApply=Apply
+$Connection=Connection
+$Connected=Connected
+$NotConnected=Not Connected
+$FactroioModManager=FactroioModManager
+$On=On
+$Off=Off

+ 3 - 3
FactorioModManager/Settings_Form.cs

@@ -55,10 +55,10 @@ namespace FactorioModManager
             api = new F_API(new Account(textBox2.Text, maskedTextBox1.Text));
             api.Connected += (bool success) =>
             {
-                if(success) label6.Text = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Connected");
-                else label6.Text = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$NotConnected");
+                if(success) label6.Text = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Connected");
+                else label6.Text = LanguageManager.GetStringByTag(Settings.LastLanguage, "$NotConnected");
             };
-            label6.Text = LanguageManager.GetStrinByTag(Settings.LastLanguage, "$Connection");
+            label6.Text = LanguageManager.GetStringByTag(Settings.LastLanguage, "$Connection");
             api.Connect();
         }
 

+ 34 - 0
FactorioModManager/en.lang

@@ -0,0 +1,34 @@
+$File=File
+$ExportModPack=Exporting a mod set
+$Settings=Settings
+$ChangeSettings=Change settings
+$ExportSettings=Export settings
+$ImportSettings=Import settings
+$Installed=Installed
+$Download=Download
+$Updates=Updates
+$Delete=Delete
+$ModDesc=Description of mod
+$ModName=Mod name
+$ModVersion=Version
+$ModState=State
+$ModAuthor=Author
+$ModContact=Contacts
+$ModWebsite=Homepage
+$ModFactorioVersion=Factorio version
+$ModDep=Dependencies
+$ModDowlnloadAllDepMods=Download all dependencies
+$ModDownloadReqMods=Download required dependencies
+$SettingsGamePath=The path to the folder with mods
+$SettingsAutoConnect=Connect on start
+$SettingsLanguage=Language
+$AccountUsername=Login (Nickname)
+$AccountPassword=Password
+$AccountTestConnection=Check the connection
+$SettingsApply=Apply
+$Connection=Connection
+$Connected=Connected
+$NotConnected=Not Connected
+$FactroioModManager=FactroioModManager
+$On=On
+$Off=Off