/// <summary> /// Gets all text style table records. /// </summary> /// <param name="symbolTbl">The symbol table.</param> /// <param name="mode">The mode.</param> /// <param name="filter">The filter.</param> /// <returns></returns> public static IEnumerable<TextStyleTableRecord> GetAllTextStyleTableRecords(this TextStyleTable symbolTbl, OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None) { return symbolTbl.GetSymbolTableRecords<TextStyleTableRecord>( symbolTbl.Database.TransactionManager.TopTransaction, mode, filter, true); }
private iPhoneFile(iPhone phone, long handle, OpenMode mode) : base() { this.phone = phone; this.mode = mode; this.handle = handle; }
public static Handle Open (string uri, OpenMode mode, int priority, AsyncCallback callback) { IntPtr handle = IntPtr.Zero; AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null); gnome_vfs_async_open (out handle, uri, mode, priority, wrapper.NativeDelegate, IntPtr.Zero); return new Handle (handle); }
// Constructor. public File(FileTable table, int number, OpenMode mode) { this.table = table; this.number = number; this.mode = mode; this.nextRecord = -1; }
public static IEnumerable<ViewTableRecord> GetViewTableRecords(this ViewTable symbolTbl, OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None) { return symbolTbl.GetSymbolTableRecords<ViewTableRecord>(symbolTbl.Database.TransactionManager.TopTransaction, mode, filter, false); }
public static Handle Create (string uri, OpenMode mode, bool exclusive, FilePermissions perm, int priority, AsyncCallback callback) { IntPtr handle = IntPtr.Zero; AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null); gnome_vfs_async_create (out handle, uri, mode, exclusive, (uint)perm, priority, wrapper.NativeDelegate, IntPtr.Zero); return new Handle (handle); }
/// <summary> /// Gets the attribute references. /// </summary> /// <param name="bref">The bref.</param> /// <param name="trx">The TRX.</param> /// <param name="mode">The mode.</param> /// <param name="includingErased">if set to <c>true</c> [including erased].</param> /// <param name="openObjectsOnLockedLayers">if set to <c>true</c> [open objects on locked layers].</param> /// <returns></returns> /// <exception cref="Autodesk.AutoCAD.Runtime.Exception"></exception> public static IEnumerable<AttributeReference> GetAttributeReferences(this BlockReference bref, Transaction trx, OpenMode mode = OpenMode.ForRead, bool includingErased = false, bool openObjectsOnLockedLayers = false) { if (trx == null) { throw new Exception(ErrorStatus.NoActiveTransactions); } if (includingErased) { foreach (ObjectId id in bref.AttributeCollection) { yield return (AttributeReference) trx.GetObject(id, mode, true, openObjectsOnLockedLayers); } } else { foreach (ObjectId id in bref.AttributeCollection) { if (!id.IsErased) { yield return (AttributeReference) trx.GetObject(id, mode, false, openObjectsOnLockedLayers); } } } }
/// <summary> /// Gets the user defined block table records. /// </summary> /// <param name="symbolTbl">The symbol table.</param> /// <param name="trx">The TRX.</param> /// <param name="mode">The mode.</param> /// <returns></returns> public static IEnumerable<BlockTableRecord> GetUserDefinedBlockTableRecords(this BlockTable symbolTbl, Transaction trx, OpenMode mode = OpenMode.ForRead) { return symbolTbl.GetSymbolTableRecords<BlockTableRecord>(trx, mode, SymbolTableRecordFilter.None, true) .UserDefinedBlocks(); }
public FormDepartment(AccessDataBase.Model.DepartmentInfo modelDepartmentInfo, OpenMode openMode) { InitializeComponent(); InitComboBoxCompany(); this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = GetResourcesFile.getSystemIco(); this.modelDepartmentInfo = modelDepartmentInfo; this.openMode = openMode; if (openMode == OpenMode.Add) { kryptonTextBoxDepartmentID.Text = modelDepartmentInfo.DepartmentID.ToString(); } else if (openMode == OpenMode.Update) { string companyName = modelDepartmentInfo.CompanyName;//.CompanyID.HasValue?modelDepartmentInfo.CompanyID.Value:0; modelCompanyInfo = bllCompanyInfo.GetModelList("CompanyName = '" + companyName + "'")[0]; kryptonTextBoxDepartmentID.Text = modelDepartmentInfo.DepartmentID.ToString(); kryptonComboBoxCompany.Text = modelCompanyInfo.CompanyName.ToString() ; kryptonTextBoxDepartmentName.Text = modelDepartmentInfo.DepartmentName.ToString(); kryptonTextBoxDepartmentTel1.Text = modelDepartmentInfo.DepartmentTel1.ToString(); kryptonTextBoxDepartmentTel2.Text = modelDepartmentInfo.DepartmentTel2.ToString(); kryptonTextBoxDepartmentDes.Text = modelDepartmentInfo.DepartmentDes.ToString(); } }
private iPhoneFile(MobileDeviceInstance phone, long handle, OpenMode mode) : base() { this.phone = phone; this.mode = mode; this.handle = handle; }
public FormCompany(AccessDataBase.Model.CompanyInfo companyInfo, OpenMode openMode) { InitializeComponent(); this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = GetResourcesFile.getSystemIco(); this.modelCompanyInfo = companyInfo; this.openMode = openMode; if (openMode == OpenMode.Add) { kryptonTextBoxCompanyID.Text = companyInfo.CompanyID.ToString(); } else if (openMode == OpenMode.Update) { kryptonTextBoxCompanyID.Text = companyInfo.CompanyID.ToString(); kryptonTextBoxCompanyName.Text = companyInfo.CompanyName.ToString(); kryptonTextBoxCompanyDes.Text = companyInfo.CompanyDes.ToString(); kryptonTextBoxCompanyAddr.Text = companyInfo.CompanyAddress.ToString(); kryptonTextBoxTelPhone1.Text = companyInfo.CompanyTel1.ToString(); kryptonTextBoxTelPhone2.Text = companyInfo.CompanyTel2.ToString(); } }
/// <summary> /// Gets the shape file table records. /// </summary> /// <param name="symbolTbl">The symbol table.</param> /// <param name="trx">The TRX.</param> /// <param name="mode">The mode.</param> /// <param name="filter">The filter.</param> /// <returns></returns> public static IEnumerable<TextStyleTableRecord> GetShapeFileTableRecords(this TextStyleTable symbolTbl, Transaction trx, OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None) { return symbolTbl.GetSymbolTableRecords<TextStyleTableRecord>(trx, mode, filter, true) .Where(txt => txt.IsShapeFile); }
/// <summary> /// Constructor /// </summary> public SitePropertiesDialog(OpenMode mode, WebSites Sites, string ActiveSiteKey) { _openMode = mode; _webSites = Sites; _activeSitekey = ActiveSiteKey; InitializeComponent(); }
/// <summary> /// Dims the style table. /// </summary> /// <param name="database">The database.</param> /// <param name="transaction">The transaction.</param> /// <param name="openMode">The openMode.</param> /// <returns>DimStyleTable</returns> /// <exception cref="Exception"></exception> /// <example> /// <code source=".\Content\Samples\Samplescsharp\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.cs" language="cs" region="DimStyleTableTrx" /> /// <code source=".\Content\Samples\Samplesvb\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.vb" language="VB" region="DimStyleTableTrx" /> /// </example> public static DimStyleTable DimStyleTable(this Database database, Transaction transaction, OpenMode openMode = OpenMode.ForRead) { if (transaction == null) { throw new Exception(ErrorStatus.NoActiveTransactions); } return (DimStyleTable)transaction.GetObject(database.DimStyleTableId, openMode, false, false); }
///<overloads> /// <summmary> /// You can not edit a dependent block(a block that is inside from xref) from the referenced drawing. /// The default is not to include dependent blocks since typically you will work on blocks that are contained /// inside the drawing, and it saves time by not opening the DbObject and comparing /// BlockTableRecord.ObjectId.OriginalDatabase.UnmanagedObject to the BlockTable.Database.UnmanagedObject property. /// </summmary> /// </overloads> /// <summary> /// Gets the block table records. /// </summary> /// <param name="symbolTbl">The symbol table.</param> /// <param name="trx">The TRX.</param> /// <param name="mode">The mode.</param> /// <param name="filter"><see cref="SymbolTableRecordFilter"/>.</param> /// <returns>IEnumerable{BlockTableRecord}</returns> public static IEnumerable<BlockTableRecord> GetBlockTableRecords(this BlockTable symbolTbl, Transaction trx, OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None) { if (filter.IsSet(SymbolTableRecordFilter.IncludeDependent)) { return symbolTbl.GetSymbolTableRecords<BlockTableRecord>(trx, mode, filter, true); } return symbolTbl.GetSymbolTableRecords<BlockTableRecord>(trx, mode, filter, true).NonDependent(); }
public FormBook(OpenMode openMode) : base() { this.openMode = openMode; InitializeComponent(); foreach (string cent in Enum.GetNames(typeof(Century))) { this.cbCentury.Items.Add(cent); } this.cbCentury.SelectedIndex = 0; }
public static Handle Open (Uri uri, OpenMode mode) { IntPtr handle = IntPtr.Zero; Result result = gnome_vfs_open_uri (out handle, uri.Handle, mode); if (result != Result.Ok) { Vfs.ThrowException (uri, result); return null; } else { return new Handle (handle); } }
public static Handle Create (Uri uri, OpenMode mode, bool exclusive, FilePermissions perm) { IntPtr handle = IntPtr.Zero; Result result = gnome_vfs_create_uri (out handle, uri.Handle, mode, exclusive, (uint)perm); if (result != Result.Ok) { Vfs.ThrowException (uri, result); return null; } else { return new Handle (handle); } }
/// <summary> /// Gets the extension dictionary. /// </summary> /// <param name="dbObj">The database object.</param> /// <param name="openMode">The open mode.</param> /// <returns> /// The existing extension dictionary or creates and add one if needed. /// use <see cref="HasExtensionDictionary" /> if only checking to see if it exist is needed /// </returns> public static DBDictionary GetExtensionDictionary(this DBObject dbObj, OpenMode openMode = OpenMode.ForRead) { if (!HasExtensionDictionary(dbObj)) { if (!dbObj.IsWriteEnabled) { dbObj.UpgradeOpen(); } dbObj.CreateExtensionDictionary(); } return dbObj.ExtensionDictionary.GetDBObject<DBDictionary>(openMode); }
public FormController(AccessDataBase.Model.ControllerInfo ModelControllerInfo, OpenMode openMode) { InitializeComponent(); doorUnit1.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick1; doorUnit1.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick1; doorUnit1.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick1; doorUnit1.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick1; doorUnit1.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged1; doorUnit1.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged1; doorUnit2.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick1; doorUnit2.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick1; doorUnit2.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick2; doorUnit2.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick2; doorUnit2.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged2; doorUnit2.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged2; doorUnit3.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick1; doorUnit3.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick1; doorUnit3.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick3; doorUnit3.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick3; doorUnit3.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged3; doorUnit3.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged3; doorUnit4.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick4; doorUnit4.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick4; doorUnit4.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick4; doorUnit4.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick4; doorUnit4.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged4; doorUnit4.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged4; this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = GetResourcesFile.getSystemIco(); this.modelControllerInfo = ModelControllerInfo; this.openMode = openMode; for (int i = 0; i < 4;i++ ) arrayDoorUnitInfo[i] = new AccessDataBase.Model.DoorUnitInfo(); if (openMode == OpenMode.Add) { showAddPara(); } else if (openMode == OpenMode.Update) { showUpdatePara(); } }
public FormManager(AccessDataBase.Model.Manager modelManager,OpenMode openMode) { InitializeComponent(); this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.Icon = GetResourcesFile.getSystemIco(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.modelManager = modelManager; this.openMode = openMode; if (openMode == OpenMode.Update) { kryptonTextBoxName.Text = modelManager.ManagerName; kryptonTextBoxName.Enabled = false; } }
public OpenPostForm(OpenMode openMode) { // // Required for Windows Form Designer support // InitializeComponent(); this.buttonOK.Text = Res.Get(StringId.OKButtonText); this.buttonCancel.Text = Res.Get(StringId.CancelButton); this.buttonDelete.Text = Res.Get(StringId.OpenPostDelete) + " "; this.labelOpenPostFrom.Text = Res.Get(StringId.OpenPostOpenFrom); this.labelPosts.Text = Res.Get(StringId.OpenPostItems); this.labelShow.Text = Res.Get(StringId.OpenPostShow); this.radioButtonPosts.Text = Res.Get(StringId.Posts); this.radioButtonPages.Text = Res.Get(StringId.Pages); this.Text = Res.Get(StringId.Open); _openMode = openMode; _includeDrafts = true; _allowDelete = true; listBoxPosts.AccessibleName = Res.Get(StringId.OpenPostItems); // Set up the timer that will be used to track when a user is done typing in the filter box _filterTimer = new Timer(); _filterTimer.Interval = 100; _filterTimer.Tick += new EventHandler(_timer_Tick); // We need to know when the box is refreshing so we can disable the search box listBoxPosts.RefreshBegin += new EventHandler(listBoxPosts_RefreshBegin); // We need to know when it gains or loses focus so we can remove the default text or put it back textBoxFilter.Enter += new EventHandler(textBoxFilter_Enter); textBoxFilter.Leave += new EventHandler(textBoxFilter_Leave); textBoxFilter.KeyDown += new KeyEventHandler(textBoxFilter_KeyDown); textBoxFilter.EnabledChanged += new EventHandler(textBoxFilter_EnabledChanged); filterPictureBox.Image = ResourceHelper.LoadAssemblyResourceBitmap("PostPropertyEditing.CategoryControl.Images.Search.png"); filterPictureBox.BackColor = SystemColors.Window; filterPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; filterPictureBox.BringToFront(); comboBoxPosts.AccessibleName = Res.Get(StringId.PostCountAccessible); }
public FormReaderHoliday(OpenMode openMode, AccessDataBase.Model.ReaderInfo modelReaderInfo, AccessDataBase.Model.ReaderHoliday modelHoliay) { InitializeComponent(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = GetResourcesFile.getSystemIco(); this.CenterToScreen(); this.openMode = openMode; this.modelReaderInfo = modelReaderInfo; this.modelHoliay = modelHoliay; if (openMode == OpenMode.Update) { kryptonDateTimePickerStartDate.Value = Convert.ToDateTime(modelHoliay.ReaderHolidayStartDate); kryptonDateTimePickerEndDate.Value = Convert.ToDateTime(modelHoliay.ReaderHolidayEndDate); } else if(openMode == OpenMode.Add) { } }
public FormCard(AccessDataBase.Model.CardInfo cardInfo, OpenMode openMode) { InitializeComponent(); this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.Icon = GetResourcesFile.getSystemIco(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.modelCardInfo = cardInfo; this.openMode = openMode; if (openMode == OpenMode.Add) { showAddPara(); } else if (openMode == OpenMode.Update) { showUpdatePara(); } }
public FormLogin(OpenMode openMode) { InitializeComponent(); this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = GetResourcesFile.getSystemIco(); initUserInterface(); if (openMode == OpenMode.Unclock) { buttonCancel.Visible = false; comboBoxUserName.Enabled = false; buttonLogin.Location = new Point ((this.Width - buttonLogin.Width) / 2,buttonLogin.Location.Y); } }
public FormReaderInfo(AccessDataBase.Model.ReaderInfo modelReaderInfo, OpenMode openMode) { InitializeComponent(); this.CenterToScreen(); this.MaximizeBox = false; this.MinimizeBox = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = GetResourcesFile.getSystemIco(); this.modelReaderInfo = modelReaderInfo; this.openMode = openMode; for (int i = 0; i < 7; i++) arrarymodelReaderTimeZone[i] = new AccessDataBase.Model.ReaderTimeZone(); if (openMode == OpenMode.Add) { showAddPara(); } else if (openMode == OpenMode.Update) { this.modelReaderInfo = bllReaderInfo.GetModel(modelReaderInfo.ReaderID); showUpdatePara(); } }
/// <summary> /// Opens a folder asynchronously. /// </summary> /// <param name="path">The path.</param> /// <param name="openMode">The open mode. Defaults to Normal.</param> /// <param name="cancellationToken">The cancellation token. Defaults to null.</param> /// <returns>An AFolder task to open a folder. The AFolder represents the folder.</returns> public async Task<AFolder> OpenFolderAsync(string path, OpenMode openMode, CancellationToken? cancellationToken = null) { await AwaitHelpers.CreateTaskScheduler(AwaitHelpers.CheckCancellationToken(cancellationToken)); return OpenFolder(path, openMode); }
/// <summary> /// <see cref="DirectoryTaxonomyWriter(Directory, OpenMode, ITaxonomyWriterCache)"/> /// </summary> /// <exception cref="IOException"></exception> public SnapshotDirectoryTaxonomyWriter(Directory directory, OpenMode openMode, ITaxonomyWriterCache cache) : base(directory, openMode, cache) { }
/// <summary> /// Gets the entities. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="btr">The BTR.</param> /// <param name="mode">The mode.</param> /// <param name="includingErased">if set to <c>true</c> [including erased].</param> /// <param name="openObjectsOnLockedLayers">if set to <c>true</c> [open objects on locked layers].</param> /// <returns></returns> public static IEnumerable <T> GetEntities <T>(this BlockTableRecord btr, OpenMode mode = OpenMode.ForRead, bool includingErased = false, bool openObjectsOnLockedLayers = false) where T : Entity { return(btr.GetEntities <T>(btr.Database.TransactionManager.TopTransaction, mode, includingErased, openObjectsOnLockedLayers)); }
/// <summary> /// Gets the attribute definitions. /// </summary> /// <param name="btr">The BTR.</param> /// <param name="mode">The mode.</param> /// <param name="includingErased">if set to <c>true</c> [including erased].</param> /// <param name="openObjectsOnLockedLayers">if set to <c>true</c> [open objects on locked layers].</param> /// <returns></returns> public static IEnumerable <AttributeDefinition> GetAttributeDefinitions(this BlockTableRecord btr, OpenMode mode = OpenMode.ForRead, bool includingErased = false, bool openObjectsOnLockedLayers = false) { return(btr.GetAttributeDefinitions(btr.Database.TransactionManager.TopTransaction, mode, includingErased, openObjectsOnLockedLayers)); }
internal static FileMode Convert(OpenMode openMode) { return(SessionStateUtilities.GetFileModeFromOpenMode(openMode)); }
/// <summary> /// Dims the style table. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>DimStyleTable</returns> /// <example> /// <code source=".\Content\Samples\Samplescsharp\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.cs" language="cs" region="DimStyleTable" /> /// <code source=".\Content\Samples\Samplesvb\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.vb" language="VB" region="DimStyleTable" /> /// </example> public static DimStyleTable DimStyleTable(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.DimStyleTable(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Dims the style table. /// </summary> /// <param name="database">The database.</param> /// <param name="transaction">The transaction.</param> /// <param name="openMode">The openMode.</param> /// <returns>DimStyleTable</returns> /// <exception cref="Exception"></exception> /// <example> /// <code source=".\Content\Samples\Samplescsharp\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.cs" language="cs" region="DimStyleTableTrx" /> /// <code source=".\Content\Samples\Samplesvb\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.vb" language="VB" region="DimStyleTableTrx" /> /// </example> public static DimStyleTable DimStyleTable(this Database database, Transaction transaction, OpenMode openMode = OpenMode.ForRead) { if (transaction == null) { throw new Exception(ErrorStatus.NoActiveTransactions); } return((DimStyleTable)transaction.GetObject(database.DimStyleTableId, openMode, false, false)); }
/// <summary> /// Linetypes the table. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>LinetypeTable</returns> public static LinetypeTable LinetypeTable(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.LinetypeTable(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Opens file dialog to select file for writing and also opens selected file. Throws exception if file could not be openned. /// </summary> /// <param name="m">Member of Logger.OpenMode enum that specifies if data should be appended to file or overwrite previous data or if user should be asked.</param> /// <param name="pathToFile">Path to file. If its null browse dialog is openned.</param> public void Open(OpenMode m, string pathToFile) { try { //check if path to file has been specified in params and possibly open browse file dialog if (pathToFile != null) { FilePath = pathToFile; } else { SelectFile(); } //If Filepath is still null user has closed browse dialog if (FilePath == null) { return; } //open log file with specified mode if (m == OpenMode.Append) { LogFile = new StreamWriter(FilePath, true); } else if (m == OpenMode.OverWrite) { LogFile = new StreamWriter(FilePath, false); } else if (m == OpenMode.Ask) { if (!IsFileEmpty()) { DialogResult Result = MessageBox.Show("Selected file is not empty. Do you want to overwrite its content?\r\n(No will append text to existing.)", "Confirm overwrite", MessageBoxButtons.YesNoCancel); if (Result == DialogResult.Yes) { LogFile = new StreamWriter(FilePath, false); } else if (Result == DialogResult.No) { LogFile = new StreamWriter(FilePath, true); } else { Enabled = false; return; } } else { LogFile = new StreamWriter(FilePath, true); } } //set enabled flag Enabled = true; } catch { //if exception is thrown during log openning reset enable flag, stop flush timers and throw exception Enabled = false; throw new ApplicationException("Could not open file."); } }
public StorageFile(IStorage baseStorage, OpenMode mode) { BaseStorage = baseStorage; Mode = mode; }
public static Stream AsStream(this IFile file, OpenMode mode, bool keepOpen) => new NxFileStream(file, mode, keepOpen);
/// <summary> /// Opens the specified pagedocument. /// </summary> /// <param name="pageVersionId">The page version id.</param> /// <param name="openMode">The open mode.</param> /// <param name="userUID">The user UID.</param> /// <returns></returns> public static PageDocument Open(int pageVersionId, OpenMode openMode, Guid userUID) { PageDocument pDocument = null; string cacheKey = CmsCache.CreateCacheKey("pagedocument", pageVersionId.ToString(), userUID.ToString()); // Check cache first if (openMode == OpenMode.View) // only use cache in view mode { // check cache first object cachedObject = CmsCache.Get(cacheKey); if (cachedObject != null) { pDocument = (PageDocument)cachedObject; return(pDocument); } } int pageDocumentId = -1; //CHECK using (IDataReader reader = Database.PageDocument.GetByPageVersionId(pageVersionId)) { //EXIST PD if (reader.Read()) { pageDocumentId = (int)reader["PageId"]; } //CREATE NEW PD else { pageDocumentId = Database.PageDocument.Add(pageVersionId); Database.Node.Add(pageDocumentId, (int)Database.NodeType.Type.StaticNode, "StaticNode", "", "", "", 0); } reader.Close(); } if (pageDocumentId > 0) { switch (openMode) { case OpenMode.Design: //load from temp storage pDocument = _temporaryDocumentStorage.Load(pageVersionId, userUID); //create temp page document if (pDocument == null && pageVersionId == -2) { pDocument = new PageDocument(); pDocument.PageVersionId = -2; } //load from persist storage if (pDocument == null) { pDocument = _persistentDocumentStorage.Load(pageVersionId, Guid.Empty); } break; case OpenMode.View: pDocument = _persistentDocumentStorage.Load(pageVersionId, Guid.Empty); // Insert to the cache collection CmsCache.Insert(cacheKey, pDocument, CmsConfiguration.Instance.Cache.PageDocumentTimeout); break; default: throw new ArgumentNullException(); } //_current = pDocument; return(pDocument); } return(null); }
/// <summary> /// <see cref="DirectoryTaxonomyWriter(Directory, OpenMode)"/> /// </summary> /// <exception cref="IOException"></exception> public SnapshotDirectoryTaxonomyWriter(Directory directory, OpenMode openMode = OpenMode.CREATE_OR_APPEND) : base(directory, openMode) { }
/// <summary> /// Gets the entries. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="dic">The dic.</param> /// <param name="mode">The mode.</param> /// <param name="includingErased">if set to <c>true</c> [including erased].</param> /// <returns></returns> public static IEnumerable <DBDictionaryEntry> GetEntries(this DBDictionary dic, OpenMode mode = OpenMode.ForRead, bool includingErased = false) { return(dic.GetEntries(dic.Database.TransactionManager.TopTransaction, mode, includingErased)); }
/// <summary> /// ms the leader style database dictionary. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the DbDictionary for MLeaderStyles</returns> public static DBDictionary MLeaderStyleDBDictionary(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.MLeaderStyleDBDictionary(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Viewports the table. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>ViewportTable</returns> public static ViewportTable ViewportTable(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.ViewportTable(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Layouts the dictionary. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <param name="includingErased">if set to <c>true</c> [including erased].</param> /// <returns></returns> public static LayoutDictionary LayoutDictionary(this Database database, OpenMode openMode = OpenMode.ForRead, bool includingErased = false) { return(database.LayoutDictionary(database.TransactionManager.TopTransaction, openMode, includingErased)); }
/// <summary> /// Author: Tony Tanzillo /// Source: http://www.theswamp.org/index.php?topic=41311.msg464457#msg464457 /// </summary> /// <param name="database">The database.</param> /// <param name="transaction">The transaction.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the BlockTableRecord for "ModelSpace"</returns> /// <exception cref="Exception"></exception> public static BlockTableRecord ModelSpace(this Database database, Transaction transaction, OpenMode openMode = OpenMode.ForRead) { if (transaction == null) { throw new Exception(ErrorStatus.NoActiveTransactions); } return((BlockTableRecord)transaction.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(database), openMode, false, false)); }
private iPhoneFile(iTMDiPhone phone, long handle, OpenMode mode) { this.phone = phone; this.mode = mode; this.handle = handle; }
/// <summary> /// Author: Tony Tanzillo /// Source: http://www.theswamp.org/index.php?topic=41311.msg464457#msg464457 /// </summary> /// <param name="database">The database.</param> /// <param name="transaction">The transaction.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the BlockTableRecord for the database's Current Space</returns> /// <exception cref="Exception"></exception> public static BlockTableRecord CurrentSpace(this Database database, Transaction transaction, OpenMode openMode = OpenMode.ForRead) { if (transaction == null) { throw new Exception(ErrorStatus.NoActiveTransactions); } return((BlockTableRecord)transaction.GetObject(database.CurrentSpaceId, openMode, false, false)); }
public static IFile AsFile(this IStorage storage, OpenMode mode) => new StorageFile(storage, mode);
/// <summary> /// Currents the space. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the BlockTableRecord for the database's Current Space</returns> public static BlockTableRecord CurrentSpace(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.CurrentSpace(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Gets the attribute definitions. /// </summary> /// <param name="btr">The BTR.</param> /// <param name="trx">The TRX.</param> /// <param name="mode">The mode.</param> /// <param name="includingErased">if set to <c>true</c> [including erased].</param> /// <param name="openObjectsOnLockedLayers">if set to <c>true</c> [open objects on locked layers].</param> /// <returns></returns> public static IEnumerable <AttributeDefinition> GetAttributeDefinitions(this BlockTableRecord btr, Transaction trx, OpenMode mode = OpenMode.ForRead, bool includingErased = false, bool openObjectsOnLockedLayers = false) { return(btr.GetEntities <AttributeDefinition>(trx, mode, includingErased, openObjectsOnLockedLayers)); }
private void DumpUnclosedAccessorList(OpenMode fileOpenModeMask, OpenDirectoryMode directoryOpenModeMask) { // Todo: Implement }
/// <summary> /// Gets a folder. /// </summary> /// <param name="path">The path.</param> /// <param name="openMode">The open mode. Defaults to Normal.</param> /// <returns>The folder.</returns> /// <exception cref="System.NotImplementedException"> /// Exception representing that this function is not implemented. /// </exception> public virtual AFolder OpenFolder(string path, OpenMode openMode) { throw new NotImplementedException(); }
/// <summary> /// Opens specified archive using the specified mode. /// </summary> /// <param name="archivePathName">Path of archive to open</param> /// <param name="openMode">Mode in which to open archive</param> public void Open(string archivePathName, OpenMode openMode) { IntPtr handle = IntPtr.Zero; // Close any previously open archives if (this.archiveHandle != IntPtr.Zero) { this.Close(); } // Prepare extended open archive struct this.ArchivePathName = archivePathName; RAROpenArchiveDataEx openStruct = new RAROpenArchiveDataEx(); openStruct.Initialize(); openStruct.ArcName = this.archivePathName + "\0"; openStruct.ArcNameW = this.archivePathName + "\0"; openStruct.OpenMode = (uint)openMode; if (this.retrieveComment) { openStruct.CmtBuf = new string((char)0, 65536); openStruct.CmtBufSize = 65536; } else { openStruct.CmtBuf = null; openStruct.CmtBufSize = 0; } // Open archive handle = Unrar.RAROpenArchiveEx(ref openStruct); // Check for success if (openStruct.OpenResult != 0) { switch ((RarError)openStruct.OpenResult) { case RarError.InsufficientMemory: throw new OutOfMemoryException("Insufficient memory to perform operation."); case RarError.BadData: throw new IOException("Archive header broken"); case RarError.BadArchive: throw new IOException("File is not a valid archive."); case RarError.OpenError: throw new IOException("File could not be opened."); } } // Save handle and flags this.archiveHandle = handle; this.archiveFlags = (ArchiveFlags)openStruct.Flags; // Set callback Unrar.RARSetCallback(this.archiveHandle, this.callback, this.GetHashCode()); // If comment retrieved, save it if (openStruct.CmtState == 1) { this.comment = openStruct.CmtBuf.ToString(); } // If password supplied, set it if (this.password.Length != 0) { Unrar.RARSetPassword(this.archiveHandle, this.password); } // Fire NewVolume event for first volume this.OnNewVolume(this.archivePathName); }
/// <summary> /// Nameds the object database dictionary. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the DbDictionary that is the Named Object Dictionary</returns> public static DBDictionary NamedObjectDBDictionary(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.NamedObjectDBDictionary(database.TransactionManager.TopTransaction, openMode)); }
public MemoryFile(OpenMode mode, MemoryStreamAccessor buffer) { BaseStream = buffer; Mode = mode; }
/// <summary> /// Groups the database dictionary. /// </summary> /// <param name="database">The database.</param> /// <param name="transaction">The transaction.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the DbDictionary for Groups</returns> /// <exception cref="Exception"></exception> public static DBDictionary GroupDBDictionary(this Database database, Transaction transaction, OpenMode openMode = OpenMode.ForRead) { if (transaction == null) { throw new Exception(ErrorStatus.NoActiveTransactions); } return((DBDictionary)transaction.GetObject(database.GroupDictionaryId, openMode, false, false)); }
/// <summary> /// Opens the BlockTable /// </summary> /// <param name="database">The database.</param> /// <param name="mode">The mode.</param> /// <returns>BlockTable</returns> /// <exception cref="Exception"></exception> /// <example> /// <code source=".\Content\Samples\Samplescsharp\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.cs" language="cs" region="BlockTable" /> /// <code source=".\Content\Samples\Samplesvb\AcDbMgdExtensions\DatabaseServices\DatabaseExtensionsCommands.vb" language="VB" region="BlockTable" /> /// </example> public static BlockTable BlockTable(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.BlockTable(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Gets a folder. /// </summary> /// <param name="directory">The directory.</param> /// <param name="folder">The folder.</param> /// <param name="openMode">The open mode. Defaults to Normal.</param> /// <returns>The folder.</returns> /// <exception cref="System.NotImplementedException"> /// Exception representing that this function is not implemented. /// </exception> public virtual AFolder OpenFolder(AFolder directory, string folder, OpenMode openMode) { throw new NotImplementedException(); }
/// <summary> /// Plots the settings database dictionary. /// </summary> /// <param name="database">The database.</param> /// <param name="openMode">The openMode.</param> /// <returns>Returns the DbDictionary for PlotSettings</returns> public static DBDictionary PlotSettingsDBDictionary(this Database database, OpenMode openMode = OpenMode.ForRead) { return(database.PlotSettingsDBDictionary(database.TransactionManager.TopTransaction, openMode)); }
/// <summary> /// Opens a folder asynchronously. /// </summary> /// <param name="directory">The directory.</param> /// <param name="folder">The folder.</param> /// <param name="openMode">The open mode. Defaults to Normal.</param> /// <param name="cancellationToken">The cancellation token. Defaults to null.</param> /// <returns>An AFolder task to open a folder. The AFolder represents the folder.</returns> public async Task<AFolder> OpenFolderAsync(AFolder directory, string folder, OpenMode openMode, CancellationToken? cancellationToken = null) { await AwaitHelpers.CreateTaskScheduler(AwaitHelpers.CheckCancellationToken(cancellationToken)); return OpenFolder(directory, folder, openMode); }
public static IFile AsIFile(this Stream stream, OpenMode mode) => new StreamFile(stream, mode);