Exemplo n.º 1
0
        public static bool Start(bool callReplaceFiles)
        {
            if (callReplaceFiles)
            {
                Local.ReplaceFiles();
            }
            else
            {
                ExclusiveLocker replaceLock = new ExclusiveLocker();
                replaceLock.id = Local.ReplaceLockId;
                try
                {
                    if (!replaceLock.Lock(2000))
                    {
                        return(false);
                    }
                }
                finally
                {
                    replaceLock.Dispose();
                }
            }
            InitLocalFiles();
            int startCount = RemoteFile.Start(localFiles);

            return(startCount <= 0);  // true for gui
        }
Exemplo n.º 2
0
        public static void KillApp(bool killSelf, bool unregister)
        {
            ArrayList files     = null;
            ArrayList filesAsoc = new ArrayList();

            try
            {
                files = RemoteFile.Load(Config.Default.GetFileListPath(false), ref filesAsoc);
            }
            catch (Exception xx) { Utils.OnError(xx); }
            RemoteFile.Start(files, true);
            if (unregister)
            {
                try
                {
                    FileAssoc.Register(filesAsoc, false);
                }
                catch (Exception xx) { Utils.OnError(xx); }
            }
            if (killSelf)
            {
                Utils.KillProcess(Path.GetFileNameWithoutExtension(Application.ExecutablePath));
            }
        }