Beispiel #1
0
        private void LoadFile(string path)
        {
            Cursor          = System.Windows.Forms.Cursors.WaitCursor;
            currentFileName = path;
            try
            {
                Environment.CurrentDirectory = (Path.GetDirectoryName(currentFileName));
                currentProject.Clear();
                projectNeedSave = false;
                XmlSerializer serializer = new XmlSerializer(Type.GetType("WarSetup.SetupProject"));
                using (StreamReader file = new StreamReader(currentFileName))
                {
                    currentProject = (SetupProject)serializer.Deserialize(file);
                }

                // Previously the merge-modules were re-loaded each time the document was
                // loaded. We have to load the information from the modules if this is an
                // old warsetup file...
                foreach (MergeModule mm in currentProject.projectMergeModules)
                {
                    if ((null == mm.ModuleId) || ("" == mm.ModuleId))
                    {
                        mm.LoadInfo();
                    }
                }

                BindData();
                projectNeedSave = false;
                SynchFeatures(true);
                ReloadMergeModuleList();
                ReloadWixModuleList();
                currentProject.projectProperties.AddAllUiCulture();
                currentProject.projectProperties.RemoveUiCultureDuplicates();
                InitLicense();
                SetSelectedLicense();
                CurrentProject.ResolveMainFeature(false);
                CurrentProject.Virgin = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                Cursor = System.Windows.Forms.Cursors.Default;
            }
        }