Example #1
0
		wcs		FNGen::gen(const wcs& prefix, int digits, const wcs suffix)
		{
			int i;

			wcs search_filename=prefix;
			for(i=0;i<digits;++i)
				search_filename+='?';
			search_filename+=suffix;

			int new_no=1;

			do
			{
				WIN32_FIND_DATA data;
				HANDLE handle;
				handle=FindFirstFile(search_filename.c_str(),&data);
				if(handle==INVALID_HANDLE_VALUE)
					break;

				wcs last_filename=data.cFileName;
				while(FindNextFile(handle,&data))
					if(last_filename<wcs(data.cFileName))
						last_filename=data.cFileName;

				FindClose(handle);

				new_no=_wtoi(last_filename.substr(prefix.length(),digits).c_str())+1;
			}while(0);

			return prefix+FORMATW((wcs(L"%0")+FORMATW(L"%d",digits)+L"d").c_str(),new_no)+suffix;
		}
Example #2
0
			static std::wstring char_to_wchar(const std::string& str)
			{
				int size	=	MultiByteToWideChar(CP_ACP,0,str.c_str(),-1,0,0);
				boost::scoped_array<wchar_t> wcs(new wchar_t[size]);
			
				MultiByteToWideChar(CP_ACP,0,str.c_str(),-1,wcs.get(),size);

				return std::wstring(wcs.get());
			}
Example #3
0
		void			SLightNode::buildControllers(const wcs& node_name)
		{
			if(!_animdata_color && !_animdata_multiplier && !_animdata_radius && !_animdata_inner_cone && !_animdata_outer_cone)
				return;

			SPtr<LightCtrl> c = new LightCtrl(wcs(L"LightCtrl: ") + node_name, this);
			c->setAnimDataColor(_animdata_color);
			c->setAnimDataMultiplier(_animdata_multiplier);
			c->setAnimDataRadius(_animdata_radius);
			c->setAnimDataInnerAngle(_animdata_inner_cone);
			c->setAnimDataOuterAngle(_animdata_outer_cone);

			if(true)
			{
				REAL start, end;
				c->getAnimDataTimeRange(start, end);
				c->getAnimCtrl()->set(TimeAnimCfg(start, end, -1));
			}

			getCtrlSet().attachCtrl(c);
		}
Example #4
0
		wcs	esc_http_str(const wcs& str, uint32_t codepage)
		{
			wcs s;
			int i,j;
			for(i=0;i<(int)str.size();++i)
			{
				wchar_t ch=str[i];
				if(
					(ch>='A'&&ch<='Z')||
					(ch>='a'&&ch<='z')||
					(ch>='0'&&ch<='9')
					)
					s+=str[i];
				else
				{
					mbs c=WCSTOMBS(wcs(L"")+str[i],codepage);
					for(j=0;j<(int)c.size();++j)
						s+=FORMATW(L"%%%02X",(unsigned char)c[j]);
				}
			}
			return s;
		}
Example #5
0
int bbs_zsendfile(char *filename, char *remote)
{
    struct stat f;

    if (stat(filename, &f) != 0)
        return ERROR;
    Totalleft = f.st_size;
    Filesleft = 1;
    calc_blklen(Totalleft);
    protocol = ZM_ZMODEM;
    io_mode_fd = 1;
    blklen = start_blklen = 1024;
    if (setjmp(zmodemjmp) == 0) {
        zsendline_init();
        io_mode(io_mode_fd, 1);
        readline_setup(io_mode_fd, 128, 256);
        raw_write(0, "rz\r", 3);

        /*   TODO : throw away received input */

        purgeline(io_mode_fd);
        stohdr(0L);
        zshhdr(ZRQINIT, Txhdr);
        zrqinits_sent++;
        oflush();

        Crcflg = FALSE;
        firstsec = TRUE;
        bytcnt = (size_t) - 1;
        Totsecs = 0;

        if (wcs(filename, remote) == ERROR) {
            readline_clean();
            return ERROR;
        }
        if (zmodem_requested)
            saybibi();
        else if (protocol != ZM_XMODEM) {
            struct zm_fileinfo zi;
            char *pa;

            pa = (char *)malloc(PATH_MAX + 1);
            *pa = '\0';
            zi.fname = pa;
            zi.modtime = 0;
            zi.mode = 0;
            zi.bytes_total = 0;
            zi.bytes_sent = 0;
            zi.bytes_received = 0;
            zi.bytes_skipped = 0;
            wctxpn(&zi);
            free(pa);
        }

        oflush();
        /* here needs a oflush */
        /* eat avalible input */
        /* better to eat some input here */
        io_mode(io_mode_fd, 0);
        readline_clean();
    } else {
        oflush();
        signal(SIGALRM, SIG_IGN);
        alarm(0);
        return ERROR;
    }
    return OK;
}