public static StaticVariables Load(string filename, ref List <string> messages)
    {
        System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
        FileStream      fromStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
        StaticVariables sv         = null;

        try {
            sv = (StaticVariables)formatter.Deserialize(fromStream);
            sv.verifyPrimitiveDataTypesExist();
        } catch (Exception ex) {
            //Interaction.MsgBox("Oops, we could not load the variables due to the following error: "
            messages.Add("Oops, we could not load the variables due to the following error: " + ex.Message);
        } finally {
            if (fromStream != null)
            {
                fromStream.Close();
                fromStream.Dispose();
            }
        }


        return(sv);
    }