示例#1
0
        public override string SetText(string value, string subvalue)
        {
            string       error;
            EncodingPair newValue = EncodingPair.ParseEncoding(value, out error);

            if (!newValue.IsNull)
            {
                this.value = newValue;
            }
            return(error);
        }
示例#2
0
 override public void SetTemp(SValue sValue)
 {
     if (sValue.IsString)
     {
         string       error;
         EncodingPair newValue = EncodingPair.ParseEncoding(sValue.String, out error);
         if (!newValue.IsNull)
         {
             value = newValue;
         }
     }
 }
示例#3
0
    public EncodingPair GetEncoding(string fullPath, EncodingPair defaultPair)
    {
        SValue value       = storage.Get(fullPath);
        string rawEncoding = value["encoding"].String;

        if (!string.IsNullOrEmpty(rawEncoding))
        {
            string       error;
            EncodingPair pair = EncodingPair.ParseEncoding(rawEncoding, out error);
            if (string.IsNullOrEmpty(error))
            {
                return(pair);
            }
        }
        return(defaultPair);
    }
    public static Encoding GetEncoding(MainForm mainForm, string parameters)
    {
        string rawEncoding = TryGetParameter(parameters, 'e');

        if (!string.IsNullOrEmpty(rawEncoding))
        {
            string       error;
            EncodingPair newValue = EncodingPair.ParseEncoding(rawEncoding, out error);
            if (!newValue.IsNull)
            {
                return(newValue.encoding);
            }
            if (mainForm.Dialogs != null)
            {
                mainForm.Dialogs.ShowInfo("Shell encoding", error + "");
            }
        }
        return(mainForm.Settings.shellEncoding.Value.encoding ?? Encoding.UTF8);
    }
示例#5
0
    public void ApplyQualitiesBeforeLoading(Buffer buffer)
    {
        if (buffer.isQualitiesApplied)
        {
            return;
        }
        buffer.isQualitiesApplied = true;
        SValue value       = storage.Get(buffer.FullPath);
        string rawEncoding = value["encoding"].String;

        if (!string.IsNullOrEmpty(rawEncoding))
        {
            string error;
            buffer.settedEncodingPair = EncodingPair.ParseEncoding(rawEncoding, out error);
        }
        buffer.customSyntax = value["syntax"].String;
        byte[] bookmarks = value["bm"].Bytes;
        if (bookmarks != null)
        {
            DecodeBookmarks(buffer.Controller, bookmarks);
        }
    }