Exemplo n.º 1
0
 public static void Save(ClgFile clg, string filename)
 {
     using (var fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
         using (var writer = new BinaryWriter(fs, Encoding.ASCII))
         {
             clg.Write(writer);
         }
 }
Exemplo n.º 2
0
 public static void Save(ClgFile clg, string filename)
 {
     using (var fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
     using (var writer = new BinaryWriter(fs, Encoding.ASCII))
     {
         clg.Write(writer);
     }
 }
Exemplo n.º 3
0
 public static ClgFile Load(string filename)
 {
     using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
     using (var reader = new BinaryReader(fs, Encoding.ASCII))
     {
         var clg = new ClgFile { FileName = filename, Character = filename.Substring(filename.Length - 7, 3) };
         clg.Read(reader);
         return clg;
     }
 }
Exemplo n.º 4
0
 public static ClgFile Load(string filename)
 {
     using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
         using (var reader = new BinaryReader(fs, Encoding.ASCII))
         {
             var clg = new ClgFile {
                 FileName = filename, Character = filename.Substring(filename.Length - 7, 3)
             };
             clg.Read(reader);
             return(clg);
         }
 }
Exemplo n.º 5
0
        private void cmdOpen_Click(object sender, EventArgs e)
        {
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                this.ActiveFile = Clg.ClgFile.Load(this.openFileDialog1.FileName);

                var commands = from p in CommandPart.KnownParts
                               where string.Equals(p.Character, "CMN", StringComparison.OrdinalIgnoreCase) ||
                                     string.Equals(p.Character, this.ActiveFile.Character)
                               select p;
                foreach (var cb in this.cbMatrix)
                {
                    // !!!Intentionally re-evaluate the query to get a new list for each combobox!!!
                    cb.DataSource = commands.ToArray();
                    cb.DisplayMember = "Description";
                    cb.ValueMember = "Id";
                }

                this.bsLevelSelect.DataSource = this.ActiveFile.Levels;
                this.cmdSave.Enabled = true;
                this.toolStripScripts.Enabled = true;
                this.lblStatus.Text = this.ActiveFile.FileName;
            }
        }