当前位置: 首页>>代码示例>>C#>>正文


C# ObjectCreator.readLine方法代码示例

本文整理汇总了C#中WinterLeaf.Engine.Classes.View.Creators.ObjectCreator.readLine方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectCreator.readLine方法的具体用法?C# ObjectCreator.readLine怎么用?C# ObjectCreator.readLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WinterLeaf.Engine.Classes.View.Creators.ObjectCreator的用法示例。


在下文中一共展示了ObjectCreator.readLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: save


//.........这里部分代码省略.........
                        currentFile = GuiEditor["LastPath"] + "/" + name;
                        currentFile = Util.makeRelativePath(currentFile, Util.getMainDotCsDir());
                        }
                    else
                        currentFile = Util._expandFilename(name);
                    }
                else
                    currentFile = Util._expandFilename(currentFile);
                }

            // Get the filename.

            string filename;

            if (!noPrompt)
                {
                filename = GuiEditorFileDialog.GuiBuilder.GetSaveName(currentFile);
                // console.Call_Classname("GuiBuilder", "getSaveName", new string[] {currentFile} );
                if (filename == "")
                    return;
                }
            else
                filename = currentFile;

            // Save the Gui.

            if (Util.isWriteableFileName(filename))
                {
                //
                // Extract any existent TorqueScript before writing out to disk
                //
                FileObject fileObject = new ObjectCreator("FileObject").Create();
                fileObject.openForRead(filename);
                bool skipLines = true;
                bool beforeObject = true;
                // var++ does not post-increment var, in torquescript, it pre-increments it,
                // because ++var is illegal. 
                //int lines = -1;
                //int beforeLines = -1;
                skipLines = false;

                //string[] beforeNewFileLines = new string[]{};
                //string[] newFileLines = new string[]{};

                List<string> beforeNewFileLines = new List<string>();
                List<string> newFileLines = new List<string>();

                while (!fileObject.isEOF())
                    {
                    string line = fileObject.readLine();
                    if (line == "//--- OBJECT WRITE BEGIN ---")
                        skipLines = true;
                    else if (line == "//--- OBJECT WRITE END ---")
                        {
                        skipLines = false;
                        beforeObject = false;
                        }
                    else if (skipLines == false)
                        {
                        if (beforeObject)
                            beforeNewFileLines.Add(line);
                            //beforeNewFileLines[ beforeLines++ ] = line;
                        else
                            //newFileLines[ lines++ ] = line;
                            newFileLines.Add(line);
                        }
                    }
                fileObject.close();
                fileObject.delete();

                FileObject fo = new ObjectCreator("FileObject").Create();
                fo.openForWrite(filename);

                // Write out the captured TorqueScript that was before the object before the object
                foreach (string line in beforeNewFileLines)
                    fo.writeLine(line);

                //for(int i = 0; i <= beforeLines; i++)
                //    fo.writeLine( beforeNewFileLines[ i ] );

                fo.writeLine("//--- OBJECT WRITE BEGIN ---");
                fo.writeObject(currentObject, "%guiContent = ");
                fo.writeLine("//--- OBJECT WRITE END ---");

                // Write out captured TorqueScript below Gui object
                //for( int i = 0; i <= lines; i++ )
                //    fo.writeLine( newFileLines[ i ] );
                foreach (string line in newFileLines)
                    fo.writeLine(line);

                fo.close();
                fo.delete();

                currentObject.setFilename(Util.makeRelativePath(filename, Util.getMainDotCsDir()));

                GuiEditorStatusBar.print("Saved file '" + currentObject.getFilename() + "'");
                }
            else
                Util.messageBox("Error writing to file", "There was an error writing to file '" + currentFile + "'. The file may be read-only.", "Ok", "Error");
        }
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:101,代码来源:GuiEditCanvas.ed.cs

示例2: onWake

        public override void onWake()
        {
            string text = "";
            FileObject f = new ObjectCreator("FileObject").Create();
            f.openForRead(this["fileName"]);
            while (!f.isEOF())
                text = text + f.readLine() + "\n";
            f.delete();

            ((GuiMLTextCtrl) FOT("TextBox")).setText(text);
        }
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:11,代码来源:NavEditorAboutDlg.cs

示例3: readDtsConfig

        public void readDtsConfig()
        {
            string filename = Util.filePath(this.path) + "/" + Util.fileBase(this.path) + ".cfg";
            string filename2 = Util.filePath(this.path) + "/" + "dtsScene.cfg";

            FileObject fo = new ObjectCreator("FileObject").Create();

            if (fo.openForRead(filename) || fo.openForRead(filename2))
                {
                string alwaysImport = "";
                string neverImport = "";

                string mode = "none";
                while (!fo.isEOF())
                    {
                    string line = Util.trim(fo.readLine());

                    if (line == "AlwaysExport:") // Start of the AlwaysExport list
                        mode = "always";
                    else if (line == "NeverExport:") // Start of the NeverExport list
                        mode = "never";
                    else if (Util.startsWith(line, "+", false) || Util.startsWith(line, "-", false))
                        // Boolean parameters (not supported)
                        mode = "none";
                    else if (Util.startsWith(line, "=", false)) // Float and integer parameters (not supported)
                        mode = "none";
                    else if (!Util.startsWith(line, "//", false)) // Non-commented lines
                        {
                        switch (mode)
                            {
                                case "always":
                                    alwaysImport = alwaysImport + '\t' + line;
                                    break;
                                case "never":
                                    neverImport = neverImport + '\t' + line;
                                    break;
                            }
                        }
                    }

                fo.close();

                alwaysImport = Util.strreplace(Util.trim(alwaysImport), "\t", ";");
                neverImport = Util.strreplace(Util.trim(neverImport), "\t", ";");

                ((GuiTextEditCtrl) this.FOT(alwaysImport)).setText(alwaysImport);
                ((GuiTextEditCtrl) this.FOT(neverImport)).setText(neverImport);
                }
            else
                Util._error("Failed to open " + filename + " or " + filename2 + " for reading");

            fo.delete();
        }
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:53,代码来源:ColladaImportDlg.ed.cs


注:本文中的WinterLeaf.Engine.Classes.View.Creators.ObjectCreator.readLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。