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


C# ObjectCreator.close方法代码示例

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


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

示例1: writeDtsConfig

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

            FileObject fo = new ObjectCreator("FileObject").Create();
            if (fo.openForWrite(filename))
                {
                // AlwaysImport
                fo.writeLine("AlwaysExport:");
                string alwaysImport = Util.trim(Util.strreplace(((GuiTextEditCtrl) this.FOT("alwaysImport")).getText(), ";", "\t"));
                int count1 = Util.getFieldCount(alwaysImport);
                for (int i = 0; i < count1; i++)
                    fo.writeLine(Util.getField(alwaysImport, i));
                fo.writeLine("");

                // NeverImport
                fo.writeLine("NeverExport:");
                string neverImport = Util.trim(Util.strreplace(((GuiTextEditCtrl) this.FOT("neverImport")).getText(), ";", "\t"));
                int count = Util.getFieldCount(neverImport);
                for (int i = 0; i < count; i++)
                    fo.writeLine(Util.getField(neverImport, i));
                fo.writeLine("");

                fo.close();
                }
            else
                Util._error("Failed to open " + filename + " for writing");

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

示例2: 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

示例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.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。