示例#1
0
 private void MapExtractParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "m":
             if ( e.Data.Length > 0 ) moddir = e.Data;
             break;
         case "d":
             if ( e.Data.Length > 0 ) dir = e.Data;
             break;
         case "o":
             overwrite = true;
             break;
         case "c":
             create = true;
             break;
         case "g":
             forceGenerate = true;
             break;
         case "1":
         case "2":
         case "3":
             includeLightmaps = int.Parse( e.Value );
             break;
     }
 }
 private void MapExportParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "d":
             if ( e.Data.Length > 0 ) dir = e.Data;
             break;
     }
 }
示例#3
0
 private void MapViewParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "1": case "2": case "3":
             useLightmap = int.Parse( e.Value );
             break;
     }
 }
示例#4
0
        private void MapColorParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
        {
            switch ( e.Value.ToLower() ) {
                case "i": case "id":
                    if ( e.Data.Length > 0 ) {
                        try {
                            id = int.Parse( e.Data );
                        }
                        catch {
                            id = -1;
                        }
                    }
                    break;

                case "rgb":
                    if ( e.Data.Length > 0 ) {
                        int idx = e.Data.IndexOfAny( new char[] { ',', '.', ':', '-' } );
                        if ( idx < 0 ) {
                            try {
                                color = int.Parse( e.Data );
                            }
                            catch {
                                color = -1;
                            }
                        }
                        else {
                            NumberStyles ns = NumberStyles.HexNumber;
                            try {
                                string[] components = e.Data.Split( new char[] { e.Data[idx] }, 3 );
                                color = (int.Parse( components[0], ns ) << 16) | (int.Parse( components[1], ns ) << 8) | (int.Parse( components[2], ns ));
                            }
                            catch {
                                color = -1;
                            }
                        }
                    }
                    break;

                case "c":
                    if ( e.Data.Length > 0 ) convertor = e.Data;
                    break;

                case "map":
                    if ( e.Data.Length > 0 )
                        makeMap = e.Data;
                    else
                        makeMap = "colourmap";
                    break;
            }
        }
示例#5
0
        private void MapImageParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
        {
            switch ( e.Value.ToLower() ) {
                case "lds":
                    action = Action.LightmapDownSizing;
                    if ( e.Data.Length > 0 ) {
                        if ( e.Data.ToLower() == "full" ) {
                            region = new Rectangle( -1, -1, -1, -1 );
                            mode = RegionMode.Full;
                        }
                        else {
                            int size = -1;
                            try {
                                size = int.Parse( e.Data );
                            }
                            catch ( FormatException ) {
                                size = -1;
                            }

                            if ( size <= 0 ) {
                                string[] spec= e.Data.Split( new char[] {','}, 4 );

                                if ( spec.Length >= 4 ) {
                                    Rectangle newRegion = region;
                                    try {
                                        newRegion = new Rectangle( int.Parse( spec[0] ), int.Parse( spec[1] ), int.Parse( spec[2] ), int.Parse( spec[3] ) );
                                    }
                                    catch ( FormatException ) {
                                        // Do nothing
                                    }
                                    region = newRegion;
                                }
                                mode = RegionMode.Normal;
                            }
                            else {
                                region = new Rectangle( 0, 0, size, size );
                                mode = RegionMode.All;
                            }
                        }
                    }
                    break;
            }
        }
 private void MapInjectParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "m":
             if ( e.Data.Length > 0 ) moddir = e.Data;
             break;
         case "d":
             if ( e.Data.Length > 0 ) dir = e.Data;
             break;
         case "l":
             regenLightmaps = 1;
             if ( e.Data.ToLower() == "o" ) regenLightmaps = 2;
             break;
         case "s":
             saveSource = true;
             break;
         case "notot":
             noTOT = true;
             break;
     }
 }
示例#7
0
 private void MapStatsParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "bb": case "boundbox":
             action = Action.BoundBoxes;
             break;
         case "adj": case "adjacent": case "adjacency": case "adjacencies":
             action = Action.Adjacencies;
             break;
         case "r": case "regions":
             action = Action.Regions;
             break;
         case "x": case "xml":
             mode = ExportMode.XML;
             break;
         case "c": case "csv":
             mode = ExportMode.Plain;
             break;
         case "o":
             overwrite = true;
             break;
     }
 }
示例#8
0
 private void MapImageParsedArguments_ProcessParameter(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     if ( source.Length == 0 ) source = e.Value;
     else if ( target.Length == 0 ) target = e.Value;
 }
示例#9
0
        private void MapImageParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
        {
            switch ( e.Value.ToLower() ) {
                case "i": case "import":
                    action = Action.ImportImage;
                    simulate = false;
                    break;
                case "e": case "export":
                    action = Action.ExportImage;
                    break;
                case "q": case "query":
                    action = Action.QueryImage;
                    break;
                case "si": case "simulateimport":
                    action = Action.ImportImage;
                    simulate = true;
                    break;
                case "c": case "check":
                    action = Action.CheckImage;
                    break;
                case "o":
                    overwrite = true;
                    break;
                case "1": case "2": case "3":
                    useLightmap = int.Parse( e.Value );
                    break;
                case "p": case "png":
                    if (e.Data.Length > 0) {
                        foreach(string s in e.Data.Split(new char[] { ',' })) {
                            switch (s.ToLower()) {
                                case "shading":
                                case "s":
                                case "shades":
                                case "shade":
                                    pngLevel |= PngLevel.Shading;
                                    break;

                                case "ids":
                                case "i":
                                case "id":
                                case "idmap":
                                    pngLevel |= PngLevel.IDs;
                                    break;

                                case "borders":
                                case "b":
                                case "border":
                                    pngLevel |= PngLevel.Borders;
                                    break;
                            }
                        }
                    }
                    else {
                        pngLevel = PngLevel.All;
                    }
                    break;
                case "d": case "direct":
                    direct = true;
                    break;
                case "g":
                    if ( e.Data.Length > 0 ) {
                        try {
                            regen = int.Parse( e.Data );
                        }
                        catch ( FormatException ) {
                            // Do nothing
                        }
                    }
                    else {
                        regen = 1;
                    }
                    break;
                case "r":
                    if ( e.Data.Length > 0 ) {
                        if ( e.Data.ToLower() == "full" ) {
                            region = new Rectangle( -1, -1, -1, -1 );
                            mode = RegionMode.Full;
                        }
                        else {
                            int size = -1;
                            try {
                                size = int.Parse( e.Data );
                            }
                            catch ( FormatException ) {
                                size = -1;
                            }

                            if ( size <= 0 ) {
                                string[] spec= e.Data.Split( new char[] {','}, 4 );

                                if ( spec.Length >= 4 ) {
                                    Rectangle newRegion = region;
                                    try {
                                        newRegion = new Rectangle( int.Parse( spec[0] ), int.Parse( spec[1] ), int.Parse( spec[2] ), int.Parse( spec[3] ) );
                                    }
                                    catch ( FormatException ) {
                                        // Do nothing
                                    }
                                    region = newRegion;
                                }
                                mode = RegionMode.Normal;
                            }
                            else {
                                region = new Rectangle( 0, 0, size, size );
                                mode = RegionMode.All;
                            }
                        }
                    }
                    break;
                case "relocate":
                    if ( e.Data.Length > 0 ) {
                        string[] spec= e.Data.Split( new char[] {','}, 2 );

                        if ( spec.Length >= 2 ) {
                            Point newReloc = reloc;
                            try {
                                newReloc = new Point( int.Parse( spec[0] ), int.Parse( spec[1] ) );
                            }
                            catch ( FormatException ) {
                                // Do nothing
                            }
                            reloc = newReloc;
                        }
                    }
                    break;
                case "id":
                    try {
                        id = int.Parse( e.Data );
                    }
                    catch ( FormatException ) {
                        id = -1;
                    }
                    break;
                case "pedantic":
                    tolerant = false;
                    break;
                case "checkidgrid":
                    checkidgrid = true;
                    break;
            }
        }
 private void MapProvinceParsedArguments_ProcessOption(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     switch ( e.Value.ToLower() ) {
         case "i": case "import":
             action = Action.ImportProvince;
             break;
         case "e": case "export":
             action = Action.ExportProvince;
             break;
         case "x": case "xml":
             mode = ExportMode.XML;
             break;
         case "c": case "csv":
             mode = ExportMode.Plain;
             break;
         case "o":
             overwrite = true;
             break;
         case "notot":
             noTOT = true;
             break;
     }
 }
示例#11
0
 private void MapExportParsedArguments_ProcessParameter(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     if ( source.Length == 0 ) source = e.Value;
 }
示例#12
0
        private void ParsedArguments_ProcessOption( ParsedArguments sender, ProcessArgumentEventArgs e )
        {
            if ( e.Type != ArgumentType.Option ) return;

            string option = e.Value.ToLower();
            if ( option == "h" || option == "?" || option == "help" ) help = true;
        }
示例#13
0
 private void MapExtractParsedArguments_ProcessParameter(ParsedArguments sender, ProcessArgumentEventArgs e)
 {
     if ( target.Length == 0 ) target = e.Value;
 }