Example #1
0
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            g.LogDebug("CPROJECT::Serialize: Enter");

            info.SetType(typeof(CProject));
            // Save Header
            info.AddValue("\r\n**\r\n** TorqueDev/CW Project (" + Application.ProductVersion + " PFV 1)   http://www.torquedev.com/   S.B. <*****@*****.**>\r\n**\r\n** This is a serialized binary object.  Alteration of this file would be ... unwise.\r\n**\r\n\r\n", "");

            // Save version info
            info.AddValue("___TORQUEDEV_VERSION", System.Windows.Forms.Application.ProductVersion);
            info.AddValue("___PROJECT_FILE_VERSION", 1);
            info.AddValue("___TORQUEDEV_SIGNATURE", "SB__NETMERCS");

            //info.AddValue("FileList", this.FileList);
            //info.AddValue("DirList", this.DirList);
            info.AddValue("FileList_V2", this.FileList);
            info.AddValue("DirList_V2", this.DirList);

            //info.AddValue("TokenObject", this._TokenObjList);
            info.AddValue("#ProjectName#", this.ProjectName);
            //info.AddValue("#FullRootPath#", this.ProjectPath);
            info.AddValue("#ProjectType#", this.ProjectType, typeof(short));

            // Save debugger information
            info.AddValue("DebugEn", this.DebugEnabled);
            info.AddValue("DebugExe", this.DebugExe);
            info.AddValue("DebugParams", this.DebugParams);
            info.AddValue("DebugPasswd", this.DebugPasswd);
            info.AddValue("DebugPort", this.DebugPort);

            // Save recent searches
            info.AddValue("RecentFinds", this.Finds);
            info.AddValue("RecentReplaces", this.Replaces);

            // Save new debugger information
            info.AddValue("DebugMainCs", this.DebugMainCs);
            info.AddValue("DebugAutoInsert", this.DebugAutoInsert);

            // Save open file list
            info.AddValue("OpenFiles", this.OpenFiles);
            info.AddValue("OpenFilesState", this.OpenFilesState);

            // Save the project's variable watch list
            info.AddValue("WatchVars", this.VarWatchList);

            g.LogDebug("CPROJECT::Serialize: Saved data");

            ArrayList al_compiled = new ArrayList();

            g.LogDebug("CPROJECT::Serialize: Saving macros");
            foreach (CProject.Macro macro in this.MacroList.Values)
            {
                try {
                    MemoryStream         mem      = new MemoryStream();
                    System.Xml.XmlWriter xmlwrite = new System.Xml.XmlTextWriter(mem, System.Text.Encoding.Default);
                    macro.MacroCmd.WriteToXml(xmlwrite);

                    xmlwrite.Flush();
                    xmlwrite.Close();

                    CProject.SerializedMacro sermac = new CProject.SerializedMacro();
                    sermac.MacroName = macro.MacroName;
                    sermac.MacroNum  = macro.MacroNum;
                    sermac.MacroXML  = System.Text.ASCIIEncoding.ASCII.GetString(mem.ToArray());

                    mem.Close();
                    al_compiled.Add(sermac);
                } catch {}
            }

            info.AddValue("SerializedMacroList", al_compiled);
        }
Example #2
0
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            g.LogDebug("CPROJECT::Serialize: Enter");

            info.SetType(typeof(CProject));
            // Save Header
            info.AddValue("\r\n**\r\n** TorqueDev/CW Project (" + Application.ProductVersion + " PFV 1)   http://www.torquedev.com/   S.B. <*****@*****.**>\r\n**\r\n** This is a serialized binary object.  Alteration of this file would be ... unwise.\r\n**\r\n\r\n", "");

            // Save version info
            info.AddValue("___TORQUEDEV_VERSION", System.Windows.Forms.Application.ProductVersion);
            info.AddValue("___PROJECT_FILE_VERSION", 1);
            info.AddValue("___TORQUEDEV_SIGNATURE", "SB__NETMERCS");

            //info.AddValue("FileList", this.FileList);
            //info.AddValue("DirList", this.DirList);
            info.AddValue("FileList_V2", this.FileList);
            info.AddValue("DirList_V2", this.DirList);

            //info.AddValue("TokenObject", this._TokenObjList);
            info.AddValue("#ProjectName#", this.ProjectName);
            //info.AddValue("#FullRootPath#", this.ProjectPath);
            info.AddValue("#ProjectType#", this.ProjectType, typeof(short));

            // Save debugger information
            info.AddValue("DebugEn", this.DebugEnabled);
            info.AddValue("DebugExe", this.DebugExe);
            info.AddValue("DebugParams", this.DebugParams);
            info.AddValue("DebugPasswd", this.DebugPasswd);
            info.AddValue("DebugPort", this.DebugPort);

            // Save recent searches
            info.AddValue("RecentFinds", this.Finds);
            info.AddValue("RecentReplaces", this.Replaces);

            // Save new debugger information
            info.AddValue("DebugMainCs", this.DebugMainCs);
            info.AddValue("DebugAutoInsert", this.DebugAutoInsert);

            // Save open file list
            info.AddValue("OpenFiles", this.OpenFiles);
            info.AddValue("OpenFilesState", this.OpenFilesState);

            // Save the project's variable watch list
            info.AddValue("WatchVars", this.VarWatchList);

            g.LogDebug("CPROJECT::Serialize: Saved data");

            ArrayList al_compiled = new ArrayList();

            g.LogDebug("CPROJECT::Serialize: Saving macros");
            foreach(CProject.Macro macro in this.MacroList.Values) {
                try {
                    MemoryStream mem = new MemoryStream();
                    System.Xml.XmlWriter xmlwrite = new System.Xml.XmlTextWriter(mem, System.Text.Encoding.Default);
                    macro.MacroCmd.WriteToXml(xmlwrite);

                    xmlwrite.Flush();
                    xmlwrite.Close();

                    CProject.SerializedMacro sermac = new CProject.SerializedMacro();
                    sermac.MacroName = macro.MacroName;
                    sermac.MacroNum = macro.MacroNum;
                    sermac.MacroXML = System.Text.ASCIIEncoding.ASCII.GetString(mem.ToArray());

                    mem.Close();
                    al_compiled.Add(sermac);
                } catch {}
            }

            info.AddValue("SerializedMacroList", al_compiled);
        }