public ObjectChange(ParamObject obj) { InitializeComponent(); outside_tower_height.Text = obj.Outside_tower_height.ToString(); outside_tower_radius.Text = obj.Outside_tower_radius.ToString(); outside_tower_top_height.Text = obj.Outside_tower_top_height.ToString(); outside_tower_top_radius.Text = obj.Outside_tower_top_radius.ToString(); outside_sphere_radius.Text = obj.Outside_tower_sphere_radius.ToString(); inside_tower_height.Text = obj.Inside_tower_height.ToString(); inside_tower_radius.Text = obj.Inside_tower_radius.ToString(); inside_tower_top_height.Text = obj.Inside_tower_top_height.ToString(); inside_tower_top_radius.Text = obj.Inside_tower_top_radius.ToString(); inside_sphere_radius.Text = obj.Inside_tower_sphere_radius.ToString(); outside_wall_lenght.Text = obj.Outside_wall_lenght.ToString(); inside_wall_lenght.Text = obj.Inside_wall_lenght.ToString(); outside_box_count.Text = obj.Outside_box_count.ToString(); result = obj; }
public static ParamObject UploadFromFile(string fname, int index) { ParamObject newobject = new ParamObject(); StreamReader file = new StreamReader(fname); file.ReadLine(); for (int i = 0; i < index * 23 + 11; i++) { file.ReadLine(); } newobject.h_dgr = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.v_dgr = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.d_dgr = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.x_pos = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.y_pos = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.z_pos = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.scale_x = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.scale_y = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.scale_z = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_tower_height = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_tower_radius = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_tower_top_height = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_tower_top_radius = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_tower_sphere_radius = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.inside_tower_height = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.inside_tower_radius = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.inside_tower_top_height = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.inside_tower_top_radius = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.inside_tower_sphere_radius = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_wall_lenght = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.inside_wall_lenght = Convert.ToSingle(file.ReadLine().Split(':')[1]); newobject.outside_box_count = Convert.ToSingle(file.ReadLine().Split(':')[1]); file.Close(); newobject.CalculateModel(); return(newobject); }