//
//  func.swift
//  SocketChat
//
//  Created by Justine on 16/5/20.
//  Copyright © 2016年 AppCoda. All rights reserved.
//

import Foundation
//去除首位String空格--------------------------------------
let whitespace = NSCharacterSet.whitespaceAndNewlineCharacterSet()
//去字符串空格
func trimstring(str:String,trimchar:String)->String{
    let array = str.componentsSeparatedByCharactersInSet(NSCharacterSet (charactersInString: trimchar))
    let arrayStr = array.joinWithSeparator("")
    return arrayStr
}



//###################   About AppdeleGate.  NotificationTypes    ##########
let Notificationtypes:UIUserNotificationType = [UIUserNotificationType.Alert,UIUserNotificationType.Badge, UIUserNotificationType.Sound]



let userDefaults = NSUserDefaults.standardUserDefaults()

//####################  About SERVER IP Address Include Port##############
let CENTER_SERVER = "http://gateway.lxumc.com:8082/app/user/"
let APP_SERVER = "APP_SERVER"
let CHAT_SERVER = "CHAT_SERVER"
let FILE_UP_SERVER = "FILE_UP_SERVER"
let FILE_DOWN_SERVER = "FILE_DOWN_SERVER"
let UPDATE_SERVER = "UPDATE_SERVER"
let SERVER_ID = "SERVER_ID"
let SOCKET_SERVER = "SOCKET_SERVER"


let USER_CENTER_SERVER = ManagerUserDefault().SelectUserDefault(CENTER_SERVER)
let USER_APP_SERVER = ManagerUserDefault().SelectUserDefault(APP_SERVER)
let USER_CHAT_SERVER = ManagerUserDefault().SelectUserDefault(CHAT_SERVER)
let USER_FILE_UP_SERVER = ManagerUserDefault().SelectUserDefault(FILE_UP_SERVER)
let USER_FILE_DOWN_SERVER = ManagerUserDefault().SelectUserDefault(FILE_DOWN_SERVER)
let USER_SERVER_ID = ManagerUserDefault().SelectUserDefault(SERVER_ID)
let USER_SOCKET_SERVER = USER_APP_SERVER
var USER_SOCKET_SERVER_URI = ((USER_APP_SERVER as! NSString).componentsSeparatedByString(":"))
let SOCKET_HOST = USER_SOCKET_SERVER_URI[0]
let SOCKET_PORT = Int(USER_SOCKET_SERVER_URI[1])
    //################## About LoginMsg
let USERDEFAULT_USER_NAME = "USERDEFAULT_USER_NAME"
let USERDEFAULT_LOGIN_NAME = "USERDEFAULT_LOGIN_NAME"
let USERDEFAULT_USER_ID = "USERDEFAULT_USER_ID"
let USERDEFAULT_PASSWORD = "USERDEFAULT_PASSWORD"
let USERDEFAULT_SERVER_ID = "USERDEFAULT_SERVER_ID"
let USERDEFAULT_APP_TOKEN = "USERDEFAULT_APP_TOKEN"
