Exemple #1
0
        // General program startup initialization routines.
        // Returns true if initialization was successful, false otherwise.
        private static bool init()
        {
            // initialize logging support for reporting program errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // save an unhandled exception in log file before program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            Task <string> prncpl = AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl.Result))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our class variables from Stranded.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }
            // initialize our logging support to log stranded elements found
            if (!initStrandedFoundLogging())
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        // General program startup initialization.
        private static bool init()
        {
            // initialize our logging support so we can log errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // save an unhandled exception in log file before program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            Task <string> prncpl = AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl.Result))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our class variables from LatestPromotions.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }

            // dynamic streams only in select depots
            _depots = new AcDepots(dynamicOnly: true);
            Task <bool> dini = _depots.initAsync(_selDepots);

            // no group membership initialization, include deactivated users
            _users = new AcUsers(_domains, _properties, includeGroupsList: false, includeDeactivated: true);
            Task <bool> uini = _users.initAsync();

            Task <bool[]> all = Task.WhenAll(dini, uini); // finish initializing both lists in parallel

            if (all == null || all.Result.Any(n => n == false))
            {
                return(false);
            }

            return(true);
        }
        // General program startup initialization. Returns true if initialization succeeded, false otherwise.
        private static bool init()
        {
            // initialize our logging support so we can log errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // in the event of an unhandled exception, save it to our log file before the program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            Task <string> prncpl = AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl.Result))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our class variables from PromoCount.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }
            // initialize our logging support for program results
            if (!initPromoCountResultsLogging())
            {
                return(false);
            }

            _users  = new AcUsers(_domains, null, includeGroupsList: false, includeDeactivated: true);
            _depots = new AcDepots(dynamicOnly: true);
            Task <bool[]> lists = Task.WhenAll(_depots.initAsync(_selDepots), _users.initAsync());

            if (lists == null || lists.Result.Any(n => n == false))
            {
                return(false);
            }

            return(true);
        }
        // General program startup initialization. Returns true if the operation succeeded, false otherwise.
        private static bool init()
        {
            try
            {
                // ensure we're logged into AccuRev
                Task<string> prncpl = AcQuery.getPrincipalAsync();
                if (String.IsNullOrEmpty(prncpl.Result))
                {
                    Console.WriteLine($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                    return false;
                }

                if (!isCurrDirInWSpace())
                {
                    Console.WriteLine($"No workspace found for location {Environment.CurrentDirectory}");
                    return false;
                }

                char[] sep = new char[] { };
                string temp = AcQuery.getAppConfigSetting<string>("SkipOver").Trim();
                if (!String.IsNullOrEmpty(temp))
                    _skipOver = temp.Split(sep);
                else
                    _skipOver = new string[] { };
            }

            catch (ConfigurationErrorsException exc)
            {
                Process currentProcess = Process.GetCurrentProcess();
                ProcessModule pm = currentProcess.MainModule;
                Console.WriteLine($"Invalid data in {pm.ModuleName}.config{Environment.NewLine}{exc.Message}");
            }

            catch (Exception ecx)
            {
                Console.WriteLine($"Exception caught in Program.init{Environment.NewLine}{ecx.Message}");
            }

            return true;
        }
        // General program startup initialization.
        private static bool init()
        {
            // initialize our logging support so we can log errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // in the event of an unhandled exception, save it to our log file before the program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            Task <string> prncpl = AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl.Result))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our ElementType array class variable from XLinked.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }

            _depots = new AcDepots(dynamicOnly: true); // dynamic streams only
            Task <bool> dini = _depots.initAsync();

            if (!dini.Result)
            {
                AcDebug.Log($"Depots list initialization failed. See log file:{Environment.NewLine}" +
                            $"{AcDebug.getLogFile()}");
                return(false);
            }

            return(true);
        }
        // General program startup initialization. Returns true if initialization was successful, false otherwise.
        private static bool init()
        {
            // initialize our logging support so we can log errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // save an unhandled exception in log file before program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            Task <string> prncpl = AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl.Result))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our depots list class variable with select depots from WSpaceTransLevel.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }

            // initialize our workspaces list class variable
            Task <bool> wslist = initWSListAsync();

            if (!wslist.Result)
            {
                AcDebug.Log($"Workspaces list initialization failed. See log file:{Environment.NewLine}{AcDebug.getLogFile()}");
                return(false);
            }

            return(true);
        }
Exemple #7
0
        // General program startup initialization.
        private static async Task <bool> initAsync()
        {
            // initialize our logging support so we can log errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // in the event of an unhandled exception, save it to our log file before the program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            string prncpl = await AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our depots list class variable from PromoRights.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }

            _users = new AcUsers(null, null, includeGroupsList: true);
            _locks = new AcLocks();
            bool[] arr = await Task.WhenAll(
                _users.initAsync(),       // all users with their respective group membership list initialized
                _locks.initAsync(_depots) // locks on all streams in select depots from PromoRights.exe.config
                );

            return(arr != null && arr.All(n => n == true));
        }
Exemple #8
0
        // General program initialization routines. Returns true if initialization was successful, false otherwise.
        private static bool init()
        {
            // initialize our logging support so we can log errors
            if (!AcDebug.initAcLogging())
            {
                Console.WriteLine("Logging support initialization failed.");
                return(false);
            }

            // save an unhandled exception in log file before program terminates
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AcDebug.unhandledException);

            // ensure we're logged into AccuRev
            Task <string> prncpl = AcQuery.getPrincipalAsync();

            if (String.IsNullOrEmpty(prncpl.Result))
            {
                AcDebug.Log($"Not logged into AccuRev.{Environment.NewLine}Please login and try again.");
                return(false);
            }

            // initialize our class variables from LatestTransactions.exe.config
            if (!initAppConfigData())
            {
                return(false);
            }

            // list of all depot names in the repository
            _depots = AcQuery.getDepotNameListAsync().Result;
            if (_depots == null)
            {
                return(false);
            }

            return(true);
        }