コード例 #1
0
        private bool InitWorldMetdataHandler()
        {
            this.worldMetadataHandler = new WorldMetadataHandler(this.Trace, ProtectorPlugin.WorldMetadataDirectory);

            try {
                this.WorldMetadataHandler.InitOrReadMetdata();
            } catch (Exception ex) {
                this.Trace.WriteLineError("Failed initializing or reading metdata or its backup. This plugin will be disabled. Exception details:\n" + ex);
                this.Trace.WriteLineError("THIS PLUGIN IS DISABLED, EVERYTHING IS UNPROTECTED!");

                this.Dispose();
                return(false);
            }

            /*if (this.WorldMetadataHandler.IsWorldOlderThanLastWrittenMetadata()) {
             * try {
             *  this.WorldMetadataHandler.CreateMetadataSnapshot();
             * } catch (InvalidOperationException ex) {
             *  this.Trace.WriteLineError(ex.ToString());
             * }
             *
             * this.Trace.WriteLineWarning(string.Format(
             *  "You might have loaded an outdated version of the current world, so a snapshot of the current metadata was created. Simply ignore this message if you've intentionally loaded the outdated world file, however, if not then you should restore the most recent version of the world and restore the metadata snapshot found at \"{0}\" otherwise some protections might become invalid",
             *  ProtectorPlugin.WorldMetadataDirectory
             * ));
             * }*/

            return(true);
        }
コード例 #2
0
        private bool InitWorldMetdataHandler()
        {
            this.worldMetadataHandler = new WorldMetadataHandler(this.Trace, ProtectorPlugin.WorldMetadataDirectory);

              try {
            this.WorldMetadataHandler.InitOrReadMetdata();
              } catch (Exception ex) {
            this.Trace.WriteLineError("Failed initializing or reading metdata or its backup. This plugin will be disabled. Exception details:\n" + ex);
            this.Trace.WriteLineError("THIS PLUGIN IS DISABLED, EVERYTHING IS UNPROTECTED!");

            this.Dispose();
            return false;
              }

              /*if (this.WorldMetadataHandler.IsWorldOlderThanLastWrittenMetadata()) {
            try {
              this.WorldMetadataHandler.CreateMetadataSnapshot();
            } catch (InvalidOperationException ex) {
              this.Trace.WriteLineError(ex.ToString());
            }

            this.Trace.WriteLineWarning(string.Format(
              "You might have loaded an outdated version of the current world, so a snapshot of the current metadata was created. Simply ignore this message if you've intentionally loaded the outdated world file, however, if not then you should restore the most recent version of the world and restore the metadata snapshot found at \"{0}\" otherwise some protections might become invalid",
              ProtectorPlugin.WorldMetadataDirectory
            ));
              }*/

              return true;
        }
コード例 #3
0
        private bool InitWorldMetdataHandler()
        {
            this.WorldMetadataHandler = new WorldMetadataHandler(this.Trace, ProtectorPlugin.WorldMetadataDirectory);

              try {
            this.WorldMetadataHandler.InitOrReadMetdata();
              } catch (Exception ex) {
            this.Trace.WriteLineError("Failed initializing or reading metdata or its backup. This plugin will be disabled. Exception details:\n" + ex);
            this.Trace.WriteLineError("THIS PLUGIN IS DISABLED, EVERYTHING IS UNPROTECTED!");

            this.Dispose();
            return false;
              }

              return true;
        }