コード例 #1
0
ファイル: SGF_Tree.cs プロジェクト: macomfan/goGo
 private byte[] ReadBytes(int count)
 {
     if (index_ + count > length_)
     {
         SGFException.Throw("out of bounds");
     }
     byte[] result = new byte[count];
     Buffer.BlockCopy(buffer_, index_, result, 0, count);
     index_ += count;
     return(result);
 }
コード例 #2
0
 internal virtual void AddProperty(SGF_Property property)
 {
     if (property.Name.Length == 0)
     {
         SGFException.Throw("A Property name is NULL");
     }
     if (properties_.ContainsKey(property.Name))
     {
         SGFException.Throw("Attempt to add duplicate Property");
     }
     property.Setting = rootNote_.Setting;
     properties_.Add(property.Name, property);
 }
コード例 #3
0
ファイル: SGF_Tree.cs プロジェクト: macomfan/goGo
        public void OpenSGF(string filename)
        {
            if (!File.Exists(filename))
            {
                SGFException.Throw("The file: " + filename + "cannot be found");
            }
            FileStream fileReader = new FileStream(filename, FileMode.Open);

            if (fileReader.Length > int.MaxValue)
            {
                SGFException.Throw("The file is too large, not supported");
            }
            buffer_ = new byte[fileReader.Length];
            length_ = (int)fileReader.Length;
            index_  = 0;
            fileReader.Read(buffer_, 0, length_);
            Parse();
            buffer_ = null;
        }