Exemplo n.º 1
0
        public static TSOConfig Load(string source_file)
        {
            XmlReader     reader     = XmlReader.Create(source_file);
            XmlSerializer serializer = new XmlSerializer(typeof(TSOConfig));
            TSOConfig     config     = serializer.Deserialize(reader) as TSOConfig;

            reader.Close();
            return(config);
        }
Exemplo n.º 2
0
        public Form1(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;
            viewer          = new Viewer();
            morphing        = new Morphing();

            if (viewer.InitializeApplication(this))
            {
                viewer.FigureEvent += delegate(object sender, EventArgs e)
                {
                    Morph();
                };
                foreach (string arg in args)
                {
                    viewer.LoadAnyFile(arg, true);
                }
                if (viewer.FigureList.Count == 0)
                {
                    viewer.LoadAnyFile(Path.Combine(save_path, "system.tdcgsav.png"), true);
                }
                viewer.Camera.SetTranslation(0.0f, +18.0f, +10.0f);

                timer1.Enabled = true;
            }

            morphing.Load(morphing_path);

            for (int i = 0; i < morphing.Groups.Count; i++)
            {
                MorphGroup group = morphing.Groups[i];

                MorphSlider slider = new MorphSlider();
                slider.Tag       = group;
                slider.GroupName = group.Name;

                List <string> names = new List <string>();
                foreach (Morph morph in group.Items)
                {
                    names.Add(morph.Name);
                }
                slider.SetMorphNames(names);

                slider.Location      = new System.Drawing.Point(10, 10 + i * 95);
                slider.ValueChanged += new System.EventHandler(this.slider_ValueChanged);
                this.Controls.Add(slider);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

            TSOConfig tso_config;

            string tso_config_file = Path.Combine(Application.StartupPath, @"config.xml");

            if (File.Exists(tso_config_file))
            {
                tso_config = TSOConfig.Load(tso_config_file);
            }
            else
            {
                tso_config = new TSOConfig();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1(tso_config, args));
        }