# Common Library - File Index

## Project Structure

```
src/
├── Common/                          # New shared library project
│   ├── Common.csproj               # Project file
│   ├── StdUtil.cs                  # File system & encoding utilities
│   ├── StdWeb.cs                   # ASP.NET web utilities
│   ├── Properties/
│   │   └── AssemblyInfo.cs        # Assembly metadata
│   ├── README.md                   # Usage documentation
│   ├── CONSOLIDATION_SUMMARY.md    # Overview of consolidation
│   ├── CONTROLLER_UPDATES.md       # Specific code changes needed
│   └── QUICK_REFERENCE.md          # API quick reference
├── Web/                            # Existing web project
│   ├── StdUtil.cs                  # [TO BE REMOVED after migration]
│   ├── StdWeb.cs                   # [TO BE REMOVED after migration]
│   └── Controllers/
│       ├── DownloadController.cs   # [NEEDS UPDATE] - Line 11
│       └── UploadController.cs     # [NEEDS UPDATE] - Lines 11-12
├── MIGRATION_GUIDE.md              # Detailed migration instructions
├── migrate-to-common.ps1           # Automated migration script
└── Muqload.sln                     # Solution file (already includes Common)
```

## Documentation Files

| File | Purpose |
|------|---------|
| `Common/README.md` | Main documentation for using the Common library |
| `MIGRATION_GUIDE.md` | Step-by-step instructions for migrating existing projects |
| `Common/CONSOLIDATION_SUMMARY.md` | Overview of what was consolidated and why |
| `Common/CONTROLLER_UPDATES.md` | Specific file changes for Web project |
| `Common/QUICK_REFERENCE.md` | API reference for StdUtil and StdWeb methods |
| `migrate-to-common.ps1` | PowerShell script to automate migration |
| `Common/FILE_INDEX.md` | This file - complete file listing |

## Source Code Files

| File | Description | Lines |
|------|-------------|-------|
| `Common/StdUtil.cs` | File system, encoding, URL utilities | ~260 |
| `Common/StdWeb.cs` | ASP.NET web helper methods | ~110 |
| `Common/Properties/AssemblyInfo.cs` | Assembly metadata | ~20 |

## Status

### ✅ Completed
- Common library project created
- Utilities moved to the `Utils` namespace
- Common project added to solution
- Build verification passed
- Complete documentation created

### Baseline usage
1. Add project reference to `Common\Common.csproj`
2. Use `using Utils;` or `using static Utils.StdUtil;` / `using static Utils.StdWeb;`
3. Exclude or remove any legacy local `StdUtil.cs` and `StdWeb.cs` files

## Quick Start

### To Complete the Migration:

**Option 1 - Automated:**
```powershell
.\migrate-to-common.ps1
```

**Option 2 - Manual:**
1. Read `MIGRATION_GUIDE.md`
2. Follow steps 1-4
3. Test thoroughly

### To Use in New Projects:

1. Add project reference to `Common\Common.csproj`
2. Add using statement:
   ```csharp
   using Utils;
   // or
   using static Utils.StdUtil;
   using static Utils.StdWeb;
   ```
3. Call utility methods as needed

## API Overview

### StdUtil Methods (14 methods)
- Time: `NowMsec()`, `Ftimed()`
- File I/O: `SafeRead()`, `SafeReadBin()`, `SafeRetainIn()`, `SafeWriteFsys()`
- Directory: `GetNextIn()`
- Encoding: `BinHexA()`, `hex2asc()`, `asc2hex()`
- URL: `Xscape()`, `unXscape()`, `Uncommand()`
- HTML: `BodyOf()`, `Quoted()`

### StdWeb Methods (11 methods)
- Context: `WinHref()`, `TemZone()`, `WorkZone()`
- File I/O: `SafeRetain()`, `SafeRetainF()`, `SafeWrite()`, `Appender()`, `DelWork()`
- Request: `HasReq()`, `SafeReq()`, `GetReq()`, `HasGuid()`
- Validation: `urlFileExists()`

## Support

For questions or issues:
1. Check `Common/README.md` for usage examples
2. Review `Common/QUICK_REFERENCE.md` for API details
3. See `MIGRATION_GUIDE.md` for migration help
