Alex Sokolek
Member
- Joined
- Apr 5, 2024
- Messages
- 44
) should function correctly as long as there are no spaces between them. You can specify the language like (
c++), but not all forums support this.) should function correctly as long as there are no spaces between them. You can specify the language like (
c++), but not all forums support this.To format your text as code, type [ code ]your code here[ /code ] without the spaces inside the brackets.Hi. I am still unable to properly post code on your site. The indentation get ignored. I tried backticks (```), tildas (~~~) and backticks with c++ (```c++).
I use Visual Studio 2022 Community Edition, but I don't think that matters. When I post, I use Chrome, and I manually type the backticks, then paste the code. Any ideas? Thank you.
void HashedFiles::SortAndCheck(int SortMode)
{
// Shell Sort
BOOL swap;
tagFileNode* TempNode;
int i, j, diff = 0;
for (j = _NodeCount / 2; j > 0; j /= 2)
{
swap = true;
while (swap)
{
swap = false;
for (i = 0; i + j < _NodeCount; ++i)
{
switch (SortMode)
{
case 0: // By FileHash, then by FileName
diff = HashCompare(_NodeList[i]->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str());
if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 1: // By FileName alone
diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 2: // By FileDate, then by FileTime, then by FileName
diff = DateCompare(_NodeList[i]->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str());
if (diff == 0) diff = TimeCompare(_NodeList[i]->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str());
if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
case 3: // By FileSize, then by FileName
diff = SizeCompare(_NodeList[i]->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str());
if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str());
break;
}
if (diff > 0)
{
swap = true;
TempNode = _NodeList[i];
_NodeList[i] = _NodeList[i + j];
_NodeList[i + j] = TempNode;
}
}
}
}
// Scan for duplicate hashes and mark them.
if (SortMode == 0)
{
for (i = 1; i < _NodeCount; ++i)
{
if (_NodeList[i]->FileHash->compare(_NodeList[i - 1]->FileHash->c_str()) == 0)
_NodeList[i]->Duplicate = true; else _NodeList[i]->Duplicate = false;
}
}
}
It sadly knows very little about even on the website is on. It basically is just API calls to GPT-4. Its possible it could be enhanced down the road!p.s. I did not even have to change tabs to spaces, and I did not need to escape the italics command problem i was having with square brackets.
I suggest that the ChatGPT data base be updated to suggest [ code ] and [ /code ] instead of three grave accents.
[PRE]
tags is a valid approach, but it might not render as expected depending on forum formatting rules. Here's how you can properly post code snippets to ensure readability and styling:` tags for forums like XenForo. - Example: ``` [CODE=cpp] BOOL swap; tagFileNode* TempNode; for (int i = 0; i < NodeCount; ++i) { // Your code here }
2. **Using PRE Tags (As You’re Doing)**: - Ensure proper formatting by avoiding extra backslashes or unnecessary nesting. - Example: [code] void exampleFunction() { cout code] [CODE] 3. **Avoid Mixing Markdown with BBCode**: - The backticks (```) you’re using signal Markdown syntax, but many forums, especially XenForo, don’t interpret Markdown natively. 4. **Indentation**: - If spaces work better than tabs due to formatting quirks, stick with them. But a consistent 4-space indentation often works universally. --- ### Corrected Version of Your Code: Here’s how your code could look using BBCode for structured formatting:
BOOL swap; tagFileNode* TempNode; int i, j, diff = 0; for (j = _NodeCount / 2; j > 0; j /= 2) { swap = true; while (swap) { swap = false; for (i = 0; i + j < _NodeCount; ++i) { switch (SortMode) { case 0: // By FileHash, then by FileName diff = HashCompare(_NodeList[i]->FileHash->c_str(), _NodeList[i + j]->FileHash->c_str()); if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str()); break; case 1: // By FileName alone diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str()); break; case 2: // By FileDate, then by FileTime, then by FileName diff = DateCompare(_NodeList[i]->FileDate->c_str(), _NodeList[i + j]->FileDate->c_str()); if (diff == 0) diff = TimeCompare(_NodeList[i]->FileTime->c_str(), _NodeList[i + j]->FileTime->c_str()); if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str()); break; case 3: // By FileSize, then by FileName diff = SizeCompare(_NodeList[i]->FileSize->c_str(), _NodeList[i + j]->FileSize->c_str()); if (diff == 0) diff = FileCompare(_NodeList[i]->FileName->c_str(), _NodeList[i + j]->FileName->c_str()); break; } if (diff > 0) { swap = true; TempNode = _NodeList[i]; _NodeList[i] = _NodeList[i + j]; _NodeList[i + j] = TempNode; } } } }
[CODE=language]
tag (like cpp
for C++ in this case).
); simply close tags normally (
).