private static bool LoadData(String fileName)
        {
            bool succeeded = true;

            try
            {
                using (BinaryReader reader = new BinaryReader(new FileStream(fileName, FileMode.Open)))
                {
                    // conversion, lines, grades, abbr, waste min, waste max
                    int listLen = reader.ReadInt32();

                    StringDoubleConversionList.Clear();
                    for (; listLen > 0; --listLen)
                    {
                        String item1 = reader.ReadString();
                        double item2 = reader.ReadDouble();
                        StringDoubleConversionList.Add(new Tuple <string, double>(item1, item2));
                    }

                    //grades and abbr
                    listLen = reader.ReadInt32();
                    GradesList.Clear();
                    GradeAbbrList.Clear();

                    for (; listLen > 0; --listLen)
                    {
                        String grade = reader.ReadString();
                        String abbr  = reader.ReadString();
                        GradesList.Add(grade);
                        GradeAbbrList.Add(abbr);
                    }

                    // lines
                    listLen = reader.ReadInt32();
                    CoatingLines.Clear();
                    for (; listLen > 0; --listLen)
                    {
                        String line = reader.ReadString();
                        CoatingLines.Add(line);
                    }

                    //waste
                    WasteMin     = reader.ReadDouble();
                    WasteMax     = reader.ReadDouble();
                    CurrentWaste = reader.ReadDouble();

                    listLen = reader.ReadInt32();
                    TexturesList.Clear();
                    for (; listLen > 0; --listLen)
                    {
                        TexturesList.Add(Texture.Load(reader));
                    }


                    // WiP Marker
                    WiPMarker = reader.ReadChar();
                }
            }
            catch (Exception)
            {
                succeeded = false;
            }
            if (succeeded)
            {
                _loaded = true;
            }

            return(succeeded);
        }
Exemple #2
0
 private void AddCoatingBox()
 {
     CoatingLines.Add("");
     CoatingLineControls.Add(new CoatingLineControl(CoatingLines.Count - 1, this));
 }