Ejemplo n.º 1
0
        public static void deleteErrorLog(bool bool_0)
        {
            string str = string.Concat(CErrorLog.m_ErrorLogFullPath, CErrorLog.m_ErrorLogFileName, ".log");

            try
            {
                if (File.Exists(str))
                {
                    if (bool_0)
                    {
                        CErrorLog.backupErrorLog();
                    }
                    File.Delete(str);
                }
            }
            catch (Exception exception)
            {
                Trace.WriteLine(exception);
            }
        }
Ejemplo n.º 2
0
        public static ITable OpenTable(string string_0)
        {
            ITable table;
            string string0;
            string str;
            object obj;
            object obj1;

            try
            {
                if (!AppConfigInfo.m_Init)
                {
                    AppConfigInfo.m_pFeatureWorkspace = AppConfigInfo.GetWorkspace() as IFeatureWorkspace;
                    if (AppConfigInfo.m_pFeatureWorkspace != null)
                    {
                        AppConfigInfo.m_Init = true;
                    }
                }
                if (AppConfigInfo.m_pFeatureWorkspace != null)
                {
                    string0 = string_0;
                    if ((AppConfigInfo.m_pFeatureWorkspace as IWorkspace).Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                    {
                        str = "";
                        try
                        {
                            object property = (AppConfigInfo.m_pFeatureWorkspace as IWorkspace).ConnectionProperties.GetProperty("VERSION");
                            str = property.ToString();
                            string[] strArrays = str.Split(new char[] { '.' });
                            str = ((int)strArrays.Length <= 1 ? "" : strArrays[0]);
                        }
                        catch (Exception exception)
                        {
                        }
                        if (AppConfigInfo.m_pFeatureWorkspace is ISQLSyntax)
                        {
                            string0 = (AppConfigInfo.m_pFeatureWorkspace as ISQLSyntax).QualifyTableName(AppConfigInfo.SDEDatabase, str, string_0);
                        }
                    }
                    table = AppConfigInfo.m_pFeatureWorkspace.OpenTable(string0);
                    return(table);
                }
                else
                {
                    table = null;
                    return(table);
                }
            }
            catch (Exception exception1)
            {
                CErrorLog.writeErrorLog(null, exception1, "");
            }
            try
            {
                string0 = string_0;
                if ((AppConfigInfo.m_pFeatureWorkspace as IWorkspace).Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    str = "DBO";
                    if (AppConfigInfo.m_pFeatureWorkspace is ISQLSyntax)
                    {
                        string0 = (AppConfigInfo.m_pFeatureWorkspace as ISQLSyntax).QualifyTableName(AppConfigInfo.SDEDatabase, str, string_0);
                    }
                }
                (AppConfigInfo.m_pFeatureWorkspace as IWorkspace).ConnectionProperties.GetAllProperties(out obj, out obj1);
                table = AppConfigInfo.m_pFeatureWorkspace.OpenTable(string0);
                return(table);
            }
            catch (Exception exception2)
            {
                CErrorLog.writeErrorLog(null, exception2, "");
            }
            table = null;
            return(table);
        }
Ejemplo n.º 3
0
        public static IWorkspace GetWorkspace()
        {
            IWorkspaceFactory sdeWorkspaceFactoryClass;
            IWorkspace        mPWorkspace;
            Exception         exception;

            if (!AppConfigInfo.m_IsCreate)
            {
                AppConfigInfo.m_IsCreate = true;
                string upper = AppConfigInfo.dbclient.ToUpper();
                if (!(upper == "SQLSERVER" ? false : !(upper == "ORACLE")))
                {
                    sdeWorkspaceFactoryClass = new SdeWorkspaceFactoryClass();
                    try
                    {
                        IPropertySet propertySet = AppConfigInfo.CreateSdePropertySet();
                        if (propertySet != null)
                        {
                            AppConfigInfo.m_pWorkspace = sdeWorkspaceFactoryClass.Open(propertySet, 0);
                        }
                        else
                        {
                            mPWorkspace = null;
                            return(mPWorkspace);
                        }
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        CErrorLog.writeErrorLog(null, exception, "");
                    }
                }
                else if (upper != "MDB")
                {
                    try
                    {
                        if ((AppConfigInfo.m_LayerConfigDB.Length <= 0 ? false : File.Exists(AppConfigInfo.m_LayerConfigDB)))
                        {
                            sdeWorkspaceFactoryClass   = new FileGDBWorkspaceFactoryClass();
                            AppConfigInfo.m_pWorkspace = sdeWorkspaceFactoryClass.OpenFromFile(AppConfigInfo.m_LayerConfigDB, 0);
                        }
                    }
                    catch (Exception exception2)
                    {
                        exception = exception2;
                        MessageBox.Show(exception.Message);
                        CErrorLog.writeErrorLog(null, exception, "");
                    }
                }
                else
                {
                    try
                    {
                        if ((AppConfigInfo.m_LayerConfigDB.Length <= 0 ? false : File.Exists(AppConfigInfo.m_LayerConfigDB)))
                        {
                            sdeWorkspaceFactoryClass   = new AccessWorkspaceFactoryClass();
                            AppConfigInfo.m_pWorkspace = sdeWorkspaceFactoryClass.OpenFromFile(AppConfigInfo.m_LayerConfigDB, 0);
                        }
                    }
                    catch (Exception exception3)
                    {
                        exception = exception3;
                        MessageBox.Show(exception.Message);
                        CErrorLog.writeErrorLog(null, exception, "");
                    }
                }
            }
            mPWorkspace = AppConfigInfo.m_pWorkspace;
            return(mPWorkspace);
        }
Ejemplo n.º 4
0
 static CErrorLog()
 {
     CErrorLog.old_acctor_mc();
 }