コード例 #1
0
ファイル: AiProject.cs プロジェクト: tSlappy/setupconverter
        // Open .aip file and parse it internally into .xml
        public AiProject(ref AsynchronousDialog progressDialog, string aipFilePath)
        {
            mProgressDialog = progressDialog;
            mProjectFile    = aipFilePath;
            mInputProject   = InputProject.IsleProject;

            ProgressMessage("Loading project '" + aipFilePath + "'...");

            ParseAipFile();
        }
コード例 #2
0
        public SetupProjectConverterApp(string sourceFile, InputProject inputProject, OutputProject outputProject)
        {
            mSourceProjectFile     = sourceFile;
            mInputProject          = inputProject;
            mOutputProject         = outputProject;
            mSourceProjectFileInfo = new FileInfo(mSourceProjectFile);

            mProgressDialog = new AsynchronousDialog();
            mProgressDialog.ShowProgressDialog();
        }
コード例 #3
0
        // Open .vdproj file and parse it internally into .xml
        public VdProject(ref AsynchronousDialog progressDialog, string vdProjFilePath)
        {
            mProgressDialog = progressDialog;
            mProjectFile    = vdProjFilePath;
            mInputProject   = InputProject.VdProject;

            ProgressMessage("Loading project '" + vdProjFilePath + "'...");
            using (StreamReader reader = System.IO.File.OpenText(mProjectFile))
                using (XmlWriter writer = XmlWriter.Create(mProjectFile + ".xml"))
                {
                    string line;
                    bool   prevLineElement = false;
                    string prevLine        = null;

                    while ((line = reader.ReadLine()) != null)
                    {
                        line = line.Trim();
                        mLineCount++;
                        Match match = ElementRegex.Match(line);

                        if (match.Success)
                        {
                            if (prevLineElement)
                            {
                                writer.WriteEndElement();
                            }

                            string elementName      = Unescape(match.Groups[1].Value);
                            string fixedElementName = GetXmlElementSafeName(elementName);

                            writer.WriteStartElement(fixedElementName);

                            if (match.Groups[2].Success)
                            {
                                //writer.WriteAttributeString("valueType", match.Groups[2].Value);
                                string value = Unescape(match.Groups[3].Value);
                                writer.WriteAttributeString("value", value);
                            }
                            prevLineElement = true;
                        }
                        else
                        {
                            if (prevLineElement && line != "{")
                            {
                                writer.WriteEndElement();
                            }

                            prevLineElement = false;

                            if (line == "}")
                            {
                                if (prevLine == "{")
                                {
                                    writer.WriteWhitespace(" ");
                                }
                                writer.WriteEndElement();
                            }
                        }
                        prevLine = line;
                    }
                }

            CreateXmlDataAndParseTree();
        }