diff --git a/TBO/TBO.csproj b/TBO/TBO.csproj index fc27e01..92932fe 100644 --- a/TBO/TBO.csproj +++ b/TBO/TBO.csproj @@ -48,6 +48,7 @@ + diff --git a/TBO/TBOFile.cs b/TBO/TBOFile.cs index 2fb2320..59a7bec 100644 --- a/TBO/TBOFile.cs +++ b/TBO/TBOFile.cs @@ -179,7 +179,7 @@ #endregion - public void AppendImage(string filename,int num) + public void AppendImage(string filename) { byte[] image; FileInfo fi = new FileInfo(filename); @@ -190,8 +190,6 @@ image = File.ReadAllBytes(filename); } WriteBlock(image); - //Test - File.WriteAllBytes("C:\\Users\\XWolf\\Desktop\\out\\" + num+".jpg",image); } private byte[] GetImageBytes(Image i) @@ -228,17 +226,6 @@ return gimg.Length < img.Length ? gimg : img; } - public void TestImage(string filename) - { - string namebase = Path.Combine(Path.GetDirectoryName(fs.Name), Path.GetFileNameWithoutExtension(fs.Name)); - using (Image i = Image.FromFile(filename)) - { - File.WriteAllBytes(namebase + ".jpeg", ImageJPEG(i)); - File.WriteAllBytes(namebase + ".8.png", ImagePNG8bpp(i)); - File.WriteAllBytes(namebase + ".4.png", ImagePNG4bpp(i)); - } - } - private byte[] ImageJPEG(Image i) { if (i == null) @@ -298,13 +285,27 @@ return ImagePNG(bmp); } + [oDBSerialize("Titl")] public string Title { get; set; } + + [oDBSerialize("Var")] public string Variant { get; set; } + + [oDBSerialize("Vol")] public string Volume { get; set; } + + [oDBSerialize("Auth")] public string Author { get; set; } + + [oDBSerialize("Publ")] public string Publisher { get; set; } + + [oDBSerialize("Year")] public int Year { get; set; } + + [oDBSerialize("Com")] public string Comments { get; set; } + public int Grayscale { get; set; } = 16; public bool KeepColors { get; set; } = true; diff --git a/TBO/UI/Windows/Studio.cs b/TBO/UI/Windows/Studio.cs index d3cc71b..f78767d 100644 --- a/TBO/UI/Windows/Studio.cs +++ b/TBO/UI/Windows/Studio.cs @@ -110,7 +110,7 @@ for (int i = 0; i < files.Count; i++) { pbGo.Value = i; - tbo.AppendImage(files[i], i); + tbo.AppendImage(files[i]); lbInfo.Text = FBytes(tbo.Size); Application.DoEvents(); } @@ -123,6 +123,7 @@ { btGo.Enabled = true; } + } private void Studio_Load(object sender, EventArgs e) diff --git a/TBO/oDB.cs b/TBO/oDB.cs new file mode 100644 index 0000000..3dafa63 --- /dev/null +++ b/TBO/oDB.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TBO +{ + [AttributeUsage(AttributeTargets.Property)] + class oDBSerialize : Attribute + { + public oDBSerialize(string name) + { + Name = name; + } + + public string Name { get; set; } + } + + class oDB + { + + private Dictionary data = new Dictionary(); + + #region Serialization + public static oDB Serialize(Object o) + { + return null; + } + + public T Deserialize() where T : new() + { + return default(T); + } + #endregion + + private object GetValue(string name) + { + object result; + if (data.TryGetValue(name, out result)) + return result; + return data[name]= new oDB(); + } + + public object this[string name] { get => GetValue(name); set => data[name] = value; } + } + +}