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


C# IFile.GetType方法代码示例

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


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

示例1: frmMassEditor

        public frmMassEditor(IFile file)
        {
            InitializeComponent();
            this.file = file;
            fileType = file.GetType();

            switch (fileType.Name)
            {
                case "SHNFile":
                    cbGetColumn.DataSource = ((SHNFile)file).Columns.Cast<DataColumn>().AsEnumerable().ToList();
                    cbWhere.DataSource = ((SHNFile)file).Columns.Cast<DataColumn>().AsEnumerable().ToList();

                    cbGetColumn.DisplayMember = "ColumnName";
                    cbWhere.DisplayMember = "ColumnName";
                    break;

                case "ShineFile":

                    break;
            }

            cbSetAction.SelectedIndex = 0;
            cbGetType.SelectedIndex = 0;
            txtGetValue.PlaceHolder("Value");
            txtSetValue.PlaceHolder("Value");
        }
开发者ID:Wicious,项目名称:Spark-Editor,代码行数:26,代码来源:frmMassEditor.cs

示例2: btnOK_Click

        private void btnOK_Click(object sender, EventArgs e)
        {
            file = file ?? new SHNFile(txtFileName.Text + ".shn");
            file.FilePath = txtFileName.Text + (file.GetType() == typeof(ShineFile) ? ".txt" : ".shn");
            file.IsSaved = false;

            if (cbFileType.SelectedIndex == 2)
            {
                using (var frm = new frmQuestDependencies())
                {
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        file = new QuestFile(txtFileName.Text + ".shn", true, frm.MobInfoPath, frm.ItemInfoPath);
                    }
                }

                using (var frm = new frmChooseQuestVersion((QuestFile)file))
                {
                    if (frm.ShowDialog(this) != DialogResult.OK)
                    {
                        ((QuestFile)file).QuestFileVersion = QuestFileVersion.NA11;
                    }
                }
            }

            if (file.GetType() == typeof(SHNFile))
                ((SHNFile)file).CreateFile();

            Program.LoadedFiles.Add(file);
        }
开发者ID:Wicious,项目名称:Spark-Editor,代码行数:30,代码来源:frmNewFile.cs

示例3: Create

        /// <summary>
        ///     Creates the specified file.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <returns></returns>
        public IProjectExplorerItem Create(IFile file)
        {
            Check.IfIsNull(file).Throw<ArgumentNullException>(() => file);

            var contextMenu = projectExplorerContextMenuFactory.Create(file.GetType());

            return new ProjectExplorerItem(file, contextMenu);
        }
开发者ID:SimoneLocatelli,项目名称:AncientTimesEditor,代码行数:13,代码来源:ProjectExplorerItemsFactory.cs

示例4: WriteFileToDisk

        internal static void WriteFileToDisk(IFile file)
        {
            Verify.ArgumentNotNull(file, "file");
            Verify.ArgumentCondition(file is FileSystemFileBase, "file", "The type '{0}' does not inherit the class '{1}'".FormatWith(file.GetType(), typeof(FileSystemFileBase)));

            var baseFile = file as FileSystemFileBase;

            baseFile.CommitChanges();
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:FileSystemFileStreamManager.cs

示例5: DeleteFile

        internal static void DeleteFile(IFile file)
        {
            Verify.ArgumentNotNull(file, "file");
            Verify.ArgumentCondition(file is FileSystemFileBase, "file", "The type '{0}' does not inherit the class '{1}'".FormatWith(file.GetType(), typeof(FileSystemFileBase)));

            var baseFile = file as FileSystemFileBase;

            DeleteFile(baseFile.SystemPath);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:FileSystemFileStreamManager.cs

示例6: GetNewWriteStream

        public Stream GetNewWriteStream(IFile file)
        {
            Verify.ArgumentNotNull(file, "file");
            Verify.ArgumentCondition(file is FileSystemFileBase, "file", "The type '{0}' does not inherit the class '{1}'".FormatWith(file.GetType(), typeof(FileSystemFileBase)));

            var baseFile = file as FileSystemFileBase;

            return baseFile.GetNewWriteStream();
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:9,代码来源:FileSystemFileStreamManager.cs

示例7: WriteFileToDisk

        internal static void WriteFileToDisk(IFile file)
        {
            Verify.ArgumentNotNull(file, "file");

            FileSystemFileBase baseFile = file as FileSystemFileBase;

            Verify.ArgumentCondition(baseFile != null, "file", "The type '{0}' does not inherit the class '{1}'"
                                                       .FormatWith(file.GetType(), typeof(FileSystemFileBase)));

            if (Transaction.Current == null)
            {
                LogNoTransaction();

                baseFile.CommitChanges();
            }
            else
            {
                Transaction.Current.EnlistVolatile(new WriteToDiskEnlistment(file, baseFile), EnlistmentOptions.None);
            }
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:20,代码来源:TransactionFileSystemFileStreamManager.cs

示例8: WriteFile

 /// <summary>
 /// Write a file to the filesystem.
 /// </summary>
 /// <param name="filename">Filename.</param>
 /// <param name="file">File object to write.</param>
 /// <exception cref="FileExistsException">A file with the specified name already exists.</exception>
 /// <exception cref="FilesystemFullException">The filesystem does not have remaining capacity to store the file.</exception>
 /// <exception cref="FilesystemNotWriteableException">This filesystem does not support write operations.</exception>
 /// <exception cref="InvalidFilenameException">The file name is invalid for this filesystem.</exception>
 public void WriteFile(string filename, IFile file)
 {
     if (IsDisposed) throw new ObjectDisposedException(GetType().FullName);
     if (!IsWriteable) throw new FilesystemNotWriteableException();
     if (file == null) throw new ArgumentNullException("file");
     if (!(file is DragonDosFile)) throw new ArgumentException("file is of unexpected type " + file.GetType().FullName);
     var dragonfile = (DragonDosFile) file;
     WriteFileRaw(filename, dragonfile.EncodeFile());
 }
开发者ID:rolfmichelsen,项目名称:dragontools,代码行数:18,代码来源:DragonDos.cs

示例9: CopyFrom

        /// <summary>
        /// Copy from the given file (<paramref name="a_source"/> to this one overwriting if necessary..
        /// </summary>
        /// <param name="a_source">File from which to copy.</param>
        public void CopyFrom(IFile a_source)
        {
            #region Argument Validation

            if (a_source == null)
                throw new ArgumentNullException(nameof(a_source));

            #endregion

            if (!a_source.Exists)
                throw new FileNotFoundException("File cannot be copied because it does not exist.");

            var source = a_source as FsFile;
            if (source == null)
                throw new InvalidOperationException($"Cannot copy from a source of type\"{a_source.GetType().Name}\".");

            File.Copy(a_source.Path, Path, true);
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:22,代码来源:FsFile.cs

示例10: createFile

        private async void createFile(IFile file)
        {
            try
            {
                var dgv = new DataGridView();

                if (file.GetType() == typeof(QuestFile))
                {
                    file = file ?? new QuestFile("");
                    Program.LoadedFiles.Add(file);
                    Extensions.FileType = FileType.QuestFile;

                    var mainTab = new TabPage("QuestFile");
                    var qTab = new TabPage("Quests");
                    var dTab = new TabPage("Dialouges");
                    mainTab.BackColor = Color.White;
                    dTab.BackColor = Color.White;
                    qTab.BackColor = Color.White;

                    var tc = new TabControl();
                    tc.Dock = DockStyle.Fill;
                    qTab.Padding = new Padding(0, 5, 0, 0);
                    dTab.Padding = new Padding(0, 5, 0, 0);
                    mainTab.Padding = new Padding(0, 5, 0, 0);

                    tc.TabPages.Add(qTab);
                    tc.TabPages.Add(dTab);

                    mainTab.Controls.Add(tc);

                    var qPanel = new QuestPanel((QuestFile)file);
                    qPanel.Dock = DockStyle.Fill;
                    qTab.Controls.Add(qPanel);
                    mainTab.Controls.Add(tc);

                    tcFiles.TabPages.Add(mainTab);
                    tcFiles.SelectedIndex = tcFiles.TabPages.Count - 1;
                }

                else if (file.GetType() == typeof(SHNFile))
                {
                    dgv = new DataGridView();
                    dgv.Dock = DockStyle.Fill;
                    dgv.BackgroundColor = Color.WhiteSmoke;
                    dgv.DoubleBuffered(true);
                    dgv.DataSource = file;

                    ((SHNFile)file).CreateFile();

                    dgv.CellEnter += File_CellEnter;

                    var tab = new TabPage(((DataTable)file).TableName);
                    ((DataTable)file).RowChanged += new DataRowChangeEventHandler(File_RowChanged);
                    tab.Controls.Add(dgv);

                    tcFiles.TabPages.Add(tab);
                    tcFiles.SelectedIndex = tcFiles.TabPages.Count - 1;
                }

                else if (file.GetType() == typeof(ShineFile))
                {
                    var mainTab = new TabPage(((ShineFile)file).DataSetName);
                    var tcTables = new TabControl();
                    tcTables.Dock = DockStyle.Fill;

                    tcTables.SelectedIndexChanged += new EventHandler((object s, EventArgs e) =>
                    {
                        ((ShineFile)file).SelectedIndex = tcTables.SelectedIndex;
                    });

                    mainTab.Controls.Add(tcTables);
                    tcFiles.TabPages.Add(mainTab);
                    mainTab.BackColor = Color.White;

                    tcFiles.SelectedIndex = tcFiles.TabCount - 1;

                    foreach (var table in ((ShineFile)file).Tables)
                    {
                        dgv = new DataGridView();
                        dgv.Dock = DockStyle.Fill;
                        dgv.BackgroundColor = Color.WhiteSmoke;
                        dgv.DoubleBuffered(true);
                        dgv.DataSource = table;

                        dgv.CellEnter += File_CellEnter;

                        var tab = new TabPage(((DataTable)table).TableName);
                        ((DataTable)table).RowChanged += new DataRowChangeEventHandler(File_RowChanged);
                        tab.Controls.Add(dgv);

                        tcTables.TabPages.Add(tab);
                    }
                }

                updateFileInfo();
            }
            catch (Exception ex)
            {
                pbProgress.Visible = false;
                pbProgress.Value = 0;
//.........这里部分代码省略.........
开发者ID:Wicious,项目名称:Spark-Editor,代码行数:101,代码来源:frmMain.cs

示例11: WriteFile

        /// <summary>
        /// Write a file to the filesystem.
        /// The provided filename will override any filename specified in the file object.
        /// </summary>
        /// <param name="file">File object to write.</param>
        /// <exception cref="FilesystemNotWriteableException">This filesystem does not support write operations.</exception>
        /// <exception cref="InvalidFilenameException">The file name is invalid for this filesystem.</exception>
        public void WriteFile(IFile file)
        {
            if (IsDisposed) throw new ObjectDisposedException(GetType().FullName);
            if (file == null) throw new ArgumentNullException("file");
            if (!(file is DragonFile)) throw new ArgumentException("Unexpected type of file parameter : " + file.GetType().FullName);

            var dragonfile = (DragonFile) file;
            WriteHeaderBlock(dragonfile);
            WriteDataBlocks(dragonfile);
            WriteEndOfFileBlock(dragonfile);
        }
开发者ID:rolfmichelsen,项目名称:dragontools,代码行数:18,代码来源:DragonTape.cs


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