- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 - 40
 - 41
 - 42
 - 43
 - 44
 - 45
 - 46
 - 47
 - 48
 - 49
 - 50
 - 51
 - 52
 - 53
 - 54
 - 55
 - 56
 - 57
 - 58
 - 59
 - 60
 - 61
 - 62
 - 63
 - 64
 - 65
 - 66
 - 67
 - 68
 - 69
 - 70
 
                        +(NSMutableURLRequest *) formatRequest:(NSString *) urlString withRequestType:(NSString *) type withData:(NSString *) dataStr withParam:(NSMutableArray *) param withContentType:(NSString *) content
{
	NSString *deviceId = [[UIDevice currentDevice] uniqueIdentifier];
	NSString *urlWithParametr = nil;
	
    #if defined(XXX_PROJECT)
	if ([urlString rangeOfString:@"?"].location == NSNotFound)
    urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro&app_name=XXX", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
	else
    urlWithParametr = [[[NSString alloc] initWithFormat:@"%@&device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro&app_name=XXX", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
    #else
    
	if ([urlString rangeOfString:@"?"].location == NSNotFound)
    {
        //urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
        
        if ([dataStr isEqual:@"NeedGuitarPro"])
        {
            dataStr = nil;
            urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
        }
        else
        if ([dataStr isEqual:@"NeedAllWithGutarPro"])
        {
            dataStr = nil;
            urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@&file_type_group=all", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
        }
        else 
        {
            urlWithParametr = [[[NSString alloc] initWithFormat:@"%@?device_id=%@&app_platform=iphone&app_version=%@", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
        }
    }
    else
    urlWithParametr = [[[NSString alloc] initWithFormat:@"%@&device_id=%@&app_platform=iphone&app_version=%@&file_type=guitar_pro&app_name=XXX", urlString, deviceId, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]] autorelease];
    #endif
	
    if (content != nil && [content length] > 0)
    {
        urlWithParametr = [urlWithParametr stringByAppendingString:[NSString stringWithFormat:@"&%@", content]];
    }
	
	//NSLog(@"PARAMETERS:");
    //	NSLog(@"%@", [param description]);
    
    if ([param count])
    {
        for (NSMutableDictionary *dict in param)
        {
            urlWithParametr = [urlWithParametr stringByAppendingString:[NSString stringWithFormat:@"&%@=%@", [dict objectForKey:@"name"], [dict objectForKey:@"value"]]];
        }
    }
	
    NSLog(@"THE urlWithParametr = %@", urlWithParametr);
    NSURL *urlServer = [NSURL URLWithString:urlWithParametr];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlServer];
    [request setHTTPMethod:type];
    [request setCachePolicy:NSURLRequestUseProtocolCachePolicy];
    [request setTimeoutInterval:30.0];
    
    if (dataStr != nil)
    {
        NSString *contentType = @"application/x-www-form-urlencoded";
        [request addValue:contentType forHTTPHeaderField: @"Content-Type"];
        NSMutableData *postBody = [NSMutableData data];
        [postBody appendData:[dataStr dataUsingEncoding:NSUTF8StringEncoding]];
        [request setHTTPBody:postBody];
    }
    
    return request;
}
                                     
        
            Творение моего "любимого" автора. Мне иногда кажется, что нас спасут только массовые расстрелы. Хотя кое-кто настаивает на введении телесных наказаний.