/// <summary>LoadContent
        /// </summary>
        public override void LoadContent(ClusterConfiguration configuration, byte[] data)
        {
            int bytesRead = 0;

            byte[] groupNameBuffer = new byte[Consts.FDFS_GROUP_NAME_MAX_LEN];
            Array.Copy(data, bytesRead, groupNameBuffer, 0, Consts.FDFS_GROUP_NAME_MAX_LEN);
            GroupName = EndecodeUtil.DecodeString(groupNameBuffer, configuration.Charset);
            //Util.ByteToString(option.Charset, groupNameBuffer).TrimEnd('\0');
            bytesRead += Consts.FDFS_GROUP_NAME_MAX_LEN;

            byte[] ipAddressBuffer = new byte[Consts.IP_ADDRESS_SIZE - 1];
            Array.Copy(data, bytesRead, ipAddressBuffer, 0, Consts.IP_ADDRESS_SIZE - 1);
            IPAddresses.Add(EndecodeUtil.DecodeString(ipAddressBuffer, configuration.Charset));
            //IPAddresses.Add(new string(option.Charset.GetChars(ipAddressBuffer)).TrimEnd('\0'));
            bytesRead += Consts.IP_ADDRESS_SIZE - 1;

            byte[] portBuffer = new byte[Consts.FDFS_PROTO_PKG_LEN_SIZE];
            Array.Copy(data, bytesRead, portBuffer, 0, Consts.FDFS_PROTO_PKG_LEN_SIZE);
            Port       = (int)ByteUtil.BufferToLong(portBuffer, 0);
            bytesRead += Consts.FDFS_PROTO_PKG_LEN_SIZE;

            while (data.Length - bytesRead >= Consts.IP_ADDRESS_SIZE - 1)
            {
                ipAddressBuffer = new byte[Consts.IP_ADDRESS_SIZE - 1];
                Array.Copy(data, bytesRead, ipAddressBuffer, 0, Consts.IP_ADDRESS_SIZE - 1);
                IPAddresses.Add(EndecodeUtil.DecodeString(ipAddressBuffer, configuration.Charset));
                // IPAddresses.Add(new string(option.Charset.GetChars(ipAddressBuffer)).TrimEnd('\0'));
                bytesRead += Consts.IP_ADDRESS_SIZE - 1;
            }
        }
示例#2
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            int intAsset = Int32.Parse(Request.QueryString["id"]);

            oAsset.Update(intAsset, txtAsset.Text);
            IPAddresses oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
            int         intIP        = oIPAddresses.Add(0, Int32.Parse(txtIP1.Text), Int32.Parse(txtIP2.Text), Int32.Parse(txtIP3.Text), Int32.Parse(txtIP4.Text), intProfile);
            int         intDepotRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms");

            if (intDepotRoom == 0)
            {
                oDepotRoom.Add(txtDepotRoom.Text, 1);
                intDepotRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms");
            }
            int intShelf = GetID(txtShelf.Text, "cv_shelfs");

            if (intShelf == 0)
            {
                oShelf.Add(txtShelf.Text, 1);
                intShelf = GetID(txtShelf.Text, "cv_shelfs");
            }
            int intRoom = GetID(txtRoom.Text, "cv_rooms");

            if (intRoom == 0)
            {
                oRooms.Add(txtRoom.Text, 1);
                intRoom = GetID(txtRoom.Text, "cv_rooms");
            }
            int intRack = GetID(txtRack.Text, "cv_racks");

            if (intRack == 0)
            {
                oRacks.Add(txtRack.Text, 1);
                intRack = GetID(txtRack.Text, "cv_racks");
            }
            oAsset.UpdateNetwork(intAsset, txtName.Text, (int)AssetStatus.InUse, intProfile, DateTime.Parse(txtDate.Text), Int32.Parse(ddlDepot.SelectedItem.Value), intDepotRoom, intShelf, Int32.Parse(txtPorts.Text), Int32.Parse(ddlClass.SelectedItem.Value), Int32.Parse(Request.Form[hdnEnvironment.UniqueID]), Int32.Parse(Request.Form[hdnLocation.UniqueID]), intRoom, intRack, txtRackPosition.Text);
            oAsset.DeleteIP(intAsset);
            oAsset.AddIP(intAsset, intIP);
            if (Request.QueryString["sid"] != null)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?sid=" + Request.QueryString["sid"] + "&id=" + intAsset.ToString() + "&commed=true");
            }
            else
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?pid=" + Request.QueryString["pid"] + "&save=true");
            }
        }
示例#3
0
        protected void btnAdd_Click(Object Sender, EventArgs e)
        {
            int intParent = Int32.Parse(Request.Form[hdnParent.UniqueID]);

            if (Request.Form[hdnId.UniqueID] == "0")
            {
                int intID = oIPAddresses.Add(intParent, Int32.Parse(txtAdd1.Text), Int32.Parse(txtAdd2.Text), Int32.Parse(txtAdd3.Text), Int32.Parse(txtAdd4.Text), 0);
                oIPAddresses.UpdateAvailable(intID, (chkAvailable.Checked ? 1 : 0));
                oIPAddresses.UpdateDHCP(intID, (chkDHCP.Checked ? 1 : 0));
            }
            else
            {
                oIPAddresses.UpdateAvailable(Int32.Parse(Request.Form[hdnId.UniqueID]), (chkAvailable.Checked ? 1 : 0));
                oIPAddresses.UpdateDHCP(Int32.Parse(Request.Form[hdnId.UniqueID]), (chkDHCP.Checked ? 1 : 0));
            }
            Response.Redirect(Request.Path);
        }
        private void RunArtemis_Click(object sender, RoutedEventArgs e)
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            if (this.SelectedIPAddress != Locations.GetCurrentIPAddress())
            {
                if (!Locations.SetIPAddress(this.SelectedIPAddress))
                {
                    Locations.MessageBoxShow("Unable to set the Server IP address.\r\n\r\nReview log file for details as to why.",
                                             MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            Window thiswin = Window.GetWindow(this);


            thiswin.ShowInTaskbar = false;
            SessionMonitor win = new SessionMonitor();

            win.StartSession();
            DoAnimation();
            win.ShowDialog();
            thiswin.ShowInTaskbar = true;
            thiswin.WindowState   = System.Windows.WindowState.Normal;

            string newIP = Locations.GetCurrentIPAddress();

            if (!IPAddresses.Contains(newIP))
            {
                Locations.AddToIPList(newIP);
                IPAddresses.Add(newIP);
                SelectedIPAddress = newIP;
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }
示例#5
0
        protected void btnImport_Click(Object Sender, EventArgs e)
        {
            if (oFile.PostedFile != null && oFile.FileName != "")
            {
                oVariables = new Variables(intEnvironment);
                string strFile = DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "_" + oFile.FileName;
                oFile.PostedFile.SaveAs(oVariables.UploadsFolder() + strFile);
                int              intNetwork = Int32.Parse(Request.Form[hdnVLAN.UniqueID]);
                string           strConn    = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + oVariables.UploadsFolder() + strFile + ";Extended Properties=Excel 8.0;";
                OleDbDataAdapter myCommand  = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
                DataSet          ds         = new DataSet();
                myCommand.Fill(ds, "ExcelInfo");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr[0].ToString().Trim() == "")
                    {
                        break;
                    }
                    string strIP     = dr[0].ToString().Trim();
                    string strServer = dr[1].ToString().Trim();

                    int intIP1 = Int32.Parse(strIP.Substring(0, strIP.IndexOf(".")));
                    strIP = strIP.Substring(strIP.IndexOf(".") + 1);
                    int intIP2 = Int32.Parse(strIP.Substring(0, strIP.IndexOf(".")));
                    strIP = strIP.Substring(strIP.IndexOf(".") + 1);
                    int intIP3 = Int32.Parse(strIP.Substring(0, strIP.IndexOf(".")));
                    strIP = strIP.Substring(strIP.IndexOf(".") + 1);
                    int intIP4    = Int32.Parse(strIP);
                    int intIP     = oIPAddresses.Add(intNetwork, intIP1, intIP2, intIP3, intIP4, -100);
                    int intDetail = oIPAddresses.AddDetails("", 0, "", 0, "", strServer, 0, 0, 0, 0, "", "", "", "", 0, 0);
                    oIPAddresses.AddDetail(intIP, intDetail);
                    intCount++;
                }
                Response.Redirect(Request.Path + "?done=" + intCount.ToString());
            }
        }