亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲精品视频免费观看| 国内精品久久久久影院色| 欧美另类高清zo欧美| 国产成人综合亚洲网站| 亚洲国产精品久久不卡毛片| 精品粉嫩超白一线天av| 在线一区二区视频| 国产一区二区三区视频在线播放| 亚洲精品第一国产综合野| 国产精品盗摄一区二区三区| 欧美大胆一级视频| 欧美午夜电影网| 成人激情视频网站| 极品销魂美女一区二区三区| 亚洲电影在线播放| 日韩精品乱码av一区二区| 一区二区三区加勒比av| 中文字幕不卡的av| 欧美sm极限捆绑bd| 日韩片之四级片| 欧美一卡2卡3卡4卡| 欧美色精品天天在线观看视频| 国产69精品一区二区亚洲孕妇 | 日韩和欧美的一区| 日韩二区三区四区| 天天亚洲美女在线视频| 一区二区三区四区乱视频| 亚洲午夜精品17c| 蜜桃一区二区三区在线| 视频在线在亚洲| 国产一区二区在线免费观看| 不卡电影一区二区三区| 欧美性高清videossexo| 5858s免费视频成人| 欧美久久一二三四区| 精品国产sm最大网站免费看| 国产精品每日更新在线播放网址| 中文在线资源观看网站视频免费不卡| 国产精品久久夜| 偷拍与自拍一区| 国产盗摄女厕一区二区三区| 色偷偷成人一区二区三区91 | 欧美中文字幕一区| 在线亚洲精品福利网址导航| 欧美一区二区精品在线| 欧美激情综合在线| 亚洲成人动漫精品| 日韩av电影天堂| 岛国精品在线播放| 成人久久18免费网站麻豆 | 91.com视频| 国产精品女上位| 日韩高清国产一区在线| www.日韩大片| 91福利社在线观看| 26uuu精品一区二区在线观看| 久久亚洲综合色一区二区三区| 日韩理论在线观看| 亚洲1区2区3区4区| 高清视频一区二区| 91精品国产色综合久久不卡蜜臀| 国产精品嫩草影院com| 肉色丝袜一区二区| 91在线观看下载| 色综合一区二区| 欧美精品 日韩| 亚洲欧洲性图库| 秋霞午夜av一区二区三区| 久久久99精品久久| 国产欧美日韩不卡免费| 在线观看精品一区| 日韩欧美第一区| 欧美亚洲一区二区在线| 久久久青草青青国产亚洲免观| 91精品国产综合久久久久久漫画 | 一本一本久久a久久精品综合麻豆| 欧美成人aa大片| 亚洲成av人片在线观看| 93久久精品日日躁夜夜躁欧美| 久久久久国产成人精品亚洲午夜| 99久久免费精品| 国产亚洲欧美色| 极品销魂美女一区二区三区| 在线播放视频一区| 亚洲午夜久久久久| 色哟哟一区二区在线观看| 国产精品午夜免费| 国产精品热久久久久夜色精品三区 | av在线不卡观看免费观看| 日韩一二在线观看| 天堂va蜜桃一区二区三区漫画版| 色婷婷香蕉在线一区二区| 国产精品久久久久久久久快鸭| 国产一区二区三区四区五区美女| 欧美大度的电影原声| 蜜臀久久久久久久| 欧美一二三四在线| 日韩av网站在线观看| 欧美区视频在线观看| 久久精品免费在线观看| 国产一区在线不卡| 欧美va天堂va视频va在线| 激情欧美一区二区| 2024国产精品| 国产福利91精品一区| 国产视频一区二区三区在线观看| 国产精品中文字幕一区二区三区| 欧美性感一类影片在线播放| 一区二区三区日韩欧美精品| 色欧美乱欧美15图片| 一区二区三区欧美日韩| 欧美人妇做爰xxxⅹ性高电影 | 成人国产精品视频| 中文一区二区在线观看| 成人av网站在线观看| 亚洲欧洲美洲综合色网| 色综合天天综合网天天狠天天| 一区二区三区四区不卡在线 | 亚洲人成网站影音先锋播放| 韩国一区二区视频| 国产女人18毛片水真多成人如厕 | 色一情一伦一子一伦一区| 亚洲一区二区影院| 99久久精品久久久久久清纯| 日韩理论片网站| 欧美另类z0zxhd电影| 久久精品国内一区二区三区| 欧美高清精品3d| 麻豆久久一区二区| 久久精品综合网| 91丝袜国产在线播放| 五月激情丁香一区二区三区| 欧美成人女星排行榜| 国产成人av电影在线播放| 一区二区三区在线观看视频| 5566中文字幕一区二区电影 | 日韩一卡二卡三卡| 国产精品一级在线| 亚洲激情五月婷婷| 欧美日韩国产综合一区二区三区| 久久精品99国产精品| 国产精品久久久久久久久久久免费看| 91高清视频免费看| 久久精品久久综合| 亚洲欧洲日产国产综合网| 欧美精品丝袜中出| 国产精品18久久久久久久久| 亚洲人成在线观看一区二区| 91精品国产麻豆国产自产在线| 国产一区二区三区美女| 亚洲精品日产精品乱码不卡| 精品国精品自拍自在线| 91同城在线观看| 黑人巨大精品欧美一区| 亚洲一区二区三区四区五区中文| 久久久久久毛片| 欧美日韩在线三级| 成人天堂资源www在线| 日韩精品欧美精品| 亚洲精品欧美综合四区| 久久久久国产免费免费| 欧美日本一道本在线视频| 成人av中文字幕| 久久99精品久久只有精品| 亚洲男同1069视频| 国产丝袜欧美中文另类| 91.com在线观看| 在线免费观看日韩欧美| 成人小视频在线观看| 久久精品免费观看| 亚洲风情在线资源站| 18涩涩午夜精品.www| 久久在线免费观看| 欧美一区二区人人喊爽| 在线亚洲精品福利网址导航| 懂色av一区二区三区蜜臀| 日本成人超碰在线观看| 亚洲在线视频网站| 国产精品久久久久7777按摩| 精品久久久久久久久久久久久久久久久| 色婷婷av久久久久久久| 国产91丝袜在线播放九色| 麻豆成人免费电影| 天天操天天色综合| 亚洲一级二级在线| 亚洲日本一区二区| 中文字幕一区二区三区av| 国产目拍亚洲精品99久久精品| 欧美va亚洲va香蕉在线| 日韩欧美一区二区三区在线| 欧美美女一区二区在线观看| 日本高清不卡一区| 一本久久精品一区二区| 97se狠狠狠综合亚洲狠狠| 不卡区在线中文字幕| 丁香激情综合国产| 国产成人精品影视| 成人av先锋影音| 99久久亚洲一区二区三区青草| 国产电影一区二区三区|