亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fileclient2server.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright (C) 2003-2007 Funambol, Inc
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */
#include <windows.h>
#include "Winbase.h"

#include "pimstore.h"
#include <stdio.h>

#include "base/Log.h"
#include "spds/spdsutils.h"
#include "spds/Constants.h"
#include "spdm/spdmutils.h"
#include "pim/Utils.h"
#include "pim/FILEClient2Server.h"
#include "pim/FILEFileManagement.h"
#include "spds/FileData.h"
#include "pim/ClientSettings.h"

#include "shellapi.h"

static wstring getXMLNote (const char* ptrFileContent, const wchar_t* fileName);


/*
to get My documents foleder
SHGetSpecialFolderPath(NULL, internalPath, CSIDL_PERSONAL, FALSE);
*/

void setAllItemsFILE(Container* c, int dataType, const wchar_t* path, const wchar_t* dir) {

    LOG.debug("Enter in setAllItemsFILE... ");

    wchar_t localTemp [DIM_LOCAL_TEMP];

    wchar_t **ptrArrayOfFileName    = NULL;
    wchar_t  *ptrFileContent        = NULL;
    char* fileContent = NULL;
    char* pp = NULL;
    wchar_t   filterPattern [256];
    wchar_t   internalPath  [DIM_LOCAL_TEMP];

    int numBytes            = 0;
    int count               = 0;
    int j                   = 0;
    unsigned long sizeFile  = 0;

    BOOL recursiveInDirectory = FALSE;
    filterPattern[0] = 0;
    internalPath[0]  = 0;

    /*
    * It avoids to send object greater then MaxObjSize.
    * In next releases it must me inserted into the
    * source.
    */

    //ClientSettings cs(APPLICATION_URI);
    //cs.readConfig();
    int fileRemoved = 0;
    //
    // decide the path of the files to read
    //

    if (dataType == constFiles)
        wsprintf(internalPath, TEXT("%s%s"), dir, TEXT("\\"));
    else if (dataType == constNotes) {
        wsprintf(internalPath,  TEXT("%s%s"), dir, TEXT("\\"));
        wcscpy(filterPattern, PWI_EXTENSION_PATTERN);
    }
    else if (dataType == constFavorites) {
        SHGetSpecialFolderPath(NULL, localTemp, CSIDL_FAVORITES, FALSE);
        wsprintf(internalPath, TEXT("%s%s"), localTemp, TEXT("\\"));
        recursiveInDirectory = TRUE;
    }

    // to retrieve num of files
    getFileList(internalPath, ptrArrayOfFileName, &count, TRUE, recursiveInDirectory, filterPattern);

    ptrArrayOfFileName = new wchar_t*[count];

    for ( int k = 0; k < count; k++) {
        ptrArrayOfFileName[k] = 0;
    }

    // to retrieve fileName
    getFileList(internalPath, ptrArrayOfFileName, &count, FALSE, recursiveInDirectory, filterPattern);

    SyncItem* syncItem = NULL;

    for (j = 0; j < count; j++) {

        // fileName with complete path (e.g. \\Program Files\\SyncClient PIM\\store\\example.bin)
        wcscpy(localTemp, ptrArrayOfFileName[j]);

        if (dataType == constFiles) {

            unsigned long sizeFile = 0;
            getFileSize(ptrArrayOfFileName[j], &sizeFile);
            if (sizeFile == 0)
                return;
            if (sizeFile > getMaxObjectSizeToSend()) {
                LOG.debug("Found file greater then maxObjectSize(%lu): sizefile = %lu", getMaxObjectSizeToSend(), sizeFile);
                fileRemoved++;
                continue;
            }
            fileContent = new char[sizeFile];
            readByteFromFile(ptrArrayOfFileName[j], (byte*)fileContent, &numBytes);
            FileData fileData;
            getFileName(ptrArrayOfFileName[j], localTemp);
            fileData.setName(localTemp);
            fileData.setSize(numBytes);
            fileData.setEnc(TEXT("base64"));
            fileData.setBody(fileContent, numBytes);
            delete [] fileContent; fileContent = NULL;
            fileContent = fileData.format();
            numBytes = strlen(fileContent);

        }
        else if (dataType == constNotes) {

            pp = readTextFromBinaryFileChar(ptrArrayOfFileName[j]);
            getFileName(ptrArrayOfFileName[j], localTemp);
            if (pp != NULL) {
                wstring note = getXMLNote(pp, localTemp);
                fileContent = toMultibyte((wchar_t*)note.data());
                numBytes = strlen(fileContent);
            }
        }
        else if (dataType == constFavorites) {

            ptrFileContent = readTextFromBinaryFile(ptrArrayOfFileName[j]);

            if (ptrFileContent != NULL) {
                translateText2Base64(&ptrFileContent);
            }
            fileContent = toMultibyte(ptrFileContent);
            numBytes = strlen(fileContent);

            wcscpy(localTemp, ptrArrayOfFileName[j]);

            wchar_t* t = wcsstr(ptrArrayOfFileName[j], internalPath);

            if (t != NULL) {
                wsprintf(localTemp, t + wcslen(internalPath));
                delete [] t; t = NULL;
            }
            if (FILE_SYSTEM_SYNC_SOURCE == TRUE)
                convertSlashAt(localTemp);
        }

        encodeKey (localTemp);

        syncItem = new SyncItem(localTemp);

        if (fileContent == NULL) {
            syncItem->setData("", 1*sizeof(char));
        }
        else {
            syncItem->setData(fileContent, numBytes);
        }

        c->addItemToAllItems(syncItem);

        if (ptrFileContent != NULL) {
            delete [] ptrFileContent; ptrFileContent = NULL;
        }
        if (syncItem) {
            delete syncItem; syncItem = NULL;
        }
        if (fileContent != NULL) {
            delete [] fileContent; fileContent = NULL;
        }
        pp = NULL;

    }

    // delete array and pointer...
    for (j = 0; j < count; j++) {
        if (ptrArrayOfFileName[j] != NULL)
            delete [] ptrArrayOfFileName[j];
    }

    if (ptrArrayOfFileName != NULL)
        delete [] ptrArrayOfFileName;

    wsprintf(localTemp, SET_ALL_ITEMS, count - fileRemoved);
    LOG.debug("Exiting from setAllItemsFILE... ");
}

void setAllItemsFILEKey(Container* c, int dataType, const wchar_t* path, const wchar_t* dir) {

    LOG.debug("Enter in setAllItemsFILEKey... ");
    wchar_t localTemp [DIM_LOCAL_TEMP];

    wchar_t **ptrArrayOfFileName    = NULL;

    wchar_t   filterPattern [256];
    wchar_t   internalPath  [DIM_LOCAL_TEMP];

    int numBytes            = 0;
    int count               = 0;
    int j                   = 0;
    unsigned long sizeFile  = 0;

    BOOL recursiveInDirectory = FALSE;
    filterPattern[0] = 0;
    internalPath[0]  = 0;

    //
    // decide the path of the files to read
    //

    if (dataType == constFiles)
        wsprintf(internalPath, TEXT("%s%s"), dir, TEXT("\\"));
    else if (dataType == constNotes) {
        wsprintf(internalPath,  TEXT("%s%s"), dir, TEXT("\\"));
        wsprintf(filterPattern, TEXT("%s"), PWI_EXTENSION_PATTERN);
    }
    else if (dataType == constFavorites) {
        SHGetSpecialFolderPath(NULL, localTemp, CSIDL_FAVORITES, FALSE);
        wsprintf(internalPath, TEXT("%s%s"), localTemp, TEXT("\\"));
        recursiveInDirectory = TRUE;
    }

    // to retrieve num of files
    getFileList(internalPath, ptrArrayOfFileName, &count, TRUE, recursiveInDirectory, filterPattern);

    ptrArrayOfFileName = new wchar_t*[count];

    for ( int k = 0; k < count; k++) {
        ptrArrayOfFileName[k] = 0;
    }

    // to retrieve fileName
    getFileList(internalPath, ptrArrayOfFileName, &count, FALSE, recursiveInDirectory, filterPattern);

    SyncItem* syncItem = NULL;

    for (j = 0; j < count; j++) {

        // fileName with complete path (e.g. \\Program Files\\SyncClient PIM\\store\\example.bin)
        wcscpy(localTemp, ptrArrayOfFileName[j]);

        if (dataType == constFiles)
            getFileName(ptrArrayOfFileName[j], localTemp);
        else if (dataType == constNotes)
            getFileName(ptrArrayOfFileName[j], localTemp);
        else if (dataType == constFavorites) {

            wcscpy(localTemp, ptrArrayOfFileName[j]);
            wchar_t* t = wcsstr(ptrArrayOfFileName[j], internalPath);

            if (t != NULL) {
                wsprintf(localTemp, t + wcslen(internalPath));
                delete [] t;
            }
            if (FILE_SYSTEM_SYNC_SOURCE == TRUE)
                convertSlashAt(localTemp);
        }

        encodeKey (localTemp);

        syncItem = new SyncItem(localTemp);
        syncItem->setData("", 1*sizeof(char));

        c->addItemToAllItems(syncItem);

        if (syncItem) {
            delete syncItem; syncItem = NULL;
        }
    }

    // delete array and pointer...
    for (j = 0; j < count; j++) {
        if (ptrArrayOfFileName[j] != NULL)
            delete [] ptrArrayOfFileName[j];
    }
    if (ptrArrayOfFileName != NULL)
        delete [] ptrArrayOfFileName;
    LOG.debug("Exiting from setAllItemsFILEKey... ");
}


/*
* The method replace the text file content with new one in xml format.
*/
static wstring getXMLNote (const char* ptrFileContent, const wchar_t* fileName) {

    char* t  = NULL;
    wstring name(fileName);

    int position  = name.find(PWI_EXTENSION);
    /*
    string s = name;
    name = string(s, position);
    */

    if (position != std::wstring::npos) {
        wstring s = name;
        name = s.substr(0,position);
    }
    encodeSpecialChar(name);

    wchar_t *cnt = toWideChar(ptrFileContent);
    wstring content(cnt);
    encodeSpecialChar(content);

    wchar_t date[64];
    doubleToSystemTime(date, getSystemTime());

    wstring xml = wstring(TEXT("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
    xml += TEXT("<note><Subject>");
    xml += name; // filename (with no .pwi extension)
    xml += TEXT("</Subject><Body>") ;
    xml += content ;
    xml += TEXT("</Body><Date>");
    xml += date;
    xml += TEXT("</Date></note>");

    return xml;
}


/*
* text pointed by ptrData is translated in base64 and assigned to ptrData
* Used only for "favorites" source.
* TO BE DELETED
*
*/
void translateText2Base64(wchar_t** ptrFileContent) {

    wchar_t* ptr = NULL;
    ptr = encodeBase64UTF8(*ptrFileContent);
    if (*ptrFileContent != NULL) {
        delete *ptrFileContent;
        *ptrFileContent = NULL;
    }
    *ptrFileContent = ptr;
}


/*
* get the data content of a file by filename and return these data into base64 format.
* It's useful to read data to set into setAllItems, setModifiedItem, setNewItems
NO MORE USED


char* getB64DataContentByFilename(wchar_t* filename) {

    unsigned long sizeFile      = 0;
    int      numBytes           = 0;
    byte*    ptrFileContent     = NULL;
    char*    base64             = NULL;
    wchar_t* ptrFileContentb64  = NULL;
    int encodeLen               = 0;
    getFileSize(filename, &sizeFile);

    if (sizeFile == 0)
        goto finally;

    ptrFileContent = new byte[sizeFile];

    // read bytes from file

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜桃视频第一区免费观看| 欧美亚洲综合另类| 91国产成人在线| 精品久久久久久久一区二区蜜臀| 亚洲国产精品成人综合色在线婷婷| 亚洲成av人片在线观看无码| 成人免费看黄yyy456| 欧美一区二区大片| 亚洲在线免费播放| 99精品视频在线免费观看| 精品免费国产一区二区三区四区| 一区二区三区不卡在线观看 | 亚洲一区二区三区四区五区黄| 国产最新精品精品你懂的| 欧美日韩精品一区二区天天拍小说| 国产精品免费av| 国产乱码字幕精品高清av| 日韩三级视频在线看| 亚洲一区二区不卡免费| 一本一道久久a久久精品| 欧美国产日产图区| 国产高清精品网站| 亚洲精品一区二区三区精华液| 亚洲大片免费看| 欧美在线一区二区| 亚洲一区二区欧美激情| 色狠狠综合天天综合综合| 亚洲欧美日韩国产综合| 99久久夜色精品国产网站| 中文字幕不卡三区| 成人精品国产福利| 国产精品第四页| av亚洲精华国产精华精华| 国产精品免费视频观看| 不卡的av在线| 一区二区三区在线播放| 色视频欧美一区二区三区| 一区二区三区日韩欧美精品| 一本到不卡精品视频在线观看 | 久久亚洲综合av| 韩国av一区二区三区四区| 久久久三级国产网站| 国产激情视频一区二区三区欧美| 久久美女艺术照精彩视频福利播放| 国产麻豆成人精品| 国产精品久久久一本精品| 91蝌蚪porny| 亚洲chinese男男1069| 6080yy午夜一二三区久久| 日韩高清一区在线| 精品国产第一区二区三区观看体验| 国产精品一线二线三线| 国产精品青草久久| 欧美性一级生活| 美女mm1313爽爽久久久蜜臀| 久久免费电影网| 色综合久久中文综合久久牛| 三级在线观看一区二区| 精品免费日韩av| av影院午夜一区| 免费一区二区视频| 欧美激情在线一区二区三区| 91国产丝袜在线播放| 免费成人结看片| 国产人成一区二区三区影院| 欧美在线视频日韩| 久久99精品久久久久久国产越南| 国产精品视频第一区| 欧美精品日韩一本| 国产91丝袜在线18| 亚洲不卡一区二区三区| 国产日产欧美精品一区二区三区| 在线观看区一区二| 狠狠网亚洲精品| 亚洲综合激情网| 国产午夜精品在线观看| 欧美性大战久久久| 成人国产视频在线观看| 蜜臀av性久久久久蜜臀av麻豆| 中文字幕欧美一| 精品国产网站在线观看| 欧美专区在线观看一区| 国产黄色成人av| 麻豆一区二区在线| 亚洲一区二区av电影| 国产精品久久久一本精品| 日韩精品中午字幕| 在线欧美日韩精品| 成人动漫视频在线| 国产一区二三区好的| 亚洲成人av中文| 自拍偷拍国产精品| 国产欧美中文在线| 日韩精品一区二区三区swag| 精品婷婷伊人一区三区三| 成人动漫视频在线| 高清不卡一二三区| 激情五月播播久久久精品| 日韩高清不卡一区二区| 亚洲成人av中文| 亚洲精品中文字幕在线观看| 日本一区二区视频在线观看| 久久人人超碰精品| 久久综合中文字幕| 精品电影一区二区| 精品卡一卡二卡三卡四在线| 制服.丝袜.亚洲.另类.中文| 欧美日韩综合一区| 色婷婷综合久久久中文一区二区| 不卡av在线网| 91捆绑美女网站| 91首页免费视频| 91免费在线视频观看| 一本到不卡免费一区二区| 99久久精品免费| 色呦呦一区二区三区| 色综合久久久久综合体| 色94色欧美sute亚洲线路一ni | 日韩一级免费一区| 911精品产国品一二三产区| 欧美精品日韩精品| 日韩欧美一区二区三区在线| 日韩视频免费观看高清完整版 | 欧美日高清视频| 欧美美女一区二区在线观看| 欧美精品v国产精品v日韩精品| 欧美美女黄视频| 欧美一区二区大片| 久久久久久97三级| 综合久久一区二区三区| 一区二区三区四区激情| 亚洲1区2区3区4区| 国产综合色在线| 99精品桃花视频在线观看| 在线观看www91| 欧美一区二区三区影视| 精品999在线播放| 成人欧美一区二区三区白人| 亚洲成人免费视频| 麻豆专区一区二区三区四区五区| 国产成人综合在线| 91色在线porny| 欧美一区二区三区四区视频| 久久九九久久九九| 亚洲一区二区偷拍精品| 久久99深爱久久99精品| 99re这里都是精品| 欧美日韩国产天堂| 国产欧美视频在线观看| 亚洲va韩国va欧美va| 国产美女视频91| 欧美在线免费播放| 精品国产伦一区二区三区免费| 亚洲欧洲精品一区二区精品久久久| 天堂一区二区在线免费观看| 国产一区二区伦理| 欧美视频中文字幕| 国产精品视频第一区| 视频一区国产视频| 99精品欧美一区二区蜜桃免费| 91精品国产免费| 伊人色综合久久天天| 高清shemale亚洲人妖| 欧美日韩精品免费| 国产精品久久久久精k8| 六月婷婷色综合| 欧美日韩亚洲不卡| 亚洲日本在线看| 狠狠色丁香婷婷综合| 精品视频色一区| 国产精品理伦片| 韩国视频一区二区| 欧美群妇大交群中文字幕| 国产精品色婷婷久久58| 美日韩一区二区| 欧美三级乱人伦电影| 亚洲图片欧美激情| 国产精品自拍av| 欧美va亚洲va香蕉在线| 亚洲高清不卡在线| 在线亚洲免费视频| 中文字幕亚洲一区二区va在线| 国产麻豆9l精品三级站| 日韩欧美www| 日韩精品三区四区| 欧美精品v国产精品v日韩精品| 亚洲男人的天堂在线观看| 成人一区在线观看| 日韩免费一区二区三区在线播放| 亚洲国产日韩精品| 欧美专区亚洲专区| 一区二区三区鲁丝不卡| 99re这里只有精品6| 亚洲品质自拍视频网站| 成人国产一区二区三区精品| 国产欧美一区二区精品性| 国产精品1024| 国产精品美女www爽爽爽| 不卡视频免费播放| 亚洲男人天堂一区|