ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Writing INI files for tourist names (Sdk)
Writing INI files for tourist names // SdkflashbstudiosAug 4, 2005, 4:43pm
I am wondering how this is possible since "s arnt allowed with filenames
on my computer can anyone tell me how (I am using the VB Wrapper Build 41 btw...) -- Flashbstudios, President of AuburnFlame Inc. lord fettAug 4, 2005, 6:02pm
You can replace the "'s with another character that is accepted to save
them to the INI file, and when you go to load the names back, convert that chracter back to " [View Quote] strike rapierAug 5, 2005, 3:18am
Replace$(aw_string$(AW_AVATAR_NAME), chr(34), "_")
For the record, if you are making something that needs to be high performance - INI files are terrible for it, especially when writing them on XP2. -- - Mark Randall http://zetech.swehli.com [View Quote] strike rapierAug 5, 2005, 10:06am
xelagAug 6, 2005, 10:16am
You could encode the filename using for example the encoding technique
for URL strings. That's what xelagot does when saving files for individual worlds. unchanged: "a" to "z", "A" to "Z", underscore "_", numbers "0" to "9" spaces are replaced by "+" symbol (or by %20) all other characters are formed by a "%" followed by two characters, standing for the hexadecimal value of the character. For example, "%" is encoded as %25. To read back, apply the converse system: (1) change all "+" to spaces, (2) then any time the "%" char appears, check if the following two chars form a hex number, convert it to the corresponding character. Alex. On 4 Aug 2005 14:43:03 -0400, "Flashbstudios" <staff at auburnflame.com> [View Quote] >I am wondering how this is possible since "s arnt allowed with filenames >on my computer can anyone tell me how (I am using the VB Wrapper Build >41 btw...) xelagAug 6, 2005, 10:25am
I use these two function (in Delphi ppascal). Note that in Delphi,
string chars start at 1, I think in C they start at 0. function URLEncode(u: string): string; var i: Integer; const okchars = '1234567890_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; begin Result := ''; for i := 1 to Length(u) do begin if Pos(u[i], okchars) > 0 then Result := Result + u[i] else if u[i] = ' ' then Result := Result + '+' else Result := Result + '%' + IntToHex(Byte(u[i]), 2); end; end; function URLDecode(u: string): string; var i: Integer; begin Result := ''; i := 1; while i <= Length(u) do begin if u[i] = '%' then begin try Result := Result + Char(StrToInt('$' + u[i + 1] + u[i + 2])); except end; inc(i); inc(i); end else if u[i] = '+' then Result := Result + ' ' else Result := Result + u[i]; inc(i); end; end; [View Quote] >You could encode the filename using for example the encoding technique >for URL strings. That's what xelagot does when saving files for >individual worlds. > >unchanged: "a" to "z", "A" to "Z", underscore "_", numbers "0" to "9" >spaces are replaced by "+" symbol (or by %20) >all other characters are formed by a "%" followed by two characters, >standing for the hexadecimal value of the character. For example, "%" >is encoded as %25. > >To read back, apply the converse system: (1) change all "+" to spaces, >(2) then any time the "%" char appears, check if the following two >chars form a hex number, convert it to the corresponding character. > >Alex. > >On 4 Aug 2005 14:43:03 -0400, "Flashbstudios" <staff at auburnflame.com> [View Quote] thenormOct 15, 2005, 3:23am
|