Ejemplo n.º 1
0
        getFileStatus(string name, out string nameUser)
        {
            nameUser = "";
            DocumentCollection acadDocs = BaseObjs._acadDocs;

            foreach (Document acadDoc in acadDocs)
            {
                if (acadDoc.Name == name)
                {
                    FileInfo fInfo = new FileInfo(acadDoc.Name);
                    if (fInfo.IsReadOnly)
                    {
                        return((int)filestatus.isOpenLocalReadOnly);
                    }
                    return((int)filestatus.isOpenLocal);
                }
            }
            Autodesk.AutoCAD.ApplicationServices.WhoHasInfo whoHasInfo = Autodesk.AutoCAD.ApplicationServices.Application.GetWhoHasInfo(name);
            if (whoHasInfo.IsFileLocked)
            {
                nameUser = whoHasInfo.UserName;
                return((int)filestatus.isLocked);
            }
            return((int)filestatus.isAvailable);
        }
Ejemplo n.º 2
0
        getFileStatus(string name)
        {
            DocumentCollection acadDocs = BaseObjs._acadDocs;

            foreach (Document acadDoc in acadDocs)
            {
                if (acadDoc.Name == name)
                {
                    FileInfo fInfo = new FileInfo(acadDoc.Name);
                    if (fInfo.IsReadOnly)
                    {
                        MessageBox.Show("Target file is already open on this machine as READONLY - close file and retry.  Exiting....");
                        return((int)filestatus.isOpenLocalReadOnly);
                    }
                    return((int)filestatus.isOpenLocal);
                }
            }
            Autodesk.AutoCAD.ApplicationServices.WhoHasInfo whoHasInfo = Autodesk.AutoCAD.ApplicationServices.Application.GetWhoHasInfo(name);
            if (whoHasInfo.IsFileLocked)
            {
                MessageBox.Show(string.Format("User: {0} has target file: {1} open. Exiting...", whoHasInfo.UserName, name));
                return((int)filestatus.isLocked);
            }
            return((int)filestatus.isAvailable);
        }