Exemple #1
0
 /// <summary>
 /// Save all mircrooperations to file
 /// </summary>
 /// <param name="fileName">String representing path to file</param>
 public void SaveTable(string fileName)
 {
     try {
         using (BinaryWriter bw = new BinaryWriter(File.Open(fileName, FileMode.Create))) {
             bw.Write(Grid_PM.Columns.Count);
             bw.Write(Grid_PM.Rows.Count);
             foreach (DataGridViewRow row in Grid_PM.Rows)
             {
                 for (int j = 0; j < Grid_PM.Columns.Count; ++j)
                 {
                     var val = row.Cells[j].Value;
                     bw.Write(true);
                     bw.Write(val.ToString());
                 }
             }
         }
         uint crc = CRC.ComputePMChecksum(File.ReadAllBytes(fileName));
         using (BinaryWriter bw = new BinaryWriter(File.Open(fileName, FileMode.Append))) {
             bw.Write(crc);
         }
         for (int i = 0; i < 256; ++i)
         {
             List_MicroOps[i] = new MicroOperation(i, Grid_PM[1, i].Value.ToString(), Grid_PM[2, i].Value.ToString(),
                                                   Grid_PM[3, i].Value.ToString(), Grid_PM[4, i].Value.ToString(),
                                                   Grid_PM[5, i].Value.ToString(), Grid_PM[6, i].Value.ToString(),
                                                   Grid_PM[7, i].Value.ToString(), Grid_PM[8, i].Value.ToString(),
                                                   Grid_PM[9, i].Value.ToString(), Grid_PM[10, i].Value.ToString(),
                                                   Grid_PM[11, i].Value.ToString());
         }
     }
     catch { MessageBox.Show("Nie można uzyskać dostępu do tego pliku"); }
 }
Exemple #2
0
 internal void CloseForm()
 {
     for (int i = 0; i < 256; ++i)
     {
         List_MicroOps[i] = new MicroOperation(i, Grid_PM[1, i].Value.ToString(), Grid_PM[2, i].Value.ToString(),
                                               Grid_PM[3, i].Value.ToString(), Grid_PM[4, i].Value.ToString(),
                                               Grid_PM[5, i].Value.ToString(), Grid_PM[6, i].Value.ToString(),
                                               Grid_PM[7, i].Value.ToString(), Grid_PM[8, i].Value.ToString(),
                                               Grid_PM[9, i].Value.ToString(), Grid_PM[10, i].Value.ToString(),
                                               Grid_PM[11, i].Value.ToString());
     }
 }
Exemple #3
0
        private static bool AddToPrint(bool add, MicroOperation row, ref string tmp, int idx)
        {
            if (add)
            {
                tmp += "".PadRight(9, ' ');
            }
            bool addToPrint = true;

            tmp += row.getColumnName(idx).PadRight(8, ' ');
            //tmp += "___" + row.getColumn(idx).PadRight(8, ' ');
            tmp += "___" + Translator.GetMicroOpExtendedDescription(row.getColumn(idx)).PadRight(8, ' ') + "\r\n";
            return(addToPrint);
        }