Esempio n. 1
0
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            // Specify what is done when a file is renamed.
            Logger.DebugFormat("File: {0} renamed to {1}", e.OldFullPath, e.FullPath);
            if (!e.FullPath.EndsWith(".bak"))
            {
                if (File.Exists(e.FullPath))
                {
                    if (GlobalSettings.PreviousStashStatus == StashAvailability.CRAFTING ||
                        GlobalSettings.StashStatus == StashAvailability.CRAFTING)
                    {
                        Logger.Info("Detected an update to stash file, but ignoring due to crafting-safety-check");
                        // OBS: Can only do this if we've previously looted! CAnnot risk it containing unlooted items
                        if (StashManager._hasLootedItemsOnceThisSession)
                        {
                            if (_delayedLootTimer == null)
                            {
                                Logger.Info(
                                    "Items has already been looted this session, post-crafting safety measures required.");


                                StashManager.DeleteItemsInPageX(e.FullPath);
                            }
                            else
                            {
                                Logger.Info("Player may have opened devotion screen before running away.. leaving items be..");
                            }
                        }
                        else
                        {
                            Logger.Info("No items has been looted this session, ignoring safety measures.");
                        }
                    }
                    else
                    {
                        Logger.Info("Detected an update to stash file, checking for loot..");

                        NotifyStashChangeDelayed(e.FullPath);
                    }
                }
                else
                {
                    Logger.Warn("Detected an update to stash file, but stash file does not appear to exist.");
                }
            }
        }
Esempio n. 2
0
        //private static void OnChanged(object source, FileSystemEventArgs e) {
        private static void OnChanged(StashManager obj, FileSystemEventArgs e)
        {
            Logger.Debug("File: " + e.FullPath + " " + e.ChangeType);

            /*
             *          // Specify what is done when a file is changed, created, or deleted.
             *          if (e.FullPath.EndsWith(".gst") || e.FullPath.EndsWith(".gsh")) {
             *              Logger.Debug("File: " + e.FullPath + " " + e.ChangeType);
             *              using (TemporaryCopy copy = new TemporaryCopy(e.FullPath)) {
             *                  obj.LastSeenIsHardcore = GlobalSettings.IsHardcore(copy.Filename);
             *
             *                  GDCryptoDataBuffer pCrypto = new GDCryptoDataBuffer(DataBuffer.ReadBytesFromDisk(copy.Filename));
             *
             *                  Stash stash = new Stash();
             *                  if (stash.Read(pCrypto)) {
             *                      obj.LastSeenModLabel = stash.ModLabel;
             *                  }
             *              }
             *          }
             */

            // Logger.InfoFormat("Detected a change");
        }