Alex Sokolek
Member
- Joined
- Apr 5, 2024
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.