Пример #1
0
    internal static Form_ImageShaper.DGVCell[] LoadProject(string filename)
    {
        List <string> cellSections = GetSections(filename);

        cellSections.RemoveAll(u => !u.Contains("Cell"));
        Form_ImageShaper.DGVCell[] cells = new Form_ImageShaper.DGVCell[cellSections.Count];
        for (int i = 0; i < cellSections.Count(); i++)
        {
            Form_ImageShaper.DGVCell cell = new Form_ImageShaper.DGVCell();
            int.TryParse(GetIniFileString(filename, cellSections[i], "ColumnIndex", ""), out cell.ColumnIndex);
            int.TryParse(GetIniFileString(filename, cellSections[i], "RowIndex", ""), out cell.RowIndex);

            string palfile = GetIniFileString(filename, cellSections[i], "FileName", "");
            int    tmp     = 0;
            int.TryParse(GetIniFileString(filename, cellSections[i], "CompressionFormat", ""), out tmp);
            SHP_TS_EncodingFormat CompressionFormat = (SHP_TS_EncodingFormat)tmp;
            tmp = 0;
            int.TryParse(GetIniFileString(filename, cellSections[i], "PaletteIndex", "0"), out tmp);
            CImageFile imf = new CImageFile(palfile, tmp, CompressionFormat);

            tmp = 0; int.TryParse(GetIniFileString(filename, cellSections[i], "BitFlags", "1"), out tmp); imf.BitFlags = (SHP_TS_BitFlags)tmp;
            bool.TryParse(GetIniFileString(filename, cellSections[i], "UseCustomBackgroundColor", ""), out imf.UseCustomBackgroundColor);
            imf.CustomBackgroundColor = String2Color(GetIniFileString(filename, cellSections[i], "CustomBackgroundColor", ""));
            bool.TryParse(GetIniFileString(filename, cellSections[i], "IsSHP", ""), out imf.IsSHP);
            tmp            = -1; int.TryParse(GetIniFileString(filename, cellSections[i], "SHPFrameNr", "-1"), out tmp); imf.SHPFrameNr = tmp;
            imf.RadarColor = String2Color(GetIniFileString(filename, cellSections[i], "RadarColor", ""));
            bool.TryParse(GetIniFileString(filename, cellSections[i], "RadarColorAverage", ""), out imf.RadarColorAverage);
            bool.TryParse(GetIniFileString(filename, cellSections[i], "CombineTransparentPixel", ""), out imf.CombineTransparentPixel);

            cell.Value = imf;
            cells[i]   = cell;
        }
        return(cells);
    }
Пример #2
0
    internal static void SaveProject(string filename, Form_ImageShaper.DGVCell[] Cells, CPalette[] Palettes)
    {
        SavePaletteSetup(filename, Palettes);

        for (int i = 0; i < Cells.Length; i++)
        {
            CImageFile imf = (CImageFile)Cells[i].Value;
            WritePrivateProfileString("Cell" + i.ToString("D5"), "ColumnIndex", Cells[i].ColumnIndex.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "RowIndex", Cells[i].RowIndex.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "FileName", imf.FileName, filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "BitFlags", ((int)imf.BitFlags).ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "CompressionFormat", ((int)imf.CompressionFormat).ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "UseCustomBackgroundColor", imf.UseCustomBackgroundColor.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "CustomBackgroundColor", Color2String(imf.CustomBackgroundColor), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "PaletteIndex", imf.PaletteIndex.ToString(), filename);
            //WritePrivateProfileString("Cell" + i.ToString("D5"), "PaletteName", imf.PaletteName.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "IsSHP", imf.IsSHP.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "SHPFrameNr", imf.SHPFrameNr.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "RadarColor", Color2String(imf.RadarColor), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "RadarColorAverage", imf.RadarColorAverage.ToString(), filename);
            WritePrivateProfileString("Cell" + i.ToString("D5"), "CombineTransparentPixel", imf.CombineTransparentPixel.ToString(), filename);
        }
    }