Ejemplo n.º 1
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (isOpen)
            {
                VCI_CloseDevice(deviceType, deviceId);
                isOpen = false;
            }
            else
            {
                deviceType = arrDeviceTypes[cbo_devtype.SelectedIndex];

                deviceId = (UInt32)cbo_DevIndex.SelectedIndex;
                canId    = (UInt32)cbo_CANIndex.SelectedIndex;
                if (VCI_OpenDevice(deviceType, deviceId, 0) == 0)
                {
                    MessageBox.Show("打开设备失败,请检查设备类型和设备索引号是否正确", "错误",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                isOpen = true;
                INIT config = new INIT();
                config.AccCode = Convert.ToUInt32("0x" + txt_AccCode.Text, 16);
                config.AccMask = Convert.ToUInt32("0x" + txt_AccMask.Text, 16);
                config.Timing0 = Convert.ToByte("0x" + txt_Time0.Text, 16);
                config.Timing1 = Convert.ToByte("0x" + txt_Time1.Text, 16);
                config.Filter  = (Byte)(cbo_Filter.SelectedIndex + 1);
                config.Mode    = (Byte)cbo_Mode.SelectedIndex;
                VCI_InitCAN(deviceType, deviceId, canId, ref config);
            }
            btnConnect.Text = isOpen ? "断开" : "连接";
            timer1.Enabled  = isOpen ? true : false;
        }
Ejemplo n.º 2
0
        private void comboChange(object sender, SelectionChangedEventArgs e)
        {
            string selected = (sender as ComboBox).SelectedItem.ToString();

            if (!selected.Equals(currentWindowsResolution[0].ToString() + " X " + currentWindowsResolution[1].ToString()))
            {
                sysRes.IsChecked = false;
                new IniManager(_iniFilepath).setParameter(keyWidth, (selected.Split('X')[0]).Trim(), _iniSection);
                new IniManager(_iniFilepath).setParameter(keyHeight, (selected.Split('X')[1]).Trim(), _iniSection);
            }
            else
            {
                sysRes.IsChecked = true;
                new IniManager(_iniFilepath).setParameter(keyWidth, (selected.Split('X')[0]).Trim(), _iniSection);
                new IniManager(_iniFilepath).setParameter(keyHeight, (selected.Split('X')[1]).Trim(), _iniSection);
            }

            if (GAME_TYPE.resolutionItemChangeWithCopyUIFixes)
            {
                string resolFixfile = INIT.RES_DIR + @"SkyUIFixesINI\" + (selected.Split('X')[0]).Trim() + "x" + (selected.Split('X')[1]).Trim() + @"\SkyrimCustom.ini";
                string skyrimcustom = INIT.getpath("skyrimcustom_ini_userdocs");
                if (File.Exists(resolFixfile))
                {
                    FileManager.remove(skyrimcustom);
                    FileManager.copyFiles(resolFixfile, skyrimcustom);
                }
                else
                {
                    MessageBox.Show("Внимание: для выбранного разрешения нет исправлений для анимации в меню!");
                }
            }
        }
Ejemplo n.º 3
0
        new void Init(INIT p_init, float p_value)
        {
            switch (p_init)
            {
            case INIT.ZERO:
                Fill(0);
                break;

            case INIT.IDENTITY:
                Fill(0);
                for (int i = 0; i < _rows; i++)
                {
                    _arr[i * _cols + i] = 1;
                }
                break;

            case INIT.VALUE:
                Fill(p_value);
                break;

            case INIT.RANDOM:
                for (int i = 0; i < _rows; i++)
                {
                    for (int j = 0; j < _cols; j++)
                    {
                        _arr[i * _cols + j] = RandomGenerator.getInstance().Rand(-1, 1);
                    }
                }
                break;
            }
        }
Ejemplo n.º 4
0
        public static void changeLO(CONTROLS_ACTIONS action)
        {
            if (action.Equals(CONTROLS_ACTIONS.RESET))
            {
                try
                {
                    FileManager.remove(INIT.PLUGINS_TXT_PATH);
                    FileManager.copyFiles(INIT.getpath("plugins_txt_backup"), INIT.PLUGINS_TXT_PATH);
                }
                catch
                {
                    MessageBox.Show("Не удалось провести сброс");
                }
            }
            else
            {
                if (currentShifted != null)
                {
                    PluginInList current = LO.Find(o => o.getTitle().Equals(currentShifted.getTitle()));
                    int          pos     = LO.IndexOf(current);

                    if (action.Equals(CONTROLS_ACTIONS.UP) && (pos == INIT.MASTER_FILES_ESM.Length))
                    {
                        return;
                    }
                    if (action.Equals(CONTROLS_ACTIONS.DOWN) && (pos >= LO.Count - 1))
                    {
                        return;
                    }


                    PluginInList tmp;

                    switch (action)
                    {
                    case CONTROLS_ACTIONS.UP:

                        tmp = LO[pos];

                        LO[pos] = LO[pos - 1];

                        LO[pos - 1] = tmp;

                        break;

                    case CONTROLS_ACTIONS.DOWN:
                        tmp         = LO[pos];
                        LO[pos]     = LO[pos + 1];
                        LO[pos + 1] = tmp;
                        break;

                    default:
                        break;
                    }
                    writeLOInFile();
                }
            }
        }
Ejemplo n.º 5
0
        Transcribe(MSyl syl)
        {
            string init = "";
            INIT   i    = syl.Initial;
            TONE   t    = syl.Tone;

            if (t == TONE.NEUTRAL)
            {
                init = ".";
                t    = TONE.CLEAR;
            }

            try {
                if (i == INIT.Void)
                {
                    if (syl.Medial > MED._)
                    {
                        if (t > TONE.MUDDY && t < TONE.NEUTRAL || syl.Rime == RIME.ONG)                  //oblique forms
                        {
                            return(init + _ywObliqueTrans [new MRt(syl.Rime, t)]);
                        }
                    }
                }
                else
                {
                    if (syl.InitialGroup == INITGROUP.GGRP && syl.IsPalatized)                      //gi ki hi gni
                    {
                        init += i == INIT.G ? "j" : i == INIT.K ? "ch" : i == INIT.H ? "sh" : "gn";
                    }
                    else
                    {
                        init += _iTrans [i];
                        if (i.IsSonorant())
                        {
                            if (syl.Tone == TONE.CLEAR)
                            {
                                init += "h";
                            }
                            else if (syl.Tone == TONE.MUDDY)
                            {
                                t = TONE.CLEAR;
                            }
                        }
                    }
                }

                return(init + _rTrans [new MRt(syl.Rime, t)]);
            } catch (Exception) {
                throw new ArgumentException(
                          string.Format("Try to transcribe a invalid mandarin syllable:{0} into GwoyeuRomatzyh!", syl));
            }
        }
Ejemplo n.º 6
0
        public static void writeLOInFile()
        {
            ArrayList LOForWriteinFile = new ArrayList();

            if (!GAME_TYPE.activepluginsMarkAsterisk)
            {
                LOForWriteinFile.Add("# This file is used to tell Oblivion which data files to load.");
                LOForWriteinFile.Add(Environment.NewLine);

                foreach (PluginInList plugin in LO)
                {
                    if (plugin.getActivity())
                    {
                        LOForWriteinFile.Add(plugin.getTitle());
                    }
                }
            }
            else
            {
                LOForWriteinFile.Add("# This file is used by Skyrim to keep track of your downloaded content.");
                LOForWriteinFile.Add("# Please do not modify this file.");

                foreach (PluginInList plugin in LO)
                {
                    if (!plugin.ismaster())
                    {
                        if (plugin.getActivity())
                        {
                            LOForWriteinFile.Add("*" + plugin.getTitle());
                        }
                        else
                        {
                            LOForWriteinFile.Add(plugin.getTitle());
                        }
                    }
                }
            }


            FileManager.WriteAllLines(INIT.getpath("plugins_txt"), LOForWriteinFile);
        }
Ejemplo n.º 7
0
        public void Init(INIT p_init, float p_limit)
        {
            switch (p_init)
            {
            case INIT.UNIFORM:
                Uniform(p_limit);
                break;

            case INIT.LECUN_UNIFORM:
                Uniform((float)Math.Pow(_inDim, -.5));
                break;

            case INIT.GLOROT_UNIFORM:
                Uniform(2f / (_inDim + _outDim));
                break;

            case INIT.IDENTITY:
                Identity();
                break;
            }
        }
Ejemplo n.º 8
0
        new void Init(INIT p_init, float p_value)
        {
            switch (p_init)
            {
            case INIT.ZERO:
                Fill(0);
                break;

            case INIT.ONES:
                Fill(1);
                break;

            case INIT.VALUE:
                Fill(p_value);
                break;

            case INIT.RANDOM:
                for (int i = 0; i < _rows; i++)
                {
                    _arr[i] = RandomGenerator.getInstance().Rand(-1f, 1f);
                }
                break;
            }
        }
Ejemplo n.º 9
0
        Transcribe(MSyl syl)
        {
            string start, end = "";
            INIT   i = syl.Initial;
            TONE   t = syl.Tone;
            MED    m = syl.Medial;
            RIME   r = syl.Rime;


            //initial
            if (i == INIT.Void && m != MED._)           //y w yu
            {
                return(_m0Trans[new MRt(r, t)]);
            }
            else if (syl.InitialGroup == INITGROUP.GGRP && syl.IsPalatized)           //j q x
            {
                start = _specInit[i];
                if (m == MED.IU && syl.Final != FIN.ENG)                //ü -> u but not iong
                {
                    r = (RIME)((byte)MED.U | (byte)syl.Final);          //ju qu xu
                }
            }
            else if (syl.InitialGroup == INITGROUP.TZGRP && m == MED.I && syl.Final == FIN.ZERO)            //zyi cyi syi
            {
                start = _specInit[i];
            }
            else
            {
                start = _miTrans[i];
            }

            //final
            _mfTrans.TryGetValue(new MRt(r, t), out end);

            return(start + end);
        }
Ejemplo n.º 10
0
 public Vector(int p_rows, int p_cols, INIT p_init, float p_value = 0) : base(p_rows, p_cols)
 {
     Init(p_init, p_value);
 }
Ejemplo n.º 11
0
 public Vector(int p_dim = 0, INIT p_init = INIT.ZERO, float p_value = 0) : base(p_dim, 1)
 {
     Init(p_init, p_value);
 }
Ejemplo n.º 12
0
 public MSyl(INIT init, MED med, FIN fin, TONE tone)
     : this((byte)((byte)init | (byte)tone), (byte)((byte)med | (byte)fin))
 {
 }
Ejemplo n.º 13
0
 public Matrix(int p_rows = 0, int p_cols = 0, INIT p_init = INIT.ZERO, float p_value = 0) : base(p_rows, p_cols)
 {
     Init(p_init, p_value);
 }
Ejemplo n.º 14
0
 protected void Init(INIT p_init, float p_value)
 {
 }
Ejemplo n.º 15
0
        static public bool IsSonorant(this INIT init)
        {
            int pos = ((byte)init) % 6;

            return(pos == 3 || pos == 5);
        }
Ejemplo n.º 16
0
 static extern UInt32 VCI_InitCAN(UInt32 deviceType, UInt32 deviceID, UInt32 CANInd, ref INIT pInitConfig);
Ejemplo n.º 17
0
        MunchSyllable(string s, ref int idx)
        {
            MImt imt;
            MRt  rt;

            INIT init = 0;
            MED  med = 0;
            FIN  fin = 0;
            TONE t1 = TONE.NEUTRAL, t2 = TONE.NEUTRAL;

            bool match = _miDict.TryMatchStart(s, ref idx, out imt);

            do
            {
                if (match)
                {
                    init = imt.Initial;
                    med  = imt.Medial;
                    t1   = imt.Tone;
                }

                var iMark = idx;
                match = _mfDict.TryMatchStart(s, ref idx, out rt);

                if (match)
                {
                    t2 = rt.Tone;

                    if (t2 != TONE.NEUTRAL && t1 != TONE.NEUTRAL)
                    {
                        idx = iMark;
                        break;
                    }

                    if (rt.Medial == MED.U)                       //IU + ONG
                    {
                        if (rt.Final == FIN.ZERO && med == MED.I) //IU
                        {
                            fin = FIN.OU;
                        }
                        else if (rt.Final == FIN.ENG)                        //ONG
                        {
                            med = med | MED.U;
                            fin = rt.Final;
                        }
                        else
                        {
                            idx = iMark;
                        }
                    }
                    else
                    {
                        fin = rt.Final;
                        if (fin == FIN.Y && med == MED.U)                       //UI
                        {
                            fin = FIN.EI;
                        }
                        else if (fin == FIN.E && ((med & MED.I) == MED.I))                              //ie,üe
                        {
                            fin = FIN.È;
                        }
                    }
                }
            } while(false);

            if (init == 0 && med == 0 && fin == 0)
            {
                return(MSyl.Default);
            }

            return(new MSyl(init, med, fin, (t1 == TONE.NEUTRAL ? t2 : t1)));
        }
Ejemplo n.º 18
0
 static void Main(string[] args)
 {
     INIT.Init();
 }
Ejemplo n.º 19
0
 public Vector(int p_dim = 0, INIT p_init = INIT.ZERO, float p_value = 0) : base(p_dim, 1)
 {
     DEBUG_Counter++;
     Init(p_init, p_value);
 }
Ejemplo n.º 20
0
 public MImt(INIT i, MED m = MED._, TONE t = TONE.NEUTRAL)
 {
     _syl = new MSyl(i,m,FIN.ZERO,t);
 }
Ejemplo n.º 21
0
 public MImt(INIT i, MED m = MED._, TONE t = TONE.NEUTRAL)
 {
     _syl = new MSyl(i, m, FIN.ZERO, t);
 }
Ejemplo n.º 22
0
 static public INITGROUP GetGroup(this INIT init)
 {
     return((INITGROUP)(((byte)init + 5) / 6));
 }