public override bool Compare(Document d) { if (d is StructureDocument) { StructureDocument doc = d as StructureDocument; if (doc.shapes.Length != this.shapes.Length) { return(false); } for (int i = 0; i < doc.shapes.Length; i++) { if (!doc.shapes[i].Compare(this.shapes[i])) { return(false); } } if (doc.Colors.Count != this.Colors.Count) { return(false); } for (int i = 0; i < doc.Colors.Count; i++) { if (doc.Colors[i].rgb != this.Colors[i].rgb) { return(false); } if (doc.Colors[i].name != this.Colors[i].name) { return(false); } if (doc.Colors[i].count != this.Colors[i].count) { return(false); } } if (doc.regression_mode != this.regression_mode || doc.calculation_mode != this.calculation_mode || doc.allow_stretch != this.allow_stretch) { return(false); } if (!Enumerable.SequenceEqual(this.dominoes, doc.dominoes)) { return(false); } if (doc.Locked != this.Locked) { return(false); } return(true); } return(false); }
public static Document FastLoad(String path) { switch (Path.GetExtension(path)) { case ".clr": return(ColorArrayDocument.LoadColorArray(path)); case ".fld": return(FieldDocument.LoadFieldDocumentWithoutDrawing(path)); case ".sct": return(StructureDocument.LoadStructureDocumentWithoutDrawing(path)); default: return(null); } }
public static StructureDocument LoadStructureDocument(string path) { StructureDocument d = LoadStructureDocumentWithoutDrawing(path); if (d.filters == null) { d.InitFilters(); } d.filters.Deserialize_Finish(d.SourcePath); using (FileStream s = new FileStream(d.SourcePath, FileMode.Open)) { d.SourceImage = Image.FromStream(s); } FileInfo f = new FileInfo(d.SourcePath); d.imageInfo = "Image Info: Resolution: " + d.SourceImage.Width + "x" + d.SourceImage.Height + ", Format: " + System.IO.Path.GetExtension(d.SourcePath) + ", File Size: " + ((f.Length > 1000000) ? (f.Length / 1000000) + " MB" : ((f.Length > 1000) ? (f.Length / 1000) + " KB" : f.Length + " B")); d.provider.OnLoad(); d.UpdateDrawRectangles(); d.Draw(); return(d); }