Exemplo n.º 1
0
        Dictionary<int, string> mScriptData = null; // Data - every line has unique index starting with 0

        public void LoadProject(BaseProject baseProject)
        {
            mVdProject = baseProject;

            mScriptData = new Dictionary<int,string>();
            /*XmlDocument document = new XmlDocument();

            try
            {
                // Load the XmlDocument with the xmlData.
                document.LoadXml(vdProject.XmlData);
            }
            catch (Exception)
            {
            }*/
        }
Exemplo n.º 2
0
        public void ConvertProject()
        {
            // Load the project
            switch (mInputProject)
            {
            case InputProject.VdProject:
                mProject = new VdProject(ref mProgressDialog, mSourceProjectFile);
                break;

            case InputProject.IsleProject:
                mProject = new IsleProject(ref mProgressDialog, mSourceProjectFile);
                break;

            case InputProject.AiProject:
                mProject = new AiProject(ref mProgressDialog, mSourceProjectFile);
                break;
            }
            if (mOutputProject == OutputProject.InnoSetup)
            {
                // InnoSetupProject
                ProgressMessage("Creating script file...");
                InnoProject innoProject = new InnoProject();
                innoProject.LoadProject(mProject);
                ProgressMessage("Generating script...");
                mResult = innoProject.Convert();

                if (mResult)
                {
                    mOutputScriptFile = mSourceProjectFileInfo.DirectoryName + "\\" + innoProject.mVdProject.ProjectName + ".iss";
                    ProgressMessage("Saving script as '" + mOutputScriptFile + "'...");
                    mResult = innoProject.SaveScript(mOutputScriptFile);
                }
                else
                {
                    // Display information for user
                    ProgressMessage("Error occurred during generating script!!");
                    mProgressDialog.EnableButton(true);
                }

                if (mResult)
                {
                    // Everything is OK so close the dialog automatically
                    mProgressDialog.CloseDialog("Script '" + mOutputScriptFile + "' created successfully!", 2000);
                    Process.Start(new FileInfo(mOutputScriptFile).DirectoryName);
                }
                else
                {
                    ProgressMessage("Error occurred during saving script as '" + mOutputScriptFile + "'!");
                    mProgressDialog.EnableButton(true);
                }
            }
            else
            {
                // NSISProject
                ProgressMessage("Creating script file...");
                NsisProject nsisProject = new NsisProject();
                nsisProject.LoadProject(mProject);
                ProgressMessage("Generating script...");
                mResult = nsisProject.Convert();

                if (mResult)
                {
                    mOutputScriptFile = mSourceProjectFileInfo.DirectoryName + "\\" + nsisProject.mVdProject.ProjectName + ".nsi";
                    ProgressMessage("Saving script as '" + mOutputScriptFile + "'...");
                    mResult = nsisProject.SaveScript(mOutputScriptFile);
                }
                else
                {
                    // Display information for user
                    ProgressMessage("Error occurred during generating script!!");
                    mProgressDialog.EnableButton(true);
                }

                if (mResult)
                {
                    // Everything is OK so close the dialog automatically
                    mProgressDialog.CloseDialog("Script '" + mOutputScriptFile + "' created successfully!", 2000);
                    Process.Start(new FileInfo(mOutputScriptFile).DirectoryName);
                }
                else
                {
                    ProgressMessage("Error occurred during saving script as '" + mOutputScriptFile + "'!");
                    mProgressDialog.EnableButton(true);
                }
            }
        }