Ejemplo n.º 1
0
 public void Enable(MD mn, bool state)
 {
     tsMD[(int)mn].Enabled = state; if (mn == MD.MBR)
     {
         browserWidgetContextMenuStrip.Enabled = state;
     }
 }
Ejemplo n.º 2
0
 protected void OnMBDropDownOpening(object sender, MD mn)
 {
     if (MBDropDownOpening != null)
     {
         MBDropDownOpening(sender, new MBDropDownOpeningEventArgs(mn));
     }
 }
Ejemplo n.º 3
0
    public static void Set()
    {
        MD datas = Save.GetData();

        tread              = datas.tread;
        TimeStone          = datas.TimeStone;
        HomeInventory      = datas.HomeInventory;
        HomeInventoryC     = datas.HomeInventoryC;
        BackpackInventory  = datas.BackpackInventory;
        BackpackInventoryC = datas.BackpackInventoryC;
        Armors             = datas.Armors;
        Supply             = datas.Supply;
        Levels             = datas.Levels;
        Health             = datas.Health;
        Hunger             = datas.Hunger;
        Armor              = datas.Armor;
        Xp              = datas.Xp;
        SkillsA         = datas.SkillsA;
        unlearneditems  = datas.unlearneditems;
        Progress        = datas.Progress;
        crafttime       = datas.crafttime;
        ext             = datas.ext;
        neededitemcount = datas.neededitemcount;
        itemindex       = datas.itemindex;
        item            = datas.item;
        exindex         = datas.exindex;
        risk            = datas.risk;
        attackchance    = datas.attackchance;
        loot            = datas.loot;
        aim             = datas.aim;
        SP              = datas.SP;
    }
Ejemplo n.º 4
0
 public void copy(ObservableModelData ObModelData)
 {
     base.Clear();
     foreach (ModelData MD in ObModelData)
     {
         base.Add((ModelData)MD.DeepCopy());
     }
     this.Change = ObModelData.Change;
 }
Ejemplo n.º 5
0
        public static void FinallyHandler(IAsyncResult iar)
        {
            Console.WriteLine("Thread ID = " + Thread.CurrentThread.ManagedThreadId);
            AsyncResult ar     = iar as AsyncResult;
            MD          d      = ar.AsyncDelegate as MD;
            int         result = d.EndInvoke(iar);

            Console.WriteLine("Res is {0}", result);
            Console.WriteLine(((DateTime)ar.AsyncState).ToLongTimeString()); // datetime
        }
Ejemplo n.º 6
0
        //--------------------------------------------------------
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (m_mouseDownMode == MD.NONE)
            {
                return;
            }
            bool b = false;
            int  v = 0;

            switch (m_mouseDownMode)
            {
            case MD.LEFT_BTN:
                v = 0;
                break;

            case MD.RIGHT_BTN:
                v = m_Maximum;
                break;

            case MD.PLEFT_BTN:
                v = m_Value - 100;
                if (v < 0)
                {
                    v = 0;
                }
                break;

            case MD.PRIGHT_BTN:
                v = m_Value + 100;
                if (v > m_Maximum)
                {
                    v = m_Maximum;
                }
                break;

            case MD.CURSOR:
                v = m_Value;
                break;
            }
            m_mouseDownMode = MD.NONE;
            m_DownValue     = 0;
            m_DownvaluePos  = 0;
            b       = (m_Value != v);
            m_Value = v;
            this.Invalidate();
            if (b)
            {
                OnChangeValueEvent(new EventArgs());
            }
            //base.OnMouseUp(e);
        }
Ejemplo n.º 7
0
    static void Main(string[] args)
    {
        var a1  = new CA1();
        var a11 = new CA11();
        var a2  = new CA2();
        var b1  = new CB1();
        var b2  = new CB2();

        MD.Foo(a1, b1);
        MD.Foo(a2, b1);
        MD.Foo(a1, b2);
        MD.Foo(a2, b2);
        MD.Foo(a11, b1);
        MD.Foo(a11, b2);
    }
Ejemplo n.º 8
0
        private void BUTcalc_Click(object sender, EventArgs e)
        {
            double N1, N2, MD;

            try
            {   //Declara N1, N2 e MD
                //Parse = passa number para uma string porque o
                //TXT tem como propriedade receber um texto || string
                //Se N1 ou N2 for menor que 0 ou maior que 10, escreve...
                N1 = double.Parse(TXTnota1.Text);
                N2 = double.Parse(TXTnota2.Text);
                if (N1 < 0 || N1 > 10 || N2 < 0 || N2 > 10)
                {
                    MessageBox.Show("Notas Inválidas \n Redigite!");
                    BUTlimp.PerformClick();
                }
                else
                {
                    //Média da Notas é Nota 1 + Nota 2, dividido por 2
                    //Média é apresentada como flutuante
                    MD            = (N1 + N2) / 2;
                    MD            = Math.Round(MD, 1);
                    LBLmedia.Text = MD.ToString("#0.0");
                    //Caso a nota média for maior que 5
                    if (MD >= 5)
                    {
                        //Pinta o Label do Resultado para a cor Azul
                        LBLresult.ForeColor = Color.Blue;
                        //Escreve no Label do Resultado que o aluno foi aprovado
                        LBLresult.Text = "Aprovado";
                    }
                    //Se não
                    else
                    {
                        //Pinta o Label do Resultado para a cor Vermelho
                        LBLresult.ForeColor = Color.Red;
                        //Escreve no Label do Resultado que o aluno foi reprovado
                        LBLresult.Text = "Reprovado";
                    }
                }
            }
            //Mensagem de erro
            catch
            {
                MessageBox.Show(" Digite apenas números! ");
                BUTlimp.PerformClick();
            }
        }
        public DateTime getHistoryFor(string asset, MD.CloudConnect.ITracking data)
        {
            DeviceModel device = RepositoryFactory.Instance.DeviceDb.GetDevice(asset);

            if (device != null)
            {
                foreach (KeyValuePair<string, Field> item in ((TrackingData)data).fields)
                {
                    if (device.LastFields != null && device.LastFields.ContainsKey(item.Key))
                        ((TrackingData)data).fields[item.Key].b64_value = device.LastFields[item.Key].B64Value;
                }
                ((TrackingData)data).location = new double[] { device.LastLongitude, device.LastLatitude };
                return device.LastReport;
            }
            else return DateTime.MinValue;
        }
Ejemplo n.º 10
0
        private async Task UpdateSyncTokenAsync()
        {
            string sig      = MD.Encrypt(this.userId + AppToken);
            var    response = await this.service.GetToken(this.userId, sig);

            if (response.HasError)
            {
                this.OnSynchronizationFailed(response.Error);
            }
            else
            {
                this.tokenTimestamp = DateTime.Now.Ticks;
                this.token          = response.Data;

                this.key = MD.Encrypt(MD.Encrypt(this.CryptoService.Decrypt(this.password)) + AppToken + this.token);
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Thread ID = " + Thread.CurrentThread.ManagedThreadId);

            MD md = Class.MyMethod;

            IAsyncResult iar = md.BeginInvoke(15, Class.FinallyHandler, DateTime.Now);
            int          m   = 30;

            while (m > 0)
            {
                Console.WriteLine("Num from Main {0}", m);
                Console.ResetColor();
                Thread.Sleep(700);
                m--;
            }

            Console.WriteLine("Finish Main");
        }
Ejemplo n.º 12
0
        private async Task <string> GetUserId()
        {
            if (string.IsNullOrEmpty(this.email))
            {
                this.OnSynchronizationFailed(ToodleDoResources.ToodleDo_EmptyUsername);
                return(null);
            }

            if (this.password == null || this.password.Length == 0)
            {
                this.OnSynchronizationFailed(ToodleDoResources.ToodleDo_EmptyPassword);
                return(null);
            }

            string decryptedPassword = this.CryptoService.Decrypt(this.password);

            if (string.IsNullOrEmpty(decryptedPassword))
            {
                // password exist but cannot be decrypted (because device changed for example)
                // remove this password and signal is it empty
                this.Workbook.Settings.SetValue <byte[]>(ToodleDoSettings.ToodleDoPassword, null);
                this.OnSynchronizationFailed(ToodleDoResources.ToodleDo_EmptyPassword);
                return(null);
            }

            if (string.IsNullOrEmpty(this.userId))
            {
                string sig      = MD.Encrypt(this.email + AppToken);
                var    response = await this.service.GetUserId(sig, this.email, this.CryptoService.Decrypt(this.password));

                if (response.HasError)
                {
                    this.OnSynchronizationFailed(response.Error);
                }
                else
                {
                    return(response.Data);
                }
            }

            return(this.userId);
        }
Ejemplo n.º 13
0
        static void testCustomInput(string input)
        {
            Console.WriteLine("Testing FNV1-Hash with string \"" + input + "\"");
            Console.WriteLine(FNV.fnv1_32Hash(stringToByteArray(input)));

            Console.WriteLine("Testing FNV1A-Hash with string \"" + input + "\"");
            Console.WriteLine(FNV.fnv1A_32Hash(stringToByteArray(input)));

            Console.WriteLine("Testing FNV0-Hash with string \"" + input + "\"");
            Console.WriteLine(FNV.fnv0_32Hash(stringToByteArray(input)) + '\n');

            Console.WriteLine("Testing CRC-Hash with string \"" + input + "\"");
            Console.WriteLine(CRC.crc_32Hash(stringToByteArray(input)));

            Console.WriteLine("Testing CRC-B-Hash with string \"" + input + "\"");
            Console.WriteLine(CRC.crcB_32Hash(stringToByteArray(input)) + '\n');

            Console.WriteLine("Testing Adler-Hash with string \"" + input + "\"");
            Console.WriteLine(Adler.adler_32Hash(stringToByteArray(input)) + '\n');

            Console.WriteLine("Testing MD2-Hash with string \"" + input + "\"");
            Console.WriteLine(MD.md2_128Hash(stringToByteArray(input)));

            Console.WriteLine("Testing MD4-Hash with string \"" + input + "\"");
            Console.WriteLine(MD.md4_128Hash(stringToByteArray(input)));

            Console.WriteLine("Testing MD5-Hash with string \"" + input + "\"");
            Console.WriteLine(MD.md5_128Hash(stringToByteArray(input)));

            Console.WriteLine("Testing SHA0-Hash with string \"" + input + "\"");
            Console.WriteLine(SHA.sha0_160Hash(stringToByteArray(input)) + '\n');

            Console.WriteLine("Testing SHA1-Hash with string \"" + input + "\"");
            Console.WriteLine(SHA.sha1_160Hash(stringToByteArray(input)) + '\n');

            Console.WriteLine("Testing SHA2-Hash with string \"" + input + "\"");
            Console.WriteLine(SHA.sha2_224Hash(stringToByteArray(input)));
        }
 public RxMeta(MD md) { this.md = md; }
Ejemplo n.º 15
0
 public RxMeta(MD md)
 {
     this.md = md;
 }
Ejemplo n.º 16
0
 public UMetaAttribute(MD key, float value)
     : this(UMeta.GetKey(key), value.ToString())
 {
 }
Ejemplo n.º 17
0
 public MBDropDownOpeningEventArgs(MD mn)
 {
     this.mn = mn;
 }
Ejemplo n.º 18
0
        //--------------------------------------------------------
        protected override void OnMouseDown(MouseEventArgs e)
        {
            int x = e.X;

            if ((x < 0) || (x >= this.Width))
            {
                return;
            }


            int  v = 0;
            bool b = false;

            if (x < LB.Width)
            {
                m_mouseDownMode = MD.LEFT_BTN;
            }
            else if (x < LB.Width + LA.Width)
            {
                m_mouseDownMode = MD.PLEFT_BTN;
            }
            else if (x < m_ValuePos)
            {
                v = (x - ARW.Height / 2 - m_ValueLeft) * m_Maximum / m_ValueArea;
                if (v < 0)
                {
                    v = 0;
                }
                b       = (m_Value != v);
                m_Value = v;
            }
            else if (x < m_ValuePos + ARW.Width)
            {
                m_mouseDownMode = MD.CURSOR;
                m_DownValue     = m_Value;
                m_DownvaluePos  = x;
            }
            else if (x < m_AreaRight + ARW.Width / 2)
            {
                v = (x - ARW.Height / 2 - m_ValueLeft) * m_Maximum / m_ValueArea;
                if (v > m_Maximum)
                {
                    v = m_Maximum;
                }
                b       = (m_Value != v);
                m_Value = v;
            }
            else if (x < m_AreaRight + ARW.Width / 2 + RA.Width)
            {
                m_mouseDownMode = MD.PRIGHT_BTN;
            }
            else
            {
                m_mouseDownMode = MD.RIGHT_BTN;
            }
            //base.OnMouseDown(e);
            this.Invalidate();
            if (b)
            {
                OnChangeValueEvent(new EventArgs());
            }
        }
Ejemplo n.º 19
0
 public void TestMD4()
 {
     Assert.Equal("7865F2C781395A074AC6161AE18059A3", MD.md4_128Hash(stringToByteArray("HelloKitty")));
 }
Ejemplo n.º 20
0
 public void Enable(MD mn, bool state)
 {
     tsMD[(int)mn].Enabled = state;
 }
Ejemplo n.º 21
0
 public void Enable(MD mn, bool state) { tsMD[(int)mn].Enabled = state; }
Ejemplo n.º 22
0
        //--------------------------------------------------------
        protected override void OnMouseDown(MouseEventArgs e)
        {
            int y = e.Y;

            if ((y < 0) || (y >= this.Height) || (m_Maximum <= 0))
            {
                return;
            }


            int  v = 0;
            bool b = false;

            if (y < TB.Height)
            {
                m_mouseDownMode = MD.TOP_BTN;
            }
            else if (y < TB.Height + TA.Height)
            {
                m_mouseDownMode = MD.PUP_BTN;
            }
            else if (y < m_ValuePos)
            {
                v = (y - ARW.Height / 2 - m_ValueTop) * m_Maximum / m_ValueArea;
                if (v < 0)
                {
                    v = 0;
                }
                b       = (m_Value != v);
                m_Value = v;
            }
            else if (y < m_ValuePos + ARW.Height)
            {
                m_mouseDownMode = MD.CURSOR;
                m_DownValue     = m_Value;
                m_DownvaluePos  = y;
            }
            else if (y < m_AreaBottom + ARW.Height / 2)
            {
                v = (y - ARW.Height / 2 - m_ValueTop) * m_Maximum / m_ValueArea;
                if (v > m_Maximum)
                {
                    v = m_Maximum;
                }
                b       = (m_Value != v);
                m_Value = v;
            }
            else if (y < m_AreaBottom + ARW.Height / 2 + BA.Height)
            {
                m_mouseDownMode = MD.PDOWN_BTN;
            }
            else
            {
                m_mouseDownMode = MD.END_BTN;
            }
            //base.OnMouseDown(e);
            this.Invalidate();
            if (b)
            {
                OnChangeValueEvent(new EventArgs());
            }
        }
Ejemplo n.º 23
0
 public void TestMD5()
 {
     Assert.Equal("C2DF5F7D3132A7920E6B245AB1E58625", MD.md5_128Hash(stringToByteArray("HelloKitty")));
 }
Ejemplo n.º 24
0
        //////////////////////////////////////////////////////
        // MD
        //////////////////////////////////////////////////////

        public UMetaAttribute(MD key, string value)
            : this(UMeta.GetKey(key), value)
        {
        }
Ejemplo n.º 25
0
 public UMetaAttribute(MD key, UClass value)
     : this(UMeta.GetKey(key), value == null ? string.Empty : value.GetPathName())
 {
 }
Ejemplo n.º 26
0
        public List <clsEstudio> getEstudiosPendientes()
        {
            List <clsEstudio> _lstEst = new List <clsEstudio>();

            try
            {
                using (NapAUXDA = new NAPOLEONAUXEntities())
                {
                    if (NapAUXDA.tbl_DET_EstudioAUX.Any(x => !(bool)x.bitSync))
                    {
                        var query = (from item in NapAUXDA.tbl_DET_EstudioAUX
                                     join mst in NapAUXDA.tbl_MST_EstudioAUX on item.intEstudioID equals mst.intEstudioID into MD
                                     from MD1 in MD.DefaultIfEmpty()
                                     where !(bool)item.bitSync
                                     select new
                        {
                            intDetEstudioID = item.intDetEstudioID,
                            intEstudioID = item.intEstatusID,
                            intEstatusID = item.intEstatusID,
                            vchNameFile = item.vchNameFile,
                            intSizeFile = item.intSizeFile,
                            vchPathFile = item.vchPathFile,
                            vchStudyInstanceUID = item.vchStudyInstanceUID,
                            datFecha = item.datFecha,
                            id_Sitio = MD1.id_Sitio,
                            intModalidad = MD1.intModalidadID,
                            vchAccessionNumber = MD1.vchAccessionNumber,
                            vchPatientBirthDate = MD1.vchPatientBirthDate,
                            PatientID = MD1.PatientID,
                            PatientName = MD1.PatientName,
                            vchgenero = MD1.vchgenero,
                            vchEdad = MD1.vchEdad
                        }).ToList();
                        if (query != null)
                        {
                            if (query.Count > 0)
                            {
                                foreach (var item in query)
                                {
                                    clsEstudio mdl = new clsEstudio();
                                    mdl.intDetEstudioID     = item.intDetEstudioID;
                                    mdl.intEstudioID        = (int)item.intEstatusID;
                                    mdl.intEstatusID        = (int)item.intEstatusID;
                                    mdl.vchNameFile         = item.vchNameFile;
                                    mdl.intSizeFile         = (int)item.intSizeFile;
                                    mdl.vchPathFile         = item.vchPathFile;
                                    mdl.vchStudyInstanceUID = item.vchStudyInstanceUID;
                                    mdl.datFecha            = (DateTime)item.datFecha;
                                    mdl.id_Sitio            = (int)item.id_Sitio;
                                    mdl.intModalidadID      = (int)item.intModalidad;
                                    mdl.vchAccessionNumber  = item.vchAccessionNumber;
                                    mdl.vchPatientBirthDate = item.vchPatientBirthDate;
                                    mdl.PatientID           = item.PatientID;
                                    mdl.PatientName         = item.PatientName;
                                    mdl.vchgenero           = item.vchgenero;
                                    mdl.vchEdad             = item.vchEdad;
                                    _lstEst.Add(mdl);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception egEP)
            {
                _lstEst = null;
                Log.EscribeLog("Existe un error en getEstudiosPendientes: " + egEP.Message);
            }
            return(_lstEst);
        }
Ejemplo n.º 27
0
 public MD_ByBlock()
 {
     this.md_bloques = new MD();
 }
Ejemplo n.º 28
0
        void ProcessDecodedMessage(int msgFunction, int msgPayloadLength, byte[] msgPayload)
        {
            int numLed, etatLed, IRGauche, IRCentre, IRDroite, MG, MD;

            switch ((Functions)msgFunction)
            {
            case Functions.LEDS:
                numLed  = msgPayload[0];
                etatLed = msgPayload[1];
                if (numLed == 1)
                {
                    if (etatLed == 1)
                    {
                        CheckBoxLed1.IsChecked = true;
                    }
                    else
                    {
                        CheckBoxLed1.IsChecked = false;
                    }
                }
                else if (numLed == 2)
                {
                    if (etatLed == 1)
                    {
                        CheckBoxLed2.IsChecked = true;
                    }
                    else
                    {
                        CheckBoxLed2.IsChecked = false;
                    }
                }
                else if (numLed == 3)
                {
                    if (etatLed == 1)
                    {
                        CheckBoxLed3.IsChecked = true;
                    }
                    else
                    {
                        CheckBoxLed3.IsChecked = false;
                    }
                }
                break;

            case Functions.telemetres:
                IRDroite = msgPayload[0];
                IRCentre = msgPayload[1];
                IRGauche = msgPayload[2];
                TextBoxTelemetres.Text = "IR Gauche:" + IRGauche.ToString() + "cm\n\r" + "IR Centre:" + IRCentre.ToString() + "cm\n\r" + "IR Droite:" + IRDroite.ToString() + "cm";
                break;

            case Functions.moteurs:
                MG = msgPayload[0];
                MD = msgPayload[1];
                TextBoxMoteurs.Text = "Vitesse Gauche:" + MG.ToString() + "%\n\r" + "Vitesse Droite:" + MD.ToString() + "%\n\r";
                break;

            case Functions.message:
                TextBoxReception.Text += Encoding.UTF8.GetString(msgPayload, 0, msgPayload.Length) + "\n";
                break;

            case Functions.RobotState:
                int instant = (((int)msgPayload[1]) << 24) + (((int)msgPayload[2]) << 16) + (((int)msgPayload[3]) << 8) + (((int)msgPayload[4]));
                RtbReception.Text = ((StateRobot)(msgPayload[0])).ToString() + "\n\rTemps: " + instant.ToString() + " ms";
                break;

            case Functions.Clavier:
                textBoxPilotage.Text = "Instruction reçue: " + ((StateRobot)msgPayload[0]).ToString();
                break;
            }
        }
 public static void D(this MD obj)
 {
     Console.WriteLine("MD");
 }
Ejemplo n.º 30
0
 public void TestMD2()
 {
     Assert.Equal("D35E6E718A891F00659CCD3ADD0259C0", MD.md2_128Hash(stringToByteArray("HelloKitty")));
 }
Ejemplo n.º 31
0
 public void Enable(MD mn, bool state) { tsMD[(int)mn].Enabled = state; if (mn == MD.MBR) browserWidgetContextMenuStrip.Enabled = state; }
        private void DecodeTracking(MD.CloudConnect.ITracking t, AccountModel account, List<TrackingModel> saveTracks, List<DeviceModel> saveDevices)
        {
            string imei = t.Asset;

            DeviceModel device = RepositoryFactory.Instance.DeviceDb.GetDevice(imei);

            if (device == null)
            {
                device = new DeviceModel() { Imei = imei };
                RepositoryFactory.Instance.DeviceDb.Save(device);
                device = RepositoryFactory.Instance.DeviceDb.GetDevice(imei);
            }

            device.LastReport = t.Recorded_at;
            if (t.IsValid)
            {
                device.LastValidLocation = t.Recorded_at;
                device.LastLongitude = t.Longitude;
                device.LastLatitude = t.Latitude;
            }

            TrackingModel track = new TrackingModel();
            track.DeviceID = device.Id;
            track.Data = (MD.CloudConnect.Data.TrackingData)t;
            track.RecordedDateKey = t.Recorded_at.GenerateKey();
            saveTracks.Add(track);

            device.UpdateField(track);

            if (saveDevices.Where(x => x.Imei == device.Imei).Count() == 0)
                saveDevices.Add(device);
        }
Ejemplo n.º 33
0
 public class MBDropDownOpeningEventArgs : EventArgs { public readonly MD mn; public MBDropDownOpeningEventArgs(MD mn) { this.mn = mn; } }
Ejemplo n.º 34
0
 public class MBDropDownOpeningEventArgs : EventArgs { public readonly MD mn; public MBDropDownOpeningEventArgs(MD mn)
                                                       {
                                                           this.mn = mn;
                                                       }
Ejemplo n.º 35
0
 protected void OnMBDropDownOpening(object sender, MD mn) { if (MBDropDownOpening != null) MBDropDownOpening(sender, new MBDropDownOpeningEventArgs(mn)); }
Ejemplo n.º 36
0
        protected override void ProcessRecord()
        {
            this.SetOptions();
            this.SetScope(Server);
            this.SetManagementPath(Identity);
            ManagementObject wmiRecord = this.Get();

            WmiRecordClass WmiRecordClassName = (WmiRecordClass)Enum.Parse(typeof(WmiRecordClass), (String)wmiRecord.Properties["__CLASS"].Value);
            String         NewPath            = String.Empty;

            #region Parameter Set validation
            Boolean Terminate = false;
            switch (ParameterSetName)
            {
            case "PS0": break;

            case "PS1":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AAAAType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WKSType)
                {
                    Terminate = true;
                }
                break;

            case "PS2":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_CNAMEType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MBType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MDType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MFType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_NSType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_PTRType)
                {
                    Terminate = true;
                }
                break;

            case "PS3":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MGType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MRType)
                {
                    Terminate = true;
                }
                break;

            case "PS4":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_TXTType)
                {
                    Terminate = true;
                }
                break;

            case "PS5":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_HINFOType)
                {
                    Terminate = true;
                }
                break;

            case "PS6":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_ISDNType)
                {
                    Terminate = true;
                }
                break;

            case "PS7":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MINFOType)
                {
                    Terminate = true;
                }
                break;

            case "PS8":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_NXTType)
                {
                    Terminate = true;
                }
                break;

            case "PS9":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_RPType)
                {
                    Terminate = true;
                }
                break;

            case "PS10":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_AFSDBType)
                {
                    Terminate = true;
                }
                break;

            case "PS11":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_MXType &
                    WmiRecordClassName != WmiRecordClass.MicrosoftDNS_RTType)
                {
                    Terminate = true;
                }
                break;

            case "PS12":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_X25Type)
                {
                    Terminate = true;
                }
                break;

            case "PS13":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_SOAType)
                {
                    Terminate = true;
                }
                break;

            case "PS14":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_SRVType)
                {
                    Terminate = true;
                }
                break;

            case "PS15":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WINSType)
                {
                    Terminate = true;
                }
                break;

            case "PS16":
                if (WmiRecordClassName != WmiRecordClass.MicrosoftDNS_WINSRType)
                {
                    Terminate = true;
                }
                break;
            }

            if (Terminate)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        new PSInvalidOperationException("InvalidParameterSetForRecordType"),
                        "InvalidOperation",
                        ErrorCategory.InvalidOperation,
                        typeof(ManagementCmdlet)));
            }
            #endregion

            if (ShouldProcess((String)wmiRecord.Properties["TextRepresentation"].Value))
            {
                switch (WmiRecordClassName)
                {
                case WmiRecordClass.MicrosoftDNS_AType:
                    A ARecord = new A(wmiRecord, Server);
                    NewPath = ARecord.Modify(TTL, Address.ToString());
                    break;

                case WmiRecordClass.MicrosoftDNS_AAAAType:
                    AAAA AAAARecord = new AAAA(wmiRecord, Server);
                    NewPath = AAAARecord.Modify(TTL, Address.ToString());
                    break;

                case WmiRecordClass.MicrosoftDNS_AFSDBType:
                    AFSDB AFSDBRecord = new AFSDB(wmiRecord, Server);
                    NewPath = AFSDBRecord.Modify(TTL, SubType, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_CNAMEType:
                    CNAME CNAMERecord = new CNAME(wmiRecord, Server);
                    NewPath = CNAMERecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_HINFOType:
                    HINFO HINFORecord = new HINFO(wmiRecord, Server);
                    NewPath = HINFORecord.Modify(TTL, CPU, OS);
                    break;

                case WmiRecordClass.MicrosoftDNS_ISDNType:
                    ISDN ISDNRecord = new ISDN(wmiRecord, Server);
                    NewPath = ISDNRecord.Modify(TTL, ISDNNumber, SubAddress);
                    break;

                case WmiRecordClass.MicrosoftDNS_MBType:
                    MB MBRecord = new MB(wmiRecord, Server);
                    NewPath = MBRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_MDType:
                    MD MDRecord = new MD(wmiRecord, Server);
                    NewPath = MDRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_MFType:
                    MF MFRecord = new MF(wmiRecord, Server);
                    NewPath = MFRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_MGType:
                    MG MGRecord = new MG(wmiRecord, Server);
                    NewPath = MGRecord.Modify(TTL, MailboxName);
                    break;

                case WmiRecordClass.MicrosoftDNS_MINFOType:
                    MINFO MINFORecord = new MINFO(wmiRecord, Server);
                    NewPath = MINFORecord.Modify(TTL, ResponsibleMailbox, ErrorMailbox);
                    break;

                case WmiRecordClass.MicrosoftDNS_MRType:
                    MR MRRecord = new MR(wmiRecord, Server);
                    NewPath = MRRecord.Modify(TTL, MailboxName);
                    break;

                case WmiRecordClass.MicrosoftDNS_MXType:
                    MX MXRecord = new MX(wmiRecord, Server);
                    NewPath = MXRecord.Modify(TTL, Preference, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_NSType:
                    NS NSRecord = new NS(wmiRecord, Server);
                    NewPath = NSRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_NXTType:
                    NXT NXTRecord = new NXT(wmiRecord, Server);
                    NewPath = NXTRecord.Modify(TTL, NextDomainName, Types);
                    break;

                case WmiRecordClass.MicrosoftDNS_PTRType:
                    PTR PTRRecord = new PTR(wmiRecord, Server);
                    NewPath = PTRRecord.Modify(TTL, Hostname);
                    break;

                case WmiRecordClass.MicrosoftDNS_RPType:
                    RP RPRecord = new RP(wmiRecord, Server);
                    NewPath = RPRecord.Modify(TTL, ResponsibleMailbox, TXTDomainName);
                    break;

                case WmiRecordClass.MicrosoftDNS_RTType:
                    RT RTRecord = new RT(wmiRecord, Server);
                    NewPath = RTRecord.Modify(TTL, Preference, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_SOAType:
                    SOA SOARecord = new SOA(wmiRecord, Server);
                    NewPath = SOARecord.Modify(TTL, SerialNumber,
                                               SOAServer, ResponsibleMailbox, RefreshInterval,
                                               RetryDelay, ExpireLimit, MinimumTTL);
                    break;

                case WmiRecordClass.MicrosoftDNS_SRVType:
                    SRV SRVRecord = new SRV(wmiRecord, Server);
                    NewPath = SRVRecord.Modify(TTL, Priority, Weight, Port, TargetName);
                    break;

                case WmiRecordClass.MicrosoftDNS_TXTType:
                    TXT TXTRecord = new TXT(wmiRecord, Server);
                    NewPath = TXTRecord.Modify(TTL, Text);
                    break;

                case WmiRecordClass.MicrosoftDNS_WINSType:
                    WINS WINSRecord = new WINS(wmiRecord, Server);
                    NewPath = WINSRecord.Modify(TTL, MappingFlag, LookupTimeout,
                                                CacheTimeout, String.Join(" ", WinsServers));
                    break;

                case WmiRecordClass.MicrosoftDNS_WINSRType:
                    WINSR WINSRRecord = new WINSR(wmiRecord, Server);
                    NewPath = WINSRRecord.Modify(TTL, MappingFlag, LookupTimeout,
                                                 CacheTimeout, ResultDomain);
                    break;

                case WmiRecordClass.MicrosoftDNS_WKSType:
                    WKS WKSRecord = new WKS(wmiRecord, Server);
                    NewPath = WKSRecord.Modify(Address, TTL, IPProtocol, String.Join(" ", Services));
                    break;

                case WmiRecordClass.MicrosoftDNS_X25Type:
                    X25 X25Record = new X25(wmiRecord, Server);
                    NewPath = X25Record.Modify(TTL, PSDNAddress);
                    break;

                default:
                    ThrowTerminatingError(
                        new ErrorRecord(
                            new PSNotSupportedException("Unsupported Record Type"),
                            "RecordModificationNotSupported",
                            ErrorCategory.NotImplemented,
                            typeof(ManagementCmdlet)));
                    break;
                }

                if (PassThru)
                {
                    this.SetManagementPath(NewPath);
                    wmiRecord = this.Get();

                    WriteRecord(wmiRecord);
                }
            }
        }
Ejemplo n.º 37
0
 public UMetaAttribute(MD key)
     : this(key, true)
 {
 }