Esempio n. 1
0
 private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
 {
     e.Handled = true;
     ShutdownApplication("Unhandled exception", e.Exception);
     WC?.Dispose();
     ClearTemp();
 }
Esempio n. 2
0
    void FixedUpdate()
    {
        if (target != null && !attacking && !RunningThisRoutine(fleeing))
        {
            Vector2        vectorToTarget = Vector2.zero;
            RaycastHit2D[] hits           = new RaycastHit2D[raycastDepth];
            Physics2D.RaycastNonAlloc(WC.transform.position, target.transform.position - transform.position, hits, aggroRange, collideLayerMask);
            string hitTag      = null;
            bool   hitIsTarget = false;
            foreach (RaycastHit2D hit in hits)
            {
                // go through hits from closest to farthest
                if (hit.collider != null && hit.fraction != 0)
                {
                    hitTag         = hit.collider.tag;
                    vectorToTarget = hit.point - (Vector2)transform.position;

                    // if the tag of this object is a target, then we will target this one since it is the closest
                    foreach (string tag in targetTags)
                    {
                        if (tag == hitTag)
                        {
                            hitIsTarget = true;
                            break;
                        }
                    }

                    if (hitIsTarget)
                    {
                        break;
                    }
                }
            }

            if (vectorToTarget != Vector2.zero)
            {
                if (vectorToTarget.magnitude < aggroRange) // if within aggro range
                {
                    if (vectorToTarget.magnitude > attackRange || vectorToTarget.magnitude > tooFarThreshold)
                    {
                        Move(vectorToTarget);
                        WC.AimInDirection(vectorToTarget);
                    }
                    else if (vectorToTarget.magnitude < tooCloseThreshold && hitIsTarget)
                    {
                        fleeing = MoveTo(vectorToTarget.normalized * -1 * Mathf.Abs(followDistance - vectorToTarget.magnitude));
                        WC.AimInDirection(-vectorToTarget);
                    }
                    else if (Time.time - lastAttackTime > attackCooldownLength && vectorToTarget.magnitude < attackRange && hitIsTarget)
                    {
                        if (WC.CanFire())
                        {
                            StartCoroutine(ShootAttack(vectorToTarget, attackChargeTime, postAttackPauseDuration));
                        }
                    }
                }
            }
            spriteDirection = vectorToTarget;
        }
    }
        public clsMouse(IntPtr hWnd)
        {
            this._hWnd = hWnd;
            WC.GetWindowRect(hWnd, out this._rctWindow);
            WC.GetClientRect(hWnd, out this._rctClient);
            this._isFullWindowed = this._rctClient.Equals(this._rctWindow);
            if (WC.GetSystemMetrics(WC.SystemMetric.SM_SWAPBUTTON) == 0)
            {
                this._MOUSEEVENTF_PRIMARYDOWN   = 2;
                this._MOUSEEVENTF_PRIMARYUP     = 4;
                this._MOUSEEVENTF_SECONDARYDOWN = 8;
                this._MOUSEEVENTF_SECONDARYUP   = 0x10;
            }
            else
            {
                this._MOUSEEVENTF_PRIMARYDOWN   = 8;
                this._MOUSEEVENTF_PRIMARYUP     = 0x10;
                this._MOUSEEVENTF_SECONDARYDOWN = 2;
                this._MOUSEEVENTF_SECONDARYUP   = 4;
            }
            int x = this._rctWindow.Left + WC.GetSystemMetrics(WC.SystemMetric.SM_CXFRAME);
            int y = (this._rctWindow.Top + WC.GetSystemMetrics(WC.SystemMetric.SM_CYFRAME)) + WC.GetSystemMetrics(WC.SystemMetric.SM_CYCAPTION);

            this._clientRectStart = new Point(x, y);
        }
Esempio n. 4
0
        private static float ComboDamage(Obj_AI_Base hero)
        {
            var dmg = 0d;

            if (ObjectManager.Player.GetSpellSlot("SummonerIgnite") != SpellSlot.Unknown)
            {
                dmg += Player.GetSummonerSpellDamage(hero, Damage.SummonerSpell.Ignite);
            }
            if (Items.HasItem(3153) && Items.CanUseItem(3153))
            {
                dmg += Player.GetItemDamage(hero, Damage.DamageItems.Botrk);
            }
            if (Items.HasItem(3144) && Items.CanUseItem(3144))
            {
                dmg += Player.GetItemDamage(hero, Damage.DamageItems.Bilgewater);
            }
            if (QC.IsReady())
            {
                dmg += Player.GetSpellDamage(hero, SpellSlot.Q);
            }
            if (EC.IsReady())
            {
                dmg += Player.GetSpellDamage(hero, SpellSlot.E);
            }
            if (WC.IsReady())
            {
                dmg += Player.GetSpellDamage(hero, SpellSlot.W);
            }
            if (Q.IsReady() && !IsCougar)
            {
                dmg += Player.GetSpellDamage(hero, SpellSlot.Q);
            }
            return((float)dmg);
        }
Esempio n. 5
0
 public WeaponController AttackFuntcion(WeaponController[] _weapons, HealthController _health, float _distance, float _time)
 {
     if (Time.time > _time)
     {
         List <WeaponController> inReach = new List <WeaponController> ();
         for (int i = 0; i < _weapons.Length; i++)
         {
             if (_weapons[i].GetReach() > _distance)
             {
                 inReach.Add(_weapons [i]);
             }
         }
         List <WeaponController> canAfford = new List <WeaponController> ();
         foreach (WeaponController WC in inReach)
         {
             if (WC.GetManaCost() < _health.GetCurrentMana())
             {
                 canAfford.Add(WC);
             }
         }
         WeaponController selectedAttack  = null;
         float            highestCooldown = 0;
         foreach (WeaponController WC in canAfford)
         {
             if (WC.GetAttackCoolDown() > highestCooldown)
             {
                 selectedAttack = WC;
             }
         }
         return(selectedAttack);
     }
     return(null);
 }
Esempio n. 6
0
        /// <summary>
        /// Downloads all required files using asynchoronous operations.
        /// </summary>
        /// <exception cref="WebException"></exception>
        /// <exception cref="ArgumentException"></exception>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="InvalidDataContractException"></exception>
        /// <exception cref="SerializationException"></exception>
        public void DownloadUpdate()
        {
            if (!updInfo.Loaded)
            {
                throw new ArgumentException("Error: attempting to download update whereas no update information available");
            }

            int filesCount = updInfo.FilePath.Length == updInfo.FileURL.Length ? (updInfo.FileURL.Length == updInfo.MD5.Length ? updInfo.MD5.Length : 0) : 0;

            if (filesCount == 0)
            {
                throw new ArgumentException("Error: update information is corrupted or incomplete");
            }

            using (FileStream fs = new FileStream(updateInfoFilePath, FileMode.Create))
            {
                jsonSerializer.WriteObject(fs, updInfo);
                fs.Flush();
            }

            wipCount = filesCount;
            for (int i = 0; i < filesCount; ++i)
            {
                WC.DownloadDataAsync(new Uri(rawUrl + updInfo.FileURL[i]), i);
            }
        }
Esempio n. 7
0
        public void BaseCountTest1()
        {
            WC w = new WC();

            w.BaseCount("dgsjssk\n");
            Assert.AreEqual(w.Charcount, 8);
        }
Esempio n. 8
0
        private static void Farm()
        {
            foreach (
                Obj_AI_Minion Minion in
                    ObjectManager.Get<Obj_AI_Minion>()
                        .Where(
                            minion =>
                                minion.Team != Player.Team && !minion.IsDead &&
                                Vector2.Distance(minion.ServerPosition.To2D(), Player.ServerPosition.To2D()) < 600f)
                        .OrderBy(minion => Vector2.Distance(minion.Position.To2D(), Player.Position.To2D())))
            {
                if (IsCougar)
                {
                    if (QC.IsReady() && Config.Item("UseQLane").GetValue<bool>() && Player.Distance(Minion) < QC.Range)
                        QC.Cast();
                    else if (WC.IsReady() && Config.Item("UseWLane").GetValue<bool>() && Player.Distance(Minion) > 200f)
                        WC.Cast(Minion);
                    else if (EC.IsReady() && Config.Item("UseELane").GetValue<bool>() &&
                             Player.Distance(Minion) < EC.Range)
                        EC.Cast(Minion);
                }

                else if (R.IsReady() && Config.Item("farm_R").GetValue<KeyBind>().Active)
                    R.Cast();
                else if (E.IsReady() && !Config.Item("farm_R").GetValue<KeyBind>().Active &&
                         Config.Item("farm_E1").GetValue<bool>() &&
                         (100*(Player.Mana/Player.MaxMana)) > Config.Item("Lane").GetValue<Slider>().Value)
                    E.CastOnUnit(Player);
                return;
            }
        }
Esempio n. 9
0
        public void CountWordsTest()
        {
            WC w = new WC();

            w.CountWords("nerer live upppp nerer live live hhkp", 3);
            Assert.AreEqual(w.putout2.Count, 3);
        }
Esempio n. 10
0
    public void CalcWC()
    {
        wcArray = GameObject.FindObjectsOfType <WC>();
        wcCount = wcArray.Length;

        float minimalDistance = 1000;

        foreach (var item in wcArray)
        {
            if (!item.occupied)
            {
                float distance = Vector3.Distance(item.transform.position, transform.position);

                if (distance < minimalDistance && item.userQueue == null)
                {
                    cantFindWC        = false;
                    minimalDistanceWC = item;
                    minimalDistance   = distance;
                    item.userQueue    = gameObject;
                }
            }
            else if (item.userQueue == gameObject)
            {
                return;
            }
            else
            {
                //все занято, или нет ни одной
                minimalDistanceWC = null;
                lookingFor        = null;
                ai.target         = null;
                ai.agent.ResetPath();
            }
        }
    }
        public static DateTime GetLastDumpDate(string wiki)
        {
            string directoryListing = null;

            while (directoryListing == null)
            {
                try
                {
                    directoryListing = WC.DownloadString(DumpsUrl + wiki + '/');
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            directoryListing = directoryListing.Replace("&nbsp;", " ");

            XNamespace ns = "http://www.w3.org/1999/xhtml";

            // to make sure DTDs are not downloaded
            var xmlReader = XmlReader.Create(
                new StringReader(directoryListing),
                new XmlReaderSettings {
                XmlResolver = null, DtdProcessing = DtdProcessing.Ignore
            });

            XDocument doc = XDocument.Load(xmlReader);

            return((from elem in doc.Descendants(ns + "a")
                    select DateTimeExtensions.ParseDate(elem.Value)
                    into date
                    where date != null
                    select date.Value).Max());
        }
Esempio n. 12
0
        // Gets the next avilable connection
        // Should be thread safe
        // Note that with the lock, if something goes wrong nothing can download for upwards of ten minutes
        public WC GetNext()
        {
            x
            lock (_lock) {
                for (int i = 0; i < DEFAULT_MAX_ATTEMPTS; i++)
                {
                    for (int j = this.Last + 1; j < this.Count; j++)
                    {
                        WC current = this.Pool[j];
                        if (!current.InUse)
                        {
                            current.InUse = true;
                            this.Last     = j;
                            return(current);
                        }
                    }

                    for (int j = 0; j < this.Last + 1; j++)
                    {
                        WC current = this.Pool[j];
                        if (!current.InUse)
                        {
                            current.InUse = true;
                            this.Last     = j;
                            return(current);
                        }
                    }

                    App.Wait(DEFAULT_WAIT_TIME);
                }
            }

            throw new Exception("Maximum number of attempts, " + DEFAULT_MAX_ATTEMPTS + ", made to find an available web connection with no result.");
        }
Esempio n. 13
0
        private static void Farm()
        {
            var target     = SimpleTs.GetTarget(QC.Range, SimpleTs.DamageType.Magical);
            var allminions = MinionManager.GetMinions(Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health);

            if (Config.Item("UseQLane").GetValue <bool>())
            {
                if (IsHuman)
                {
                    R.Cast();
                }
                foreach (var minion in allminions)
                {
                    if (QC.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= QC.Range)
                    {
                        QC.Cast(minion);
                    }
                    if (WC.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= WC.Range)
                    {
                        WC.Cast(minion);
                    }
                    if (EC.IsReady() && minion.IsValidTarget() && Player.Distance(minion) <= EC.Range)
                    {
                        EC.Cast(minion);
                    }
                }
            }
        }
Esempio n. 14
0
        public void LeftClick(Point pos)
        {
            WC.SetForegroundWindow(this._hWnd);
            int lParam = (pos.Y << 0x10) | pos.X;

            SendMessage(this._hWnd, 0x201, 0, lParam);
            SendMessage(this._hWnd, 0x202, 0, lParam);
            Thread.Sleep(this._message_delay);
        }
Esempio n. 15
0
        public void BaseCountTest()
        {
            WC w = new WC();

            w.BaseCount("dgsjssk\n");


            Assert.AreEqual(w.Wordcount, 2);
        }
Esempio n. 16
0
        /// <summary>
        /// Download update information from GitHub repository.
        /// </summary>
        public void GetUpdateInfo()
        {
            if (!Directory.Exists(updateDir))
            {
                Directory.CreateDirectory(updateDir);
            }

            WC.DownloadStringAsync(new Uri(updateInfoFileUrl));
        }
Esempio n. 17
0
        // thanks to http://www.blizzhackers.cc/viewtopic.php?p=4584495#p4584495 and Opkllhibus
        public static PointF FromD3toScreenCoords(Vec3 vec3)
        {
            RECT rect;

            WC.GetClientRect(Globals.winHandle, out rect);
            int resolutionX = rect.Width;
            int resolutionY = rect.Height;

            return(FromD3toScreenCoords(vec3, resolutionX, resolutionY));
        }
Esempio n. 18
0
        public void Drag(Point start, Point finish)
        {
            WC.SetForegroundWindow(this._hWnd);
            int lParam = (start.Y << 0x10) | start.X;

            SendMessage(this._hWnd, 0x201, 0, lParam);
            lParam = (finish.Y << 0x10) | finish.X;
            SendMessage(this._hWnd, 0x202, 0, lParam);
            Thread.Sleep(this._message_delay);
        }
Esempio n. 19
0
    /// <summary>
    ///     Times the attacking cycle for a sword style attack
    /// </summary>
    /// <remark>
    ///    The total time this coroutine takes to execute is equal to chargeTime+enableLength+pauseTime+retreatLength
    /// </remark>
    ///     <param name="vectorToTarget">The vector from the center of this gameObject's transform to the target</param>
    ///     <param name="chargeTime">The time this enemy waits before attacking</param>
    ///     <param name="enableLength">How long to enable the weapon's collider for</param>
    ///     <param name="pauseTime">The time after turning off the collider this enemy waits before retreating</param>
    ///     <param name="retreatLength">The length of time over which this enemy retreats</param>
    private IEnumerator SwordAttack(Vector2 vectorToTarget, float chargeTime, float pauseTime, float retreatLength)
    {
        attacking = true;
        WC.AimInDirection(vectorToTarget);
        float     startTime = Time.time;
        Coroutine retreat   = null;
        bool      doing     = true;
        bool      shot      = false;

        while (doing)
        {
            Vector3 startingPosition = transform.position;
            if (Time.time < startTime + chargeTime) // CHARGING ATTACK
            {
                attackIndicator.SetActive(true);
                // do animations here
                yield return(new WaitForSeconds(.05f));
            }
            else if (Time.time < startTime + chargeTime + pauseTime) // ATTACKING
            {
                attackIndicator.SetActive(false);
                if (!shot)
                {
                    WC.Fire(vectorToTarget);
                    shot = true;
                }
                else
                {
                    if (WC.IsFiring())
                    {
                        startTime += Time.deltaTime;// increment start time to prevent from moving on and waiting until the attack is complete
                    }
                }
                // do animations here
                yield return(new WaitForEndOfFrame());
            }
            else if (Time.time > startTime + chargeTime + pauseTime && doing) // RETREATING (jumping backwards)
            {
                if (retreat == null)
                {
                    //AimWeaponAtTarget(-vectorToTarget);
                    WC.AimInDirection(-vectorToTarget);
                    retreat = MoveTo(-vectorToTarget.normalized * retreatLength);
                }
                else if (!RunningThisRoutine(retreat))
                {
                    doing = false;
                }
                // do animations here
                yield return(new WaitForFixedUpdate());
            }
        }
        attacking = false;
    }
        public static SmartClicker GetInstance(IntPtr hwnd)
        {
            WC.GetClientRect(hwnd, out ClientRect);
            if (!WC.IsFullScreen(hwnd))
            {
                return(null);
            }
            ScreenSize size = (ScreenSize)Enum.Parse(typeof(ScreenSize), string.Concat(new object[] { "Size", ClientRect.Width, "x", ClientRect.Height }));

            return(GetInstance(hwnd, size));
        }
Esempio n. 21
0
        public void OrderTest()
        {
            string expected = "目录 :D:\\Patch 中没有此格式的文件!!";

            string[] opar = new string[1];
            opar[0] = "-s";
            WC     testWc = new WC(opar);
            string actual = testWc.Order("*.doc");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 22
0
        public void WCTest()
        {
            string expected = "字符数   :171" + "\n";

            string[] opar = new string[1];
            opar[0] = "-c";
            WC     testWc = new WC(opar);
            string actual = testWc.Order(@"D:\Patch\test1.txt");

            // assert
            Assert.AreEqual(expected, actual);
        }
 public static ScreenSize CurrentSize(IntPtr hwnd)
 {
     WC.GetClientRect(hwnd, out ClientRect);
     try
     {
         return((ScreenSize)Enum.Parse(typeof(ScreenSize), string.Concat(new object[] { "Size", ClientRect.Width, "x", ClientRect.Height })));
     }
     catch
     {
         return(ScreenSize.SizeUnknown);
     }
 }
Esempio n. 24
0
    void FixedUpdate()
    {
        if (Time.time - lastAttackTime <= attackCooldownLength)
        {
            return;
        }                                 // cancel if this enemy just attacked

        if (target != null && !attacking) // if the enemy is not attacking, do movement and try to attack
        {
            Vector2        vectorToTarget = Vector2.zero;
            RaycastHit2D[] hits           = new RaycastHit2D[raycastDepth];
            Physics2D.RaycastNonAlloc(WC.transform.position, target.transform.position - transform.position, hits, aggroRange, collideLayerMask);
            string hitTag      = null;
            bool   hitIsTarget = false;
            foreach (RaycastHit2D hit in hits)
            {
                // go through hits from closest to farthest
                if (hit.collider != null && hit.fraction != 0)
                {
                    hitTag         = hit.collider.tag;
                    vectorToTarget = hit.point - (Vector2)transform.position;

                    // if the tag of this object is a target, then we will target this one since it is the closest
                    foreach (string tag in targetTags)
                    {
                        if (tag == hitTag)
                        {
                            hitIsTarget = true;
                            break;
                        }
                    }

                    if (hitIsTarget)
                    {
                        break;
                    }
                }
            }

            if (vectorToTarget != Vector2.zero)
            {
                if (vectorToTarget.magnitude < aggroRange) // if within aggro range, move and aim weapon towards target
                {
                    Move(vectorToTarget);
                    WC.AimInDirection(vectorToTarget);
                }
                if (vectorToTarget.magnitude < attackRange && hitIsTarget && WC.CanFire()) // attack
                {
                    StartCoroutine(SwordAttack(vectorToTarget, attackChargeTime, postAttackPauseDuration, postAttackRetreatDistance));
                }
            }
        }
    }
Esempio n. 25
0
        /// <summary>
        /// Get's the client area of a given window handle.
        /// </summary>
        public static Bitmap GetWindowImage(IntPtr hwnd)
        {
            //Variable to keep the handle to bitmap.
            IntPtr hBitmap;

            //Here the passed handle to the window and pass it to the varaible used for this function
            IntPtr hDC = PlatformInvokeUSER32.GetDC(hwnd);

            //Here we make a compatible device context in memory for screen
            //device context.
            IntPtr hMemDC = PlatformInvokeGDI32.CreateCompatibleDC(hDC);

            Size s      = WC.winGetClientSize(hwnd);
            int  width  = s.Width;
            int  height = s.Height;

            //We create a compatible bitmap of the screen size and using
            //the screen device context.
            hBitmap = PlatformInvokeGDI32.CreateCompatibleBitmap
                          (hDC, width, height);

            //As hBitmap is IntPtr, we cannot check it against null.
            //For this purpose, IntPtr.Zero is used.
            if (hBitmap != IntPtr.Zero)
            {
                //Here we select the compatible bitmap in the memeory device
                //context and keep the refrence to the old bitmap.
                IntPtr hOld = (IntPtr)PlatformInvokeGDI32.SelectObject
                                  (hMemDC, hBitmap);
                //We copy the Bitmap to the memory device context.
                PlatformInvokeGDI32.BitBlt(hMemDC, 0, 0, width, height, hDC,
                                           0, 0, PlatformInvokeGDI32.SRCCOPY);
                //We select the old bitmap back to the memory device context.
                PlatformInvokeGDI32.SelectObject(hMemDC, hOld);
                //We delete the memory device context.
                PlatformInvokeGDI32.DeleteDC(hMemDC);
                //We release the screen device context.
                PlatformInvokeUSER32.ReleaseDC(PlatformInvokeUSER32.
                                               GetDesktopWindow(), hDC);
                //Image is created by Image bitmap handle and stored in
                //local variable.
                Bitmap bmp = System.Drawing.Image.FromHbitmap(hBitmap);
                //Release the memory to avoid memory leaks.
                PlatformInvokeGDI32.DeleteObject(hBitmap);
                //This statement runs the garbage collector manually.
                GC.Collect();
                //Return the bitmap
                return(bmp);
            }
            //If hBitmap is null, retun null.
            return(null);
        }
Esempio n. 26
0
        // Save url to file
        public void SaveTo(string url, string path)
        {
            WC wc = null;

            try {
                wc = GetNext();
                wc.web.DownloadFile(url, path);
            } finally {
                try {
                    wc.InUse = false;
                } catch { }
            }
        }
 public static bool IsSupported(IntPtr hwnd)
 {
     WC.GetClientRect(hwnd, out ClientRect);
     try
     {
         ScreenSize item = (ScreenSize)Enum.Parse(typeof(ScreenSize), string.Concat(new object[] { "Size", ClientRect.Width, "x", ClientRect.Height }));
         return(Utility.supported.Contains(item));
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 28
0
        private void Flee()
        {
            Player.IssueOrder(OrderType.MoveTo, Game.CursorPos);
            bool usew = Menu["flee"]["fleew"].Enabled;

            if (usew && WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name != "Pounce" && R.Ready)
            {
                R.Cast();
            }
            else if (usew && WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce")
            {
                WC.Cast(Game.CursorPos);
            }
        }
        private static IEnumerable <string> GetWikipedias()
        {
            XDocument doc;

            using (var sitemaxtrixStream = WC.OpenRead(SitematrixUrl))
            {
                doc = XDocument.Load(sitemaxtrixStream);
            }

            return(from lang in doc.Element("api").Element("sitematrix").Elements("language")
                   from site in lang.Element("site").Elements("site")
                   where site.Attribute("closed") == null &&
                   site.Attribute("code").Value == "wiki"
                   select lang.Attribute("code").Value);
        }
Esempio n. 30
0
        public override void ExecuteAll()
        {
            // restart the whole system
            StopAll();
            StartAll();

            try
            {
                // connect to the WC
                this.myWC = (TP.WC)System.Activator.GetObject(typeof(RM), "http://" + this.rmiHost + ":" + this.rmiPort + "/WC.soap");

                Console.Clear();
                Console.WriteLine("Welcome to the interactive query client!");
                Console.WriteLine("----------------------------------------");

                PrintHelp();

                String line;
                while (true)
                {
                    Console.Write("Enter Command: ");

                    if ((line = Console.In.ReadLine()) == null ||
                        line.Equals("exit", StringComparison.InvariantCultureIgnoreCase) ||
                        line.Equals("stop", StringComparison.InvariantCultureIgnoreCase))
                    {
                        break;
                    }

                    line = line.Trim();
                    if (line.Length > 0)
                    {
                        this.process(line);
                    }

                    Console.WriteLine("");
                }
                this.process("exit");
            }
            finally
            {
                try { this.process("exit"); }
                catch (Exception) { }

                // stop the system
                StopAll();
            }
        }
Esempio n. 31
0
        public override void ExecuteAll()
        {
            // restart the whole system
            StopAll();
            StartAll();

            try
            {
                // connect to the WC
                this.myWC = (TP.WC)System.Activator.GetObject(typeof(RM), "http://" + this.rmiHost + ":" + this.rmiPort + "/WC.soap");

                Console.Clear();
                Console.WriteLine("Welcome to the interactive query client!");
                Console.WriteLine("----------------------------------------");

                PrintHelp();

                String line;
                while (true)
                {
                    Console.Write("Enter Command: ");

                    if ((line = Console.In.ReadLine()) == null
                        || line.Equals("exit", StringComparison.InvariantCultureIgnoreCase)
                        || line.Equals("stop", StringComparison.InvariantCultureIgnoreCase))
                    {
                        break;
                    }

                    line = line.Trim();
                    if (line.Length > 0)
                    {
                        this.process(line);
                    }

                    Console.WriteLine("");
                }
                this.process("exit");
            }
            finally
            {
                try { this.process("exit"); }
                catch (Exception) { }

                // stop the system
                StopAll();
            }
        }
Esempio n. 32
0
        protected WC GetWC()
        {
            bool done = false;
            while (!done)
            {
                try
                {
                    if (null == s_wc)
                    {
                        s_wc = (WC)System.Activator.GetObject(typeof(WC), "http://localhost:8086/WC.soap");
                    }
                    s_wc.ToString();

                    done = true;
                }
                catch (Exception)
                {
                    s_wc = null;
                }
            }

            return s_wc;
        }
Esempio n. 33
0
        private void StartUp()
        {
            StopProcesses();
            File.Delete(TwoPhaseCommit.LogFileName);
            string[] files = Directory.GetFiles(Environment.CurrentDirectory, "MYRM_*");
            foreach (string file in files)
            {
                File.Delete(file);
            }
            files = Directory.GetFiles(Environment.CurrentDirectory, "*.manifest");
            foreach (string file in files)
            {
                File.Delete(file);
            }

            StartProcesses();

            this.WorkflowControl = (TP.WC)System.Activator.GetObject(typeof(RM), "http://localhost:8086/WC.soap");
            this.CarsRM = (RM)System.Activator.GetObject(typeof(RM), "http://localhost:8082/RM.soap");
            this.RoomsRM = (RM)System.Activator.GetObject(typeof(RM), "http://localhost:8083/RM.soap");
            this.FlightsRM = (RM)System.Activator.GetObject(typeof(RM), "http://localhost:8081/RM.soap");
            this.TransactionManager = (TM)System.Activator.GetObject(typeof(TM), "http://localhost:8089/TM.soap");
            InitInventory();
        }
Esempio n. 34
0
 public CommandLineClient(WC wc)
 {
     myWC = wc;
 }